#topgg-api

1 messages Β· Page 86 of 1

languid plaza
#

I did

#

-botinfo @steel plinth

abstract mothBOT
#
Bot info
ID

591181377848868867

Username

Universal

Discriminator

0871

Short Description

MultiPurpose bot made by β™° The Vampire β™°#6961

Library

Other

Prefix

/

Total Upvotes

43

Monthly Upvotes

6

Server Count

No server count

Owner(s)

@languid plaza
@twin oxide

languid plaza
#

See

true talon
willow spindle
#

so?

languid plaza
#

Nvm Bye

worn rivet
#

Why my bot, haven`t permissions to #commands ?

true talon
#

🀦

#

u consufes me all

willow spindle
#

this is not related with top.gg API @worn rivet

worn rivet
#

ahhh

restive otter
#
dbl.webhook.on('vote', vote => {
console.log(`Test`)
})``` :/ Not Working When I Vote
*My Bot Has Been Approved
willow spindle
#

πŸ€¦β€β™‚οΈ

#

first

#

that is dbl.webhook.on

#

you have to setup webhook

restive otter
#

Help Me

willow spindle
restive otter
#

πŸ€¦β€β™‚οΈ

#

Zoey Is Sed is my account

#

Check bot for that user

willow spindle
#

only primary owner can edit webhook

restive otter
#

I have edited from that account

willow spindle
#

ok

#

setup webhook

restive otter
#

Ok

#

Can u explain with SS?

willow spindle
#

what did you write on webhook settings

restive otter
#

url ^

#

i dont think auth is public

willow spindle
#

remove :5000 and try

restive otter
#

Auth is secret

#

Ok

willow spindle
#

also /dblwebhook

#

not dlwebhook

