#topgg-api
1 messages · Page 88 of 1
Replace username with points?
@lucid mesa it seems it hasn't been approved, I don't see it in this server.
probably kicked if it has been approved
it was approved by @open garden but when I DMed them they said they did add them
so it was kicked ?
right sorry, will be more careful next time
@restive otter where?
So DBL accepts a client as a parameter - I don't imagine passing the ShardingManager will work? Eg.
https://gyazo.com/b3c9c0ee592f1c9a665ce308df3f9c87
@restive otter Remove that token picture asap
@restive otter Are you sharding yet or?
If not sharding and using DJS12, change client.channels to client.channels.cache
The answer isnt this
I don't know how to use dbl.webhook someone to help me?
I have changed
https://discordbots.org/api/docs @tame bison here you go
I've already been there and I don't understand it.
@restive otter Have you supplied your URL in your DBL bot options on the site
The moderator told me to do this, MY IP:3000/dblwebhook
@tame bison if someone will vote your bot its (logging or whatever you set) on vote event, and ready event is notifying to dblwebhook ready. (Sorry for bad grammer)
@restive otter VPS or local machine? If local, you need to port forward 3000 to the specific machine
yes
@empty peak I have the same problem i did everything correct but not working.
(Previously)
Also, make sure you've got the protocol correct. HTTP or HTTPS
http://vpsip:8000/dblwebhook true?
VPS is different
How is everyone
VPS you'll likely use NGINX to proxy traffic to http://vpsip/dblwebhook to the proper port
-api @sterile tapir
@sterile tapir
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
For example:
location /dblwebhook/ {
proxy_pass https://127.0.0.1:3000;
}
Boss! Maybe you'll know - DBLAPI library for JS accept shardingManager?
@restive otter Çözersen banada söyler misin?
@restive otter Yakında çözücem ama bunlar sayesinde değil, kendi kendime bunlardan bir beklentim yok
🥺
@restive otter Gerçekten öyle aynı şeyleri tekrar ettiriyor sanki
@restive otter - It's not a simple copy-and-paste to setup DBL. If local machine, you'll need to:
- Port forward 3000 (or whatever port) to your local machine.
- Add
http://yourIP:3000/dblwebhooktohttps://top.gg/bot/yourBotID/edit - Use
new DBL( yourDBLToken, { webhookPort: 3000 }, bot )
Not 100% sure @empty peak
I’d wait for someone else
@gloomy fractal - Alright bro. I get no errors, but I don't know if the server count and stuff it has is just old
Again, VPS is kinda different
I use a vps
Do you have any sort of webserver like a website running on it ATM?
sad
VPS you'll likely need to configure the firewall to allow traffic through the correct port
iptables -I INPUT -p tcp --dport 3000 --syn -j ACCEPT
service iptables save
@empty peak not sure if someone answered already but no, the sharding manager is not a valid client
the only valid clients are Discord.Client and Eris.Client
Shite. That would have made thing hella easier
So instead I use new DBL( process.env.DBL_TOKEN, bot ) in every shard?
yes, it does account for shards automatically if you do that
you just cant use webhooks like that
Yeah, that's my issue
do it like this
if(client.shard.ids[0] === 0) {
new DBL(token, {webhook options}, bot)
} else {
new DBL(token, bot)
}
alternatively, you can create a webhook in your sharding manager
Might have to just to send like a thank you for voting, for example
I ended up not using the DBL library for the webhook at all because it doesn't support HTTPS
wdym it doesnt support https?
if you have https on your side, dbl should be able to send to it
DBL can send to it, but the DBL JS library on NPM only uses HTTP
ah you mean the webhook server instance?
Yeah
well traditionally node.js apps are made with an nginx layer for SSL
if you have an nginx reverse proxy with SSL, then it doesnt matter if node.js's server is http
you can also pass your own https server instance to dblapi using the webhookServer option
My NGINX redirects all http traffic to https. So all requests to http://my-site/dblwebhook were being upgraded to https://my-site/dblwebhook and then:
location /dblwebhook/ {
proxy_pass https://127.0.0.1:3000;
}
if you have SSL on nginx, dont proxy it to another SSL
thats basically doing double the work
ideally it should be internet <-HTTPS-> nginx <-HTTP-> node.js
Really? I didn't think you actually could pass to http, TBH
the only reason for going double SSL would be if your internal network is somehow public
and you need to hide the connection from other internal processes/machines
So literally just change that proxy_pass https://127.0.0.1:3000; to proxy_pass http://127.0.0.1:3000;
yup
let me check my config
yup
thats basically doing SSL on both nginx and on node
which is a waste of resources
Well God damn
THat coulda saved me some time
I've literally been doing that for years
Hmm i have the vote webhooks behind cloudflare but how do i whitelist the ports for like, only dbl
Bots love to portscan my vps and attack any open port :/
Which rn are both of my 2 ports open for webhooks from dbl voting
bots portscan all vps's
theres no hiding from them
since dbl itself is also behind cloudflare, their ips are probably also dynamic
i dont think there is a way to accurately whitelist dbl's requests, except for using the authorization header, which is why it exists in the first place
@vapid cape - Going back to this:
then use broadcastEval to send
Now, if I'd like to send the message to the person voting, broadcastingthis.users.fetch( ID ).then( user => user.send( 'Thanks!' ) )would send it to him/her 5x if I have 5 shards
yes
if(this.shard.ids[0] === 0) { this.users.fetch(id).then(user => user.send()) }
i guess its easier to just setup the webhook in shard 0 in the first place
Oh, I was just gonna manager.shards.random( ).eval( )
well, you could also do that
but if the same user votes multiple times, might as well only cache him in one shard, instead of having multiple copies on random shards lmao
Ah true
how to get the URL? pls
whats the poststats limit
autoposter is 15m minimum but I can do 60calls per minute to API, cant I just post stats every 5minutes then
Do many people use the DBL Java Library?
Yes, like i do/did
It uses both Gson and Json?
I mean you don't really get JSON out of it because it parses itself afaik
Yeah
if you have a webhook you put its url in
Thanks
now it gives Promise { <rejected> TypeError: Cannot read property 'size' of undefined
because it's client.guilds.cache on v12
no ı use 11.5.2
then it should be fine
let me see
Yeah, that should work
you're sure you aren't on v12?
Nothing happens when I click test
gimme <@&364144633451773953> <@&304313580025544704> and <@&265158261945270273> plz
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.
Begging for mod.
....
?
Woah
lmao
wow
ok
The flood into this chat 😂
mods got crazy when they got a ping
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
Can someone help me with upvote webhook
-ask2ask
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
What exactly do you not understand
Can someone help me with upvote webhook
well what doesnt work? what exactly are you not understanding
I asked for help, I didn’t say can someone help@me, my question was for@someone to help/link me to somewhere, to help me with upvoting webhook
Ask2ask headass
well now we wont help you 
I asked a simple question, lmao
Is there something wrong with how I'm using the python lib
class MyBot(commands.Bot):
def __init__(self):
self.dblpy = dbl.DBLClient(
self,
self._alt_auth[1],
autopost=True,
webhook_path='/dblwebhook',
webhook_auth='some super cool dbl password',
webhook_port=3583
)
async def on_dbl_vote(self, data):
...
Will this automatically manage the webhook too, or do I need to setup a webhook server too?
Also, it doesn't seem to be autoposting my count
is {client.guilds.cache} shown how many guild is the bot on or it shown how many member in it because i had an error saying this
@rugged trail client.guilds.cache.size
Thanks !
Would be dope if the votes endpoint also returned timestamps
might be a good idea to implement, maybe suggest it at https://github.com/DiscordBotList/issues
You could just do your own with webhooks
that also works 
You could just do your own with webhooks
@green mantle - You could, but if for whatever reason your webhook is down, even for maintenance, you don't lose any and is easy to back-track and prevent duplicates. Even webhooks should be provided with a timestamp
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
does anyone know why he is not answering?
did you setup your webhook properly?
I think so
can I send a link to the print?
yes
and your webhook options?
@vapid cape
where would that be?
and your config.webhookAuth is "top123" right?
yes
where is your bot hosted?
vps
do you have SSL enabled?
if not, change https to http
also, check if your vps requires opening ports in the firewall
some vps's like google compute engine, require you to allow the port in your admin panel
also, check if your vps requires opening ports in the firewall
@vapid cape
it's already open
well then, change it to http and try again
if it still doesnt work, test it with reqbin
Anyone know why it doesn't work
I changed few letters in between
Does it not output anything?
The bottom of the page has another example
It just says webhook running at 0.0.0:5000/dblwebhook
Hi
If my bot is sharded do I still just create the dbl object in my bot entry file? Or do I move it to my sharding manager?
@opal schooner depends on the library, in dblapi.js you can add to the entry file as long as you dont use webhooks
Okay it will count shards and sum the guild counts?
yes
dbl.webhook.on('ready', hook => {
^
TypeError: Cannot read property 'on' of undefined
I am copying the documentation
i have defined dbl with my token
-botcommands @violet field
@violet field
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
My bot is not posting server count
@misty mica - Show where you init DBL
@Muffin
ey
the api its bugged?
i think thats just glitch bugging out
when i delete the code of post server count the bot turn on
hello i have problem here
server count code working well
but vote code doesn't working
here is my code
and here is webhook settings
address and pass same
and the console
i think here is a problem

Try removing the port from the URL
and change port to 3000
ok i already removed it
Tried?
i added them
test it on reqbin.com
So the C# api does not throw an error if it couldn't be initialised. It just throws a NullReferenceError if subfunctions are referenced.
Is there a possibility to check whether it was able to correctly initialise?
null check
ok i need help getting my webhooks to work
it's setup i just need help making sure requests work and stuff ?
what am i putting as the request
When it comes to webhooks, you don't send the request to a server. Instead the other service (top.gg in this case) sends the request to your server. Basically reverse of other http requests you send.
In order to implement top.gg webhooks, you need a web server which listens for the request from top.gg (preferably authenticated with the auth string).
I have no idea what language/library you're using so can't say how exactly to implement it.
@restive otter
right yes that's what i meant
javascript. the ready event fires for the webhook and i have the vote event setup
i'm just not sure how to get the request to actually go to through to me
so i believe all i need help with is the webhook options and how to make sure i can receive them @jade shuttle
Did you deploy the code?
what
Did you deploy the web server on your vps?
You need to add the webhook in your bot's settings
yes under the Webhook options ?
yes that's the part i need help with
the URL part specifically
because i can't get it to go through
What url are you entering?
The url should be formatted like this
http://yourIP:port/endpoint/
k sec
From the example:
dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); });
This should log a url
Replace the hostname with your vps's ip
clicking test doesn't show anything
What url did you enter?
Did you save?
ye
Is your server responding properly?
wym
Can you try POSTing to your url
ye
Same payload as what you expect
Could Not Connect error code 1007
Looks like a cf error code
what's that mean
It means you can't connect to your server
Your firewall is probably blocking it
Open the port in your firewall
how do i do that uhh
dbl token is the same as the api key right?
yes
My console shows: Error: 429 Too many requests
you are being ratelimited
To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.
const dbl = new DBL(api_token, { webhookPort: 5000, webhookAuth: 'password' });
I am using Heroku, so what i have put at the webhookPort
??
Are there any plans to add more endpoints to the api in the future?
Such as an endpoint to get votes by each user this month? So bot owners can give out rewards each month to users who voted most
-api @restive otter
@restive otter
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
Ok sorry
@frank grove you could use marcos api here: https://dbl.marcorennmaus.de
View the historical performance of over 7600 bots listed on Discord Bot List (top.gg). Updates every hour.
Thanks, I'll take a look 
Any one can help me what is this
@restive otter your token has been leaked in a public github repository and regenerated
I have a little question, I don't test it myself because I haven't published my bot yet
you're not able to interact with dbls api until your bot was actually submitted and approved
Can I have two instances using the same DLB key? One from the bot's code (to auto-post bot's stats), and one from my webserver to host the votes webhook?
There is no way to setup a sandbox environment to test votes right?
Faka you can test vote webhooks, use the test button ¯\_(ツ)_/¯
@spark sphinx
http://<ip>:5000/dblwebhook
ip = my address public ip
right?
http://<ip>:5000/dblwebhook
ip = my address public ip
right?
because mine is not working
and I don't know what to do anymore
read the docs, thats the only thing i can tell you rn
I've read the documents, that's why I'm here in need of help
http://<ip>:5000/dblwebhook
ip = my address public ip
right?
@viral solar - Make sure you've port-forwarded 5000 to that machine
n!yardım
@misty lantern
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
my bot is in i think 15 servers and on top.gg says N/A do i have to do something for it to correctly display?
To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.
what is the api link to see the amount of servers my bot is in?
read the message
yea sorry i put the wrong question. My bot is in like 30+ servers and the API says 1 server.
And i have no idea why that could be
a dumb question regarding the dblapi.js lib, does it support sharding? cuz postStatus uses this.client.guilds and that only contains the list of guilds for the current shard, i think
No it wont add up every guild on every shard all it seems to do is add the shard count

