#topgg-api
1 messages · Page 98 of 1
[READY] Black Sheep#5071 has been successfully booted up! Promise { <pending> }
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 19ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 15ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 50ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 17ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 18ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 17ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 17ms.
everything it logs
no
add a console.log in your vote event, before bot.uptime
but noone will vote rn for testing
test button
add a console.log in your vote event, before bot.uptime
@vapid cape i did nothing logged
and i pressed test
nothing
console.log(vote)?
@vapid cape yes
const bot = new Client({
disableMentions: "everyone"
});
const DBL = require("dblapi.js");
const dbl = new DBL('SIKE', { webhookPort: process.env.PORT, webhookAuth: 'bruhboomer' }, bot);
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(vote);
if (bot.uptime) {
bot.users.fetch(vote.user).then(user => {
user.send("Thanks for voting :kittylove:. In the future, this will have benefits!")
bot.channels.fetch('739081152807305308').then(channel => {
channel.send(`Thanks for voting ${user.tag} :kittylove:.\nIt is super apricated!`)
})
})
}
});``` @vapid cape this is my current code
Webhook running at http://0.0.0.0:3000/dblwebhook
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 984
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 6
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] wss://gateway.discord.gg/?v=6&encoding=json in 63ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1
[WS => Shard 0] [READY] Session 30b95111ab43d733bf91e8f1f0fc1b2c.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 842ms.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[READY] Black Sheep#5071 has been successfully booted up! Promise { <pending> }```
everything it logs
that is it
even if i test something
i mean press test
button nothing logs
Waiting 