restive otter
#
2020-05-08T08:14:49.006305+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=universal-discord.herokuapp.com request_id=c2babc8c-27f0-473a-b9b4-b14840141b65 fwd="209.97.134.24" dyno= connect= service= status=503 bytes= protocol=https```
#

Got this when i test

#

NMW03 are u here?

worn rivet
#

But in logs, or where?

#

@restive otter

restive otter
#

logs

#

@worn rivet How to fix it

worn rivet
#

umm
at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=titonbot-beta.herokuapp.com request_id=b3c3c3ec-c519-428c-aa41-37bd446752fb fwd="5.173.185.106" dyno= connect= service= status=503 bytes= protocol=https

restive otter
#

@willow spindle Sorry For Ping But Why Im Getting This When I Test?

#

U didnt replied thats y i pinged πŸ˜…

willow spindle
#

503 error code πŸ€”

restive otter
#

-botinfo 684805224573042688

abstract mothBOT
#
Bot info
ID

684805224573042688

Username

Witch

Discriminator

2384

Short Description

A magical good Witch with magical powers.

Library

discord.js

Prefix

w!

Total Upvotes

57

Monthly Upvotes

56

Server Count

155 Servers

Owner(s)

@dawn maple
@lyric pulsar

restive otter
#

hmm

abstract mothBOT
#
Bot info
ID

591181377848868867

Username

Universal

Discriminator

0871

Short Description

MultiPurpose bot made by β™° The Vampire β™°#6961

Library

Other

Prefix

/

Total Upvotes

43

Monthly Upvotes

6

Server Count

No server count

Owner(s)

@languid plaza
@twin oxide
@karmic plaza

restive otter
#

Wut

#

No server count??? Its in 20+ servers

#

🀦

kind trench
#

-botinfo 695991708680323174

abstract mothBOT
#
Bot info
ID

695991708680323174

Username

TitonBot

Discriminator

3235

Short Description

Polski bot discord, ktΓ³ry zawiera wiele komend administracyjnych, 4fun oraz ogΓ³lnych.

Library

Other

Prefix

.

Total Upvotes

7

Monthly Upvotes

6

Server Count

No server count

Owner(s)

@kind trench
@worn rivet

fiery shadow
#

bruv

tepid patrol
ancient pawn
#

no

tepid patrol
#

Why does the 2nd argument say "The ID of this shard" πŸ€”

#

and it starts with client.

worn rivet
#

Help pls

at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=titonbot-beta.herokuapp.com request_id=b3c3c3ec-c519-428c-aa41-37bd446752fb fwd="5.173.185.106" dyno= connect= service= status=503 bytes= protocol=https

ancient pawn
#

its optional

tepid patrol
#

Oh I think i see, it's if the bot doesn't have shards i'd assume

ancient pawn
#

i havent seen it anywhere on the site

#

all bot has at least one shard

#

a more useful stat is the shard count

tepid patrol
#

Alright cheers, was a little confused

vapid cape
#

you can post a server count for all shards, or you can post server counts individually from each shard

worn rivet
#
const DBL = require('dblapi.js');
const dbl = new DBL('Token', { webhookPort: 5000, webhookAuth: 'secret-pass' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

dbl.on('posted', () => {
  console.log('Server count posted!');
})

Why it doesn't post servers?

vapid cape
#

to enable the autoposter

worn rivet
#

Bot client id?

#

@vapid cape

vapid cape
#

no, your client instance/object

worn rivet
#

Bot id?

#

I am new

vapid cape
#

no, your client instance

#

the client you create and login with

worn rivet
#

Umm

#

I host bot on heroku

vapid cape
#

whatever = new Client()
whatever.login()
DBL(token,{options},whatever)

worn rivet
#

🀦🏻

#

I don't know options

tepid patrol
#

Hey Tim, would you mind helping me with the vote function?

worn rivet
#

I am suck with this.

vapid cape
#

@worn rivet your options are fine, dont change them

#

just add your client instance

#

at the end

worn rivet
#

ok

vapid cape
#

you created a client, right? you used either new Discord.Client() or new Client()

#

which name did you give it?

worn rivet
#

const dbl = new DBL('Token', { webhookPort: 5000, webhookAuth: 'secret-pass' });

I have there client

vapid cape
#

no, i mean your discord client

worn rivet
#

Ouh, i have two repositories, and 2 hostings

#

One with this code, and two with bot code

vapid cape
#

so you dont have a bot on the DBL hosting?

worn rivet
#

no

vapid cape
#

then where are you gonna get the server count from? to post

#

@tepid patrol just post your question

worn rivet
#

Umm xDDDD

tepid patrol
#

Alright, sure thing.

#

So firstly, I'm currently struggling with how this webhook stuff works.

Do I need to set anything in this field? I host my bot on a VPS which has a dedicated IP; would it be this? https://vps-ip

vapid cape
#

yes, your vps's ip address, the port that you set up your webhook with, and the path you set your webhook with

#

if you didnt set a path, the default is /dblwebhook

worn rivet
#

so

#

ip:host/dblwebhook

tepid patrol
#

without the slash in the middle idk why it put that

vapid cape
#

so the full url would be http://YOUR.IP.ADDRESS:WEBHOOKPORT/dblwebhook

tepid patrol
vapid cape
#

yes

tepid patrol
#

Alright let me try that.

#

I've must've gone wrong somewhere πŸ€”

worn rivet
#

no

#

You must/dblwebhook on the end

#

And authorization in not dbl token

tepid patrol
worn rivet
#

🀦🏻

#

Remove first line,

tepid patrol
#

That shouldn't matter

#

I did that so i can easily edit the options

worn rivet
#

replace to your token

#

In ""

#

or ''

tepid patrol
worn rivet
#

Its always 0.0.0.0

#

It doesn't matter

true talon
#

^

worn rivet
#

o/ Lumap

tepid patrol
#

Oh right...

#

Then i've done everything correct and should work?

worn rivet
#

Send me screen from top.gg settings

#

Webhook section

tepid patrol
worn rivet
#

uhm ok

tepid patrol
#

That's correct tho isn't it?

worn rivet
#

It's correct

tepid patrol
#

So when I press Test it should say I voted

#

or no

worn rivet
#

We will see πŸ˜„

tepid patrol
#

Yeah but it doesn't πŸ˜‚

worn rivet
#

😭

tepid patrol
#

But I dont see where I went wrong

worn rivet
#

But is there any error like this:
code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=titonbot-beta.herokuapp.com request_id=ee4030f4-229a-4a1b-95ba-116e72837e3e fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https

#

?

tepid patrol
#

no because im not using heroku

worn rivet
#

So idk

tepid patrol
#

It just doesnt print anything

worn rivet
#

Try to run yourip:5000/dblwebhook in web

#

But are you using public ip in code?

balmy hamlet
#

@worn rivet why would they do such a thing?

#

it's the same

#

do you know what a variable is?

#

due to the way you said that I'm starting to doubt

echo salmon
#

For the c# wrapper is there a reason I randomly get null ref's from GetMeAsync ?

#

Ah im guessing because of the connection issues

restive otter
#

How do I show the number of members' votes?

stuck pike
#

Like # of reactions on a message?

#

oh i read up nvm

tepid patrol
#

God this is so irritating, can anyone see where i've gone wrong? It doesn't print anything which means nothing is being sent.
I believe the issue is on the website where the "Webhook URL" is as I can use postStats from the bot to the website and it updates.

green mantle
#

is your endpoint actually SSL

#

if not

#

dont have https

#

http and https make a big diffrence

tepid patrol
#

I'll try all 3

#

ohw ait wtf

#

Although when i press the Test button it doesn't work ?

green mantle
#

theyre two seperate events

#

last i checked atleast

tepid patrol
#

Not entirely sure

#

Idk how it printed that, it must've taken like 5 minutes or smth

tepid patrol
#

Not sure, it's not working at all anymore and the only thing i changed was the authorization key

#

from the test button?

#

I'm pretty sure mines correct though as it printed that just voted message, although now nothing is printed. I might get a friend to vote and see if anything gets sent

#

It could be the test button or just the api itself but I have no idea; first time using this

#

πŸ˜‚ im gonna try and figure it out although i've pretty much tried everything

#

but i'm still confused how that printed

#

https

#

got a friend to vote and nothing came through

#

5000

#

what are you using?

#

i mean yeah it should

#

like it literally just worked somehow, and the only thing changed since then was the authorization key lmao

trail garnet
#

so is webhook a valid discord.js command

vapid cape
#

@tepid patrol dont use https, use http because you dont have SSL in your webserver

#

you can test your configuration using services such as reqbin

#

@trail garnet discord.js includes methods for Discord Webhooks. Top.gg webhooks are not discord webhooks

tepid patrol
vapid cape
#

yes

trail garnet
#

@vapid cape Im talking about discord webhooks, I can figure out the command

vapid cape
trail garnet
#

cool thanks

limpid vector
#

I think voting is delayed by a bit right now

#

so your voting event will take some time to fire

tepid patrol
#

@vapid cape Thank you so much, it works now. Just takes around 2-3 minutes until i receive the response.

vapid cape
#

rip, thank god none of my bots use votes lmao

tepid patrol
#

Tbh i'm only testing it out if i were to ever use votes

#

It's kinda good to know, I have no idea what to use votes for lmao

vapid cape
#

well normally they are not that slow, its usually quite instant

#

but the website has been having issues lately

limpid vector
#

It's kinda good to know, I have no idea what to use votes for lmao
@tepid patrol rewards for stuff in your bot, or access to features through votes

tepid patrol
#

Yeah I guess

topaz verge
#
const dbl = new DBL(process.env.DBLTOKEN, {
  webhookPort: 5000,
  webhookServer: server
});
client.on("ready", () => {
  setInterval(() => {
    dbl.postStats(client.guilds.cache.size);
  }, 1800000);
});
dbl.on("posted", () => {
  console.log("Server count posted!");
});
dbl.webhook.on("ready", hook => {
  console.log(
    `Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`
  );
});
dbl.webhook.on("vote", vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
i am try to make if user vote send in console user just voted but he not working
restive otter
#

did you set the Auth,and URL in edit page?

topaz verge
#

no

#

:\

restive otter
#

Then set and try again

topaz verge
#

@restive otter what i will put in Auth

restive otter
#

Whatever you want

#

think as a password

topaz verge
#

password?

#

yes

#

i am already put a password

#

but the url idk what i will put in

restive otter
#

glitch?

topaz verge
#

yes

restive otter
#

Oh ok

#

http://projectname.glitch.me/dblwebhook

#

like this

topaz verge
#

oke

restive otter
#

don't do https instead http

topaz verge
#

yes i know

restive otter
#

okey.

short edge
#

Does anyone have a tutorial on how to create a webhook? I haven't played around with it, and i can't find anything i would want on google

#

this I want to do it for the on_dbl_vote event

short edge
#

I have opened port 5000 on my router, but what is the webhook path used for? Can someone guide me?

restive otter
#

where can i get invite manager alpha

#

?

buoyant jay
true sonnet
#

light hacks

#

maybe crashes

#

over heating the host of the bot

#

maybe too much usage of text or action of the bot

vapid cape
#

no? lmao

#

@buoyant jay unauthorized means you have an incorrect token somewhere

ebon pivot
#

Why is botblock blocked from using the api?

restive otter
#

(Third time asking)

lusty hornet
ebon pivot
#

4th*

crystal hawk
#

How long after starting up a DBLClient with autopost should I expect to see it post? (using the Python library)

#

and when it does post, does it make sure that the bot matches the Top.GG token? Because I have a test bot I'm trying to use to test it

restive otter
#

what the write webhook password?

#

anycone can help me?

#

not work

restive otter
#

help_

paper grotto
#

What should I put in my package.json? " dblapi ":" ^ 2.4.0 "?

restive otter
#

not solved

#

@restive otter

restive otter
#

Umm

#

i get webhook running at https://0.0.0.0.0.0/:5000/dblwebhook

barren egret
#

Can we make program like if someone vote the bot then it'll send message on the server ?

short edge
#

are you on python?

barren egret
#

Nope

#

JavaScript

short edge
#

I know that you will need a webhook

#

But that's all i can tell you, i don't use js

uncut hinge
#

does anyone know why this doesn't work :

dbl.getVotes().then(votes => {
    if (votes.find(vote => vote.id == message.auhor.id)) {
      //command script
    }
});```
#