d.js v12 uses internal sharding by default which means client.guilds.cache contains all the guilds from all shards
and it detects external sharding too, posting the shard id as well causing the total calculation to be handled on our side
oo nice one, thanks
d.js v12 uses internal sharding by default which means client.guilds.cache contains all the guilds from all shards
@arctic arch - I'm sure that's not true
it is, or at least was
client.guilds.cache will contain the cached guilds of that shard
and all guilds get cached on startup unless you're doing something horribly wrong
That's correct, they do. But bot.guilds.cache will only contain the guilds on that shard, not all shards
I just tested it
I suggest you read up on the new sharding then
Unless you're talking about a change on master that I'm not aware of
obviously if you're still using the old sharding manager its the old external sharding which my second message addresses
I'm using V12
Bot currently in nearly 300 guilds. I force it onto 2 shards:
bot.guilds.cache.size -> 143 - Shard 0
bot.guilds.cache.size -> 155 - Shard 1
If it contained all of them, get( ) would likely have to be async
Hell, even here clearly shows that: https://discordjs.guide/sharding/#putting-them-together
Otherwise, client.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'') would return 4x the correct value if you had 4 shards...
And it would entirely defeat the purpose of sharding
you're still talking about the traditional sharding manager...
The sharding manager in V12
and it detects external sharding too, posting the shard id as well causing the total calculation to be handled on our side
there are two methods of sharding in v12
the internal sharding does not use broadcastEval or fetchClientValues
How do you specify the internal sharding? I've not seen it
So shards: 'auto', you mean?
if that is what you wish
Seriously - so V12 allows you to get rid of all the...
const manager = new ShardingManager( ... );
```...shit?
yes
there are advantages and disadvantages to both methods, but yes
traditional sharding lets you make use of multiple cpus
internal sharding uses a single cpu
but internal sharding is much easier to use, and uses less memory
I wonder if they'll ever internally account for that
only if they make it shard across worker processes
i think some custom frameworks and sharders do that
if they kept the cache in one place and then communicated with eachother behind the scenes
or would that be a bad idea
but basically worker shards with all the work invisibly done behind the scenes
depends
if you want to handle events on the main process, and have the workers receive data from discord, then you'll have a lot of data going through ipc
it should work, but not sure about performance
also stuff like voice would be very hard to make it work like that
Have you tried ctrl + F5 on the bot's page?
Maybe it's the cache that's not showing live numbers
k
Then idk, see if someone here use the dbl python lib
hey! i get a 401 Unauthorized then getting https://top.gg/api/users/USERID with my bot, but, then i run the exact url in my browser, it works... what's going on?
because you are logged in in your browser
your bot needs an authentication key in order to access the API
because you are logged in in your browser
your bot needs an authentication key in order to access the API
@rocky bough no, i tried with reqbin and in tor, still working
and it doesn't says that you need apikey in the docs
you do
are you sure you're not logged in in topgg?
@rocky bough yes i'm sure
@violet spoke listener decorator on on_guild_post
And make sure you're loading the cog properly
i need a help
async def upvoted(self, id):
async with aiohttp.ClientSession() as session:
async with session.get(f'{self.base_url}{self.client.user.id}/votes', headers={'Authorization': self.dbltoken}) as resp:
data = await resp.json()
for user in data:
if id == int(user['id']):
return True
return False``` so this is to check if the user has voted or not , i wanna know when does the list resets , like one of my friends used a command but it didnt ask him to vote , guess his Id was on the upvote lists, how long does it take the list to refresh so it will ask again to vote
ping me if you have the answer and thanks
@stray sluice 12 hours
@sullen nymph sometimes it takes time?? like there may be a difference of one or two hours?
dblpy docs if you want to use dblpy, or use aiohttp.web
Do i have to postStats or it will do automaticly
not again Pete
@restive otter - If you passed your client to new DBL( ), it's automatic.
-botcommands
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
@restive otter
how do i make my bot site show server count? i have no idea what im doing
dbl.postStats EhU?
@vapid cape where do i put it? im so confused
what language are you using?
for my bot?
yes
discord.py. rewrite branch
did you check the Tools section?
on the docs?
no let me check
if my bot is running via repl.it do i put dblpy in the requirements file?
i dont use repl so idk
oh ok
but do the same you did with discord.py
kk
Anyone seen this before? Can someone on the dev team or website team let me know what I'm doing? Maybe something is breaking my widgets?
did you put your widget somewhere where its accessed too frequently?
Saw above about there being two options fornsharding in discord.js 12, the version I'm using ias the whole shard manager file that then loads up the not file..
Where can I find an example of the other version?
@vagrant barn
you just set that in your client options
set it to "auto" to use the recommended number of shards, or define the shards yourself
Hey does anyone know how to get to this page?
bot page --> edit --> scroll down
You'll be able to see that once you have an approved bot.
yw
Thanks @jagged pine
what do we do to webhooks on discord what do they even do
You what?
Discord webhooks are a way to broadcast messages or send messages with custom username and avatar
@knotty garnet thats what i mean
how can I check if someone has voted in discord.py?
Let me look for you
There is a bot @stuck moon
@frigid basin ^^
O wait never mind
What am I thinking
idk about that
I meant as in making a vote lock command, if thats possible in discord.py
I tried looking in the api section but I couldn't really find anything
Hello
My bot is displayed as 600 servers on your site, but the bot is on 200 servers. Would it be a problem?
Yes
shows 561 for me
A figure between 550 and 600 appears
Alright, try doing.
view your page on a different browser
nevermind, my bad, i thought your problem was that it was showing the wrong number just to you
Okey 1 sec
Try using dbl.postStats(client.guilds.size);
It shows for me 200 servers.
weird
I'm thinking.
I think I should renew api token
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
Try this
Oh you are sharding?
Yes
That's the problem
I think it has fixed!
Alright
cool
How can I check.if user is voted or not
see the docs
İ checked but i want to trigger the action when user is not voted
Hello, I look at my bot in Discord Bot List and typing N/A on my bot. I added a code to bot.js but still the same
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
I forgot :D
lmfao
I changed but still the same
show us the code with censoring your token
censoring 100
can you send it with using codeblocks?
also, do any errors appear?
delete
Thats not i meant
I censored with the character -
sigh
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('mytoken', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
code ^^
well you need to obviously post your server count
see the methods on https://discordbots.org/api/docs#jslib
Do you create a new client just for dblapi.js
Or do you use an already existing one
i just created
I changed the code a bit but still the same
const Discorddbl = require("discord.js");
const clientdbl = new Discorddbl.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('mytoken', clientdbl);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
read the methods
Providing a client to DBL constructor is fine
pfff still couldn't do :(
I looked at the https://top.gg/api/docs#bots site to make a server counter, but I don't know how to do it in html. Thanks in advance ^^
what language?
HTML only
So I generate the token, what do I do next?
read what the error says
You're not going to get a response by requesting it in a browser. It requires auth
Hey for count the total number of members like a member count but for all server i need to fetchUsers ? sorry i'm new with the v12
discord.py dblpy issue where whenever I create a DBLClient object I get this issue: Unclosed client session
Error message:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f422607e880>
Anyone .-.
Is it possible to send http requests directly as the language I use isn't available on the docs?
I don't see how it's not possible :p
I also know that I require to have a bot in here.
@spare mulch Are you sure it happens when you declare DBLClient?
Alright. I'll have to look into their "docs" to see for endpoints.
Yes I commented everything else out shivaco
What are your discord.py and dblpy versions?
Latest for both, let me go look for numbers
discord.py version 1.3.3
dblpy 0.3.4
@sullen nymph What was the aiohttp version used to develop the library
I'll get back to you when I'm free
My local aiohttp version is 3.6.2
Same :\
I'll play around with it a bit later
K, thanks
Hey @keen saddle If you need the required headers and payload dm me, I figured them out
For posting*
Alright, Will be a while yet, Still need to code my bot.
How do I know if someone has voted and give them a role?
Use webhooks
hello
i have been having an issue with the dblapi.js library since yesterday. when i try to use the hasVoted method to get if a user has voted or not, it now throws this error: SyntaxError: Unexpected token < in JSON at position 0. any help would be appreciated!
That looks like some internal fuck ups... judging by the fact that it's a < leads me to believe the api returned html for whatever reason.
are you parsing it yourself? also you should show some code.
no i'm not parsing it myself, i'm just using the built-in hasVored method from the dblapi.js library
I'm not sure why that would error like that unless it's an actual api error and returned html for some reason
I don't have a bot on top.gg anymore either so I can't really help further
i see, thanks for the help though!
how does one also show the shards with discord.py or is that meant to be automatic with the server count
is it able to make my bot announces on a room when it gets a vote ?
oh okay where do i put the webhook link ?
i use js
I can't really help you then, google how to use webhooks w/ js
does anyone know why this error spams my console ? :
(node:29836) UnhandledPromiseRejectionWarning: Error: 503 Backend fetch failed
at IncomingMessage.<anonymous> (/home/discord/imaginarium-bot/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:333:22)
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:29836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 82)
pls ping me i don't read every messages ^^
it shouldnt be spamming
unless you're also spamming api requests
like posting server stats on guild add
hum i'm posting the server stats like every 5 minutes
is it spamming more than once every 5 minutes?
did you put it in your ready event?
is it an interval?
the ready event may fire multiple times if your bot disconnects and reconnects
so it will create multiple intervals
what language?
JavaScript
Thxs
there are examples there which you can pretty much copy and paste
just remember to use your token and choose the correct port
@slim mauve If that fails I know all the request headers and body required to update it
Hi everyone hope all is well. Looking for a translator
Google translate
what you want a bot @lone viper
Yes if possible
this channel is for development (and for the most part discord)
I looked up translator for discord and it sent me here
Ok thank u
Hi
is there any other way to get the voting feedback other than webhooks? my bots aren't accessible from the outside 🤔
?
voting feedback? as in if someone voted for your bot on top.gg?
i've only seen docs on webhooks but i can't do webhooks with my bots
my bots aren't accessible from the outside
What do you mean by this
that the server they're on doesn't have a static IP and my firewall is closed as well
oh that'd be neat.
Lemme find it
https://top.gg/api/docs#votes @dusty fulcrum
oh lol, missed that line. thank you
I'm using dblpy, how am I able to get my API token? I can't seem to find where to get it
ty
Hey
is this normal?
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
My error sending the message, sorry
My bot shows about 200 servers on the site, but my bot is on +690 servers. I think this is an API problem. How can I solve it?
-servercount
To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.
Ok
How can I show all servers on site in a bot with a shard?
const DBL = require("dblapi.js");
const dbl = new DBL('my token (dbl)', client);
client.on('ready', async() => {
setInterval(() => {
client.shard.fetchClientValues('guilds.size').then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})
}, 900000);
});
I'm using this but not working
if you're using the sharding manager you dont need to postStats
it will do it automatically
Ha, okey
How to set up webhook? I'm confused https://i.imgur.com/EfEIF4g.png
how can i chanege bot's page theme?
like this
CSS
iknow but how?
style tag in long description
@potent tide webhooks are meant for receiving votes, so dbl will post to that webhook on a new vote.
its not meant for channels iirc
you usually have your own webserver receiving those post requests
@oblique osprey #memes-and-media
Well.. where did the css go?
Legit, tried disable adblock.. still same, could it be a browser issue or?
ohhh ok
i have rewards for when someone votes for the bot but for some reason the value i want it to add to doesnt get added to?, im not sure whether ive missed something or done something wrong.
ah okay, ty
@restive otter Aga bu yetkililere kalırsak botunun eklediğine şükret sen
Benim botumu denerken komutu yanlış kullanmış bot hatalı diye laf ediyo aq
@left egret
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
where do i go to set the "password" / webhookauth on top.gg?
@icy sinew
1 - Bu kanal ingilizce sadece ve türkçe’ye hiçbir şekilde izin verilmiyor - Türkçe için sadece #memes-and-media
2 - Küfür/Argoları kendine sakla, ilk ve son uyarı
3 - Ret ile ilgili sorun varsa modlara ulaş, detay eklemeyip modların arkasından böyle boş boş konuşma.
Ty.
@left egret The official who checked my bot has used the @dense grail command incorrectly, refused my bot considering it to be an error, but it is completely the admin fault.
sorry
How I can get the votes of my bot?
Sorry I was thinking of the wrong api
ㅤ
@tacit wren can you stop this?
Thanks
@left egret ily
My bot just got approved and I can't find my dbl token and only a api key is the api key a token
Heya, I have created a webhook for the channel where a upvote should be posted an copied the link into the field, how to go on?
@jagged mantle https://top.gg/api/docs#mybots
the token isnt there only a api key
Prehaps the api key is the token 👀
You tried that last night. and you broke the bot
u prob pasted in wrong
I hate to say it but you were right, and i think u mean we not me lol
after the server count is posted, and is displaying on the bot's page, there's any way to remove it?
I'd asume you'd just remove the servercount code
yeah, i tried that, idk if takes a while to remove it from the page or if i have to do something else
Me and my friends bot just got added so uh in all honesty i dont know
np, thanks anyway
if ive already put my token in do i still need to put it in this?
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!`);
});```
or do i remove the const dbl new dbl token
this is for webhooks, if you only want to post server count, you dont need this
I have a server count but I want vote updates as well
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
I just voted for my Bot but didnt got anything printed, how long does it normally take?
import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.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_dbl_vote(self, data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))
```I have this in my cog @sullen nymph did I forgot anything?
I suggest you still don't post your tokens, even if some part of them is censored
You are not actually setting the webhook up
oh I found
okay ill try again
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000, autopost=True)```
can I still use autopost with a webhook? and are `webhook_path` and `webhook_port` the same? i have to change the auth ik this
Port is the port in the URL
Auth is the password you create
They can't be the same
Can leave the same or remove it, the default value is /dblwebhook anyway :p
okay
ty 🙂
i'm so lost with this lmao
Port is the port in the URL
@sullen nymph do u mean the webhook url?
can I send the webhook url to ask you for the port in my case?
http://<ip>:<port><webhook_path>
It's the URL to your webhook
That's Discord webhook
Also don't post such URLs in public channels either please
okay wont do anymore
make sure you re-create the webhook you just posted if it's in use
yeah
Anyway, you sent a Discord webhook URL
a webhook is just a script running in background waiting for requests
http://<ip>:<port><webhook_path>
You use this as the template for your URL, yes
uh guys whats this for?
@willow spindle I donr understand this webhook
import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.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_dbl_vote(self, data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))
```So do I need a webhook for the upvote event?
Yup
Yup
okay
and there's actually no way to use an upvote event without a webhook
because a friend said he's doing without
what 
well it isnt the upvote event but its the last 10 upvotes
last 1000
is it bad for the connection when I dont close before restart my code?
How can we send a message via webhook when someone votes?
Is there a way to do use dblpy without await/async?
e.g. can i still use aioclient.get(url, data=payload, headers=headers) to get the vote of a user from the api?
just ask your question @restive otter
hey, im doing this super simple POST request, but getting error 400?
require('dotenv-flow').config();
const fetch = require('node-fetch');
const body = JSON.stringify({
server_count: this.client.shard.fetchClientValues('guilds.cache.size')
});
fetch(`https://top.gg/api/bots/${this.client.user.id}/stats`, {
method: 'POST',
headers: {
'Authorization': process.env.TOPGGTOKEN,
'Content-Type': 'application/json'
},
body: body
});
now i made the same post requests on postman posting the server_count and shard_count params and that seemed to work
im off for the night, but any insight on this would be great! (i'm having similar issues on other listing sites and i've exhausted all options that i think would work + everything i searched here pertains to the dblapi.js npm package which isn't that helpful here)
Does the DBL module on python allow you to feed the guild_count yourself ?
Why should it?
When you separate the shards over different instances it will get the guilds on that specific instance
def guild_count(self):
"""Gets the guild count from the Client/Bot object"""
return len(self.bot.guilds)```
I'll just adjust it to my needs.
been thinking about rewriting that for a while tbh
tbh when splitting on multiple instances i just have a master control that does the posting
the nodes communicate to it anyway so just send each cluster's guild count to the master then master sends.
It'd be easier to split stats posting and consistency imo 
@clear kayak mind opening an issue on https://github.com/DiscordBotList/DBL-Python-Library/issues
A simple API wrapper for top.gg written in Python. Contribute to DiscordBotList/DBL-Python-Library development by creating an account on GitHub.
OKe
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})``` @jaunty depot so i just add this to my code?
also sorry for double pin
ping
no you don't
those are optional as it says
deep into the doc and you'll find postStats()
that's what you need
bot.dbl = new DBL(process.env.DBLTOKEN, { webhookServer: server, /*webhookPort: 5000,*/ webhookAuth: process.env.DBLKEY }, bot);
bot.dbl.webhook.on('ready', hook => {
console.log(`📯 Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
bot.dbl.on('posted', () => {
console.log(`🎀 Server count updated and posted!`);
});
bot.dbl.webhook.on('vote', vote => {
console.log(`💎 User with ID ${vote.user} just voted!`);
});```
actual webhook: https://hastebin.com/ewaheducut.js
votes dont go through my webhook
the ready event doesn't seem to trigger
it used to i think before i updated to version 12
i changed all v12 methods
the posted event works but none of the others do
are you sure the port 5000 is open
i had that commented out before and it still worked
try uncomment it and use port 3000
yes
didnt get it
what's your host
well
but thats all i can do right now
thanks, i defined a listener at the top of my code as that
let listener = app.listen(process.env.PORT);```
so it's a glitch issue not top.gg api?
the webhook doesn't start at all like it used to
The origin server returned an empty, unknown, or unexplained response to Cloudflare
just dbl fucking up
If a cluster of 3 shards needs to report its guild count for those shards, does it have to make 3 requests?
not necessarily, it can be done both ways
how
i mean, from what i understand, if you pass an array of shards it has to be all of them
you can make 3 requests with server_count, shard_id and shard_count
or you can make 1 request with an array of guild counts on shards
right but
if i pass shards
there's 6 shards
and i pass 3
how will the API know what to do with that
how will it tell apart me posting shards 0, 1, and 2 from 3, 4, and 5
not sure, i think its all or one by one
you have 6 shards divided in 2 processes of 3 shards each?
yes
do you have ipc between them?
no
then i guess you have to send them one by one
ah alright
im following the docs and my id is being given and stuff
dbl.hasVoted("id").then(voted => {
if (voted) {
msg.channel.send("You upvoted the bot! GGs")
}else if(!voted) {
msg.channel.send("Upvote the bot ")
}
});
Yet im always being given the 2nd option, Am I missing something?
are you checking "id" with quotes?
Xdddd
no?
my id is being given, its just I didnt place it in there. .hasVoted("328600107022942210")
nvm, i just realized what the problem was
How can I make it to where if a person didn't upvote the bot, it can give an error but if they did, the command will execute? (In discord.py)
hi i need help.
If i want to catch the user this comes up: https://tayron.is-inside.me/khbvr3p3.png
This is the code
let body = req.body
console.log(body)
let user = bot.users.cache.get(body.user)```
yeah it tries to log body but there is nothing
if you're using express, you need the body-parser middleware to access body
oof okay
Hi, can someone help me? https://i.imgur.com/rzeZgg2.png
The site is showing 76 servers While im posting 83 servers
Im sorry im stupid and had the code comented 🤦♂️
lol
is it right that there is no way to use the on_vote event in dblpy without a webhook?
I assume so because it is an event
okay
The webhook is the listener
yeah
When it receives the event it triggers the on_event
How can I make it to where if a person didn't upvote the bot, it can give an error but if they did, the command will execute? (In discord.py)
so when I use a webhook for the upvote event I wont get a api timeout if i get to many votes in a hour right?