Still
did you change your project name?
did you change your project name?
@vapid cape yes
oh shit
i did
@vapid cape ```js
[WS => Shard 0] Heartbeat acknowledged, latency of 19ms.
{
bot: '716985864512864328',
user: '587663056046391302',
type: 'test',
query: [Object: null prototype] { test: 'data', notRandomNumber: '8' },
isWeekend: true
}
(node:8499) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at Client.<anonymous> (/app/index.js:189:43)
error
looks like you got something
np
One thing
the bot does not gives role
and says cannot read property role la blah
error ```(node:9645) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
just me or is webhook slow?
just me or is webhook slow?
@rapid kettle idk
webhook slow i think
yo the snowflake type doesn't exist in json
is it a string or a number
@vital anvil 
just me or is webhook slow?
@rapid kettle works fine for me
nice ping
@dawn kernel probably string
¯_(ツ)_/¯
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!`);
});
it does not remind me
when someone does vote
my DBL token?
No.
Webhooks require top.gg to push data to the url of your webhook server
Top.gg doesn't know this url unless you set it
On your bots edit page, at the bottom is a location to put it
But I do not have a bot site,
The dblapi.js lib creates the site.
Thats what the webhook running at http stuff is
Which its not really a site
But a webhook
I dont understand
@little harbor I don't get it
what language are you using
discord.js
so look up "how to make a webhook in javascript" or "how to listen for post requests in javascript" and follow a tutorial, when you get a valid url set up for your webhook (you'll know when you get this), put it in the "URL" section of the "API options"
I can't give you a full tutorial since I don't use JS
but people here will be willing to help you to some extent
unfortunately, this is a somewhat complex topic and even if I gave you a step-by-step guide, it's a bit too much
okay
And what do you think about this bot? https://top.gg/bot/479688142908162059
okay
It worked!!
And it's super simple to do
I just entered the url and authorization that the bot gave me and that's it
imagine needing a bot to do vote rewards
You need API for that
webhook on the site not working, tried with postman and it words
idk if its me or not
yes but i send a post req to my wb with postman to test it
where do you host
my vps
ok, so vps has public ip right?
ye
itd be http://vps.public.ip.here:port/dblwebhook
ok wait, i should put url to my file where i handle webhook right
if you didn't change the path that is
k thx gonna try, let you know
if i have a subdomain will it works ? like bot.domain.ovh/votes
or i need to put the base ip and port (that redirect to the sub)
also jeremy, for authorization i put something and that is webhookAuth ?
base ip and port works more reliable
also jeremy, for authorization i put something and that is webhookAuth ?
@eternal crown yup
how do i start webhook? maybe its a dumb question but first time working with webhooks
you don't
oh so now if i setup everything correctly
if i vote
i'll see it in my logs
right?
ty
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!);
}); so if i am running my bot with pm2, i doubt these logs that are from specific voting file will show there, but i am not sure where should i look for these logs, or how exactly to set it up
try node running it
the bot?
hmm i tried with node , nothing shows when clicking test, just to double check, 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!);
}); this part isnt in index.js its in separate file?
put it in index.js
no
when i run it in index, i get this: Webhook running at http://0.0.0.0:5000/dblwebhook
do you know where am i making a mistake?
no thats normal
yea
still doesnt work, i am not sure where am i making a mistake
ok works now
thanks for the help
np
Alguien me ayuda?
english only pls
Oky
I need help to make those who drop my bot send it to a channel who dropped it and thanking them
@willow spindle
what
"drop your bot"?
@restive otter say it in spanish, i can translate it
Oky
Es que quiero hacer que los que boten por mi bot salga en un canal
@kindred walrus
He wants to know how to send on a channel when someone votes for his bot
im pretty sure all that is in the documents
yes
@restive otter Which language? Javascript?
si pero no encuentro como hacerlo
setup webhook
@restive otter ^^
no, you dont have to use glitch
you just need a webhook, it can be locally hosted or in your VPS
You should wait for someone here to set webhooks, but the documentation shows how to
y en que pagina es?
in the top
Top of page
yo es pero en que pagina la pego?
es donde tengo el bot?
Ok yo se pero en donde configuro la webhooks
in the same place you have your bot being hosted
osea en el proyecto de mi bot?
yes
solo copio y pego y losto y arreglo eso?
dont copy it, you need to change some things
but that example should work if you put your token
i think you need to have your port open too
and in top.gg you edit your bot and put the IP of where your port is
should be fine using 5000 unless you have something else using it
yo se pero necesito ayuda para hacer eso
Gracias por si algo te menciono
okay, but i'll be busy for a bit. I'll probably setup a vote for myself too
Bonjour,
Comment faire pour avoir un event quand quelqu'un à voter ?
English here @deep smelt
No, french incluse
#rules-and-info 6. Speak english. This way everyone can understand you. It is our lingua franca after all.
@kindred walrus
yo anyone got any idea what this is
its discord rewrite
and it happens when i invite it to a new server
Update discord.py
oh crap sorry i thought this was for specific apis

again sorry and thanks
.
.d
:')
Hey, I moved my bot from a selfhost to a VPS today. I opened the port I'm using, and changed the IP on the top.gg page, and all the code is the same, but I am no longer receiving the webhook. Anyone know what went wrong here?
How to get MEE6 IN SERVER
@restive otter Invite from mee6's website
Hi
What is the best way to program a discord bot because in this case I use it by cell phone and the programs here are bad...
Plz Mark me
can i use discord webhook url for dbl webhook url?
2020-08-02T11:38:03.917689+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
2020-08-02T11:38:03.917690+00:00 app[worker.1]: at IncomingMessage.res.on (/app/node_modules/dblapi.js/src/index.js:118:25)
2020-08-02T11:38:03.917691+00:00 app[worker.1]: at IncomingMessage.emit (events.js:203:15)
2020-08-02T11:38:03.917692+00:00 app[worker.1]: at endReadableNT (_stream_readable.js:1145:12)
2020-08-02T11:38:03.917693+00:00 app[worker.1]: at process._tickCallback (internal/process/next_tick.js:63:19)
2020-08-02T11:38:03.917772+00:00 app[worker.1]: (node:4) 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(). (rejection id: 1)
2020-08-02T11:38:03.917836+00:00 app[worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
``` Help
const DBL = require("dblapi.js");
const dbl = new DBL('wdbuiwgfoiagyfouagwf87w4gfo (my token)');
Try to regenerate it
kk
I don't understand how to use webhooks, can someone explain to me ?
The docs do a good job imo
https://top.gg/api/docs
where is it explained ? I've already read the doc but i didn't understand, it doesn't seem clear
For example, we have to write a webhook url on the bot's page but how can i get such an url ?
a webhook is like a reverse request
instead of you sending a request to a website or a server, they send a request to you directly
so you have to provide an address to where they will send this request to
this url is typically a webserver that you run, either inside your bot or as a separate process
to receive these requests
ok i see
My webhook url was something like http://amazingurl:port/api/webhooks/incoming and it didn't work until I changed it to http://amazingurl:port/topggwebhook any idea why?
my vps didn't receive anything at all with the test button
Does heroku provide a static ip/url for things on their platform?
You get a subdomain yeah
please ping with reply
You gotta Actually show us your code, not the top.gg one that shows an example
@gray vigil
Just blur it out or replace with just API TOKEN
@craggy sentinel they did it in #development too
how can i set my webhook url?
click Edit button and scroll down
http://vps.public.ip.address:port/dblwebhook
http://server IP:port/dblwebhook
so i need a website?
no
why would you?
where do i have to get the server ip and port lol
yes
then it is heroku project url/dblwebhook
guess i got it
dont need port?
ah
heroku using 3000 iirc
key lemme try
what does this mean Error: listen EADDRINUSE: address already in use :::3000 2020-08-02T19:50:46.835972+00:00 app[Worker.1]: at Server.setupListenHandle [as _listen2] (net.js:1309:16) 2020-08-02T19:50:46.835973+00:00 app[Worker.1]: at listenInCluster (net.js:1357:12) 2020-08-02T19:50:46.835973+00:00 app[Worker.1]: at Server.listen (net.js:1445:7) 2020-08-02T19:50:46.835982+00:00 app[Worker.1]: at DBLWebhook._startWebhook (/app/node_modules/dblapi.js/src/webhook.js:45:18) 2020-08-02T19:50:46.835987+00:00 app[Worker.1]: at new DBLWebhook (/app/node_modules/dblapi.js/src/webhook.js:27:12) 2020-08-02T19:50:46.835987+00:00 app[Worker.1]: at new DBLAPI (/app/node_modules/dblapi.js/src/index.js:69:22) 2020-08-02T19:50:46.835988+00:00 app[Worker.1]: at Client.<anonymous> (/app/main.js:1501:18) 2020-08-02T19:50:46.835988+00:00 app[Worker.1]: at Client.emit (events.js:321:20) 2020-08-02T19:50:46.835992+00:00 app[Worker.1]: at MessageCreateAction.handle (/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14) 2020-08-02T19:50:46.835997+00:00 app[Worker.1]: at Object.module.exports [as MESSAGE_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32) 2020-08-02T19:50:46.835998+00:00 app[Worker.1]: Emitted 'error' event on Server instance at: 2020-08-02T19:50:46.835998+00:00 app[Worker.1]: at emitErrorNT (net.js:1336:8) 2020-08-02T19:50:46.835999+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21) { 2020-08-02T19:50:46.835999+00:00 app[Worker.1]: code: 'EADDRINUSE', 2020-08-02T19:50:46.835999+00:00 app[Worker.1]: errno: -98, 2020-08-02T19:50:46.836000+00:00 app[Worker.1]: syscall: 'listen', 2020-08-02T19:50:46.836000+00:00 app[Worker.1]: address: '::', 2020-08-02T19:50:46.836000+00:00 app[Worker.1]: port: 3000 2020-08-02T19:50:46.836001+00:00 app[Worker.1]: }
guess something wrong with the port
port is already in use
So i've been trying to setup a webhook to get the user who voted it doesn't log anything
Webhook:
http://<My host ip>:<host port>/dblwebhook``` and this is the event to get the votes but it doesn't work...
```js
dbl.webhook.on('vote', vote => {
console.log(`User with the tag: ${vote.user.tag} has voted!`);
})```
http
Huh, lemme check if i did that correctly
It's http
As i set my set my host ip
At the ready event it shows
running at http://0.0.0.0:<port>/dblwebhook instead of the actual ip
This is Suspicious
try posting to your webhook with reqbin
K
Hello, i have configured a webhook listener on my webserver but there are no response when i test it with the test button, but when i send a post request with postman it works, here is my code ```js
const express = require(express),
router = express.Router(),
Discord = require(discord.js);
router.post(/, async (req, res) => {
if(req.headers.authorization === req.client.config.topggWebhookToken){
const user = await req.client.users.fetch(req.body.user);
await req.client.votesHook.send(new Discord.MessageEmbed()
.setTitle(Vote by clicking here)
.setURL(https://discordbots.org/bot/${req.client.user.id}/vote)
.setDescription(:arrow_up: **${user.tag}** (\${user.id}`) voted for ${req.client.user.username} on top.gg, thank you!)); res.status(200).send({ message: Thank you =)`
});
}
});
module.exports = router;```
in my app.js
topggRouter = require(`./Routes/topggvote`);
app.use(`/topggvote`, topggRouter)```
just use the dbl's
if it works with postman then it should work
did you save the config on top.gg before pressing the test button?
@sullen nymph
1- Raw: 403 forbidden
2- With Authorization: 400 bad request
can you also test with reqbin?
are you sure you are logging in with the right bot under the top.gg token @restive otter
hmm yes i can
@sullen nymph Of course
if you get bad request, the authorization is correct
autopost?
providing your d.js client to dblapi.js to post server count automatically
Yea auto posting server count
@vapid cape well in overall it doesn't even emit the event... Meaning it's not working
Or else it should have at least logged something
if you get bad request, the authorization is correct
@vapid cape it returns a 404
Was your request a get?
no a post
@restive otter test with reqbin, with something like {"user":"test123"} in the body
and with authorization
in reqbin in the body field
request body
@violet crown 404 means url not found
yeah ik i fixed i got an error but now the real error is a timeout
200: Wehook successfully received
windows or linux?
linux debian10
check if they require ports to be opened somewhere in the admin panel
@restive otter and nothing in the logs?
okay, so im not blocked bc i send the post loccaly with the same ip as im connecting to the server
this console.log(User with the tag: ${vote.user.tag} has voted!);
Oh i received this
User with the tag: undefined has voted!
then its working
Hmm so what to do now, my Friend voted and I didn't receive anything
i suppose you to fetch the id and then send the message
I know
and tim thanks i notify you when my network admin answers me bc idk anything about firewall lol
I know, i mean Should have at least logged
User with the tag: undefined has voted!``` when he voted?
it probably should, but if it logs correctly with reqbin it should work
test again with the test button
Says Webhook tested! This may take a few seconds
This happened too before i made a request
with reqbin
Yea
did you remove the .tag just to make sure?
Lemme remove and test again
the port is already in use
you cannot use the port twice
do you have something else using the port? like an express server?
how can i solve /remove the first process
search your code for all instances of "process.env.PORT" or "3000"
but is the bot automatically checked or do I have to tell you to check? plz help
They check when they reach submitted bots in the queue
resume plz
@vapid cape K worked thanks tim and also @sullen nymph
Return the non-parsed response body
Oh
It gets that after the bot runs for a while
I hit that api on every message create event
Could that be why?
maybe you got rate limited
Yeah that’s what I’m thinking
Thats a lot of api requests
But I’ve been doing that ever since I put out the bot a couple months ago and I only got that error today
I should probably set it up to receive webhooks and cache those results / get that endpoint when it’s not in the cache
I’m just waiting for it to throw the error again
how i can do when someone vote its sent in any channel
use webhooks and listen when a user has voted or manually check if they've voted. It's in the documentation
Ok, thank you.
🤔
how would you use the dblapi.js module correctly on a sharding bot?
Dblapi.js handles shards by itself iirc?
You might have to manually post each shards server count
https://top.gg/api/docs#jslib
Should cover it
i mean like
how do i use its functions on each shard?
it's not useable by any
like, DBL#hasVoted() doesn't work within any of the shards
and you can't branch them via a master class either
due to it just attempting to reuse the same address, causing you to get the EADDRINUSE error
Don't use the webhook on anything other than your main shard
the main shard, that's the first one, right?
Yeah
I'm not sure why?
Only the webhook uses a port
mhm
if you add a webhook
and then create another instance without a webhook
that still causes an EADDRINUSE error
Hmm, I dont see where that would happen.
https://github.com/DiscordBotList/dblapi.js/blob/master/src/index.js#L67
An official module for interacting with the top.gg API - DiscordBotList/dblapi.js
Maybe someone else knows better than me
so i fixed the port issue on my project and got this console.log but i dont get the console.log for new votes
also tried to test it on the edit page on top.gg but nothing happend :/
Is that the url your using? Or you just edited it to hide it?
iam using this
herokuurl isn't your actual heroku url is it ?
ehm xd it is
no it isnt
someone told me that its the url from heroku
Thats where you are supposed to put your heroku url
yea it is
Thats where you are supposed to put your heroku url
@jaunty plank i did
on the code its just on the console
So the actual url your using is something like
http://someSubdomain.herokuapp.com/dblwebhook
where is the subdomain?
If I understand correctly, the subdomain is your heroku projects name
Its above where that link takes you
Your webhook url depends on your settings and hosting location
Hello, I sent you 15 days until now you have no answer.
@gloomy vortex do you not understand
The docs give some examples
how can i make live server,member count on my site with php
More of a #development question
Your webhook url depends on your settings and hosting location
@jaunty plank which hosting location
Vps/self hosted/glitch/heroku
Like a virtual server? Vps?
yes
Then the url would typically be
http://yourvpsip:port/dblwebhook
Port and dblwebhook you can define in your code.
Dblwebhook is default
huuuuuuuuh?
yes?
we need a guide for webhooks
i help two @restive otter
what should i do now
idk
what
i need help two
lol
whick authorization key
You set auth
it is your choice
It can be anything you want
anything?
anything
Obviously something secure
can i check this again
where can i create url and authorization
The url is the url to your webhook server
Auth you set in your code
If you are using a lib it makes it pretty easy
What should I exchange for dlwebhook
Then the url would typically be
http://yourvpsip:port/dblwebhook
@jaunty plank
The path you set in your code.
If your using the dblapi.js webhook, and are not setting something custom you can just use dblwebhook
must i host anything?
The webhook server
how
python
Has examples and everything
can somebody show me how can i do api options
Api options?
idk how i do that
this is for server count for my bot page right ?
no
No, webhooks are for getting vote events
@jaunty plank idk hoe this works
@restive otter which langue
Turkish,English
i mean java or python
Bingo
java
@jaunty plank can i write you per dm
I dont really check dms, this channel is for api related questions.
!help
Whene a bot in 75 serveur how many time to discord send you a message in dm
I think they typically send it at 76 servers.
But you can send your request at 75 on your bots page.
@restive otter gg mec pour tes 75 serveurs 
where can i find the token 'Your top.gg token'
thx
is there a function to get the user vote cooldown?
@frozen mica just store the times when the users voted somewhere
yes ty
Am I allowed to use SFW endpoints on nekos.life?
Okay, thank you
-api
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
umm
one error is happening
the dbl api sends vote event even if someone didn't voted
like i pressed vote button
and top.gg said that i already voted in last 12 hrs
but still my bot sent me a message saying thanks for voting
which is under vote event
Which port do you recommend using? Preference?
pretty much
Let's say I do 80, then I still get the same error.
ports < 1024 are restricted to root/admin
I'm on an ubuntu VPS, so all my ports are open by default.
All the ports I've tested so far has given me the same error, even < 1024.
if you want to use ports < 1024, you have to run the node process as root
which is not recommended
but other ports should work, just make sure you're testing the correct one
if you use webhookServer:server, and server.listen(7000) then you should curl 7000, not 8080
webhookPort is ignored if webhookServer is pesent
I forgot switching the port whilst trying other ports lol.
Thank you for the help mate 😉
Whats the best way to debug with the api using a testing bot (aka not production)
as far as i can see, it blocks connections using a different bot
api
using dblpy
im guessing i could make a new bot listing for my testing bot
running the production bot on my wifi is hard
There's the option of scrapping dblpy
scrapping?
you can run dblpy on your prod bot account separately also
aka not using dblpy and doing manual requests instead
you dont need to run the entire bot
i dun wanna make a whole new thing rn :p
ps please don't name your files/folders dbl
pythonk
pain
noice
you're setting up a webhookServer
@vapid cape
How to make it sure
thanks for the help and i hope the head guys enjoy my money
That vote is completed
wdym
Ok
does that happen every time or only every 12 hours
does that happen every time or only every 12 hours
@arctic arch
Everytime
Like u voted for my bot and u got a thanks message
Then few mins later once u press the vote button
Top.gg will say you already voted but will send info through API and my bot will send u msg saying thanks for voting again
If I post stats manually (dblapi.js) for servercount do I specify the servercount for current shard or servercount across all shards?
if you define shard information, it will be for those shards
if you only pass the count, without any sharding information, it will be for everything
Ok thanks
if you use the autoposter, it will detect shards for you
Bruh, whats an API?
...
An application programming interface (API) is a computing interface which defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follo...
Must i change anything on this line of code from the dblapi.py?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
Probably want to change the auth to something more secure.
And if port 5000 is unavailable a diffrent port(it only isn't available on some platforms like glitch or heroku, or some other program is using it)
http://ip:port/dblwebhook
okay
I’ve entered the token in for the API (getting server count etc)
How long does it take to appear
Typically instantly.
^
Probably a stupid question on my part but its been like this for ages now, why does my bots presence on its top.gg page appear as • ??? instead of a green dot saying its online
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
wrong channel to ask tho
ahh alright my apologies
?
Anyone know anything about voting detection with sharded bots? Mine broke as soon as I sharded. Do I have to use webhooks?
well you have to use webhooks
i was helping someone else with this earlier.
but from what i understand, having the webhook on its own process not on bot, or only on your main shard(the first shard) is how to do it
https://jeremy-clarkson.is-inside.me/Ck6vRsn9.png (plus apis dont host minecraft servers
)
a
How can I test my webhook without having to wait for 12 hours with voting?
test button on your bot's Edit page
That's very helpful! Thank you

I don't know my webhook doesn't work
but api posts server count
https://0.0.0.0:5000/dblwebhook
is this a valid url ^ ?
0.0.0.0 means any ip that the server has access to
youd need to put your own public ip
it still doesn't work
typically its also http:// not https://
can anyone help me
Maybe ask the question
Do I need to host anything for the webhooks?
how?
const DBL = require('dblapi.js');
const dbl = new DBL(dblToken, { webhookPort: 8080, webhookAuth: 'pass' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
My server count is not being posted
Any idea why? (Token is right)
Also, webhook for votes is working good
Id add the posted and error events just incase its not erroring and attempting to post
dbl.on('posted', () => { console.log('Server count posted!'); }) dbl.on('error', e => { console.log(`Oops! ${e}`); })
Bad copy pasta 
-api
!p blank space
Hey my bot isn't posting any stats
wha
a webhook handles traffic from dbl -----> your bot
you need to send traffic from your bot ------> dbl
if you're using js do ```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});
})```
@upper acorn
aight ty
How Can I Get DBL Api Key
you need to have an approved bot
How do I use webhooks to post votes? Because I put the webhook there and nothing happened.
you don't post votes
Public what?
Webhooks are for receiving "notifications" when someone upvotes your bot. Similar to how you make a request to an API to retrieve info, DBL will make a request to your "API" when someone upvotes, and you can do stuff with that data. @livid matrix
You can log it in a Discord channel, you can give them perks within your bot, etc
Posting your bot's server count to DBL is done by a POST /bots/:id/stats
You can either use one of their client libraries or just make a regular post request according to their docs: https://top.gg/api/docs#bots... example:
curl https://top.gg/api/bots/:id/stats \
-H "Authorization: $TOKEN" \
-d '{ server_count: 1 }'
a
help
ready.js:17
dbl.postStats(client.guilds.cache.size, client.shards.Id, client.shards.total);
^
TypeError: Cannot read property 'Id' of undefined
at Timeout._onTimeout (C:\give16do07\events\ready.js:17:58)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)```
and isn't it
idand notId
@rapid kettle even making this change, the error remains the same
no idea
I'm using this example
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});```
The example on the dbl website for manual posting is for djs 11 iirc
Its just outdated, and isn't copy paste.
Client.shards.id?
That works in djs 12?
Oh, not sharding lmao
Idk if you can even get the current shard id
Without using a guild
Iirc, that's how it worked in 11 right?
Something like that, the only way I know is on v12 is <Guild>.shardID
typically its also http:// not https://
If the service doesn't serve via SSL
99% of users are not going to setup ssl for their webhook.
All you need is a cert 🙂
Does that work with no-ip.org? I feel like I've used this before, and if that's the case, I was def using no-ip
provides what, the cert?
Yeah
Iirc, you cant cert a subdomain unless you own the domain
That's my concern as well
Yeah
🤷♂️
So I think noip would provide a cert, or you cant
You could self sign a cert, but browsers would reject it
just do cert with following stuff *.domain.(your domains end, like com) www.*.domain.--/-- domain.--/-- www.domain.--/--
thats messy ik
hello
Doesn't letsencypt try and send requests to domain.--/-- which he wouldn't be able to get certs for?
Since he wouldn't have acess to it
how can i know when the bans time is over? nvm the bans time is over
If I'm running the bot from a local server the host of the dbl says it's http://0.0.0.0:5000/dblwebhook . I tried to type both that and my public IP into the edit page url form but I get no response when trying to test. Is there an obvious mistake I'm not seing?
Ok. No I didn't port forward, I will try that. Thank you.
If your bot is on a system with a firewall, you also need to let the port through the firewall
=help
I wrote the dbl webhooks inside the app of my bot and deployed it to heroku. The syslogs says it's running on 0.0.0.0:port/dblwebhook.
How can I communicate with that ip?
0.0.0.0 just means any ip that the server has access to
A way to specify "any IPv4 address at all". It is used in this way when configuring servers (i.e. when binding listening sockets)
https://en.wikipedia.org/wiki/0.0.0.0
read channel topic.
what is it
what
what
he's a genius
;-;
@restive otter
It's off topic, but you should check the guilds your bot is in and check how much guilds are from the same discord-user,
if someone's using your bot more than for example 2 times, you should kick your bot out of one guild.
oh okay
If you got any questions please DM me, the Discord Bot List isn't responsible for any discord-bot verification...
oh okay
@restive otter 👌
has your program done a postStats since the change?
@jaunty plank
What do you mean by that
My bot is in now 422 servers
But it still
Says 417
Right so I want to manage stats posting from each of my shards and the webhook from the manager - how do I stop the manager from trying to post stats?
don't add the client in the constructor @severe quiver
@restive otter what do you need
i want create a webhook regarding youtube
it will work or not
oh ok sorry
Right I have another question about the right API lol
ok
It appears that my webhook is not starting at all - nothing logs, not even an error
My token is there, the config is there
(and I checked whether dblapi.js is installed and it is)
So my question is help?
(pls)
n e v e r m i n d I fixed it
Does the Java library have webhooks?
It doesnt seem to.
You'd have to make it yourself
What about the .js library?
Mhm
Time to learn some basic .js then.
@dim halo
?
Mg pv?
yes
Zaproś do znaj
for what?
Bo nie mg pisać do ciebie
ok, opened
Send a friend request
You can speak in #memes-and-media also
One message removed from a suspended account.
my bot doesnt have a api and if it has idk where
You must make a webhook server on your bot. You can use the libs or make your own
@tawny pelican do u use glitch?
Yes but host on a vps
;-;
wym
anyways
for glitch
it would be
@tawny pelican
https://web.hook/your-glitc-project-name.glitch.me/dblwebhook
Yes
this
huhu
that's what i am telling u
Thats the path you define in your code
its that only
and u can see pins
i rhink
Thats not really a proper url
^^^
What do you mean by that
how does api look likes
Requesting from the api, is a bit diffrent than webhooks
Hi
Hi, so I'm confused onto how to make a voting system.
Well, voting notifications.
const dbl = new DBL(client.config.tokens.tokenDBL, { webhookPort: '3000', webhookPath: '/newVote', webhookAuth: 'Auth' }, '717034854012813404');
ok
@willow spindle, does the rest look fine?
My console is telling me the webhook is hosted at 0.0.0.0:port/newVote
I'm not sure of that's how it's supposed to be.
the 3rd parameter has nothing to do with the webhooks
Well.
replace 0.0.0.0 with your server's public ip
Yeah, I figured.
dont forget the http
{ webhookServer: 'http://ip', webhookPort: '5000', webhookPath: '/newVote', webhookAuth: 'auth' }
correct?
no don't set webhookServer
ok
have you filled out the webhook details on the website
It's on a VPS.
So I'll need to check.
It probably is though.
http://0.0.0.0:5000/newVote
ok
I'll try now.
I've opened it on the firewall.
Alright, thanks Tonkku. It works now!
Do u have tutorial for make webhook topgg ?
im trying to post my bot's stats to dbl using dbl.postStats bc the automatin version doesnt seem to work, but it doesnt seem to post anything. any idea why
Do you have the error event in your code?
Webhooks are seperate entirely
This channel is for top.gg api related questions
Whats your code look like @true talon
the setup line is logged obviously
Then I have zero idea tbh
https://github.com/DiscordBotList/dblapi.js/blob/master/src/index.js#L144
It seems to just take that data and just send a request
hm
How can I
Get number of votes
Like my bot has 62 upvotes
I want my bot to tell current number of votes as well
i'd imagine you could use dbl.getBot
Huh
scroll down
ok
It's .getVotes
But in this event?
i'd imagine you could use dbl.getBot
@rapid kettle
What about event I am using
afaik dbl.getBot provides votes too
because dbl.getVotes doesn't work above 1000
As far as I know ?
yes