it runs anyway

#

even if the author hasn't voted

#

pls ping me

waxen meadow
#

i always get error

restive otter
#

@uncut hinge look at carefully your code, not "auhor", its "author"

uncut hinge
#

i did

#

it's not the problem

restive otter
#

so?

uncut hinge
#

nope

restive otter
#

Yes its a problem.

willow spindle
#

@waxen meadow hasil[0].nama also this is not related with top.gg API

restive otter
#

You can do directly if (voted){

uncut hinge
#

dbl.hasVoted("95579865788456960").then(voted => {
if (voted) console.log("Tonkku has voted!!!")
});

#

yep

#

i tried it too

#
dbl.hasVoted(message.author.id).then(voted => {
    if (voted) {}
});```
restive otter
#

so, its not worked?

uncut hinge
#

no

#

any of them

restive otter
#

did you tried }else{?

uncut hinge
#

yep

#

it just run the command

#

even if i didn't voted

#

πŸ€·β€β™‚οΈ

restive otter
#

then dont use .then

#

define it with await

uncut hinge
#

like

var votes = await dbl.hasVoted(message.author.id)```
#

?

restive otter
#

Yes

#

yes

#

you can also directly put it into the if statement

#
if(await dbl.hasVoted(id)) {
// has voted
} else {
// hasnt voted
}
uncut hinge
#

ok

#

i'll try it

restive otter
#

it will dont work.

#

10/10 grammar and yes it will

#

i tried it

#

sorry for my bad engliş

#

see

#

i see

uncut hinge
#

it returns me this

(node:28100) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (/home/discord/imaginarium-bot/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:333:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:28100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 308)```
restive otter
#

did you provide an api key

uncut hinge
#

yep

restive otter
#

Is it valid

uncut hinge
#

i guess

#

πŸ€·β€β™‚οΈ

#

i took it on my bot interface

restive otter
#

just regenerate

uncut hinge
#

ok

restive otter
#

Can someone help me

#

yes?

#

Regards I want to show in dbl how servers my bot had reached

#

How can I do

#

dbl.postStats

#

Where

#

main file or what you want

#

Okay

#

I see

#

Ok thanks

#

np

quiet isle
#

hi

short edge
#

How do i get a webhook working for python, discord.py? This is what i got, i have port forwarded, but i guess i need to setup more than that since it isn't working.

ebon pivot
#

Why is botblock blocked from using the api?

gloomy fractal
#

-api @warped quiver

abstract mothBOT
#

@warped quiver

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs

warped quiver
#

ah ok

#

πŸ‘

sullen nymph
#

http://<ip>:<port><webhook_path>

restive otter
#

its should be just dblwebhook @lusty flare

green mantle
#

well it defo doesnt need to be ultra fast with no need for packet loss

#

so tcp

dawn karma
#

ok where do i implement your api into my bot thats the problem here i had made my bot so long ago and have been out of full on programing for a while i do some tinkering here and there with my bot but where do i add the javascript libary command to?

balmy hamlet
#

...

#

you can't loose basic knowledge just by entirely stopping from coding

dawn karma
#

not basic coding i just dont know what file i need to implement it into

balmy hamlet
#

basic coding

dawn karma
#

had some help with more advanced coding of the bot

#

do i add this into my discord.js file?

balmy hamlet
#

add it whenever you want

#

you just need to know how to use it

dawn karma
#

well see the issue is i have the bot set up funny thats the problem

#

client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});

this command cant go here

balmy hamlet
#

ofc not

quiet isle
#

hi

#

does not fail and does not work

gilded dawn
#

bot id?

quiet isle
#

511648606101700629

#

@dense crag

gilded dawn
#

thank you πŸ™‚

#

btw putting post Stats in the posted event doesn't post it

quiet isle
#

what should I do

fiery shadow
#

gimme sec

gilded dawn
#

put db.postStats into a setInterval

fiery shadow
#

or this

gilded dawn
#

dbl.on("posted") gets fired after the stat has been posted

#
const Discord = require('discord.js');
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  setInterval(() => {
    dbl.postStats(client.guilds.size);
  }, 60000) // One minute change to something like an hour
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');
  }
});

client.login('token');```
#

something like that

quiet isle
#

@gilded dawn

TypeError: Cannot read property 'size' of undefined
#

discordjs 12.0.2

gilded dawn
#

oh

#

one sec

#

client.guilds.cache.size

#

I forgot they changed that

quiet isle
#

still the same

gilded dawn
#

show code

gilded dawn
#

is english your second language?

quiet isle
#

turkish

gilded dawn
#

do you have a ready event listener?

quiet isle
#

sorry my mistake

gilded dawn
#

np

quiet isle
#

can there be a version problem

#

the error still exists even though I fixed it

gilded dawn
#

this is a glitch project right?

quiet isle
#

yes

gilded dawn
#

ok I can join that if you like

balmy hamlet
#

dude

#

don't put it in the message event+ΒΏ

#

or else you'll spam the api

#

and you'll get IP banned

#

I suggest you learn the lang you're trying to use first

gilded dawn
#

@balmy hamlet it's been solved.

balmy hamlet
#

Β―\_(ツ)_/Β―

barren egret
#

const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});

#

I took it from docs and I filled everything but it is not showing when someone upvotes

sturdy frost
#

What's the best strategy for dealing with webhooks and sharding?

Sharding my bot now, I have all my dbl and webhook logic inside of the bot instance itself, won't the webhooks step on eachother?

restive otter
#

Express is not running if i add dbl webhook thing

rocky bough
#

did you really just asked the same question

restive otter
#

yes

#

Express is not running if i add dbl webhook thing
Even it saying 404 in all my page

sullen nymph
#

Well

#

Are you going to give us any more details

restive otter
#

when i add that webhook the Webhook is only working

#

my website is not working

#

and also it listing the app automatically

#

like i do app.listen(process.env.PORT)

restive otter
#
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.TOP_GG, { webhookPort: process.env.PORT, webhookAuth: 'Tqbb72c7beyu2qQDUwue' });

dbl.webhook.on('posted', () => {
console.log("posted");
})

const express = require('express')
const app = express()
app.get("/", (req, res) => {
res.send("Hi!")
})

When i gone to / its not working

restive otter
#

any idea?

#

why it says that

open garden
#

Your bot doesn't have the correct permissions.

