#topgg-api
1 messages Β· Page 67 of 1
Aahh seems like the stats are not going through
@worn quail marco's site updates hourly
I thought it went with when dbl updated
Ah ok
Hello Iβve been scammed and I have no idea how to book a ticket because I am new
Can you plz tell me what to do
is this even #topgg-api related
The website says my bot is offline even thought it isnt.
-bots @winter spade noembed
DieselJS#1689's bots:
@restive otter @indigo orchid
It's going to take time to update
I'm guessing you are talking about the chatbot one?
Its here @abstract moth will update it soon.

Hi
[discord.py] Forbidden 404
Yup
ok, added that π update frequency of an hour should be more than enough.
and 60x less than the rate limit too, lol
thanks shivaco
i love simple APIs

its strange that posting an update to /bots/:id/stats returns an empty payload
you'd think it would return a success boolean, at the very least?
Suggestions go to https://github.com/DiscordBotList/issues :p
try except should work iirc
Js (Discord.js)
dblapi.jshas not a Vote Event ?
It does https://top.gg/api/docs#jslib
wag1
Hey! If i got my own VPS - what should i type here?
@restive otter the external ip of your vps as a url
@boreal bridge with no ports etc?
Well yeah you need a port
Ok!
That depends on your configuration
@boreal bridge If I set all to port 3000 but is not working?
when i test
it should send me an message
A_dblcount 264811613708746752
What makes you think this is a channel to execute commands
@restive otter you need to open the port on your vps
@restive otter it depends on your vps provider, os, etc
I think google is your friends for this one
Itβs pretty simple on Ubuntu
π
Google should tell you in 2 seconds
Shouldn't forget http:// before that
^
Also mind deleting it
That still shows your IP address
I can ocr it
Gucci
and with /dblwebhook ?
Nokia no, we be gucci
Yea
thanks worked!
-bots
What makes you people think this channel is for command usage
I'm confused how DBL API works...
can someone help me?
Idk how to webhooks
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!`);
});
that's what it says on docs
it's just doing it like that besides changing vars?
nvm i did it
When i do
const dbl = new DBL('i put my token', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
It doesnt post
Do someone here know how to add a check for individual commands like on a regular non cog file check? Any help would be much appreciated.
Please ping me on response
@frank laurel the dbl.on(posted...) is just a reminder for you that its posted, you still need to post. I would make a guildRemove event and a guildAdd event and in those you write: dbl.postStats(client.guilds.size)
Hello
Does dblAPI.HasVoted(user) Updates everytime the user can vote again?
.NET btw
Should
Is it possible to get the user who voted for the bot with api?
https://github.com/DiscordBotList/DBL-Java-Library
I use Java so... Got this
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
@restive otter yes. You can either use the lib for your language or access the api directly.
I just access it directly

Or use a webhook and process votes in real-time
String userId = ...; // ID of the user you're checking api.hasVoted(userId).whenComplete((hasVoted, e) -> { if(hasVoted) System.out.println("This person has voted!"); else System.out.println("This person has not voted!"); });
which saves a lot of ratelimits and delays
meh
does anyone know a webhook port that is open (working)
@restive otter you need to open the webhook port on your end
Can anyone help me? I'm working on a website get request in .js to fetch the obtained json.
However, im constantly getting a 401 Unathorized error
What you trying to get
user id from discord
fetch('https://discordapp.com/api/users/@me', {
method: 'get',
headers: {
Authorization: request.session.discord.token_type + ' ' + request.session.discord.accesss_token,,
"Content-Type": "application/x-www-form-urlencoded" ,
},```
@cold ledge
rip
"He didnt respond for 30 seconds!"
Alright. Have fun π
Also. i'll shamelessly delete my post. Cause i found the error.
π
for some reason my dlb token doesnt work
nvm it just doesnt read it from the .env file
Does the voting webhook address allow for specifying a port?
yes
Weird...
If I visit ||REDACTED|| myself, it works fine, but if I hit the test button it does nothing
Oh, I'm a derp...need to save first...
I have 1 problem: My computer screen is small, and I can't copy and paste API Key, due just one part of this is out of my screen. (in https://top.gg/api/docs#mybots)
although that should be fixed you can inspect element and get it that way
I actually havent added a bot in forever and dont have one so idk if there is a copy button
https://shivaco.is-inside.me/1ynT4Hzk.png this crappy copying
As Steven said, your best bet is inspect element
what happens if you click on it 3 times
Java API down?
https://top.gg/bot/621182362008551444
sending my server count and it stopped working a couple days ago?
Im up to near 800 but the page only shows 622?
Looks like cache issues
not a cache issue
don't excuse everything with cache without being clear that its a cache issue
@real frost are you able to get logs to see what is going wrong
Nothing is being returned in my console
has even tried assigning the api call to a command to force some sort of log
Is there an argument I need to call to force debugging?
idk about java
Who wrote the library?
I think it's nikki
So i was reading in doc and i copied
const dbl = new DBL(DBLtoken, { webhookAuth: DBLauth, statsInterval: 1800000 }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
this is the error is it normal? or i need to change something
Webhook isnt defined
Hello, do you have MAL API?
@grizzled gulch what
Does anyone read this channel's topic
@sullen nymph reading is overrated
^
Your bot's top.gg token can be found on https://top.gg/api in section My Bots or on the bot's Edit page

hey guys what did dbl.isWeekend() do?
Is Friday really considered a weekend? 
DBL says it is
Well, I get this error when I try to do something when someone votes
Error: 401 Unauthorized
at IncomingMessage.res.on (/rbd/pnpm-volume/5639bec1-3b08-4925-9ce4-7a48960a6c42/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
raw: '{"error":"Unauthorized"}',
body: { error: 'Unauthorized' },
status: 401,
headers:
{ date: 'Fri, 18 Oct 2019 08:48:50 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '24',
connection: 'close',
'set-cookie':
[ '__cfduid=df0ee34cab1621d0f1444eed25b722a601571388530; expires=Sat, 17-Oct-20 08:48:50 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ],
'x-powered-by': 'Express',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization',
etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
'cf-cache-status': 'DYNAMIC',
'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
'expect-ct':
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '5279416c3fbbc1c0-IAD' },
ok: false,
statusText: 'Unauthorized' }
I think problem with this line only
const dbl = new DBL('token', { webhookServer: server, webhookAuth: 'pass' }, client);
Token might be incorrect
Is this what it should be there in website? http://prntscr.com/pkyx4j
Yeah if the password is actually 'pass' but I meam the token, not the password
Oh the token
Let me check once
I tried with regen token option
And still same error
What goes here http://prntscr.com/pkyz6q
Is it needed?
What is?
That URL
I mean how else is it going to send the requests
oh uhh
So should it be like this http://name.glitch.me/idkwhatcomeshere
name being the project name
Yea I know
And if you don't use webhookPath, it'll default to 'dblwebhook'
http://name.glitch.me:3000/dblwebhook ?
Oh yea I got it
I don't think the port goes for Glitch URLs
Now?
worth a try
@formal sparrow On the token, replace token with the actual dbl token and the pass with the password
and you have to like host a webserver on the url you enter
and if someone requests something there with the pass you entered you let it thru
Yea I know and I replaced it with original one only
So in glitch, I can't use webhook?
i dont think so
Is there a way to get bots with a prefix in the api?
(javascript / node.js)
Like to get all bots with a specific prefix
no error, no logs
link to the website pls? https://discordapp.com/channels/264445053596991498/412006692125933568/634674912929513482
for the webhooks
i found it
const dbl = new DBL('token', { webhookPort: 3000, webhookAuth: 'authpasshere' });```
```events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at DBLWebhook._startWebhook (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (
:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)```
@sharp juniper With your token part we can literally figure out your real token
change pls
ok
help me
It seems like I get that error when the port is 3K
But I got told the port needed to be 3k because I host it on glitch
Servers are not being updated
Force a restart by editing your bot.
@dawn coyote you have to update servers manually
^
how?
js
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);```
I think
I tried this
You can use raw http requests
I think XMLHttpRequest (would work but is depreciated) will work if you supply headers
whatever other http request you use 
do it like me, everytime your bot joins / leaves a server send stats or if the bot emitted ready
@sharp juniper it's saying that port 3000 is already being used
What can I write then?
is glitch using port 3000?
yes
That's why
?
@sharp juniper do you even know how ports work
Port 3000 is taken so use another port
e.g. 8080
oof
Then the easiest way to solve that it to create a separate glitch project for your voting stuff
whats this voting thingy
You can "upvote" a bot, this can be used by developers to give users rewards for voting. Bots with more upvotes appear higher in the list
is the position in the list only dependent on how many votes your bot has or does it include the creation date?
does anyone a piece of code that would allow my bot to delete a specific channel?
Why does my bot list page say N/A where it shows how many servers it's in?
because you didnt transfer your stats
So i think im doing everything right.
Server count is posted correctly, works fine.
So basically i just want to log when a user votes. It returns http://0.0.0.0:5000/dblwebhook (0.0.0.0 means this machine)
For the url in the webhooks section on edit i put http://(public ip beginning with 86.):5000/dblwebhook
Because my public ip begins with 86. I also tried the public ip address that begins with 192.
Code:
const DBL = require("dblapi.js");
const dbl = new DBL('(iremovedtheapitoken)', { webhookPort: 5000, webhookAuth: '(iremovedthepassword)' }, bot);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
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!`);
});```
It never logs when a user votes though. I've voted and my friends have.
I don't get any error messages. Bot is my "client" object.
Anyone got any ideas?
Are you sure port 5000 is open?
yep
@tardy badger does the ready event get fired
And are you sure that is your public ip
ready event is fired
the bot starts up properly
and yeah, it is my public ip
i tried the local and the public ip as well
Iβm not really sure what to say at that point
I would try manually doing it with postman to see if you can debug the problem of you are sure you have done everything else you needed to do such as open the port
ok, just in case i did it wrong, how do you open the port?
192.x isn't generally a public ip
i also used 82.x
You'll need to open the port using port forwarding in your router
And the webhook will then be the 82.x address externally
oh ok, thanks
Make sure also your pc has a static ip
Otherwise the port forwarding will only work until your next reboot
You might want to look into something like cloudflare too to hide your public IP
It will be important if you put a web dashboard on there or anything
And also if your public IP changes
Anyone know what is going on with checking vote. Appears that some users have voted with proper screenshots with the same account, but it's not returning true that they voted.
that's why it's recommended you use webhooks
@gaunt steeple using cloudflare with your public IP is against their policy so /shrug
Where does it say that?
For most sites that use a webhook, their public IP is their only IP
Well I've seen someone report a site for using cloudflare on their own IP
That would be stupid. Cloudflare isn't something illegal. I'm guessing discord would just disregard such a report
Cloudflare or similar is essential for ddos protection
I can't find any policy that says it's against any terms
hey, short question
what do i have to put in there?
the client id of my bot from discord developers?
Your bot token from the discord developer portal
no, your dbl token
yes, that token
you can share your client id, its public anyways
okay, thank you for help ^-^
Just don't share the bot token π
or the bot secret
Things to share: Client id
Things to NEVER share:
everything else
@runic grove not always but generally yes
wdym not always
older bots have different user ids and client ids @runic grove
for example, my first bot has
client id: 172799048015675403
user id: 172799284968816640
oh
I think you can ask questions about the discord api in #development
Hey, can I create an command that is only unlocked for servers that voted for the bot 20 times?
yes
Anyone know why it's sending this back to me ?```
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
`Webhook running at http://0.0.0.0:5000/dblwebhook`
To check if he receives the votes
like this ?
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});
Hi
My boy has a "say " command and works but don't delete the message of the command
How could my bit delete the message?
Do <Message>.delete() if you need more help go to #development
Thanks ^^
Make a GET request to the API @modest nova
they probably meant to post it
Phrasing matters too much honestly
It does
That doesn't explicitly say GET from the top.gg page
And their bot doesn't have server count posted on the bot page so /shrug

I take that as "How to get servercount on my bot top.gg page" the one character can make a lot of difference tho
Yep
If it was "on a bot top.gg page" then it would be impossible without web scraping

Is there an event for when someone votes? .net
@fast comet
that don't look like an event
that's because it isnt..
sounds like some good api abuse
checking if someone voted every x seconds wont really work if the bot is running on big servers
and like steven said it's kinda abuse of the api
You'd also have to check if the vote was an added one and did not already exist. That would be terrible
@worn quail How yo make a req can u help me
One message removed from a suspended account.
For help dude
You mention you can help
thats why i pinged you so can you help me @fair pier
One message removed from a suspended account.
Just looked into the updated dblpy API and I'm noticing an on_dbl_vote event. Does this mean my old system of having a separate webserver process the votes is obsolete and they can be sent straight to the bot now?
By using the webhook_path kwarg right?
Yeah
only port must be set, the rest is optional
Yes
Change a few stuff here and there and all good really 
Like anything related to guilds
Ah cool if I get this to work it'll be so much more convenient
@tepid garden @arctic arch
yes
I'm confused with how to show the server count on a bot, can anyone help me please?
what language and library
unless you mean on the website
which
actually you probably do
which either way id need to know language

you're welcome i guess
I think most libraries have a way to get all servers the bot is connected to, just count that
i didnt read what you put correctly π
I don't think this is normal behavior but I'm getting the HTTP request in my console without the print(data) from the code in on_dbl_test
Huh?
I get [2019-10-23 23:08:52,705] x.x.x.x [23/Oct/2019:21:08:52 +0000] "POST /webhook HTTP/1.1" 401 178 "-" "DBL" in the console
but not the actual vote data
Your webhook_auth and the authorization string sent from DBL don't match

Same behavior unfortunately
I even tried removing the auth completely on both sides, no change
Save, restart still doesn't work?
isnt [2019-10-23 23:08:52,705] x.x.x.x [23/Oct/2019:21:08:52 +0000] "POST /webhook HTTP/1.1" 401 178 "-" "DBL" the request data
Eh that's good enough
Looks like certain someone didn't think of getting None returned
Try setting webhok_auth to None and try again please π€£
Good it works thank you
I agree, the docs are too bare bones
I should probably work on those a bit
Yeah I really try searching around before bugging people but there's not too much to go on when it comes to the api, probably why it took me this long to realize there was an easier way to do things
Some precise feedback could help :^)
Well where I went wrong was thinking I could remove the webhook_auth kwarg since it's "optional" instead of setting it to None cause I figured it'd go to None by default
That'll need a fix for sure since I'm comparing NoneType to an empty string under that condition 
dblpy has on_dbl_vote and on_dbl_test events if you use the built-in webhook
DBLClient has webhook-related arguments (https://dblpy.readthedocs.io/en/latest/api.html#dbl.DBLClient)
Specifying at least webhook_port should be enough though reading the above messages you can see that setting webhook_auth to empty string while having Authorization field sent can cause a few issues with processing requests from DBL
yep

Someone can help me please
I want to get new votes and send it to a chat
But i create webhook etc
I linked it to my application's server
With right password
and port
But nothing happened
that looks like dbm
I don't think you can add the DBL api to dbm
:v
I have a friend who uses dbm and I saw something exactly like that
@restive otter you should read https://top.gg/api/docs
ok
so are we no longer able to post server counts to top.gg for a discord.py bot without using the dbl library
like can we still use #312614469819826177
You can always use aiohttp/requests to send your server count, though? 
oh
i wasn't sure because it said in there that all those examples are old
so I thought it meant that they no longer worked
Well yeah they're old so you shouldn't rely too much om 'em
I can at least say with confidence that the C# method I posted in #312614469819826177 still works π
Ree
@618633293121847317
@dense compass py examples work fine
Too many requests when trying to post server count 
lul how many requests are you making?
@sullen nymph How track votes with dbl api ?
Webhooks
How that works
I setup my webhook and i linked it to my application's server
But nothing seems to work
It's maybe because i use glitch
idk
Did you make sure your URL is correct
The url is https://0.0.0.0:3000 something like that
Replace 0.0.0.0 with the project's name
What
wait
"http://${hook.hostname}:${hook.port}${hook.path}"
How i can change the webhook's hostname
Literally put your project name followed by ".glitch.him" in the URL instead of the 0.0.0.0 it outputs
"http://rem-ultimate.glitch.me${hook.path}"?
I think i've found the solution
Can some1 tell me why i get the response {"shards":[]} if i try to see the stats?
the bot has no stats
how do i give him stats?
by posting them
How do i post them do i need to add something the the code?
nvm gona search it a bit ty
Is the .hasVoted method based on 24 hours vote or just in overall?
nvm i got my answer
This sounds like a stupid question, but was there a change within the Python API surrounding the status things?
@bot.event
async def on_ready():
print("Connected to Discord Servers.")
print("Ready for start up.")
print("Running on v" + str(version) + " on the account " + bot.user.name)
status = ["Tetradon Gen", ".help"] # Change the status here!
# Changes the status messages on the bot
await bot.wait_until_ready()
msgs = cycle(status)
while not bot.is_closed:
current_status = next(msgs)
await bot.change_presence(game = discord.Game(name = current_status, type = 2))
await asyncio.sleep(60)```
Wrong channel my fam, #development
this is my code for it and Idk if there is something wrong with it because my bot won't start
but it is surrounds API
Read this channel's topic
fine
cough
mhm
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
put token there
this is in your index.js file btw
main file
uhhhh
ok
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})
idk how the events work lol
ill put the code at the top of index.js
mhm
cough
with?
i wanna do that it sends a message when someone votes (by webhook)
Inspect element and get it
?
Right click on the text, inspect element, and find it in the code it should be highlighted
right click on it and inspect element
next
Idk what to suggest, try selecting it and dragging your cursor to the end continues
there is like 3 dots in token
isnt that correct tho
can i show the token
No
so better understand
Never
so how use the dblapi.js
You read the documentation
yes
get your token with inspect element jeez
or just zoom out on the page
yeah just zoom out
xd
!p aleyna tilki
-nicetry @restive otter
@restive otter
Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.
@amber dune can u unmute my bot and change prefix
@restive otter no, you can do it yourself through an eval or editing the database yourself
ok
(Do people realize this channel is for stuff related to DBL API?)
yes
no
Is it possible to find out when a specific user last voted?
Webhooks + databases
What do you mean with that
Wait do you mean that when someone upvote i should save that time into the database
and then check according to that
If you use a webhook you can
On vote -> save id and timestamp to database -> query database for timestamp when needed
So basically yeah.
Ok ty
I don't know how to create a webhook so I can send when someone votes for the bot in a channel
You can use the dbl api for this
assuming they use discord.py
Of course
i use discord.js
Oh sorry then you can use the js version https://discordbots.org/api/docs#jslib
There is an example on the bottom of that page
thanks
No worries
@tender crater you set it yourself. It acts as a password
@boreal bridge Do I need anything else besides that?
I'm new and I get Webhook running at http://0.0.0.0:5000/dblwebhook
hi?
@tender crater calm down i have a life too π
enter the details into the settings page of your bot
xD
i don't understand
https://top.gg/api/users/${user.id} @restive otter
API => https://top.gg/api/
Endpoint => /users/{user.id}
The API is
submitting false info for my bot
and I dont wanna get banned for that
bot.shard.fetchClientValues('guilds.size')
.then(results => {
bot.user.setActivity(`-help | ${results.reduce((prev, val) => prev + val, 0)} guilds`);
data.postStats(`${results.reduce((prev, val) => prev + val, 0)}`, bot.shard.id, bot.shard.count)
})```
It's posting 13k guilds instead of 5050
Anyone got any ideas? :/
data is defined as js const data = new DBL('my key here'); if that helps
Number of shards is right 'nd everything
Just server count
Β―_(γ)_/Β―
As you can see status is setting just fine
Yet its posting wrong guild count
:/
@karmic veldt you can repost this informations :)
wdym?
I am French please type your answers without abbreviation
Ok
You can eval js ${results.reduce((prev, val) => prev + val, 0)}
When you use postStats, does that not overwrite the past information given to the API?
I have done that
And repost with a command your stats
It returns the proper guild amount
You can repost
I have reposted
It reposts every time a guild joins or leaves
But itβs always wrong
Oh this is bad
Nope
I use 35m ^^
You will already solicit the API less
Ok
Iβll test it tomorrow at itβs 3:00am right now
π
Thanks for your help
Can we vote throw api ?
User has to directly vote
@sullen nymph ? You mean can't with api ?
The user has to visit the Vote page and upvote a bot themselves
You cannot vote on behalf of another user
Okay
thank you
Imagine sudo-voting.
Trying to set up a DBL voting webhook but nothing shows in console when someone votes.
Code:
const dblapi = require('dblapi.js')
const express = require('express')
const app = express()
const http = require('http')
const server = http.createServer(app)
const get = require('superagent')
module.exports = (client) => {
const dbl = new dblapi(process.env.DBL_TOKEN, { webhookPort: 80, webhookAuth: process.env.DBL_AUTH })
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!`);
});
}
Anyone got an example of posting stats to api (js)
docs arent great tbh
They are good, they have examples you can copy paste
Does anyone here have a good DBL bot I could selfhost with at least logs, and a points system if possible? Would be great if it's in js btw
Getting error 401 unauthorized when trying to post stats..
const DBL = require("dblapi.js");
const dbl = new DBL('TOKEN', client);
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})````
you need your bot's authorization token
Ping me when responding please
@spiral steeple yeah I did set the webhook up on top.gg
Not to advertise but I have an open-source bot with those features @marsh panther
Can you dm me the link please
Sure.
@smoky breach can you send it me too? XD

Hi
hi
@smoky breach send it in dm pls
i feel like i wanna see this
I have a problem, my bot sends 2 messages at once, seems it's an API bug, how do I fix that?
Should I use client.once('ready') instead of client.on('ready')?
This has nothing to do with the top.gg API, and I don't think that is the issue. If it's sending twice then you have two separate instances running your bot's token
I have only one
I need a bot setup link
wdym
how do you get top.gg to show that a bot is online? I currently have had a bot running for a few hours and it still shows "???" on the website
is the bot in the server? @fallen cypress
I believe if it's in the server it should show automatically? - Just checked and it seems like it's not in the server
I think im close? idk what to do next tho
const dblWeb = new DBL(package.DBLToken, { webhookPort: 5000, webhookAuth: 'nunya' });
dblWeb.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dblWeb.webhook.on('test', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
Ya not much clue after that, i host on heroku, i think i set up it properly on the site under the API options thing, and ya
ping me or dm me
Any time the bot updates, and whenever the DBL cache resets
can someone tell me how i put the dbl upvotes in my bot status
I would use a webhook and a counter, you'll need to reset the counter monthly though.
hi, so
Yknow how they're now the custom status feature
when will that be a thing in the discord API?
or is it already there?
- wrong channel
- not really known
read the channel topics next time :p
yeah oops
can someone tell me how i put the dbl upvotes in my bot status
@restive otter
Specify webhook_port and the webhook will run
The other webhook args have default values
We use 5000 usually
const dblWeb = new DBL(package.DBLToken, { webhookPort: 5000, webhookAuth: 'nunya' });
dblWeb.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dblWeb.webhook.on('test', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
Idk what to do next
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL_KEY, {
webhookPort: 5000,webhookAuth: process.env.DBL_WEBHOOK_AUTH}, bot);
dbl.on('posted', () => {
//bot.channels.get(botlogchannel).send('Server count posted!');
})
dbl.on('error', e => {
bot.channels.get(boterrorchannel).send(`Oops! dbl error: ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
if (vote.type == "test") {
console.log("Test successful!")
} else {
if (vote.type == "upvote") {
bot.channels.get(botdblvotechannel).send(`${vote.user} just upvoted <@${vote.bot}>!`)
}
}
});
when im testing nothing show in console
@dense grail
does your webhook work
it needs to be a valid host, port and path 
Port is 5000 but how set path
Im not understand how to do this
I guess your path & hostname is process.env.DBL_KEY
Ya how do you link up a webhook
Hello, I just integrated the server posting into my bot, which seems to work correctly. However, it has changed the number of votes my bot has from 17 to 2, which coincidentally is the same number of votes as my other bot. I checked to ensure the API keys were correct and they are so I am not sure where the issue is coming from.
Monthly votes were reset
thats a thing? my other bot is the same level as it has been for ages. It reset to 2 as soon as I started the bot and the server count came up on the website
Eh yeah, monthly votes are shown on the vote page while you can fetch the total votes with API
DBL won't reset the votes until someone votes, however
An application programming interface key (API key) is a unique identifier used to authenticate a user, developer, or calling program to an API. However, they are typically used to authenticate a project with the API rather than a human user. Different platforms may implement ...
Long articles short, you use your bot's API key to confirm that it's your bot so you get access to the API directly (as DBL requires authorization for all endpoints)
ok
Thanks @sullen nymph

