#topgg-api
1 messages · Page 119 of 1
yea
Not sure if it runs on start
same :/
wait
maybe support knows
does the server count run every 30 mins after the bot starting?
Yeah I'm pretty sure it runs on start after looking at the code
what's your code?
the
i mean i load the extension
import dbl
import discord
from discord.ext import commands
class Topgg(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'token that i dont want leaked' # 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
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully on DBL")
def setup(client):
client.add_cog(Topgg(client))
@acoustic dove
Perhaps you aren't loading it in correctly?
i dont know
extensions = ["fun", "misc", "mod", "space", "us", "emoji", "events", "help","topgg"]
the file is lower case
And all the other ones work?
yep
Idk then
F
where can i find the api docs? i have to do my own client bc there is no one availavle on the lang i used
which language?
How do I post shard count? (I'm not using the library, I'm using requests in python)
I currently have this for my body:
{
'users': num_users,
'guilds': num_guidls
}
To add shard count, do I just add 'shards': num_shards to the body?
read the docs
The docs only offer support for the official libraries
If not, then I just couldn't find it, and if you could give me a link that would be great
ok gimme a sec
thanks
can i enter the address given in the webhook ready event in the Webhook url box on the website or is that 2 different things?
bcus im not receiving any response when doing a vote test
0.0.0.0 is the one you're using, right?
use your public server address
0.0.0.0 is just another meaning of "being able to connect to it from anywhere", like a domain, or localhost or your public ip address
where can i find that
that is most likely the ip your bot is on
if it's on repl or something, then the project url afaik
can i eval and console.log that?
somehow probably
like console.log(client.env.ipaddress)
oop ok
ok im hosting on my home computer, and its ip4 address doesnt work

oh the public address is ipv6
nvm there are 2
welp doesnt work either
You can disable ipv6 in your adapter settings so it only allows ipv4
ok so this is my code for the server count cog and i am just unable to make it send the count or send something in the terminal ```py
import dbl
import discord
from discord.ext import commands
class Topgg(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'token i dont want leeked' # 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
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully on DBL")
def setup(client):
client.add_cog(Topgg(client))
help
hi
const vote = req.vote; //this is your vote here
console.log(vote)
let boxs = db.fetch(`${vote.user}boxs`);
var newbox = parseInt(boxs) + 1
if (isNaN(boxs) || boxs === null) {
db.set(`${vote.user}boxs`, 0);
}
db.set(`${vote.user}boxs`, newbox);
boxs = db.fetch(`${vote.user}boxs`);
})``` this only works when a test is run
but when someone actually votes it wont work
Can someone help me. I tried the get_user_vote() function in my bots code but it is returning False instead of True even though i have voted?
It'll probably take some time to be processed since the value is fetched from the API
I am getting this error
dbl is installed in my system and VPS too
the same dblclient works in my other cogs idk why
Don't call your files or folders dbl
it has been 3 hrs since i voted.
still giving false
poggers
can someone tell me wht to do if the get__user_vote function is returning false even if the user has voted?
i m using python
@mortal ore do you have a snippet/example of the code you're using to call the function?
yes wait for a sec
@green sluice
the function returns false even if the user has voted
guys can anyone help me as to what this place is , for starters, which thread do i ask dumb doubts like this one, i know i cant do it here and this will probably be deleted
@mortal ore I don't see any glaring problems with the code, so there is something failing outside of that. I would start debugging. verify ctx.author.id, verify other dblpy functions are working like get_user_info(ctx.author.id)
@left egret ads 
@lethal oriole seni banlı görmek isteyen dm atsın mı
reklam yapma lütfen
Teşekkürler
ok thanks
thanks
In the API tab of the docs in DBL, my bot doesnt show up. Is this something to do with it being verified?
it has to be approved, yes
npm install dblapi.js is that still correct?
hey there, trying to post the shard count so that the number of servers my bot is in is displayed. could somebody help me with that? specifically I need to know what auth I need
the auth (API token) can be aquired from https://top.gg/api/docs
there's also more stuff about how to use the api
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 do i put in webhook port and webhook Auth :/
your webhook password you can define yourself
it has to be the same there and on your top.gg bot page settings under "Webhooks"
in Authorization?
yes
do you know what is port
a port is a communication endpoint.
I am vorking with top.gg api and test on_dbl_vote event. But I can vote only 1 time in 12 hours. Is it possible to send test vote or something like that?
on_dbl_test is fired when the Test button is pressed
Same section where you enter webhook settings on the website
Where is that button?
See my last message
Oh ok
How I can setup webhooks? I don't own any website to send data to it.
You have a webserver with an Internet connection, therefore it has an IP
Ok, so https://myip. And what is webhook_path and port? (It's my first time working with webhooks)
http://ip:port/path
webhook_path is the route that comes after the IP and port
(Must start with /)
ok, thanks
dbl.webhook.on('test', test => {
console.log(`User with ID ${test.user} just voted!`);
db.add(`money_${test.user}`, 1000)
});```
y wont this work :/
is there any docs for that?
check their page
is there anyway I can dev and test webhook on local enviromen
there is test button btw
for receiving requests you can use https://pipedream.com
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000) I need to change something here?
wodefok
webhook_auth to, well, a password of your choice
Why it is not working?
import discord
import dbl
from cogs.helpers.Bot import Lebby
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot: 'Lebby'):
self.bot = bot
self.token = 'my token'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='auth password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_test(self, data):
channel = self.bot.get_channel(725029189585207316)
await channel.send(f"Test")
def setup(bot: 'Lebby'):
bot.add_cog(TopGG(bot))
Webhook url in top.gg: http://myip:myport/root
http://ip:port/dblwebhook
doesn't work too
hey guys i have a qustion.....i want to post a msg to a particular channel in a particular server when somene votes it....how to do so???
i don't want to use the dbl module
i use python
@tawdry bone I have same problem. And without dbl module it is impossible to do.
can't we use requests?
Maybe you can... But code will be too long and much slower than with module.
well
then hwo to do with the module??
maybe
cause i saw the docs andthere wree examples bout posting server count
but tht's not what i want
I try to do the same feature that you - on vote message. DBL module have on_dbl_vote event. But it needs webhooks. I have some problems with it so I asked questions here.
@rare flame are you sure your server doesn't have a firewall running on port 5000?
I use vps host with ssh port 22
You need TCP port
Can I use on_dbl_vote without webhooks?
I'm trying to get the bot to thank when it is voted, the first shard calls successfully but the others say that the door is already being used, what to do?
Yeah, i have some troubles. Everything is fine, when i checking my link in req bin everything look fine, but when i use 'test' in top.gg that i have no results
is that something broken with top.gg api?
How do I get a webhookAuth?
Go to Your profile on top.gg, select your bot, press edit and select webhooks
{
"error": "Unauthorized"
}
``` i still cant get it..
rust
never heard of it
Rust
Are you using discord.py or discord.js
??
i use discord.js
Uhh ok i don't know I use discord.py i'm sorry, but you can read #topgg-api to learn something.
Go into your develop server -> settings and -> interaction and click create webhook
then click copy webhook url and past it there
The link is this: https://discord.com/api/webhooks/YOU_BOT_ID/YOUR_AUTH_TOKEN
Here it is
you have to copy YOUR_AUTH_TOKEN to the Authorization BOX in the form.
Click Create a webhook
okay i try it
Then click copy webhook link (or url, it depends from the language)
Now go to you bot edit page on top.gg
and select Webhooks from the left navigation menu
And past the link you copied from discord
In the first box of the form.
you mean like this
dbl.webhook.on('vote', vote => {
const channel = client.channels.cache.get('<id here>');
if (vote.isWeekend) {
return channel.send(`<@${vote.user}> has just upvoted @modest parcel 2x on top.gg!`);
}
else {
return channel.send(`<@${vote.user}> has just upvoted @modest parcel on top.gg!`);
}
});```
I had this working for over a week but now it suddenly stopped and says "TypeError: Cannot read property 'send' of undefined".... any idea what happened? no code changed
okay bro
I don't know, I use discord.py
Is that done?
No, now you've to copy the last part of the link (te long code after the last /) in the Authorization box in the form
then click save and you've done. After you have to write the code for send datas to the webhook, but I don't know how to because you use Node.js and i use Python.
you mean like this
hmm
Do I have to re-enter the above code into Webhook URL and Authorization? I thought save was over
Wait, I send a photo
okay
This is wrong
Definitely wrong
That is not how webhooks work
These are Discord webhooks, that is not what that is fir
for
You have to make your own Webhook
Not a Discord one
Ahhhhh ok i didn't know this I say that because for me it works fine!
hmm how do create it, i don't understand
It's not supposed to work with discord webhooks as these are different things, or did i miss something @signal hawk
Your getting vote events through a discord webhook @narrow lava?
I'm most likely sure that this is not what they're supposed to be used for
Servers dont work through discord webhooks
You have to have the webhook hosted on a server that's accepting post requests iirc
Exactly, no clue how discord webhooks are working for you
No i'm getting the number of servers my bot is in
Thats not what top.gg webhooks are for
They are exclusively for getting vote events
Its their only feature.
I didn't know that.
So will I have to create a webhook through my bot?
Yes
The new library is this one.
https://github.com/top-gg/node-sdk
okay i try it
hey anyone please help me with role rewards for voting my bot
If anyone know
sure, what library
Javascript?
this is the new library for the webhook receiver to receive vote events https://github.com/top-gg/node-sdk#webhook-server
Without api role rewards aren't possible?
well, the webhook isnt really the api. the api is more making requests, the webhook is receiving requests.
but yes, this is the only way
I mean isnt this event suppose to show the bot's guild count other than showing N/A?
dbl.postStats(this.client.guilds.cache.size)
}, 1800000);``` but it doesnt work (my bot isnt approved yet)
@jaunty plank
you need a token to post your stats, which you get after approval.
{
"error": "Unauthorized"
}
``` anyone please
are you using your token?
Is there a token for the discord server list portion or how do i setup rewards with that?
can i still use the dblapi.js api?
there is no tokens for servers afaik, but you can use dsl for role rewards, or setup a webhook receiver/server
how should i use token? Actually im using https://www.npmjs.com/package/@top-gg/sdk and theres no token needed for votes updating on discord channel
you mean the webhooks?
yeah
youll need authorization for the webhooks
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
yeah i had that
in your webhook dashboard and the code?
yeah
if (this.auth && req.headers.authorization !== this.auth) return res.status(403).json({ error: 'Unauthorized' })
Then you probably didnt make them the exact same, as this is the error for that.
https://github.com/top-gg/node-sdk/blob/master/src/structs/Webhook.ts#L37
i will try that one
wait
nah, them are exactly same
i just copied from dashboard to code
im really dont know whats goin on with that
so, thats the only line that logs that.
maybe its something wrong with mine hosting
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
class Topgg(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'mytoken'
self.dblpy = dbl.DBLClient(self.client, self.token)
@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()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(Topgg(bot))
``` any one able to help it doesn't post a server count :/
?
@nocturne magnet self.update_stats.start() in the __init__
Hi
hmm
which module you using?
straight from right here:
I'm trying to get the bot to thank when it is voted, the first shard calls successfully but the others say that the door is already being used, what to do?
Your code is doing what it is supposed to
I don't see the problem
I just wanted to make sure that like the spam of 'Server count posted to DBL' wasn't like my code somehow spamming an api or anything
but good, good
what do you mean?
like do i have to add something like that?
Yeah
oh
so
do i need to put anything in the ()
@sullen nymph ```py
def init(self, client):
self.update_stats.start()
self.client = client
self.token = 'mytoken'
self.dblpy = dbl.DBLClient(self.client, self.token)
start it after declaring self.dblpy
ok
let me try that
i put that but i still dont get a message in the terminal
or
am i missing something
Put a print instead of all the logger stuff I guess
so dblpy isn't compatible with python 3.9?
what waht
for real
well it doesnt work and someone mentioned something about the problem being the fact that i use python 3.9
well shiz
but they never replied when i asked for more information
thats the doc
nice thx
thankful they allow us to send links
def __init__(self, bot):
self.bot = bot
self.token = "token"
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='auth', webhook_port=5001)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
return
```ive gone to the web portal and filled in my ip, with the right port and endpoint. (also the right auth) and yes, i have port forwarded port 5001
however nothing happens
or might this be another consequence of having python 3.9
yea
i figured with even the simple auto post
meme man
cool
spacey boi
ill vote him
https://top.gg/bot/681875101020454930#/
Webhook is not updating, my bot is stuck at 1971 Servers.
This is my code I use on my shard.js
const DBL = require("dblapi.js");
const dbl = new DBL('xxx', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
There is no error
@fluid cobalt use https://npmjs.com/topgg-autoposter instead

what?
is there any way to get like an "API Key"?
I want to fetch a bot via the /bots/:id endpoint but it throws unauthorized
only way currently to get it to work is to include my own auth cookie in the request which I don't think is how its supposed to be used
no like I want to access the API to fetch stats on other bots
Is there a way to make a post request to post an announcement, or is this a new thing and you can't do that?
not a thing, but i think it's planned to be able to post request announcements
an integration with something
Yeah but what?
w
well, it depends on your lib/language/hosting location
Hey, would anyone be able to tell me where I can clearly find how to use top.gg's API to connect with my bot in python whenever a user upvotes the bot?
brooo
it doesnt woork
🥲
why if I try this:
url = "https://top.gg/api/bots/(top.gg bot id)/stats"
data = {'server_count': '0'}
headers = {'Authorization':'token authorization'}
r = requests.post(url, headers=headers, data=json.dumps(data))
<response [400]>
?
It might be authorization not Authorization
My bot is discord.js and i want to make it so when someone executes a bot command, discord shows that my bot is typing.
So lets say i do " !help "
discord says:
CoolBot is typing...
@wild lantern
@wild lantern reply to me if you are not gay, if you dont reply u are gay
ill give u 5 mins to reply
discord.js
@regal creek (1) dsl is a bot and (2) stop being so immature
does this need to be replaced with something?
Not if you don't change default webhookPath in our official libraries
i want to do something like this
the problem is
i don't know how to do "something like this"
is there any reason why a user vote does not get counted?
im mean it does not send anything back to the webhooks
hi
@leaden obsidian means?
then you should know what to do
go you have any info regarding my case ?
it gets counted, it's probably caching
@tawdry bone what library?
Can a bot send larger attachments then 8mb if the server is boosted?
Use the webhook system
remember that you need to remember what the documentation says about initialising the client
if you wish to use webhooks like you do
what wrapper are you using?
What exact package are you using for the dbl api
I'm hosting on heroku and trying to receive votes. But I'm not sure what to put here. In the example i saw it should be something like https://IP_ADDRESS:PORT/dblwebhook but i don't have ip of my heroku app.
dblapi.js
your heroku project url afaik
https://www.npmjs.com/package/@top-gg/sdk use this, the dblapi.js is old
so like https://myAppName.herokuapp.com:5000/dblwebhook ?
Is other things are same ?
probably yeah
wdym?
alr ill try that.
The other things like const dbl things from docs
it should, if the documentations is correct
Nope. Doesn't seem to work... I set the url saved and pressed the test button nothing happened. Here is my code if anything is wrong 
it does say it has been started though, right?
u mean the ready event?
nah, the webhook running at etc
it did
Pls update the documentation oof
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
Does it matter if i don't give the options (ik they r optional but will that affect the voting and webhook ready events or not?)
Auth optional path optional port required in order to run the webhook
nvm if i use the 5000 number that won't error right?
thx
is this code finished or do i need to put somethign in it??
got it from dbl.py github
i want just like this (a feature)
shivaco boutta lose it i bet
Read the docstring attached to the class itself
Other than that it's pretty much ready to use
Other than crap like firewalls and port forwarding
Can someone help me? What am I doing wrong 
https://i.imgur.com/JqLhapf.png
I wanted to get the voting information, but for some reason only the ready runs, and every time I try to test the vote event, nothing comes of it.
make sure to press "save" on the bot page settings before testing it
guys over here what is the webhook_path means and how to get it??
meowwww
everythings going over my head since my short test is tomorrow
help
!
Nyan.
It's a route that comes after domain or ip:port in the webhook URL
yeah, just any address that points to your server
discord server or like wifi server?
(ik im talking like noob cause i've got exam tomorrow...sorry for that)
but im addicted to programming....
lol
sa
another qustion....what will be the webhookAuth?
efendiler botu niye olnine değil bi arkın sunucu dizicemde
why not the masters bot, but an arc in my server array
meooww
?
pleas bro help
same here
means?
can som1 give me example for how can i call the api in webpage
so when does it open
A password of your choice
kk
has anyone before done this thng in discord.py???
can i use this https://Zeta-Z.xcelsiorbusines.repl.co as my webhook?
thnx
can i use a discord webhook also??? channel specific?
if u r bored....obscure then can u answer my q?
No, you have to use a webserver and handle requests whichever way you want
Wrong channel
where do i ask it then?
cut & paste mode on
I can't setup webhook. I have VPS host with ssh port 22 (I don't have any other ports!). What I need to write it top.gg webhook url? What I need to write to connect it in code? I use dblpy library, python.
only?
Yes
No
Yeah
Oh not, thats not working.
It top.gg I write http://myip/dblwebhook it webhook url. It's not working.
And in code webhook_path='/dblwebhook'
you need the port aswell.
Thats the same thing that computer. But remote and works everytime) Vitrual Private Server
http://myip:port/dblwebhook
It doesn't meter that i have ssh port 22?
not ssh port, the port of the receiver.
and what to do if i don't have any vps?
You don't use port 22 for your webhook
@rare flame Which VPS
depends on where you are hosting @tawdry bone
Name of VPS?
Yeah
with /dblwebhook
GalaxyGate
Aaaa my brain
There should be a panel something related to firewall or port, no?
Can you please pin a tutorial vid so no one can get their brain rekt lol
Why it's not working? http://myip:22/dblwebhook
in .py
Just a opinion
Ya
That will not work because you need a TCP port not SSH.
the community demands a video!!!!!
I don't have TCP port!! It's the only port I have!!
Idk his username aaa
That's what am saying dear, There should be a panel for ports related. Search your VPS Settings, Explore it.
You can use any port on galaxygate
ooh
i did this
Ok
is it correct?
I will try
does that means, all the ports are opened?
Oh tell me the repl webhook url
Now
Or I'll slap u
Tell me the template
Yeah galaxygate doesn't restrict any ports by default
Not urs
That's simple then, Use 5000 default port both in the script and website. It'll work @rare flame
Ok
I actually did everything that the people said and even now I can't access the vote id
Oof
LOL
YA
TRUE
@tawdry bone REGEN UR TOKEN
LOL
kk
Also
Delete that pic
@tawdry bone don't set the port in the URL in webhook settings on the website
repl.it will reverse proxy requests from port 443 (default for HTTPS) to 8080
kk
So you just use the link but host the webhook on port 8080
can u like simplify?
rofl
someone kill me pls
Wait I have SSH and VNC ports in my VPS.
Is VNC normal?
Galaxygate gives you all ports
bruh, just do what I wrote above. Don't touch anything, Just use any port.
From 0 to 25565 or whatever
Really?
I swear to fucking God
webhook_port=8080
On the website:
https://xx-xxx.repl.co/dblwebhook

@jaunty plank Where can I see that ips?
just type whree?
In your code
set webhook_port to 8080
Then, when ENTERING your repl.co URL on the WEBSITE
You don't set the port to 8080 in the URL
okay?
No...
bruh
My brain - 
webhook_path is literally supposed to be /dblwebhook
?
what IPS
Just edit your already existing one?
f my brain
F
Oh, ports. Not ips
My brain hurts
The thing AFTER your DOMAIN
PATH NOT PORT IG
O
My Lovely Bruh, You can use any port since none of them is blocked by your firewall.
Do one thing, Use 5000 PORT in the script and your website both. It'll work out, Okay?
Remove anything that isn't /dblwebhook in your webhook_path kwarg
As in
Literally
kk
webhook_path="/dblwebhook"
Shivaco is damn ded
Wait, VPS don't block some ips???
so is this okay?
Nice
There we fucking go
Oof
They do, But yours doesn't
tis also okay??? np right?
Ok, I gona try it
Idk about that one
Ahh.. the good old 404
YES!!!! IT WORKS! 🎉🎉
Oof
Congrats firecracker
Sofia please help, my braincells and nerves are about to give up
Ok hoister is having a hard time
It's ded.. simple words
the best frnd of a progamer
Are you loading your cog
data is returning like dict?
yeah
ok
Yes
Ig that webhook URL is not correct ig
It's correct
O
Trying to blindly guess when helping someone who's shit out of clue doesn't help
you know
Ngl it will relief u guys
Typically in the developer world documentation is enough.
I'm really surprised people struggle with this
ehh
But people here says its ancient old
The docs are up to date afaik
Oh
i gtg....sorry.....thanks for ur time.....
maybe help me tomorrow
i need to study now
bye
Cya
O
But yes, use the sdk package for node.js
O
The rest hasn't changed significantly enough at least
O
Possibly something changed ✨
Btw thank you for spending time lol I can feel ur pain so get rest
please I will pay 2$ (paypal) if someone explains me how to put guild count, webhook with Python on my top.gg bot page

where's my 2$ now
wait 10 minutes >~<
okie
see
top.gg page has this
but
from discord.ext import commands
import dbl
class TopGG(commands.Cog):
"""
This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
but in my code have this
Does it print anything?
(Top.gg)from discord.ext import commands (my code) from discord.ext import commands as command
Do you load the file as an extension?
Client = discord.Client()
def setup(client):
bot.add_cog(TopGG(client))
I dont know if I have to put
wai I will put it
fuck
wait
import discord
from discord.ext import commands as command
from discord.ext import tasks
import dbl
Client = discord.Client()
url = "https://top.gg/api/bots/761359894791192596/stats"
data = {'server_count': '15'}
headers = {'authorization':'bot token'}
r = requests.post(url, headers=headers, data=json.dumps(data))
print (r)
class TopGG(command.Cog):
"""
This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
"""
def __init__(self, Client):
self.bot = Client
self.token = 'bot token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
def setup(client):
bot.add_cog(TopGG(client))
What does that tell me
import discord
from discord.ext import commands as command
from discord.ext import tasks
import dbl
imports xd
then
Client = discord.Client()
init discord client
url = "https://top.gg/api/bots/761359894791192596/stats"
data = {'server_count': '15'}
headers = {'authorization':'bot token'}
r = requests.post(url, headers=headers, data=json.dumps(data))
print (r)
test?? try to use this code to put manual like
class TopGG(command.Cog):
"""
This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
"""
def __init__(self, Client):
self.bot = Client
self.token = 'bot token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
def setup(client):
bot.add_cog(TopGG(client))
and I have made this up, because I dont use cogs to programing my discord bot
And?
my code be like
client = commands.Bot(command_prefix='//', intents=intents)
prefix = "//"
Client = discord.Client()
@client.event
async def on_member_join(user):
bla bla bla
@client.event
async def on_ready():
@client.command()
async def lang(ctx, lang=None):
@client.command(aliases=['helpme'])
async def help(ctx):
guild_id = ctx.author.guild.id
@client.command(aliases=['8ball'])
async def _8ball(ctx, *, question = None):
client.run('dasdasdadas')
I'll just rewrite the examples not to use the fucking cogs 😔
Just
Do something like Client.dblpy = dbl.DBLClient(...)
mi code:
token = 'fcking cogs'
Client.dblpy = dbl.DBLClient(Client, token, autopost=True)
hmm
If it is not.. ur below 13
it works for u?

Lol
Lol
Ya
python version u use?
Just modify some things like pasting dbl token and some thing

Just paste ur dbl token
U stoopid
?
Welp
self.token = 'your dbl token'
Time to use your on_ready
Do it
It is like 1000 characters shoot
I tried many ways but when I voted bot, my console.log still doesn't show anything. Am I doing anything wrong?
maybe show the code?
const Discord = require('discord.js');
const { tl, logger, text, escapeMarkdown } = require('cat-utils/autoloader');
const client = new Discord.Client();
const DBL = require('dblapi.js');
const dbl = new DBL('eyJhb....Eff8gTBEDYA', { webhookPort: 3019, webhookAuth: 'p....k' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
I do as in docs
"Webhook running at .. "log is displayed
but user id just voted is not displayed
@willow spindle
use https://npmjs.com/@top-gg/sdk instead. dblapi.js is deprecated
also, make sure the url your using uses the actual ip, not 0.0.0.0
I think so. But when I see "Webhook running at ..." I'm not sure
thank u
okay maybe i should reuse my server's root ip
@sullen nymph sorry for ping, but If I try to post server count with java file and try to do a weird fusion?

Ya that's a problem for me too
So what is your solution? I still can't find a way to log my bot voters @crude elm
listen if you want to make a webhook you need to be sure that u have the port open,
if you have a host like vps cloud etc you need to find the firewall rules and open the port u will use.
if you are hosting the bot in your pc you need to go to your router config and open the port there.
next you need to use the public ip of the vps or your pc public ip Followed by the port you have opened
Knowing that and confirming that they already have set up their webhook simply have to be accessed by
http://yourpublicip:yourport/yourroute
if there's any more doubt ping me
if your using a platform like, heroku, glitch, repl youll also need to comply with their port rules, which you can find on their documentation.
Node.js Library has been updated
dblapi.js, now known as node-sdk or @top-gg/sdk has been remade.
Here's some info:
The new name for the npm package is @top-gg/sdk and can be installed like npm i @top-gg/sdk
https://npmjs.com/@top-gg/sdk
What changes have there been
Auto-Posting
First, one of the bigger changes, is autoposting is no longer supported directly in the package
This package now serves the purpose of creating interaction between you and the API.
If you want to autopost we suggest using this external package:
https://npmjs.com/package/topgg-autoposter (npm i topgg-autoposter)
Here's an example of usage
const AutoPoster = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client
Api#postStats() is still a method on the main package, so if you're interested in manually doing it yourself without this package, you absolutely still can!
Webhooks
Another big change is to how webhooks are presented, these, unlike auto-posting are still built into the main package.
The webhooks now act as an express middleware, and here's an example of usage:
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 121919449996460033
}) // attach the middleware
app.listen(3000) // your port```
The GitHub repo has also been changed from dblapi.js to node-sdk
https://github.com/top-gg/node-sdk Contributions are absolutely appreciated!
I'm the new maintainer for this package, and if you have any questions or concerns, feel free to DM me!

👍
Guessing since the lib was changed the docs will be updated soon?
I was waiting to suggest the new one until the docs where updated.
there are new docs in progress right now and the new library will be officially documented in that, old docs will likely not be updated
My bot seems to have 99 votes on the site, but the apide is 100
does 1 vote really matters
Yes. Because there will be 100 votes :D
probably related with cache. Try refreshing page
And I know there is a prize
what prize
First 100 votes
🤨
what endpoint are you requesting from to get your 100 vote count?
what
points
the vote rewards and whats displayed on the website is monthly points
but accept my bot 7 days ago
🤷♂️
Hi everyone,
I need some help please
the event ready for dbl connection is working but the the vote one
please ping me when you answer
Is there a way to get vote total for previous month or is that something i'd have to track on my own?
The latter
please help me 😢
ty
Can we sort the top rated ${vote.user.top} like <@${vote.user}> ?
wdym top rated?
yes
hmm
?
oh no
yeah
like this
use webhooks and store when a user votes
top.gg doesnt store the amount of votes a user has given
👍
will top-gg dotnet-sdk get an update soon (last update feb 2020, many dtos arent working anymore)? or is it deprecated?
It's probably not maintained anymore
I kinda suggest you to make your own wrapper/sdk if it doesn't work
For some reason the API isn't posting the server count on my bot's page. It works, it posts messages in the console such as what webhook it's running on. But when I check it doesn't post anything.
posting counts is not the webhook.
I mean, I have ```dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})
those are just the events for posting, and only fire after posting happens or if an error happens.
the autoposter for the dblapi lib needs these lines
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
Discord and client being the bots stuff you should already have.
Yeah I have those lines within the file already.
So errr
https://top.gg/api/docs is stuck in an endless cloudflare ddos protection loop
I dont know if this is just me or in general
it is just me nvm-
is it working now?
hey
im look at the api docs
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
how do i see my webhook porn?
*port
do i scan top.gg?
@wispy turret the port is whatever you want