barren egret
#

const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
I took it from docs and I filled everything but it is not showing when someone upvotes

open garden
#

Filled const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); in correctly?

barren egret
#

Yes of course

restive otter
#

what it will be in v11 bot.guilds.cache.size

#

bot.guilds.size ??

barren egret
#

And my project on the glitch
So I need to make changes on dbl edit page? @open garden

restive otter
#

@open garden wdym

#

its made correct

#

its my second bot

#

@barren egret you need to make your own webhook encoder thats why

open garden
#

Invalid page @restive otter

restive otter
#

@restive otter without /check

#

but why

#

without /check

#

ok

barren egret
#

@restive otter how to do that?

restive otter
#

i wanted to see who voted

#

@barren egret well you can use glitch.me there is pre-made encoder model that you can use

#

and it works

barren egret
#

I am using glitch

restive otter
#

but . . .

#

change boti to yours

#

ok

#

nvm

#

botid

#

ok

#

i know it

#

Your bot doesn't have the correct permissions.
ok but how can i add this correct permissions

#

so how i can get vote vote count ?

#

like display how many vote i have

#

with command

barren egret
#

@restive otter can you please provide me link for pre-made encoder model?

restive otter
#

change botid to yours

#

@barren egret sure

#

but with javascirpt (i dont want to get that picture)

#

or i cant

#

??

#

ok

#

another way ? not using link ?

#

maybe not

#

idk

#

kk

barren egret
#

@restive otter thanks
Mention me here when you send link

restive otter
#

is that way to get channel.size bot.guilds.channels.size ??

#

or bot.guild.channels.size

#

just remix this,

#

edit .env

#

and put

#

the url

#

in this format

#

on page

barren egret
#

Thanks!

restive otter
#

@barren egret put this on website

#

change yourpagename to the name

#

you got

#

enjoy

#

^^

#

also auth must correspond on website and glitch too

#

can be anything

#

and you need to put on index.js too

barren egret
#

Alright I'll try!

restive otter
#
const dbl = new DBL('APITOKEN', { webhookPort: 3000, webhookAuth: 'PASSWORD' })```
#

change apitoken to yours

#

and password to the auth word you put on glitch

#

and your bot page

#

@barren egret

#

and for the main code you have it

barren egret
#

Ah, when I try to open dbl webhook project then it says error to load

restive otter
#

you need to remix

#

idk

barren egret
#
const dbl = new DBL('APITOKEN', { webhookPort: 3000, webhookAuth: 'PASSWORD' })```

@restive otter
I'll use it

restive otter
#

this is just to define dbl

#

on header

barren egret
#

Ah

#

Really thanks
I'm gonna try it!

restive otter
#

@barren egret make sure you have a webhook on the desire channel

#

if not, its not goanna work ^^

barren egret
#

Alright!

restive otter
#

@restive otter i sended the picture

#

but when i upvote it doesnt reload

#

reload the picture ??

#

@restive otter its a delay due top.gg just wait ^^

#

also you can make a code with that url to show image from that

#

no i went to the link and i saw that it channegd

#

but the bot dosent change

#

@restive otter because you downloaded that as image

#

the image needs to remain

#

on host

#

no

#

dont download it

#

i used superagent

#

i havent

#

is it good module for getting pciture ??

barren egret
#

.env: line 11: mywebhookurl : No such file or directory , I have set everything but only this error @restive otter

#
Auth=
dbl=``` , I put everything correct
restive otter
#

@barren egret you need to have webhook discord knowledge

#

....

#

webhook is an url

barren egret
#

that's what I put

restive otter
#

if you dont have webhook knowledge i cant help u

barren egret
#

I created webhook and copied url and pasted there

true talon
#

no

#

dbl webhook are not discord webhooks

fast spruce
#

webhook are ezay

barren egret
#

Webhook= https://discordapp.com/api/webhooks/....... That is what I pasted

#

@true talon Is it correct way?

true talon
#

no

#

show your code

barren egret
#
app.post('dblhook', async (req, res) => {
    let auth = req.headers['auth'];
    if(!auth) return res.json({status: "Failed", message: `You didn't provide a 'Authorization' header!`});
    if(auth !== process.env.Auth) return res.json({status: "Failed", message: `You didn't provide the correct authorization key!`});
    if(!req.body) return res.json({status: "Failed", message: `You didn't provide any data!`});
    if(!process.env.dbl) {
      console.log(`You didn't add your dbl api key in the .env file.. smh`)
      return res.status(401).json({status: false, message: `Unauthorized`})
    }
    let bot = req.body.bot;
      let {body: user} = await get(`https://top.gg/api/users/${req.body.user}`).set("Authorization", process.env.dbl);
     post(process.env.Webhook)
      .send({embeds: [{
        title: `Vote Here`,
            color: 0xbc00ff,
            url: `https://top.gg/bot/${bot}/vote`,
        timestamp: new Date(),
            author: {
                name: `New Vote by: ${user.username}#${user.discriminator}`,
          icon_url: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}${user.avatar.toString().startsWith("a_") ? ".gif" : ".png"}`
            },
            footer: {
                text: `Discord Bot List`, 
                icon_url: `https://i.imgur.com/78Hl85r.gif`
            }
      }]}).catch(console.error)
});
app.listen(4000, () => console.log(`Website is up and running`));```
fast spruce
#

hooly

barren egret
#
Webhook=
Auth=
dbl=```
#

and it is in .env

true talon
#

you dont use dblapi.js webhook system?

barren egret
#

I use it only for posting server count on the website

true talon
#

hmm

#

@ruby mauve read channel topic

barren egret
#

I'm not understanding how to use it for votes , so some guy gave me this glitch link

ruby mauve
#

oh sorry

true talon
#

TOP.GG API ONLY!!! ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED - This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at https://top.gg/api/docs

#

@barren egret read the dblapi.js docs

#

you dont need a glitch link or whatever

barren egret
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

Will it work?

true talon
#

yes

#

yes of course

#

make sure the port is open

#

(here, 5000)

barren egret
#

ok thanks , let me try

#

http://0.0.0.0:5000/dblwebhook

#

In terminal it posted it ^ correct? @true talon

true talon
#

yes

#

but

barren egret
#

but?

#

port

true talon
#

replace 0.0.0.0 by your actual ip

barren egret
#

where?

#

at webhook url?

#

I have https:/myglitchproject.glitch.me/dblwebhook there @true talon

true talon
#

https://

barren egret
#

yes

true talon
#

.glitch.me:5000/dblwebhook

barren egret
#

oh

restive otter
#

https?:d?

barren egret
#

so all things has been set up , now it should work

#

And it worked ! @true talon thanks!

hollow owl
#

Oops! Error: 401 Unauthorized
uhh

#

but i authorized

restive otter
#

regen your token

restive otter
#

how i can stop else

dense shale
#

i keep getting 400 errors any idea?