Im making an image api with reactions and stuff
anyone wanna be a user once im finished with it :/
What makes you think this is the appropriate channel for that
its called #topgg-api -_-
What does the topic say
ok then what IS the appropriate channel?
#memes-and-media at least
testing the webhook doesnt work for me lol
How do I make the DBL Website display the server count of the bot?
Post to the endpoint for stats
either one of the libraries or /bots/{bot.id?}/stats
wait is it possible to count members in all servers with discord.js
it sure is
any ideas of how to get the bot total upvotes as clear text so that i can put it on a website
Hallelujah https://top.gg/api/docs#bots
Are you sure about that
Cuz I see points Number The amount of upvotes the bot has
my webhook isnt working
sad
Make sure webhook is running and your port is forwarded
npm install google-translate --save
One message removed from a suspended account.
how would i find if a user upvoted the bot?
One message removed from a suspended account.
thsnkd
any ideas of how to get the bot total upvotes as clear text so that i can put it on a website (HTML, PHP)
I tried with api but still don't get it to work
yes, as plain text
Not entirely sure how else you can get it
fetch your bot page, get points field, you have an integer
I already gave him the docs...
This is DBL, we need to repeat ourselves and abstract everything
What exactly have you tried
How have you tried it
i know
So what's the exact issue
Let's combine our messages instead of spamming like that
Is there a reference documentation to better unerstand discord api other than its orginal api page
Alright
Stop tagging me
-m @jaunty owl spam pinging members and just spamming nonesense | 1 week
π€ Muted MQ DT.| Adrien Agreste#8031 (@jaunty owl)
what url do you put in the webhook url
because whatever i put doesnt work
do i have to personally fetch the requests?
or will the dblwebhook api get it for me?
you set up your own webserver and we will send requests to you
you don't fetch webhooks, you listen to them
cough
just forgot how else to phrase it
anhway
wait then whats the webhook on vote event for?
For times when someone eventually upvotes your bot
You add a custom listener and upon successfully getting a request from DBL, your code will handle that
wait im stupid lol
wait no
so the ready event logs its listening at a port
or whatever
then should i out that in the webhook url on the website
One message removed from a suspended account.
Guys, when I tried to set a bot on my server, i found out that the site didnt use my account, but another account that i made long time ago. How can I change account to put Bots?
Or maybe, Am I saying this to the wrong Channel?
If yes, sorry
is there any way to listen to the votes
use webhooks
@runic grove That's why there is a message at the bottom in the channel
and that's also why i sent the channel as answer
??
fair enough
but whats the point of directing someone to old examples that gives them a link to the new ones
I want an event to happen when someone votes for my bot, but I see that I need a webhook but I have no idea what that is or how to do it. How do you do it from 0?
@tender crater what language are you using
@spiral steeple js
@tender crater https://top.gg/api/docs#jslib
sorry it took so long
What do I have to put here?
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
@spiral steeple
What it says to put there
@hardy acorn just that?
k!avatar
One message removed from a suspended account.
oke
y i am getting this error ```Error: listen EADDRINUSE :::3000
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at Server.listen (net.js:1492:7)
at Function.listen (/home/ubuntu/Fantasy-Music-Bot-Devlopment/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/ubuntu/Fantasy-Music-Bot-Devlopment/MusicBot.js:8:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
another program is already using port 3000
how i change the port in my vps
Change the port number when you set it up 
@spiral steeple how I do that I haven't code any port in my bot file
Or i need to change through vps
Show me the code where you makethe webhook.
:/ I haven't make a webhook till now
It's being created so you made it somewhere...
I just want to see the code you have to create it.
I have to go, check https://top.gg/api/docs#jslib
Uh
So my bot is online if you search it
But when you click it
It says offline
Seems like a cache issue. Also wrong vhannel
Is it not relating to the API?
Considering I have been editing the code to push stats
It's not a cache issue either
I have tried multiple browsers
The status is just its status in this server, you don't need to send it yourself. And yeah it's a cache issue it's online for me.
rlly?
I have tried multiple browsers, weird
Like I downloaded firefox just to test it
lmao
Yeah its offline on all browsers for me
and my friends
So its not a cache issue
@arctic arch Is the API having any problems rn?
Or is it just taking time to sync between the search page and the bot page
cache across devices?
its happening to my laptop, my pc, my friend in the UK's laptop
And across different browsers
cleared cache
etc etc
OK Β―_(γ)_/Β―
Ok it finally synced up @arctic arch lmao but there are now different server counts between search menu and actual bot page
the bot page now says online tho
the caching's on our side, clearing them from your own browser will not affect the results
stop talking about cache in #topgg-api
cache issues and not the apporiate channel
^^
Hey can i have my api token?
your bots are not yet accepted
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
.
One message removed from a suspended account.
I cant wait
One message removed from a suspended account.
-faq 2 -c @hollow talon
@hollow talon
no
@amber dune ur best mod here
why did you ping me in this channel
HI AGAIN
-api @still coral
@still coral
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
how do i get an json data with this code?
could any body help me how to create webhook to this work
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
You want a webhook to send this to a channel correct?




