#topgg-api
1 messages · Page 108 of 1
the data i requested from a website was fetching finical information from the server to then load on the webpage to display more dynamic content
basically its portal that integrated your app with another app
yep if u want to integrate ur bot to another app
ok i got an err
here the log
my bot keeping says "dblapi.js is not found"
but im sure installed
anyone can help me
???
here the package.json
use requests instead of dblapi.js if you wan't post stats
Or try remove and install it again
is there a ratelimit on the https://top.gg/api/bots/722088096195149874/check?userId= endpoint?
@keen mesa i did reinstall for 4 times,
but when i run it locally there is no problem comes
heroku
Hmm, everything should be ok
lel it solved
i forget remove package.json in my .gitignore
when i deploy from git, "dblapi.js" isn't include in package.json
@keen mesa thx
@frigid basin https://top.gg/api/docs#ratelimits
please stop
this is proly a stupid question but in my index.js where would i put this code
client.user.setActivity('-user_invite', { type: 'PLAYING' }).catch(console.error);
here is the code
how the hell do i integrate webhooks into my bot using discord.py
how do i connect with the API
you need an approved bot to be able to get your api token for top.gg
if I recall correctly
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
oh oops my bad
@plucky haven https://top.gg/api/docs D:
You have to wait your bot be approved before access the api token
I might just make the examples non-cog
the webhook api create a server if i not specify it? or i need to specify server
this arguments
cus in the example the server is not set
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
That doesnt work with the newest version, how do i set the shard things
Ping me please if you got an awnser
const DBL = require('dblapi.js');
const dbl = new DBL('my dbl token', { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
```Hello, when I vote for my bot, it doesn't send anything to the console, can you help me please? ping me
🤔
Are you missing some part of the code here? What you sent would result in a syntax error - dbl.webhook.on('ready', hook => {.
I sent you all the code related to DBL, and when I vote, there is no error
@dusk trail
Ah, I see it's edited now.
Yes
Well, does this log anything in console?
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
Does the on ready event trigger?
Well try putting it, see does the webhook even run? Maybe the port is closed?
the ready event say : [ .........] \ prepare:container: timing audit body Completed in 1ms Webhook running at http://0.0.0.0:5000/dblwebhook
I don't use upvote webhooks myself, just giving you some clues that I could find.
okay
the ready event say :
[ .........] \ prepare:container: timing audit body Completed in 1ms Webhook running at http://0.0.0.0:5000/dblwebhook
@paper grotto if i click on the link, it's doesn't works
Well the IP is 0.0.0.0, where is your bot hosted?
Bruh, it's 0.0.0.0 when I try it as well.
why it doesnt work ? @dusk trail
the link : http://0.0.0.0:5000/dblwebhook
doesnt work
someone can help me please
Replace the 0.0.0.0 with your public IP address when pasting it anywhere
0.0.0.0 is just a placeholder
Are you sure the port is open and none of your firewalls are blocking the requests
Replace the 0.0.0.0 with your public IP address when pasting it anywhere
@sullen nymph I thought the library would get the IP address by itself, why isn't IP setting mentioned anywhere in the docs?
Just port and auth.
i don't change the port
Because 0.0.0.0 is a placeholder used by the library dblapi.js uses to create the webhook
@paper grotto Well is the port open in your firewall? And do you have any other stuff running on the same port?
To get the actual public IP address is up to you, but 0.0.0.0 means "accessible on all available IP addresses"
@paper grotto Well is the port open in your firewall? And do you have any other stuff running on the same port?
@dusk trail where i can see ?
Replace the 0.0.0.0 with your public IP address when pasting it anywhere
@sullen nymph where i can see ?
@paper grotto I'm not sure about your hosting. I'm running a CentOS server and I open ports with iptables via SSH or via a control panel like CWP.
The IP you use to connect to your VPS
I never touched the port, I don't even know what it is
ok
@sullen nymph
just look
Try that IP
and the port ?
well you use 5000 so try it
???
I try 5000 or 10101 ?
@sullen nymph
taste 👀
try*
ok, I am very much so a newbie to webhooks so please don't slam me for not understanding basic stuff
I'm trying to send test webhooks to my bot and recieving nothing in my log. other prints are working but the test is not recieving. Here is the info I can give:
- I'm hosting this locally
- I'm using the template listed at https://top.gg/api/docs under python under
Example with manual server count and webhook - For the webhook URL I put
http://[ip]/dblwebhook(my IP of course in the place where [ip] is)
I don't know how much else I can share without leaking important info...
I'm using on_dbl_test btw
@commands.Cog.listener()
async def on_dbl_test(self, data):
logger.info('Received a test upvote')
print(data)
print("E\n"*100)```
No errors outputted, it's just no output
nothing is happening ?
@runic pawn what value did you set for webhook_port?
5000, just realized that's an important thing I forgot to mention
http://[ip]:5000/dblwebhook is what I actually have
Getting any output now?
Make sure port 5000 is not blocked by a firewall and is forwarded to your machine
Port forwarding is done via your router's settings, port blocking - a firewall on your PC
thanks
wdym by "this"
hm
webhook still not fixed?
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!`);
});
```So I set my port to 500, I replace password by my authorization, and i replace yourDBLtokenhere by my token dbl ?
and it could work ?
i have to put / between port and webhooks ?
http://ip:port/YourWebhookPathHere
http://ip:port/YourWebhookPathHere
@sullen nymph I replaceYourWebhookPathHereby My webhook url ?
Whatever your webhookPath is set to in the webhook settings
since it's nothing, it's /dblwebhook
Whatever your webhookPath is set to in the webhook settings
@sullen nymph I don't have to tou this ?
ahh okay
No, you don't use a Discord webhook
@sullen nymph can i send you my link for you to check if it's good?
please
Send requests to it manually via postman or reqbin
Sorry I don't understand, i'm french and i don't speak english very well
what do you mean "at the end of the link"
yes
okay
so i try it thanks
const DBL = require('dblapi.js');
const dbl = new DBL('my dbl token', { webhookPort: 5000, webhookAuth: 'my dbl password ' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://ip:port/dblwebhook`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
});
```it doesn't work
Send me in DMs the URL and authorization key you use
How can I check faster if a user has voted?
I don't want to use the dblapi.js module.
If you don't want to use the API provided by us, then you need to use something else that others or yourself made
or just use DSL vote listener by matt
I don't know where to start.
I don't know where to start.
@hollow temple by reading the API docs
it's pretty simple you just need an HTTP server on your bot code (I'd suggest express.js) listening for POST requests to a specified path then put the ip:port/path on the webhook URL and finally just read the docs
What do I put in the link for the port and IP and path?
What do I put in the link for the port and IP and path?
@frosty quail https://github.com/Giuliopime/top.gg-webhook-tutorial
This might be useful
Quick guide on how to set up webhooks for your bot on top.gg - Giuliopime/top.gg-webhook-tutorial
what do you mean?
When someone votes that the bot sends that.
what do you mean?
.
they are tuto for python ?
someone's got to give me a few lines of code to DM the person who just voted, since what ive been doing up until now is js setInterval(() => { dbl.getVotes().then(votes => { if (votes.message.send('Thank you so much for voting! ^^.')); }); }, 2000);
which isn't working
of course
a little confused with getVotes, i logged what i have and it seemed to show 18 of me and no one else, which seems normal. i'm just confused with the actual intent of getVotes
because it includes repeats, but doesn't include weekend multiplier
Token doesn’t matter
but changing pfp is done by editing the bot and not changing anything
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Received an upvote!")
print(data)
Why is this not working?
How do I connect a webhook to the voting api
Does anyone have a guide for the api to get the server count for my bots profile?
@rough plover Here: https://top.gg/api/docs
read through it, it shows how to do it
how do I do a webhook?
my bot's server count stopped updating and im getting an error 400 on the dbl API that's been working until recently, were there any recent changes to it?
hi
what are you posting?
like what is the type of the thing you're posting
it needs to be a number, double check if it is
alright, i'll make sure
not too sure how to google this but how can i create the source of a webhook like the api does
i know how to receive data from top.gg api webhook
but how can i create my own, for data to send from one server to another
thanks!
when testing my webhook with js console.log(`Body: ${request}`) I receive Body: [object Object] in my terminal
is that normal?
Yes because you stringified it
SKIP
.
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.
One message removed from a suspended account.
Error?
Did you put your webhook url on the site?
With the correct auth, port, ip, path
Your bots edit page, in the webhook section
Your ip
i got a question about the dbl.getvotes, for some reason, every once in a while it will show like 600 users that have never voted for my bot
Possibly might need to do some router port forwarding but Else it should work easy if on VPS

@grave sundial they possibly have, just not in the past 12 hours
no i dont think so
it's a hella long list
my botinfo.points is 135 or so
the dbl.getVotes said at least 200
unique votes
Oh, just one more question, is the port TCP or UDP ?
@verbal venture TCP i would guess
Oh, just one more question, is the port TCP or UDP ?
@verbal venture send me in DMs your code and what you entered on the top.gg page
Hello !
I wanted to know what the Discord Server List (Webhook) API is for.
Can I detect votes with this?
Thanks !
Cool
Is that all it's for?
discord.js
But I want to go through Express, to detect who votes for my server.
no no
but it's only for bots, no ?
https://top.gg/servers : webhooks for server
getVotes is still broken for me, i can share my code if needed
it has improper names as well i can gurantee it
i have a feeling it's because of a token issue on top.gg's side and reusing tokens
when i regen token the first 3/5 of the token is the same lool
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.use(bodyParser.json());
app.post("/webhooks", function(request, response) {
response.sendStatus(200);
if (request.headers.authorization === "my super token") {
const webhook = request.body;
console.log(webhook);
}
});
app.listen(80, function() {
console.log("Online!");
});
@grave sundial
i have
im saying the getVotes is broken
just reset my token and auth and when i run getVotes it shows a bunch of people who are not me or another friend it showed last night
i feel like the api tokens are reused because of what i'm seeing
is there documentation for top.gg/servers api?
there ain't one but webhook data format is pinned in this channel
You don't change it
You simply treat it as a placeholder and replace it with your actual IP or domain whenever entering the link somewhere
nvm
i am inside dblapi.js's node module
i can change it!!!
wait, but if i did change it, do I add https prefix?
i there a listener of on vote, Java?
Not if you somehow have SSL certificate attached to the server that handles your requests @random kindle
@gentle hawk Something tells me no
i have heroku ssl
Ah yes then use https
thanks
dbl.getVotes sometimes shows other users who may have voted for another bot, are tokens reused? when i generate new ones, most of the token is the same as all past tokens
Are you only looking at the first the part of the token
i’m taking the whole token, it’s just about 2 thirds of the tokens i generate have the same beginning
i promise you no one else has voted for my bot this month besides two friends (sad), but sometimes getVotes displays at least a hundred users that i have never heard of, and i’m not in the array either
thank you
@jovial kiln sorry for mentioning. regarding the token needed, do i need to apply a bot first to top.gg before i can use the webhook? (and obviously, get the token)
Bot needs to be approved to top gg
so.. in short, i couldnt get myself a token for the webhook without having a bot approved to top gg?
yes
alrighty, thanks!
https://top.gg/bot/new you can submit a bot here
well, this bot is only for one server with 10k+ member
am i still able to submit my bot there?
since it's actually only for one server
If it's not for public use, then no you can't
you can submit your server though and do webhooks through there
if the server is for public
server is for public but i kinda confused with the configurations
wym configurations
so what’s “etc”
sec
that "auth"
i copied the webhook URL, and pasted there
then idk what to do with the auth stuff
when i clicked test webhook, nothing happens
the auth is what you can use the verify that the requests are coming from top.gg and nowhere else, so that if someone else sends a request to your webhook, it will not accept it.
And it should work when u press test, show me your code @rare shadow
show your code for the webhook, what language you using @rare shadow ?
oh ask someone else I dont know nodejs very well
someone else pls respond to his question
Hey sorry I posted this in the other channel but am getting not response I cannot get the bot to return a list of members for a channel using the code:
channel = ctx.channel
for member in channel.members:
print(channel.members)
memberIDs.append(member.id)
-api
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
my bad
im just trying to figure out which token is this docs talking about x.x
i don't have this
yourDBLTokenHereyet
that's why im here
@rare shadow Go to https://top.gg/api/docs#mybots and click your bot, then it will show the token
idk if it shows for unverified tho
yeah, that means i need to submit my bot first
You don't need it
dblapi.js doesn't support server webhooks, you need to host your own one separately
like this one?
@rare shadow sorry for confusing you.
@patent lintel no no, thanks for answering! really appreciate it
@rare shadow that will post the server count on the webpage, but I dont think it has anything to do with webhooks
you need to host like your own thing
search up "How to listen for webhooks in js" or something, because I mainly code in python, sorry :(
use express
do i make express listen to the webhook URL or?
@rare shadow I found thing online https://blog.bearer.sh/consuming-webhooks-with-node-js-and-express/ which might help you
@rare shadow I found this
thing online https://blog.bearer.sh/consuming-webhooks-with-node-js-and-express/ which might help you
@patent lintel
oops sorry for sending twice
my device glitched
wow, thank you very much!
i'll check it out
much ❤️
:)
and for putting it on dbl, u need ur ip: ip:PORT and replace PORT with your port obviously
like in that tutorial, it is 3000
Hello !
I would like to know if it is possible to know the number of votes of a user without going through a database.
If it's not possible, I wouldn't pass a database
ping me if you have the solution
is there a way to send a message when someone upvotes your server in a channel?
probably
I'm trying to create voting rewards but when I put the log voting code in my bot(main's bot assistant) it doesn't do anything even though I have everything setup correctly, i think. Please ping if u see this
const dbl = new DBL('dbl token', {webhookPort: 1204, webhookPass: "dbl pass"});
dbl.webhook.on('ready', hook => {
console.log(`Webhook Running At: http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let tyforvoting = new Discord.MessageEmbed()
.setColor("#a581e7")
.setTitle(`${vote.username} has voted on top.gg!`)
.setDescription(`:wumpus_luv: Thank you for voting, ${vote.user.tag}! You have received a role and a cool badge on your ReCreate profile. Remember to vote every 12 hours so you can keep that sweet badge!`)
.setFooter("Thank You For Supporting ReCreate!")
bot.channels.cache.get("767103210539188286").send(tyforvoting);
let role = message.guild.roles.cache.find(r => r.name === "Voted");
vote.roles.add(role);
});```
whatever you put in the top.gg page for authorization
you create your own password
then put it in for webhookAuth
um
?
not sure what ur sending
for the URL
oh
you have your IP and port written?
for example
or just http://domain.com/dblwebhook
i wasn't sure if you had the port in the URL as well
that's why im saying this
let me know if it works
so its ip then port in the webhook url
ok
imma test it out
dont think it worked
i voted
and it didnt do anything @grave sundial
changed the webhookurl on top.gg to https:// ip:port/dblwebhook and changed webhookPass to webhookAuth
Webhook Running At: http:// 0.0.0.0:port/dblwebhook
when i restarted the bot
running 0.0.0.0 is normal
oh
dbl.?
const dbl = new DBL('token', {webhookPort: 1204, webhookAuth: "pass"});
dbl.webhook.on('ready', hook => {
console.log(`Webhook Running At: http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let tyforvoting = new Discord.MessageEmbed()
.setColor("#a581e7")
.setTitle(`${vote.username} has voted on top.gg!`)
.setDescription(`:wumpus_luv: Thank you for voting, ${vote.user.tag}! You have received a role and a cool badge on your ReCreate profile. Remember to vote every 12 hours so you can keep that sweet badge!`)
.setFooter("Thank You For Supporting ReCreate!")
bot.channels.cache.get("767103210539188286").send(tyforvoting);
let role = message.guild.roles.cache.find(r => r.name === "Voted");
vote.roles.add(role);
});```
when you click the test button nothing happens right?
yea
first i don't believe :wumpus_luv: would work, you need to use the ID as well like <:wumpus_luv:idhere>
try this instead
you have app and express right?
no
ok
then at the top of your main file have something like this
const http = require('http');
const express = require('express');
const app = express();
const listener = app.listen(1204);
const server = http.createServer(app)```
then in the new DBL options
instead of webhookPort
have webhookServer: server
um i tested and it didn't do anything, i realized that my ip was wrong so i fixed it and tested it again, nothing happen so i might wait until i can vote to see if the original code will work @grave sundial
thanks for the help
rip
use the app.post method instead, it should work
ok thanks, goodnight
Webhooks aren't sending?
Hmmmmmmmmmm
Keep the channel on topic please @slate knot
ya we're trying to discuss the failing webhook here
the help channel in many large bot servers are flooded with complaints
about vote rewards not being distributed. something on top.gg end
any devs around to look into this or do we need to implement fallback redemption
I'll let the team know in case they aren't aware already
thank you
I tried everything and it still won’t work :/
Oh lol my bad
It would be really nice if we could have an incidents channel / page so people can know that there is an issue
agreed ^
so is webhook not working atm?
can you use DBL API without the wrappers?
Ik we can do that for DSL but can you do that for DBL?
Yeah?
Is webhook fixed yet?
Can we get an official confirmation that webhooks are down and an estimate of when they will be fixed?
that'd be nice right?
they should
To be honest just an announcement channel we can follow in our servers so top.gg api outages can get published to our support servers when it's offline.
To be honest just an announcement channel we can follow in our servers so top.gg api outages can get published to our support servers when it's offline.
@golden adder I've forwarded this to the other CM's for discussion
Awesome. Thanks @mighty shuttle 😉
It would save all us developers having to come and figure out what's going on. Also, it happens when I'm asleep most of the time so my users aren't updated on the situation until I wake up.
Is the site under maintainance. Most users didnt recieve rewards for voting i.e it didnt sent any webhooks
Seems like the webhooks all started coming
No, nothing comes with me either.
The votes that were missed all started rolling in for me
not sure why there are so many GETs though
In which language do you code? @prime sable
Python
Okay, can you help me c:
No
:c
Well, you can ignore the GET requests
I remember being sent like PATCH requests or something randomly
I just 405 them but it's just weird that there are so many being sent
aiohttp.web essentially kept bitching about invalid HTTP methods
Yeah
@whole wind sup
hey there, I have again problems with my webhook
i set my webhook url to
http://IP-OF-MY-SERVER:2510/dblwebhook
and created a auth code
this is my code
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'My-Token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='My_Auth', webhook_port=2510) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Vote!")
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("Vote Test!")
def setup(bot):
bot.add_cog(TopGG(bot))```
ohh so its not caused by my code?
Make sure your port is properly forwarded and no firewall is blocking the requests
Make sure your port is properly forwarded and no firewall is blocking the requests
@sullen nymph until now everything worked fine, just about 4 hours ago a member said to me that his vote didnt got recived
Well your setup could be bad, but even if you everything up right webhooks might not be fine
and now its not working
Yeah
k
Man I really hope those requests are the webhooks rolling in
How do I create a webhook in python (e.g. that when someone votes)
Something like what Narmy had #topgg-api message
Yes
hahaha a german nice
But how do you do that with the URL?
u have a server right
yes
where u host ur bot
then u use
http://ip-of-server:Some-Port/dblwebhook
some port is a port with 4 numbers
and ip is ur server ip
Typo, and also make sure your firewall is properly configured
yeah
But I think that isnt a problem for me cause of it worked until now as I said 😄
Ok, I'll test it out, thanks!
but be aware it probably wont work
would probably recommend putting it under a reverse proxy if you know how to do it
Man the requests are still coming I really hope it's the webhooks working and not someone figuring out that I didn't verify the webhook secret
hmm? wdym
oh
Lots of people getting their rewards after hours
i can try
Is that normal?
yeah
yes
dont know could u tell us?
@whole wind which page of top.gg are u trying to access?
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
self.update_stats.start()# Your linter may say this is wrong, but your linter is wrong
def cog_unload(self):
self.update_stats.cancel() # Your linter may say this is wrong too, but again your linter is wrong
# The decorator below will work only on discord.py 1.1.0+
# In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())
@tasks.loop(minutes=30.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
print("DBLPY - Count Posted")
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
I want who who votes that I get a message in the console.
yeah that should work but I think webhooks are still not working
mine is not working as well
and look if no firewall is blocking anything
Sorry I don't understand anything :c
lets go to dms, i can explain it in german
Okay thx c:
@plush ore
@radiant peak Can you help me too?
Any suggestion to this issue?
this channel is for top.gg api help/suggestion, that issue is not related to the api, lets move to #development
Well, you tried to install dblapi.js but npm isn't installed
It's more of a development issue than top.gg API
cc @jovial kiln I'll bonk you for this
@crisp idol it is npm i
@sweet sandal #development ?
o oops i read that wrong my b
llol
i'm a little confused how to get server information using webhooks
i was told it's in the docs but i dont see
like dbl.getServer
@frigid wren https://top.gg/api/docs#intro
i didn't understand
@sweet sandal
i just need a vote-logging channel
using any bot, for votes on top.gg
it already has a logging channel?
Bruh whats up with ur font
how to use api with python plzzz?
no and 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
where's top.gg/servers api stuff
this channel is fine for servers and bots
how can I recognize the votes of those who voted for my bot for the yes of a reward
ok
Yes I posted on the wrong channel, sorry
How do I set up the webhook? I'm really confused.
@dull jay
https://top.gg/bot/YOUR_BOT_ID/webhooks
Thanks now im have another question
Where im can get my DBL token and webhook auth = my webhook?
|| const dbl2 = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); ||
auth is your password put any pass you want here
const dbl2 = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'YOUR_PASS'});
DBL token its again https://top.gg/bot/YOUR_BOT_ID/webhooks?
yes go there and Click Show Token
Very very thanks
Np
Yes
Ooof wait yes sorry my mistake
@fickle lantern http://ip:port/dblwebhook
ip is your public IP address
port is 5000 as you set it as webhookPort
Sure, set webhookPath to '/mybot'
Hello, how can I link my bot to the discord bot list so that when a user votes for it, it tells me
Sorry for my bad English
I hope you understand what I want
Does anyone know how to make it so that my server gets a post when someone upvotes my server or bot?
Guys in dbl.post stats 1800000 its seconds or what?
Milliseconds
One message removed from a suspended account.
is it not by 1000 @scarlet cobalt
One message removed from a suspended account.
One message removed from a suspended account.
How can I get him to give a role when I vote for the bot?
10000 milliseconds / 1000 = 10 seconds
How can I get him to give a role when I vote for the bot?
Hi im using heroku to host my bot and i was wondering how to use the webhooks? I've never used webhooks b4 and im kinda confused. Im using Python btw
How do I do the system that sends messages when someone votes without not using webhook?
or how to create a webhook?
How can I get him to give a role when I vote for the bot?
@tacit lichen
Isn't it the correct way of listening for votes ?
But i don't receive anything
I also did setup my webhook settings in website
but i did not used authorization
Is it the problem?
What's your DBLClient like
That your public IP in the URL?
yes
I'm pretty sure the port is open and also disabled firewall for testing purposes
ok
I get 405 (Method Not Allowed)
Oh yea i forgot that's post ^_^
well, now i get 401 (Unauthorized)
Send Authorization header with password as value
How can I get him to give a role when I vote for the bot?
@tacit lichen
and here you can see what you get as a data: https://top.gg/api/docs#webhooks
If I'm doing right, it still gives me
401
@restive otter I appriciate any help cuz i'm really stuck rn and don't have any idea why it's happening. Is there any way to disable the webhook authentication?
** i ended up changing the port to 5005, and now, i get error 500 (Internal Server Error) ** lol
I checked the console and now it gives me nonsense logs which is about json and these stuff
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/dist-packages/dbl/client.py", line 440, in vote_handler
data = await request.json()
File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_request.py", line 584, in json
return loads(body)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
i guess that's the problem with library
usr/local/lib/python3.8/dist-packages/dbl/client.py"
@restive otter ah yeah
I'd say don't worry, since dblpy is trying to access keys in the request body rendered as dictionary
which I assume you didn't send
which I assume you didn't send
@sullen nymph Yes i thought but test in the website doesn't send anything
The test actually does send fake data
Same format as real votes, just the type key being type and not upvote
..... right
Use on_dbl_test to handle test votes
I've been thinking about just merging them and letting users handle the difference
Yea that's better idea i think
Might do it in next release, which will be 1.0.0
including breaking changes with webhooks!
The authorisation token you can find in the docs > my applications
Webhooks dead again
I have some problems with the webhook and the api, I don't know where to get the api
I have some problems with the webhook and the api, I don't know where to get the api
Which part exactly?
for some reason, top.gg just suddenly stopped sending any request to my webhook. When i vote, or i press "test webhook", it doesnt send any request. It isnt a problem with my code, because it isnt sending the request at all. It was working before, pls help
I have some problems with the webhook and the api, I don't know where to get the api
@restive otter the api docs is https://top.gg/api/docs
i can't help you srry ;-;
They might be in maintenance cuz @prime sable also mentioned it's not working
oh ok
Which part exactly?
@restive otter const dbl = new DBL('', {webhookAuth: '', webhookServer: '' });
Sorry haven't worked with js, if it was python I could help you out
ok
who can help me with js @restive otter ?
Idk really maybe official moderators.
ok
@signal hawk const dbl = new DBL('', {webhookAuth: '', webhookServer: '' });
@jolly moth I don't want to be a bother, but can someone check in and make sure the team is aware that webhooks stopped working?
(again)
I cannot request the API or the webhook I cannot find the API
@restive otter https://github.com/top-gg/dblapi.js
replace yourDBLTokenHere with your token
port 5000 is fine
set the webhookAuth to whatever password you want and you'll have to enter it in on the bot edit page
Ok bro
How do I get him to send a message when I vote?
Get him :/? You mena the bot?
Well, if I'm right, you have to listen to the voting event, and receive the data which is an json object, using that data you can get the user that voted and depending on what library you are using, you can send the message
Is this how I can get someone to message the channel when they vote? By the way, I'm using discord.js
Yep that's how it works, which is called webhook
Here is docs you can get help depending on your programming language https://top.gg/api/docs
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!);
});
What should I write in the password part
or where should I fill
password is whatever you want, but you have to put that password (authorization) in the website too
That's for security that no one actually spoof or fake the voting
You can set your password here in this link:
https://top.gg/bot/{your bot id}/webhooks
okay. Is there any other place to fill?
No, that's it
Thank you very much I love you <3
Your welcome
!p ono moje baka prase
When every I try to go to the dblwebhook page it says I can't open it am I doing something wrong?
like the docs?
Anyone know why this doesn't work? It's old code and i'm only now going back to using vote logs, and wanted to see if it worked still. iirc on_dbl_test still returned the same as on_dbl_vote. I have checked to make sure the token, port, path, and auth are correct
Should also mention im using the py lib, if it wasn't apparent
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Guys does DBL accept Discord Webhook for the voting and such? If they don't then what do I use then
@hidden wave a webserver hosted manually
Oh ok
@restive otter _test is for test requests, _vote is for actual votes. Make sure your port is forwarded and no firewall is blocking the requests
hi, I have a couple of questions about the api real quick
Ask away
so I am creating a reward system with my discord bot, the more someone votes the more rewards they will get by role. Is it possible to see how many times that person voted for an server?
Also, it is required to have my bot listed to start using the api?
- Yes, you can use the webhook system to keep track of votes
- Yes, you need a listed bot to get an API key in order to use the API
When my bot will be done verified
ok, thank you
under the topics one where it says webhooks right?
It looks like I can only see users who have voted for my bot and not a server
how do i know my webhook url if im hosting on my pi?
ah ok ty
it doesnt really work
i got my ip machine on my pi with hostname -I and i typed that url into top.gg page and tried to test but i dont receive any info on the webhook
how do i do that
do i port forward to 5000? or other values
i still cant get my vote log to work
dblhook.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
avatar: vote.user.avatarURL({dynamic: true}),
})
.then(webhook => webhook.edit({
name: vote.user.username,
avatar: vote.user.avatarURL({dynamic:true})
})
.then(wb => {
const hook = new Discord.WebhookClient(wb.id, wb.token)
hook.send(`${vote.user.username} bota oy verdi!`)
setTimeout(() => {
hook.delete()
}, 2500);
}))
});```
did I do something wrong?
const dbl = new DBL(config.apitoken, { webhookPort: 5000, webhookAuth: 'My 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!`);
console.log(vote.user);
});```
i did this but it doesnt log anything
@nova sierra how to use
Means how to setup it
In bot
Bot
@tacit lichen how to setup
It
@sullen nymph how to use js library api vote log
How to setup
dblhook.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
avatar: vote.user.avatarURL({dynamic: true}),
})
.then(webhook => webhook.edit({
name: vote.user.username,
avatar: vote.user.avatarURL({dynamic:true})
})
.then(wb => {
const hook = new Discord.WebhookClient(wb.id, wb.token)
hook.send(`${vote.user.username} bota oy verdi!`)
setTimeout(() => {
hook.delete()
}, 2500);
}))
});```
did I do something wrong?
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post():
print("Server count posted successfully")
def setup(client):
client.add_cog(TopGG(client))
does it post shard count too along with guild count?
Yes, autopost every 30 mins
const dbl = new DBL(config.apitoken, { webhookPort: 5000, webhookAuth: 'My 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!`); console.log(vote.user); });``` i did this but it doesnt log anything
@nova sierra is someone able to help
i need some help I don't know how to get dbl token
Hey guys, so it looks like that my bot shows the wrong amount of servers on the website. It shows the actual amout of server multiplied by the shards. Is there maybe anything I miss?
this.dbl.postStats(guildSize).then(r => Logger.info('Updated guild amount on top.gg', r))
this.dbl.on('error', e => {
if (config.DEVELOPMENT !== true) {
Logger.error('Error occurred while trying to update the server amount on top.gg!')
console.error(e)
}
})
// how I get the guild size
/**
* Counting all guilds.
* */
client.on('ready', async () => {
...
setInterval(async () => {
updater.updateTopGg(await this.guildCount())
, 1800000);
}
exports.guildCount = async () => {
return client.shard.fetchClientValues('guilds.cache.size')
.then(res => {
return res.reduce((prev, count) => prev + count, 0)
}).catch(console.error)
}
And instead of 3,092 servers it now show 9,276 servers https://top.gg/bot/554751047030013953
Should I maybe run the update function on one shard only cause currently it runs multiple times (which I saw just now but before it runs perfectly fine)
why do i get error 404 for my api on my bot logs?
is there an api endpoint for servers/guilds?
How to create a covid 19 tracker bot
Hello
How to create a covid 19 tracker bot
@restive otter You code it
#roles
dblhook.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
avatar: vote.user.avatarURL({dynamic: true}),
})
.then(webhook => webhook.edit({
name: vote.user.username,
avatar: vote.user.avatarURL({dynamic:true})
})
.then(wb => {
const hook = new Discord.WebhookClient(wb.id, wb.token)
hook.send(`${vote.user.username} bota oy verdi!`)
setTimeout(() => {
hook.delete()
}, 2500);
}))
});```
did I do something wrong?
Im experimenting with the top.gg api atm, and i cant find the on_dbl_vote event to be triggered
Heres my starting code:
@bot.event
async def on_dbl_vote(data):
print(1)
channel = bot.get_channel(769417504300466176)
await channel.send("Someone voted!")
print(data)
I'm not quite sure what Am i supposed to put in here
@maiden comet pressing Test or actually voting?
Simplify life with on_dbl_test and the Test button
Where are you hosting?
Now for the solution, are you sure your port is forwarded and your firewall isn't blocking requests?
@restive otter ^^
hmm
where are you hosting?
heroku 🤔
your heroku url
POST it
what
Simplify life with on_dbl_test and the Test button
@sullen nymph what do you mean
matthew are you talking to me ill take that as a no
dblapi.js for js, dblpy for py, and yes I am.
oh
@maiden comet ba da boom, on_dbl_test event fires when the test button is pressed on the website
Saves time and effort
I don’t get it why i should use on dbl test and not on dbl vote
Not needed to post stats
I don’t get it why i should use on dbl test and not on dbl vote
@maiden comet not for your actual vote thing, but for testing.
Ok, how do i do the testing on the website
Test button on the edit page
Nope in webhooks
yes
Wait do i need to set up a webhook to use the api @rapid kettle
No
@restive otter turn on the web dyno
I get this error when pressing the test button
See my message
ok let me see what i can do 🤔
uh can someone help me with getting voting updates and sending them in a specific channel with discordjs?
ok
Sth for python
Pls
A tutourial for python?
I gtg now ping pls thanks in advance and bye
im not hosting on vps tho @jagged pine
Where are you hosting
Then idk sry
ok
Where are you hosting
@rapid kettle
heroku
Puol
not sure if this is api or development just redirect me if so. does the “Give Role” on top.gg/servers webhooks give the role permanently?
or only for 12 hours since vote
@restive otter u need web server
For webhooks
Dank memers web server open source and on their GitHub
@grave sundial 13 hours
oh really?
it auto removes the role after 13?
:DDDDD
how often does the roles menu update, i just created a role and refreshed a few times and it won't appear
Should be instant 
i checked role hiearchy
ah got it, the webiste is incorrect
"Can't see your role? Make sure it's below the bot's highest role
"
the bot's personal role was below the role
but it's highest role was above
wait weird
it has some above and some below
could be the perms of the role
hey, I want to create a command which only voted people can use!
can anyone help me with that
Use webhooks, cache and/or user ID and then check if ID of a command invoker is in a list of a voters
eh that works too but it's API requests
And that can get your bot ratelimited if not handled properly

And that can get your bot ratelimited if not handled properly
@sullen nymph ok
Use webhooks, cache and/or user ID and then check if ID of a command invoker is in a list of a voters
@sullen nymph how can i create a list of voters?
Attach a custom property to your client object
client.voters = []
On vote, push user ID to that array
On command usage, check if ID is in the arrau
Hmm. You could run a timeout that deletes the ID from the array after 12 hours
Or instead store an array/map of user ID and a timestamp when they voted
And on command usage check if they voted within 12 hours
oh yeah and I almost forgot. Since I have to add my own bot to DSL to start using the api, if approved, can I have it hidden from the bot list? My bot is still very much being worked on, so currently I only want it in communities I am friends with
oh yeah and I almost forgot. Since I have to add my own bot to DSL to start using the api, if approved, can I have it hidden from the bot list? My bot is still very much being worked on, so currently I only want it in communities I am friends with
@drifting terrace you're saying that you want your bot hidden from bot list? Or saying you want your api hidden from your bot list
@hidden wave bot hidden from bot list
That's most likely impossible I think @drifting terrace
Ok
i see
how do i find out the username of the user that just voted? instead of vote.user which give me the id of the person
using the id of the user, depending to your library that you are using, you have to get the user from its id
from the intents update, you may have to enable server members intents in order to not get None
i wanted to know how to show the number of the server the bot is in top.gg
When i search my bot name in top.gg it doesn't show, why is that so ?
@restive otter _test is for test requests, _vote is for actual votes. Make sure your port is forwarded and no firewall is blocking the requests
@sullen nymph Sorry for the late response. After looking at it the port im using (5000) isn't forwarded
Set up a webhook
@oblique sluice dms
const dbl = new DBL(config.apitoken, { webhookPort: , webhookAuth: });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
console.log(vote.user);
Account.findOne({ UserID: vote.user }, (err, account) => {
if(!account) return;
account.VotePoint++;
account.VoteCoins++;
account.save();
})
});``` Im running this code on my pi but it doesnt seem to log the votes when i test them
im not sure if its the problem with port forwarding but i did port forward on my pi already
how can I do like this, I looked at the documentation but didn't really understand
who did you even send that to
I hate Data bases, i have the code but It's not fucking working
search is a little broken currently
oh
dev team are looking for fixes
oh k and what about
i wanted to know how to show the number of the server the bot is in top.gg
this
@jaunty plank
do u know about it ?
I hate Data bases, i have the code but It's not fucking working
@restive otter depends on what dbms you're trying to learn really, but they aren't that difficult
I vaguely know SQLite3 but idk where i need to put the Db
channel topic go brr
Is there some python example for dbl events
welp does someone actually knows how this works with .Net bcs the doc from top.gg isnt really clear :/
What is the part that you need help with
do i have to restart my bot to post stats again?
no
you can post as much as you want(within reason, no need to post more than once every 30 minutes)
What is the part that you need help with
@dense basalt i just dont really get what to do, im kinda new with this :c
Do you want to post your stats or what do you want to do
You can see this topic
You need your token first though, you get that once your bot has been approved
alright
how do i set up a webhook url?
I'm new to this sort of networking stuff so forgive me if im a bit slow
its just the url to your webhook server.
for example
http://ip:port/path
is there a guide to setting up a webhook server?
most of the libraries will do that for you
hi - im getting these errors trying to npm i dblapi.js
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npmjs.org/dblapi.js failed, reason: self signed certificate in certificate chain
npm ERR! A complete log of this run can be found in:```
what am i doing wrong, as in what is a self signed certificate in certificate chain
oh nvm
The docs cover it
@jaunty plank i k but where should i put the commands
I hate Data bases, i have the code but It's not fucking working
@restive otter you're blaming the database for your own fault
-bots
-bots
-bots
-bots
-bots
next person to use bot commands here will be muted
this clearly isn't the channel for it (check the description), commands should be kept in testing channels
Install dblpy
Hi, im kind of new to webhooks... so where does one aquire the webhook URL that is requested on the settings page of the bot
Hi
can anyone share their code to post guild count with python
The docs have examples
can someone quickly show me an example of how the webhook URL should look like?
I can't get it working with a new hosting location
now it send the test thing but it didn't send it in 5 sec so I don't know which of the many tries was correct 😂
working
http://ip:port/path
I don't have / in front of the : tho
There is no / in front of a :
but you have in your message
Discord auto puts it there
Ah yeah, doesn't on mobile so I can't see it
Put it in `` so it doesn't add that anymore
Haiii guys
I expect I need to open that port in my router for it to work?
im trying to post discord server count and i get a 404 not found, do i have to wait till my bot gets approved?