#

wrong channel i think

restive otter
#

oops

#

Sorry

dense shale
#

already got a new API key but still getting 400 Errors

sturdy crane
#

Code:

bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.cache.size, bot.shards.id, bot.shards.total);
    }, 1800000);
});

Error:

dbl.postStats(bot.guilds.cache.size, bot.shards.id, bot.shards.total);
TypeError: Cannot read property 'id' of undefined

I am using v12

willow spindle
#

bot.shards is undefined oliythink

sturdy crane
#

How can I fix it

#

Like where do I have to define it

sullen nymph
#

If you're not sharding, remove anything related to shards

sturdy crane
#

It is sharded

#

But I used bot.shardID

#

Is it bot.shard.id

#
bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.cache.size, bot.shard.id, bot.shard.count);
    }, 1800000);
});
``` - I changed it to this let me see
green mantle
#

english?

little robin
#

How does the dbl system message come?

median badger
#

?

#

what system message?

little robin
#

server system notification

jagged pine
#

How do I permit my ubuntu server firewall to receive webhooks from top.gg?

spiral steeple
#

I would use ufw

jagged pine
#

I do use it

#

But I don't know if I just have to allow the port or the ip too

spiral steeple
#

then sudo ufw allow port you can make it more specific if you want to specify an ip

#

idk dbl's ip tho

#

or if it changes

jagged pine
#

that's what I was wondering

cinder jackal
#

What data does dbl pull out from our bots exactly and why?

spiral steeple
#

nothing but its status

#

you send it server data

#

and that's it

#

that I recall anyways

cinder jackal
#

Server data?

spiral steeple
#

number of servers

#

But it isn't required and you have to send it yourself

#

You can also send some shard data

#

but dbl doesnt "pull" anything besides status (which doesn't even work if it isn't here)

cinder jackal
#

Why does it get(or why do we send) the server count?

#

Why is it used for

#

Is it used for something other than displaying how many servers the bot is in?

spiral steeple
#

what else would it be used for?

#

it's a number

#

it's quite meaningless to dbl, just another data point in a database to take up space

#

I mean with the api other people can access it

cinder jackal
#

Idk

jagged pine
#

they are not stealing any credit card number man haha

#

hopefully ^^

restive otter
#

I how take my bot api?

jagged pine
#

What?

restive otter
#

I how find my bot api

vapid cape
rancid trout
#

Is there like a client.on('invite'...)?

vapid cape
#

there is inviteCreate

rancid trout
#

o oki

vapid cape
dire prairie
#

oh sorry i thought i wa there

lucid depot
#

On the page, how long does it take to activate the counter for my bot's servers, once the code has been placed?

vapid cape
#

usually less than a minute

lucid depot
#

How strange, it doesn't activate me

vapid cape
#

then perhaps you did something wrong

lucid depot
#

this is my code;

const DBL = require("dblapi.js");
const dbl = new DBL('key api')
dbl.postStats(client.guilds.size);

and

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.cache.size, client.shards.id, client.shards.total);
    }, 1800000);
});
#

what is missing?

vapid cape
#

dbl.postStats(client.guilds.size);
should also be inside the ready event

#

as it doesnt work if the client is not ready yet, and the setInterval only starts firing after the interval

#

also, if you're using v12, it should be client.guilds.cache.size

#

also in v12, its client.shard.ids[0] and client.shard.count

jaunty salmon
#

Hello. So I recently added this server count code to my bot. Can someone check if I can use it this way? For me it does not count the servers. Do I have to run a command or something else to show the count?

class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot

    async def on_guild_post(self):
        print("Server count posted successfully.")

    async def sendStats_topgg(self, guilds, shards):
        token_topgg = '**.**.**'
        topgg = f'https://top.gg/api/bots/{self.bot.user.id}/stats'  # https://top.gg/
        headers = {'Authorization': token_topgg, 'content-type': 'application/json'}
        shards_array = []
        for shard_id, shard in self.bot.shards.items():
            shards_array.append(self.shard_guilds(shard_id))  # [1000, 998, ...]
        print(shards_array)
        data = {"server_count": guilds, "shards": shards_array, "shard_count": shards}
        async with aiohttp.ClientSession() as session:
            response = await self.request(session, 'POST', topgg, headers=headers, json=data)
        return response

    async def send_stats(self):
        guilds = len(self.bot.guilds)
        shards = self.bot.shard_count
        with suppress(Exception):
            await self.sendStats_topgg(guilds, shards)

    async def request(self, session, method, url, **kwargs):
        async with session.request(method, url, **kwargs) as response:
            print(response)
            assert response.status == 200
            return await response.json()

    @staticmethod
    def guild_shard(guild: discord.Guild):
        return guild.shard_id + 1

    def shard_guilds(self, shard_id: int):
        count = 0
        for guild in self.bot.guilds:
            if guild.shard_id != shard_id:
                continue
            count += 1
        return count


def setup(bot):
    bot.add_cog(TopGG(bot))
restive otter
#

legit no clue,

#

how do I make 1 user be blacklisted

#

from 1 command

jaunty salmon
#

@restive otter You can build in checks so they can't run the command but this would include a whole group

restive otter
#

hmm

#

mk

vapid cape
#

dont you need a loop/interval?

#

libraries like dblpy post it every 30 minutes

#

im not a python user but i dont see any timer that fires that code every 30 mins

jaunty salmon
#

Yeah, you are right. I need to check if I can build that in somehwere.
For "dblpy" it is self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

open garden
abstract mothBOT
#

If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.

open garden
#

Specifically the error section.

restive otter
#

Im bored

open garden
#

This channel is for the Top.GG api only so for other development questions, which this is, please go to #development . Thank you! πŸ™‚

viscid burrow
#

Hello, I'm having some trouble with updating my server count. I have copied the example with automatic server count posting.

class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = '**.**.**'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

    async def on_guild_post():
        print("Server count posted successfully")

But my server count is never updated, what am I doing wrong?

green mantle
#
  1. add a @commands.Cog.listener() to that on_guild_post
#

cuz shiv keeps forgetting to add that ree

#
  1. are you sure you're loading it as a cog?
elfin bolt
green mantle
#

it can be anything

#

you make it youself

#

e.g

#

TonkkuStinky1234

elfin bolt
#

haaaa
ok thx

#

❀

viscid burrow
#

I'm not sure I'm loading it as a cog, how do I do that?

green mantle
#

are you using the commands.Bot() or discord.Client()

elfin bolt
restive otter
#

URL is not correct

green mantle
#

yeah

elfin bolt
#

0w0

green mantle
#

you dont use discord webhooks

#

its normally somthing like

#

http://you.ip.goes.here/dblwebhook

elfin bolt
#

ok

#

hmmm but how i can get it?

restive otter
#

http://yourprojectname.glitch.me/dblwebhook

#

@elfin bolt ^

viscid burrow
#

are you using the commands.Bot() or discord.Client()
I'm using commands.Bot()

green mantle
#

then you can use bot.load_extension('some.path.to.file')

#

you will need a setup(bot) function

elfin bolt
#

no response 0w0

restive otter
#

Im Also Stuck With Top.gg API Im Thinking To Switch Site To Any Other Listing

gusty moth
#

I'm very confused with trying to display my server count on my bot and have 0 idea if im doing any of it correctly

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(`mytoken`, client);

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size);
    }, 1800000);
});
dbl.on('posted', () => {
  console.log('Server count posted!');
})
vapid cape
#

you dont need the interval if you put client in your new DBL

#

adding client there enables the autoposter

#

is this in your main bot file?

limpid cradle
#

How can i enable the guild count of my bot?

vapid cape
#

the easiest way is using one of the official libraries

gusty moth
#

it is in my main file, yes

vapid cape
#

then just remove the setInterval, it should work just like that

gusty moth
#

Okay

#

Thanks

restive otter
#

@restive otter

gusty moth
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(`token`, client);

client.on('ready', () => {
        dbl.postStats(client.guilds.size);
});
dbl.on('posted', () => {
  console.log('Server count posted!');
})

It still randomly isn't working, just want to double check that's correct

#

Im not good at APIs at all lmao

vapid cape
#

wdym randomly isnt working? what part of it is random?

#

you dont need to postStats at all

#

remove that too

barren egret
#

Is there any problem with dbl api? Because it is not sending any message when somene upvotes

#

It was wroking well today but It is not working now

junior tusk
#

@barren egret I haven't received any error with my auto stats poster

barren egret
#

Auto stats is working , but it is not sending any message to the terminal and discord channel and it was working today

golden adder
#

I use webhooks and haven't experienced any errors today

barren egret
#

i don't use webhook , i use bot to notify when someone upvotes . I tested it on dbl edit page too by using test button but not sending anything to discord as well as in the terminal @golden adder

golden adder
#

Webhooks are better imo because they're obligatory once you get beyond 1,000 servers

#

Sooner you get used to them the better

#

But the test button wasn't working yesterday

#

For a while

#

It's a DBL problem. Only worked with real votes.

#

If you have a way to test with a real vote, do that @barren egret. If that doesn't work then it might be something else πŸ€·β€β™‚οΈ

restive otter
#

how to throw the voter as a message to a channel? There is 1k vote right now. :)

barren egret
#

actually bot user mentioned me that issue and i looked into it

restive otter
#

example text?

barren egret
#

@golden adder what do you think about it?

golden adder
#

Did you test with a real vote?

#

The test button wasn't working yesterday. The api worked with real votes though

restive otter
#

hello

barren egret
#

@golden adder Testing button was working for me today and I tried with real vote but not working

golden adder
#

Hmm

teal plaza
#

Hey all β€” quick question cause I couldn’t find anything online or in pins β€” with sharding, our vote detection has stopped working. Is there any way to detect votes across all shards?

dense shale
#

still get 400 errors any idea why?

vapid cape
#

@teal plaza are you using webhooks?

#

@dense shale where do you get that error? show the full error

dense shale
#

when the bot starts i get a 400 Error

vapid cape
#

show full error

dense shale
#

[DBL ERROR] Error: 400 Bad Request

vapid cape
#

are you using postStats?

#

show code

dense shale
#

const dbl = new DBL(process.env.API_TOKEN, { webhookPort: 5000, webhookAuth: 'NOTHING'},bot);is used for posting

#
      console.log('[DBL Notice] Server count posted!');
    })
    
    dbl.on('error', e => {
     console.log(`[DBL ERROR] ${e}`);
    })
#

there is then the webhook stuff but this doesnt cause errors and still work

#
      console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
    ```
