#topgg-api
1 messages · Page 122 of 1
hi are there any websites/docs about how to use the api and what i need to set up?
the test button worked... just once tho... i cant make it do it again.. is there a problem with the api or is it just me?
probably your code, unless you made more than 1 request at once
is it possible to use the API with heroku?
hey how do i test the vote func
python lib
@commands.Cog.listener()
async def on_dbl_test(data):
print(data)```
can someone tell me, if i can use the voting API by heroku?
discord.js
hello how dbl token works in my code?
i put token in config.json
{
"dbltoken": "my_token"
}
and in my index.js
const DBL = require("dblapi.js");
const config = require("./config.json");
client.dbl = new DBL(config.dbltoken);
and i try to set command
module.exports = {
name: "check",
aliases: ['check'],
run: async (client, message, dbl) => {
dbl.hasVoted(message.author.id).then(c => {
if(c) {
message.channel.send('yes voted')
} else {
message.channel.send('not yet')
}
})
}
}
why dbl is not function?
is possible if i used second bot to test my bot in top gg?
with put top.gg token into second bot?
@uncut kelp
wait
dbl ain't a command, you can't handle it like one
thats a webhook
api has a ceiling tho
also if that is a command where is the message?
the issue is that you're handling dbl as if it were a command
it's not
you aren't supposed to create a command file for it
you're supposed to start it during bot startup sequence
so, how to check when people has vote with command?
i don't understand
is that issue?
because i need to test my code have error or not
no, you can't use top.gg api without the token anyway
it is supposed to be in ur code
well, not exactly in the code because that'd be a leak
the issue is how you're using top.gg api
you're creating a command file and treating it like a command
read the docs for some examples
to detect member has vote is need webhook url?
I'm using dblapi.js but I don't know how to create a webhook, can someone help me?
check the docs
how to do that?
is this right i put? @knotty garnet
read the docs
i have to read the doc, but idk is didn't works
if you follow the docs it'll work
your 👏 structure 👏 is 👏 wrong
if you don't fix the way you're handling dbl api you won't get anywhere
rank?
Rank card
heu can someone please help me
im using the python api
@commands.Cog.listener()
async def on_dbl_test(self,data):
print(data)```
when i click on the test button in topgg it doesnt print any data on my console
im tryin to execute a func when user has voted on topgg
const app = express();
const server = http.createServer(app);
let api = new top(
"token",
{ webhookPort: 5000, webhookAuth: "password", webhookServer: server },
client
);
api.webhook.on("ready", (hook) => {
console.log(`Webhook running with path ${hook.path}, http://${hook.hostname}:${hook.port}${hook.path}`);
});
api.webhook.on("vote", (vote) => {
console.log(`User with ID ${vote.user} just voted!`);
});
server.listen(5000, () => {
console.log("Listening");
});```
Listening```
The vote event is not working, what should I do?
the webhook url from website is pointed to http://urdomain/dblwebhook?
What if you don't have a domain?
0.0.0.0 is local host.. that means point it to where the code is running
you mean 127.0.0.1
no its not
or localhost
then its urappname.hosting/dblwebhook i believe
How can I change the hostname
Can any one tell how to add server count in bot dashboard
0.0.0.0 is a placeholder @civic crow
just means that it’s listening on all IP addresses
post your count to the top.gg api
Tell me in dm
hold on a sec
Ok
got it
Tell
Send me ss where
with data in json format like this
{
"server_count": 69 // your server count
}
you know what a post request is?
No
@hot axle you tell me please
It's on my host
oh k
um
make sure you can make requests to the server
add something like a test route that responds with anything
and check if you can access it
What do you mean?
no prob
Idk why but I set this for webhook and I don't get any response with test button
can someone tell me, if i can use the voting API by heroku?
Do you know how to do it? which link do I have to put on the webhook
Why I don't get any respond in my webhook?
I think so, Flask (python) has it
Ok now I get it working, But in test Authorization is None 🤔 , To be exact nothing is sent 🤦
Even I voted and nothing is sent by webhook it is completely empty
the example code is not working :[
<@&304313580025544704> ??
@rough crater here
<@&304313580025544704>
bruh
thanks :)
-atmods @stiff breach @golden scroll
@stiff breach @golden scroll
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
it was an emergency
no it was not
he tried to raid
no, they didnt. dont ping the mod role for something like that
P!PLAY go the kid laroi
x)
also
you know how python api is working?
i dont have any responses in events
my program is listening on the port 5000 (tcp)
but nothing appears
I guess find why 🙂 @stiff breach
tell me
I looked in the source and find out if you press test button it calls on_dbl_test instead of on_dbl_vote
@commands.Cog.listener()
async def on_dbl_test(self, data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:")
That was my problem lol
:(
Did you set the link in webhooks?
self.dblpy = dbl.DBLClient(self.bot,
self.token,
webhook_path="/dblwebhook",
webhook_auth='mypasswd',
webhook_port=5000)```
What is your hosting?
??
Where are you hosting the bot?
There should be IP to be called
I use a private hosting too so I know what you are saying
😐
Not the 127.0.0.1 one
Found the IP and Port which is open and set it in the webhooks page
For example you have 123.123.123.123 as ip and 25564 as port
then first set port in your code to 25564 and then the endpoint url in webhooks page to http://123.123.123.123:25564/dblwebhook
The auth field is also need to match with your auth in code
thanks
im going to try
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
the is literally my program which is using the port
or that
future: <Task finished coro=<DBLClient._webhook() done, defined at /usr/local/lib/python3.7/dist-packages/dbl/client.py:436> exception=ValueError('path should be started with / or be empty')>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 453, in _webhook
app.router.add_post(self.webhook_path, vote_handler)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1167, in add_post
return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1094, in add_route
resource = self.add_resource(path, name=name)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1071, in add_resource
raise ValueError("path should be started with / or be empty")
ValueError: path should be started with / or be empty
@golden scroll
If it is in use it means some other application is using that port, Do you have a flask app for example or any web related app?
Or maybe the host doesn't gave you the port
Is your host type Pterodactyl
ping it?
Btw you just need to check for ports
What is the code right now?
This line
What is this
webhook_path="http://ip:5000/dblwebhook"
Change it to just /dblwebhook
No ip and port is needed here
at=error code=H14 desc="No web processes running" method=POST path="/" host=myapp.herokuapp.com request_id=af148f57-32c1-4780-ab2e-98185607ac34 fwd="165.xx.xx.xx" dyno= connect= service= status=503 bytes= protocol=https
?
I meant this page https://top.gg/bot/bot_id/webhooks
I put this in the API webhook
http://myapp.herokuapp.com/dblwebhook
like
i dont understand
webhook url?
aaah
What is your bot Client ID?
498580306773934081
Second field
self.dblpy = dbl.DBLClient(self.bot,
self.token,
webhook_path="/dblwebhook",
webhook_auth='p',
webhook_port=5000)```
Exactly what you have in second field
If auth is the p in the second field you should get a response
p = password
its other password
wtf
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
but
few seconds
=
5 seconds
69 seconds
but i think
Don't you have a second port?
that the real error
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
I guess you are using that port for https://yasuho.xyz
Hi
They do
it's all get request on my side for a week
both for server and bot upvotes
and that makes it return 405
I asked this a week ago too but no one really responded
please help
It's always POST
Any other requests to that endpoint can be ignored
but top.gg is making me get requests
I waited for a week
if it was something temporary
and apparently it's only me who is experiencing this
the server counter appears immediately after configuration. Do I have to wait?
Could I used a discord webhook to get when someone votes?
So what could I use?
you can use a server that receives the request
and forms the payload to send to the discord webhook
Could I use local host?
unless you wanna keep your pc running 24/7, nope
I have a VPS
Can I ask about dblpy here?
@tasks.loop(minutes=30.0)
async def update_stats(self):
try:
await self.dblpy.post_guild_count(shard_count=2)
await self.dblpy.post_guild_count()
except Exception as e:
await self.bot.get_channel(self.logs_channel_id).send('||<@&789112955501412377>|| Failed to post server count\n{}: {}'.format(type(e).__name__, e))
I keep getting 401 Unautorized access.
your token is most lkely wrong maybe
if you are using a development bot (not the same id as the top.gg bot), you wouldn't be authorized to it @restive otter
other issue may be the token being wrong
a
b?
@rain heart Hey, i just wanted to know what authorization link it is asking for like that of a bot or...
is it req.headers.user for the user id for the webhook? 
I voted and the user was undefined
oh I guess it wouldn't be passed as a header
now that I think about it

is req.body.user
Hi
Hi
sa
Not the channel to chat in. Read the channel topic. Thanks
I guess it's a bug, today is not Saturday or Sunday but it gives 2 votes
(api gives)
My bots kısmından.
webhook password nedir orası boşmu kalcak
foto atsana
sitede webhookla kanalda vote verenleri duyurma diye bişe var
orda password diyorda
bundan bahsediyom
Vote duyurcaksan botunun Edit sayfasına gel ve en aşagıda Webhook ile ilgil 2 şey var
İkincisi şifre yani webhookAuth
hee onu benmi seçiyom
Evet
eyw reisler
IP kısmınada bot ipsini
yada bot urlsi
örn:
0.0.0.0:PORT(3000 gibi)
Yada site.com
Sor
sen bu kdr şeyi biliyonda bot developer olmamana şaşdım yan hesabınmı bu
Bu kanalda zaten gereken yada api bilgileri sitede var
Hello
Bu arada bence @top-gg/sdk yi kullan
dblapi.js artık güncellenmiyor
hmm
Pinlerde nasıl kullanılcağı yazıyor
komutlarda vote isteğini nasıl yapcam onu anlamadım
tam bilmiyorum aynı mı değil mi eski dblapi.js ile
blm
dbl.hasVoted("95579865788456960").then(voted => {
if (voted) console.log("Tonkku has voted!!!")
});
Eğer aynısa buna benzer bişey olması lazım
id kısmına da böle mesaj sahibi geliyor
if voted dan sonrada komutun
glitch
glitchen bence hostlama ama genede yardım etcem
başka yerlerde var
knk ben burda komut sınırına geldim orda o sınır varmı ordada
komut sınırı 
var ztn
94 komut 
çoğu gifli komik komutlar
@restive otter @true owl Keep this channel English only
Use #general-int for discussions
#support for support requests
i need subtitles
dont ask to ask
sucks to suck
What do you use(discord.js, discord.py etc)

I'm using the dblpy library and i keep getting this error
Command raised an exception: TypeError: object Lock can't be used in 'await' expression
Downgrade to Python versions below 3.9
Hell
o
i have a problem
my webhook is now working
but server count is not work

@stiff breach do you have member intents on for your application and also installed into your code?
yes
Then idk... i have the same problem but i feel like it will come later on
top.gg api in python x)
yesterday my server counting was working
but not the webhook
and today
my server count is not working
but the webhooks are working
Same, i use python
I would try to help if I knew python
hey so im using python lib and the test func aint workin
it doesnt print anythin on console
but now when i click on test on browser i get this error
@signal hawk
i dont know the api and i dont know python
please dont ping people for help
wait for someone who knows to help you
Hi, so i am using the structure as shown on the java script library but when someone votes for my bot it does not log it.
do you have the webhook setup?
@median river Are you using new one or dblapi.js?
dblapi.js
use @top-gg/sdk
thats new library
it is a library ...
for js
^
Oh so change it instead of dblapi.js to @waxen widget-gg/sdk?
O ok thanks
please help I still face the same issue why no one is trying to help me out??????
why is top.gg making get requests instead of post ^ above sent using Test Webhook button
it makes get request and returns 405
uh it must be your code, considering a 405 request means method not accepted.
@restive otter
const DBL = require("dblapi.js");
const dbl = new DBL('mope', client);
dbl.on('posted', () => {
console.log('...!');
})
dbl.on('error', e => {
console.log(`Error ${e}`);
})
can i fix this with this command
??
dbl.postStats()
ok
wdym by connecting your website?
In which channel dank memer is there?
i dont think dank memer is in this server.
not #topgg-api
whats the code for python to make my bot status show online instead of N/A?
use top.gg api
@copper tundra
oh i thought the guy above said there is just code i can add
the code is inside of this link
ok. how do i install dbl
python? or nodejs?
py
yup so fck bugged xd
yea
pip install dblpy
yeh
sec
Them I have this, works
class TopGG(command.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'bot 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
async def on_guild_post():
print("Server count posted successfully")
client.add_cog(TopGG(client))
done
I am bad at py, dont ask me.
done
Go here
on bots...
my bots
Them I have this, works
class TopGG(command.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'HERREEE' # 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
async def on_guild_post():
print("Server count posted successfully")
client.add_cog(TopGG(client))
xd
what do i put for the webhook path and auth
webhooks its appart
I mean I only use server count
and this code only post ur server cont
ok, how would i do that webhook part. I want everything lol
I don use webhook, I think just use top.gg api code for webhook
u ask about N/A
I just show u
how to change it... not webhook

i found the Webhook_auth
now im trying to figure out the dblwebhook part
yea i got an error
I repeat.... I use this to post sever cont on my bot top.gg page...
and works I dont know more
i want both
hmmm ok just try to mixed both
read the docs I dont know :((
what would be the simplest way for my bot to request an array of all userids who voted in the last 12 hrs?
the bots/id/votes endpoint will get the last 1000 votes, youd have to figure out from there.
other endpoints might be able to have that data.
https://top.gg/api/docs#bots
alright thanks
i came up with a different solution since that didnt seem as feasible
How can I create an embed and give the member who upvoted my server a role?
How would I make it post my bots server count with discord.js ?
i have the token and everything
nvm
its cool
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 457, in _webhook
await self._webserver.start()
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_runner.py", line 104, in start
reuse_port=self._reuse_port)
File "/usr/lib/python3.7/asyncio/base_events.py", line 1378, in create_server
% (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
Hey, how to hide this error
that’s not something you should hide?
to fix it you should stop binding to the same port
I clicked on this channel because I was interesed
but now I only see top tier super cyber hacking shit
bro it’s coding
Matthew you know what I am gonna say again
the problem is that i did not bind to the same port
:|
what?
weird, could be something in the lib
Is it possible to use dblapi npm to get server voting information?
Like whenever someone will vote for the server, it'll get triggered?
The library doesn't run the listener twice at any point
it's just "vote.id" :)
hey so im using python lib and the test func aint workin
it doesnt print anythin on console
but now when i click on test on browser i get this error
can someone pls help me with this
have been askin for 2-3 days now
@tribal sky what are you hosting your bot on
make sure your router isn't blocking the port you've set
cuz im setting up voting rewards
what port shud i be setting?
I don't know, it depends on your router config
in general, all ports are blocked except the ones used for incoming and outgoing traffic
so port 3000, the default, will probably be blocked
hmm
well how do i find the right port no
welp ok
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 = 'eyJhbE' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",wehook_auth = "xjgl") # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully to topgg")
@commands.Cog.listener()
async def on_dbl_test(self,data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))```
alr so this is my code
and iit doesnt print data when i test the webhook
and there are no errors
can someone pls help me
Hello, I'm trying to send a message by a webhook when someone vote for my bot, but I don't understand what is "Authorization" field... Can someone help me please ? Thank you in advance
||mention me if you can help me||
@viral ermine it's like a password you can use to verify that requests are coming from top.gg
can be pretty much anything as long as its secure
ok thank you, but it's automatic ?
i think you can set the authorization on the dbl libraries so yes
Hi, Does anyone know how to connect the top.gg site to discord so the bot can count if you vote for the bot there and thus give rewards etc? (in python)
guys i use discord.js and quick.db and i would like to check if user has voted in the last 12 hours to give him an item
how can i do that using the api?
ideally, youd use the vote webhook and track it yourself with your database, but there's also a hasVoted endpoint
https://topggjs.readthedocs.io/en/latest/Api.html#Api+hasVoted
https://topggjs.readthedocs.io/en/latest/Webhook.html
i'll check thanks!
can i replace the hasVoted id thing with like message.author you think?
users objects in djs have the .id property
ok
What about using this is python? @jaunty plank
I dont know the python lib, however the docs for the py lib are really decent from the looks, lemme find them for you
Thanks
How does a bot get approved?
submit it here https://top.gg/bot/new
then wait a week+ for a reviewer to review the bot.
#502193464054644737
or what r the requiments
@jaunty plank i tried the thing you gave me but it doesn't work...
i just wanna check if user voted then execute something
what did you try?
and if not then else
if(api.hasVoted(message.author)) {
message.reply("vote")
} else {
message.reply("didn't vote")
}```
i'm new to code
i don't even know if this is normal
or if it works
you need to use the id, not the author
replace message.author by message.author.id?
yeah
@jaunty plank Im wondering if your bot should be completley operational before submitting it to top.gg
that's what i did actually
in terms of verification
this is a public listing service, if you dont think the bot is in a completely functional state you shouldnt release it
i think...
mine was but i didn't put all the commands i wanted in it
but all of them were working
the bot i intend to release will have pvp and trading and such however will lack adventuring
sick
you can list bots before they are "finished" its just not really reccomended, since your bot could end up joining thousands of servers in a few days from release
moderation, economy and memes
sounds fun
all-in-one i would call it
mines about anime chaarcters
same lol
lol nice
wanna dm i wanna try your bot
@jaunty plank still doesn't work i added .id
whats the error/problem?
it just doesn't care and send vote anyway
if(api.hasVoted(message.author.id)) {
message.reply("vote")
} else {
message.reply("didn't vote")
}```
my code
if voted supposed to send vote
and if not then didn't vote
and this is in a command?
yes
Hi
How do I send a DM message when someone votes
Using @ top-gg / sdk
const user = client.users.get(req.vote.user); // This will get the User Object from the Client#users Collection
if(user) { // This checks if the Bot knows who the User is.
user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
}
I tried this not working
const user = client.users.fetch(req.vote.user); // This will get the User Object from the Client#users Collection
if(user) { // This checks if the Bot knows who the User is.
user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
}
like this ?
TypeError: user.send is not a function
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
no async ?
@rapid kettle
@pine heart
make it async then ??
async (req, res)
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 = 'eyJhbE' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",webhook_auth = "xjgl") # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully to topgg")
@commands.Cog.listener()
async def on_dbl_test(self,data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))```
alr so this is my code
and iit doesnt print data when i test the webhook
and there are no errors
can someone pls help me
What URL and Authorization field value did you set on the website
Hey does the python lib work on 3.9?
Nah
How can I test a vote ?
How many people are here
Where are u from
UK
Ur a girl or boy
why does it matter?
girl
Christmas is coming I am soo excited
Same 
But in our country we don't celebrate Christmas
I mean some of the people celebrate it not all
Oh ok
Can u saythat does general means its my first time here and I am a quite dumb
Anyone here
How can I test the votes ? Because I dont want to wait for 12hours every time
hmm idk
@bot.event
async def on_dbl_vote(data):
c.execute(f'''INSERT INTO vote VALUES ('{data.user}', NULL)''')
user_result = bot.fetch_user(data.user)
embed = discord.Embed(description = 'Vote', color = 0x00ff99)
embed.add_field(name = f'User has voted and recieved a reward!', value = '[Vote Discord Empire at top.gg](myboturl)')
embed.set_author(name = user_result, icon_url = user_result.avatar_url)
channel = await bot.fetch_channel(790163457358037012)
webhook.send(embed=embed, username = bot.user.name, avatar_url = bot.user.avatar_url)```I made this code now
How can I test it ?
The webhook is saved in my bots code
what do you mean then ?
https://discordapp.com/api/webhookssecretnumbersinhere do you mean this link ?
I mean to where dbl will post to when some one votes
What do I have to setup to authorization ?
I think u have to run a webserver ur self
ah
Well i mean i use js
So i am saying it the way i did
So maybe there is a other way
Lile using flask to create a webserver
Okay the whole code does not work
hey, I'm trying to set up voting rewards for when my bot (hopefully) gets accepted, and I just have a quick question:
I have this code:
client.events.get('vote').execute(vote.user, client)
console.log(`User with ID ${vote.user} just voted!`);
});```
And I just want to make sure that vote.user returns the voter ID (I assume it does, since the console.log mentions and ID, and that's copy pasted from the documentation)
(feel free to ping me when you reply)
@main prairie it does.
👌 ty
How can I setup webhook to discord?
what programming language?
you have to set up an endpoint
how do i setup a webhook for votes?
woah lmfao
Okay so
@restive otter you need to point the URL to your webserver and not use Discord webhooks
Most official top.gg libraries support webhooks
If yours doesn't because you're special, then you can set up a webserver yourself cia whatever framework there is for your programming language



discord.js
aight
dblapi.js was deprecated or something i think
Yeah
How do I make a discord webhook to use in my bot when someone votes, example: https://discord.com/api/webhooks/.....
you dont use a discord webhook
How do I create a webhook so when a person votes for bot it appears on discord?
You can use one of the libraries listed on the docs(the javascript one is deprecated, use the bottom link if on js)
https://top.gg/api/docs
Or make your own webhook receiver
dbl.on('vote', vote => {
client.channels.cache.get(id).send(msg)
});
Can I do something like this, I don't wanna use webhooks
there no vote event on dbl
it is dbl.webhook
also dblapi.js is deprecated. Use https://npmjs.com/@top-gg/sdk instead
how do i set the lib for my wiget
^ answered in support
In my widget it does not show the number of servers, how can I solve it?
Hey i need help setting up the webhooks for voting data
python
sorry, can't help you there.
first question is do i have just to enter my server ip?
http://serverIP:webhookPort/webhookPath
anyone can help me? i am trying to use the dblapi.js to add to the user money and send to a specific channel a message, but when i test, nothing happens
https://top.gg/api/docs#mybots @restive otter
This doesn't seem to be working - no error, just nothing....
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')
app.post('/dblwebhook', webhook.middleware(), (req,res) => {
console.log(req.vote.user)
})```
I'm guessing that it's because I don't link the package with my bot - how do I do that? I'm following the examples on https://www.npmjs.com/package/@top-gg/sdk
populate a list of voters ID as they vote in ur db and in the command
if ctx.author.id not in TheListUcrated:
return
you dont need to ping
i still dont understand this tho
i think its automatically updated. i didn't do a thing its automatic for me
Ok
give it sometime
can u log a webhook ready?
Wow thank you! But iam still disnt understand :(
Is there any youtuber that explain this api
what package am i meant to use?
js for node js
dblapi.js if u are using nodejs
its the easiest in the docs tbh.. for me.. and im a python programmer 🤷♂️

yeah it's funny but that works
@slow dust they released a new one
they did?? where?
why isn't it on the docs then.. anyways I'll take a look later.. kinda in the middle of something.. thanks @dapper copper
the docs are being rewritten currently
@dapper copper ^^
What site??
like your bots website
ah
then use this
This doesn't seem to be working - no error, just nothing....
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')
app.post('/dblwebhook', webhook.middleware(), (req,res) => {
console.log(req.vote.user)
})```
I'm guessing that it's because I don't link the package with my bot - how do I do that? I'm following the examples on https://www.npmjs.com/package/@top-gg/sdk
you need to fill in this on your bots edit page.
https://camo.githubusercontent.com/de589c73a4a72f855b595407134d890551d32b77fdd17b28409815b0c656ee2e/68747470733a2f2f692e696d6775722e636f6d2f77466c703448672e706e67
with the relevant info
i have
where are you hosting this code?
on a host
theres several types of hosts, the next troubleshooting steps depends on what it is.
well, I have the server IP, then the port all sorted
but if you need to know, I use a host that uses Pterodactyl Software
well, youll probably want to talk to your host then about hosting a web service
as pterodactyl is for game services, not bots or web services(like webhooks)
@rugged patio its not a discord webhook
hello, why this didn't works?
// index.js
const DBL = require("dblapi.js");
const config = require("./config.json");
client.dbl = new DBL(config.dbl_token);
// vote.js
module.exports = {
name: "rewards",
aliases: ['reward'],
run: async (client, message) => {
if (client.dbl.hasVoted(message.author.id)) {
// give poin
} else {
return
}
}
}
so after i install it, i need to change
const DBL = require("@top-gg/sdk")
yea
Yea
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')
app.post('/dblwebhook', webhook.middleware(), (req,res) => {
console.log('We have arrived.')
console.log(req.vote.user)
})
app.listen(<port number>, () => {
console.log('Listening');
});```
Why doesn't it work? I don't get any errors, the webhook just isn't triggered.

i have install top-gg/sdk
i need to install topgg-autoposter too?
Old one is not maintained so you can only use autoposter
@top-gg/sdk is for the API and is maintained
topgg-autoposter isn't needed if you don't want a package to automatically post your server count
why didn't works in my code
i put in command
const config = require('@root/config')
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api(config.dbl_token)
module.exports = {
name: "check",
aliases: ['check'],
run: async (client, message) => {
if (api.hasVoted(message.author.id)) {
message.channel.send('voted')
} else {
message.channel.send('not yet')
}
still didn't works
why are you defining api as global property
no, i have change it. and try new command code below
can someone tell me how to use the dbl event listeners like on_dbl_vote in python? I tried a lot but they dont seem to work
hey, I'm getting an "unsupported client" error when I try to use the top.gg autoposter... This is my code:
const ap = AutoPoster(topggtoken, client)```
"client" is actually my bot client, it's not a different name and topggtoken is the token pulled from another file
the only thing is my client has extra stuff, like client.command properties, could they be causing the issue?
please ping when you reply 🙂
how this works?
i really don't understand
what is the dbl api package name ?
for which language @restive otter
discord.js
.... that’s a library. it’s @top-gg/sdk
MY BOT NOT SHOWING HOW MANY SERVER IT ADDED ON
My bot uses shards, but with the "posted" event it just puts the server count from shard 0, how do I make the bot put the count of all servers?
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 = 'eyJhbE' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",webhook_auth = "xjgl") # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully to topgg")
@commands.Cog.listener()
async def on_dbl_test(self,data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))```
alr so this is my code
and iit doesnt print data when i test the webhook
and there are no errors
can someone pls help me
Wud really appreciate if someone cud explain why this happens
Also someone had told me before that it's due to my router cuz it blocks the port so what port shud I give if I'm hosting it on a vps
No i just removed the credentials
ahhh ok
how can i get this?
Anyone can help me? I use shard in my bot and I want to use webhook, but I am receiving the EADDRINUSE error.
ip of your host
by providing the correct server count
Cock.js
what do I have to enter? @hot axle
I have but I don't know which server address
Oh whatever :/
@main prairie hey are you still having issues?
yeah @hearty lintel , but I've now ran into something else I need to solve 1st lol... if you know the issue I wouldn't mind some help tho
is it to do with the autoposter or sdk?
the autoposter says it the client is unsupported
can you post your client defining code?
sure gimme a sec
The api works on python 3.9 right
client.once('ready', () => {
console.log('Index.js is ready!');
client.user.setActivity(`${prefix}help | ${prefix}invite`, {type: 'PLAYING'})
const AutoPoster = require('topgg-autoposter')
AutoPoster(topggtoken, client)
});```
There's a client.login further down in the code as well, that part all works fine
where are you requiring discord.js?
oh a couple of lines above
iirc 0.4.1 will support 3.9
show that please
👌
What’s iirc
const Discord = require('discord.js');
const { prefix, token, qazwsxID, topggtoken } = require('./index.json');
const Sequelize = require('sequelize');```
Hi, i have a question, ¿The webhook is a richpresence or a integration in my discord server?
if i remember correctly
that's just above the const client = ... part
the only thing I've edited out is all the DB defining (I know it's poorly done, but I really can't see how it'll affect the client bearing in mind it's not mentionned in that part)
yeah its fine im lookin into what could be causing the issue
if you take it out the ready event does it fix it?
no, that's how it was at 1st, and I thought maybe putting it in would work (actually wait for the client to be ready)
what's weird is it worked fine yesterday, and I added the vote reward code (didn't modify the autoposter part at all), and it all stopped working... and now even without the vote part it still doesn't work
could adding properties to the client change anything? I have a client.commands property for dynamic command handling
no it definitely shouldn't
we work with the cached instance of discord.js to see if your client is an instance of it
im testing it right now
np
hm
what version of the package are you on?
and/or try and install the latest and see what happens
alright one moment
if you find anything can you ping me please, I'm going back to sorting some other stuff out