vapid cape
#

what is your dblapi.js version?

dense shale
#

"dblapi.js": "^2.3.1", "discord.js": "^12.2.0",

vapid cape
#

your dblapi is outdated

#

install 2.4.0

dense shale
#

thx

teal plaza
#

@vapid cape no we don’t have 1000+ votes β€” should we switch regardless?

vapid cape
#

webhooks are the only reliable way of receiving votes, but you need to store them yourself

#

ie: receive webhook -> store in database along with a timestamp -> check database and timestamp when people use commands

#

all other api methods are usually slow and often unreliable, according to people's complaints on here

livid hound
#

why does this happen

#
(node:4302) ExperimentalWarning: The fs.promises API is experimental```
#

when i start my bot

devout iris
#

Hey guys, someone know what is glitch port ?

vapid cape
#

@devout iris process.env.PORT

devout iris
#

@devout iris process.env.PORT
@vapid cape thank you!

gloomy fractal
#

-api @regal flower

abstract mothBOT
#

@regal flower

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs

whole dagger
#

Hi

restive otter
#
    const app = express();
    const server = http.createServer(app);
    const dbl = new DBL("token here", { webhookAuth: 'pass here', webhookServer: server})```
#

if i click on test it doesnt post anything

#

in the webhookServer do i need to put anything?

karmic veldt
#

for js client.on('ready', () => { setInterval(() => { dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); }, 1800000); });

I see they are pushing client.guilds.size, so do I run this for every shard and push them all individually? or do I push all stats through 1 shard using broadcastEval

valid ravine
#

How to get number for vote ?

restive otter
#

I need help .*

#

:(

abstract mothBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

restive otter
#

I need help

little robin
#

in the webhookServer do i need to put anything?
@restive otter token, pass here, server.. did you fix the variables?

willow spindle
#

@restive otter just ask

restive otter
#

i cant understand what to put in the server's place @little robin others i have done

restive otter
#

i gave the token and pass

#

but what do i give in the place of server

knotty garnet
#

the url to your webserver

#

but idk if that method is correct

#

normally I set the api's webhook server in the bot page's config

restive otter
#

Yea i did that @knotty garnet

#

In the config page

#

Do I need to make a edit in this

knotty garnet
#

if you've set up in the config page all you need to do is make a webserver then

restive otter
#

Ohk

#

Ty

silk echo
#

how do I get the bot to say "Thanks for voting for me" in user DM?

restive otter
#

Go to the api documentation u will get there @silk echo

silk echo
#

ok

fiery spear
#

how do I show the online status of the bot?

fierce sparrow
#

is application bot offline rn?

#

and does it automatically become online on its own

fiery spear
#

ohh

#

its been online for the past week

sullen nymph
#

-wrongserver

abstract mothBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

sullen nymph
#

-api

abstract mothBOT
fiery spear
#

why'd I be here if I got my answer at the docs XD

nova skiff
true talon
#

its broken

balmy hamlet
#

that literally has nothing to do with djs

#

stop bundling shit together

balmy hamlet
#

stop dotposting

topaz zodiac
#

Can someone help me with the webhooks?

#

I put the webhook URL into the input and I pressed test and nothing happened

vapid cape
#

which url did you put?

olive geyser
#

Hello, i'm trying to use the endpoint https://top.gg/api/bots/{bot.id}/votes , I'm using GET method, I'm correctly passing the AUTHORIZATION header but I get {"error":"Forbidden"}
Any ideas why ?

#

I'm also sure that the authorization token is correct, I've verified twice

restive otter
#

f!pp @signal juniper

#

!pp @signal juniper

#

m!pp @signal juniper

spiral steeple
#

wrong channel

restive otter
#

t!pp @signal juniper

spiral steeple
restive otter
#

thx bro

lapis pond
#

hi, does anyone know how i get webhookAuth?

spiral steeple
#

by setting it

#

it's your choice

lapis pond
#

can i put what i want then? I'm trying everything and does not notify that someone voted ..

knotty garnet
#

@lapis pond the auth is what will be sent in the Authentication header in the http request

#

If you're not validating requests it'll be of no use for you

#

Have you set up an api server?

lapis pond
#

nope

knotty garnet
#

So it'll not send votes to you

limpid vector
#

is there any downside to having your bot react with 4 different reactions every 7 seconds for thousands of users? Is there a bottleneck somewhere with this situation? Unfortunately I don't think discord.js lets your bot perform 4 different reactions with just 1 request to the api...?

spiral steeple
#

Wrong channel. This is for the top.gg api. However that sounds like api abuse to me.

limpid vector
#

yeah I'll go to the right channel. It's not automated though, I was talking about user-actions and how they'll scale with growth.

hearty pagoda
#

@limpid vector most rate limits are per server/dm channel, I'd assume that only things like changing your presence are global.

restive otter
#

how to get existing express from dbl api.js?

arctic arch
#

look at the bottom of the documentation on the website

austere river
#

@spiral steeple that comment refers to things such as rainbow roles

#

Adding reactions to a message is fine pretty sure

flint stag
#

-api

restive otter
#

Hi

devout iris
#

its correct ?

#

5000 its glitch port

restive otter
#

No

#

Fully incorrect

restive otter
#

how i can do a command like if the user vote my bot int he last 12 hours, it can use it, if not, it send a message?

#

Just keep track of the time between command yourself, there's not really a way to check when the user last voted I think

trail sigil
#

javascript? @restive otter

restive otter
#

yeah

#

discord.js

#

i found a thing about .hasVoted(id)

trail sigil
#

yeah, that is it

restive otter
#

ok

trail sigil
#

and it just returns true or false, so pretty simple

restive otter
#

ok

trail sigil
#

@restive otter tbh i find that it is better if you just keep track of this yourself based on receiving webhook notifications because the .hasVoted(id) can take a couple minutes to update

restive otter
#

Oh there's an actual function for that?

#

um

#

ok

#

@restive otter tbh i find that it is better if you just keep track of this yourself based on receiving webhook notifications because the .hasVoted(id) can take a couple minutes to update
@trail sigil and how to that?

trail sigil
#

do you use a database?

restive otter
#

i use mongodb

trail sigil
restive otter
#

ok

strong fiber
#

Using: https://www.npmjs.com/package/botlist

const botID = '673994042450903089'
const listclient = new BotList.Client(botID, {
  tokens: {
    'top.gg': process.env.TOPGG_TOKEN,
    'A LOT OF OTHER BOT LISTS': TOKENS
  },
  interval: 300000,
  verbose: true
})
listclient.on('beforePost', () => {
  const serverCount = client.guilds.cache.size;
  console.log('Posting')
  listclient.update(serverCount);
});

listclient.on('afterPost', (successful, failed) => {
  console.log('Just finished posting to all bot lists, ' + successful + ' were successful, ' + failed + ' failed to post');
});

listclient.on('error', (error) => {
  console.warn('Something happened', error);
});

listclient.start()

restive otter
#

ok

#

403 meaning forbidden

#

are you using the correct token?

strong fiber
#

yes

#

i checked 10 times and regenerated it and still doesnt work

restive otter
#

could you try test posting with a test program?

#

Using: https://www.npmjs.com/package/botlist

const botID = '673994042450903089'
const listclient = new BotList.Client(botID, {
  tokens: {
    'top.gg': process.env.TOPGG_TOKEN,
    'A LOT OF OTHER BOT LISTS': TOKENS
  },
  interval: 300000,
  verbose: true
})
listclient.on('beforePost', () => {
  const serverCount = client.guilds.cache.size;
  console.log('Posting')
  listclient.update(serverCount);
});

listclient.on('afterPost', (successful, failed) => {
  console.log('Just finished posting to all bot lists, ' + successful + ' were successful, ' + failed + ' failed to post');
});

listclient.on('error', (error) => {
  console.warn('Something happened', error);
});

listclient.start()

@strong fiber but with this is to send server count to all discord bot list

#

and i want to if a person vote in the last 12 hours, it execute the command, if not, it dont execute the command

gloomy fractal
#

@restive otter What do you mean?

strong fiber
#

What???

gloomy fractal
#

They weren’t providing that code for you

restive otter
#

the same that when you use ch-bb

#

is like, i know how to it with db.hasvoted

strong fiber
#

Thats not what we are talking about

gloomy fractal
#

@strong fiber We only help with our npm package or a direct request to our API. Not with other unofficial npm packages

restive otter
#

ohh thats a different package?

#

ask in their support, they have one too

strong fiber
#

it is nothing with the package, it litterally sends the request directly to the api. It worked with the exact same token using reqbin

restive otter
#

Still no support here if that's not the official topgg package

gloomy fractal
#

The best I can suggest is you to regen your topgg token

strong fiber
#

When it worked with the token i used?

gloomy fractal
#

It’s the best I can suggest besides getting support from that packages support

strong fiber
#

And what if i get a 403 error when using the official npm package?

#

Will u then try to help me with the issue and why i am getting a 403

restive otter
#

just ask in their support, they made that package, so they should provide you support

strong fiber
#

nonono now ima try with ur package

gloomy fractal
#

@strong fiber If you get a 403 using our package yes we can help you

strong fiber
#

Done

#

got a 403 error

#
const dbl = new DBL(process.env.TOPGG_TOKEN, client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```
#

Error: ```Oops! Error: 403 Forbidden

devout iris
#

Please, someone speak portuguese ? I need help.

restive otter
#

print out the process.env.TOPGG_TOKEN in your logs and see if thats the correct one

strong fiber
#

Wouldnt it be a 401 error if it wasnt the right token

devout iris
#

Fully incorrect
@restive otter
What's wrong?

strong fiber
#

It is the right token @restive otter

gloomy fractal
#

Regenerate the token and try it again

devout iris
#

This goes back to my console:
Running at: http://0.0.0.0:5000/dblwebhook

const dbl = new DBL(
  dblToken,
  { webhookPort: 5000, webhookAuth: dblPass },
  client
);
dbl.webhook.on("ready", hook => {
  console.log(
    `🌐 | Running at: http://${hook.hostname}:${hook.port}${hook.path}`
  );
/* Ignore it => */webhook.send(`🌐 | Running em: http://${hook.hostname}:${hook.port}${hook.path}`)
});```


And when I press the test button, it doesn't work
#

@gloomy fractal ^

strong fiber
#

Same error

#

@devout iris im talking about my issue

devout iris
#

@vapid cape Λ†Λ†

vapid cape
#

?

devout iris
#

This goes back to my console:
Running at: http://0.0.0.0:5000/dblwebhook

const dbl = new DBL(
  dblToken,
  { webhookPort: 5000, webhookAuth: dblPass },
  client
);
dbl.webhook.on("ready", hook => {
  console.log(
    `🌐 | Running at: http://${hook.hostname}:${hook.port}${hook.path}`
  );
/* Ignore it => */webhook.send(`🌐 | Running em: http://${hook.hostname}:${hook.port}${hook.path}`)
});```


And when I press the test button, it doesn't work

@devout iris

vapid cape
#

why ping me lol

devout iris
#

You're the best

#

To help us

vapid cape
#

that doesnt mean you can just ping me whenever you need help lol, i have other things to do

#

top.gg webhooks are not discord webhooks

devout iris
#

I was reading the documentation and had seen it.

#

Do I need to use what the console log, such as webhook?

vapid cape
#

no

devout iris
#

oh

vapid cape
#

webhooks is like a webserver, it depends on where its hosted

#

it can be the server ip address, domain name, website, etc...

#

in your case, glitch does it for you automatically

#

yourprojectname.glitch.me/dblwebhook

devout iris
#

okay.

vapid cape
#

and glitch uses process.env.PORT

#

which is port 3000, but better use the process because they might change it

#

so webhookPort: process.env.PORT

devout iris
#

ok

devout iris
#

It continues logging 0.0.0.0 and does not log that the vote was taken.

vapid cape
#

what did you put in webhookAuth?

devout iris
#

what did you put in webhookAuth?
@vapid cape The DBL autorization... why, is wrong ?

strong fiber
#

403 error while using the official npm package, works when i do a direct request via reqbin with the same token

vapid cape
#

@devout iris show your code

#

@strong fiber console.log(process.env.TOPGG_TOKEN)

strong fiber
#

I am already doing that and it shows the right token

#

On error is this ``` console.log(Oops! ${e} ${process.env.TOPGG_TOKEN});

#

and it worked with the unofficial npm package until a couple days ago

#

But doesnt it throw a 401 when the auth is wrong and a 403 when something else is forbidden

vapid cape
#

whats your dblapi.js version?

strong fiber
#

2.4.0

vapid cape
#

is this in our main file?

strong fiber
#

its in index.js

#

so yes

devout iris
vapid cape
#

what is dblPort?

devout iris
#

what is dblPort?
@vapid cape 3000

vapid cape
#

@strong fiber try console.log(e) in your error event

#

so it shows the full stack trace

devout iris
#

@vapid cape 3000
@devout iris its process.env.PORT. but return 3000

vapid cape
#

@devout iris you have a webserver running?

devout iris
#

@devout iris you have a webserver running?
@vapid cape noup

vapid cape
#

then why do you have an http request?

strong fiber
#

Done, what part of it do you want me to send?

vapid cape
#

all of it

strong fiber
#
    at IncomingMessage.<anonymous> (/rbd/pnpm-volume/4f8ad52e-ba22-41fd-9dd1-b43452d34f9e/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:201:15)
    at endReadableNT (_stream_readable.js:1130:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:17) {
  raw: 'error code: 1006',
  body: 'error code: 1006',
  status: 403,
  headers: {
    date: 'Wed, 13 May 2020 17:15:46 GMT',
    'content-type': 'text/plain; charset=UTF-8',
    'content-length': '16',
    connection: 'close',
    'cache-control': 'max-age=15',
    expires: 'Wed, 13 May 2020 17:16:01 GMT',
    'set-cookie': [
      '__cfduid=db7bb5dc346cb1593d2a4775f0a731c601589390146; ' +
        'expires=Fri, 12-Jun-20 17:15:46 GMT; path=/; ' +
        'domain=.top.gg; HttpOnly; SameSite=Lax; Secure'
    ],
    'expect-ct': 'max-age=604800, ' +
      'report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
    'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    server: 'cloudflare',
    'cf-ray': '592e05fd7c87ea8a-IAD',
    'cf-request-id': '02b0a2126a0000ea8a6d3f5200000001'
  },
  ok: false,
  statusText: 'Forbidden'
}```
#

its hosted on glitch with paid plan btw

#

if that is any help

devout iris
#

then why do you have an http request?
@vapid cape ok, i removed

vapid cape
strong fiber
#

r i p

devout iris
strong fiber
#

So who should i contact

wanton oriole
#

@strong fiber Just get a new IP

vapid cape
#

tonkk probably

devout iris
#

Tim still not working.

#

:(

vapid cape
#

@devout iris test using reqbin

#

if you dont know how to test, send me your glitch project name and i can test for you

devout iris
#

can i talk to u in private ?

hoary lodge
#

Am I allowed to test my DBL implementation on my dev bot (with inaccurate server count data) before pushing it to prod?

green mantle
#

no.

vapid cape
#

of course you are lol

#

as long as its not an absurd number

green mantle
#

true

hoary lodge
#

Is "2" an absurd number? πŸ˜‚

#

going to test sharding with 1,1

vapid cape
#

sure

hoary lodge
#

nevermind my sharding framework implodes when I try to run 2 shards apparently

fluid cobalt
#

I have a question. My api says it is in 11 servers, but I know that it is in more. Did I something wrong? Or is that normal, that it is not in synch?

median badger
#

it should refresh every so often

vapid cape
#

if you're using one of the official libraries, it should post every 30 minutes by default

fluid cobalt
#

I see, hmm, it didnt change. Does it matter where I have put the code? Atm it is in my main js. Or should I rather put it in my backend, where I set up my express server

vapid cape
#

you should put it in your bot's main file

fluid cobalt
#

ok, thanks

ancient pawn
#
  • how do you fetch the total guild count from this endpoint, it doesnt look like you can but i have seen bots display total guild count
vapid cape
#

really weird that it doesnt have a server count property lmao

ancient pawn
#

this means nothing to me

#

lol

#

lol u have to query /stats for this info

#

why??

#

pointless

#

im not making 2 rest calls to fetch the info of a single bot

vapid cape
#

Β―_(ツ)_/Β―

#

perhaps the server count is managed by a different process, and thus requires a separate endpoint

#

and they didnt bother to link it internally

ancient pawn
#

making 2 rest calls for a single command is something i dont want to do