#topgg-api
1 messages Β· Page 87 of 1
i mean its like sending two responses to a channel from a command
i imagine that they share a ratelimit so it will be twice as easy to ratelimit myself by making 2 calls lol
well, true, you can always cache the responses
the top.gg api rate limit is what? 60 per 60?
idr
i guess
and make them concurrently, so no double latency
60/60s
yeah, you do it using Promise.all
public async fetchTopGGBot (botId: string) {
const responses = await Promise.all([this.fetchTopGGBotInfo(botId), this.fetchTopGGBotStats(botId)]);
return {
...responses[0],
...responses[1]
};
}
crazy code
i rlly need to properly type the api response
How can I grab upvotes
Hey there. Can anyone help on using the API? How does it work, what can I do with it?
If there's already a place that tells me that, could someone redirect me to there?
for both of you
Alright, thank you!
guys, I want to know what I put in the "Url" in Webhooks tests
an address to a webserver to process the webhook
for example, the ip address and port where your program is running
or the project url if using glitch, heroku, replit, etc
type: project_domain.glitch.me/ ?
yes
if you're using dblapi.js, then your url should be projectname.glitch.me/dblwebhook
do I need to include "http (s)"?
should work with or without
async def upvote(self, ctx):
await self.bot.get_bot_upvotes(users)
await ctx.send(users)```
How can I grab all users who upvoted the bot
I thought that would work
but I don't know what to define users as
oh
i'm sutoid
how to use express and top.gg webhook at the same time
Hey how can y get the username of the voter like vote.user (index.js)
Anyone can help with "filtering" the public_flags to show the badge of the user?
-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
@torpid nexus move that to #development
it is so bad my bot was 3 minutes offline then the bot would be rejected and I should publish the bot again. The main thing is that I have to set everything up again

I press the regenerate token button and itβs not showing the new token and the code is giving Error: 401 Unauthorized error
did you clicked save button?
Where is the safe button??
I canβt find it
On your bot's Edit page
https://i.imgur.com/BMmlOA7.png this part?
I try regen token in the api docs and the edit page still same thing
https://i.imgur.com/BMmlOA7.png this part?
@brittle spoke yes
o*
ok it works ty
hello, I have my webhook URL set to 0.0.0.0:5000/dblwebhook, although it does not seem to be working?
Replace 0.0.0.0 with your public IP
where is your bot hosted?
google cloud
do what shivaco said, and you'll also need to allow port 5000 in your google firewall
oh okay
hello, i've tried what i was told. I had use the cloud's public ip, and also allowing port 5000 on the firewall, and it still seems to not be working
how do I add server count to my dbl page?
some mod please do -servercount
-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.
Hello. For some reason, the webhook test button is not working. Here is my code.
const DBL = require('dblapi.js');
const config = require('./config.json');
const dbl = new DBL(config.dbl.token, {
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(vote);
// Do what you need to do
});```
I am not getting anything in the console.
for glitch, I think you can use glitchtitle.glitch.me URL
yeah, i did that
ohh, i guess were on the same boat now
well with that, i'm not using repl or glitch
but same thing, everything works fine. Just not the vote webhooks
Oh, for the glitch URL, did you include the ending /dblwebhook ?
worked?
yeah
Error: 400 Bad Request trying to get my server count
is servercount suppposed to be defined?
Hello, does anyone have a solution for my case ?
@grim hazel ?
Will try again!
seems to give no errors but wont post servercount
seems to give no errors but wont post servercount
@restive otter is that even running? like, it'll only run after 1800 seconds
ah yes bc literally using 0.0.0.0 will work
im confused, i was reading the docs for the API but im unsure how it will show the number of servers hes in, i have it getting and posting the stats i think??
you dont need to get, just post
if you use one of the official libraries, they will do it for you
i think ive used dblapi.js
@balmy hamlet 0.0.0.0 will try and map it to the external IP
You dont need to bind it to the external IP because its running locally and you can access it from the outside using a port
@hollow raptor Hey, i've followed the guidance page you had shown. It still does not work.. Same issue, the vote webhooks didn't show up
I've tried both 0.0.0.0 and my external ip for the URL, and it still reproduce the same issue
where are you getting that?
console
Idk,
functioned normally, but gave this error
still, 401 can happen ANYWHERE, I need to know how you're getting that
π
does anyone know how to add servercount for bot in site
some mod please do -servercount
is there a way to tell if someone upvoted my bot?
how do you use it?
oh thank so much
is the latest version v0.3.3?
idk, the libs listed there are up-to-date
i suck at documentation \
@solid wharf I meant, some random dude literally tried to use 0.0.0.0:5000 on TOP.GG's webhook url
that was late af
-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
where are the error/status codes listed
im getting a 403 status code 1006 error code
no idea what it means lol
mostra codigo
are webhooks having a moment or the api in general rn?
@wet zenith this?
when this happens, the api throws a 403 with an "error code 1006" in the body
i solved it already
@azure pollen Sorry for the late response, but i have not seen any issues. Is it working fine for you now?
-bot
-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
does anyone mind helping me with this ?
https://canary.discordapp.com/channels/264445053596991498/412006692125933568/710685063813267496
What does api actually mean ?
And how do I get my bot online ? Iβve added it to my server
application programming interface
@blazing condor bots are pieces of software that run on a machine
you need to learn 1 programming lang and then make a bot
easy
all I need to have server count populate is to instantiate the dbl object with my token and bot client yeah?
and it will populate eventually?
I don't need to call any methods?
cos client.guilds.size is deprecated in discord.js 12
You can still use v12 to post the server count
just change client.guilds to like
client.guilds.cache.size iirc
i dont use djs but youd use the docs
yeah the docs don't mention the cache collection having a size property
but apparently it does
regardless I shouldn't need to manually post my server count right?
as long as the dbl object exists
cos it's been like 4 hours now and my server count has straight up not populated
but I've spoken to other people on discord.js 12 and all they have is the standard
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
so I guess I just needs to wait?
if someone who works on the API sees this please @ me
I've got two other bots I've never had this issue with and the only difference is the discord.js version I'm running
-help
@opal schooner
Have you pushed the server count to DBL?
no, I haven't had to do that in the past though, afaik the dbl object auto pushes it - at least it does on my other bots
yeah i guess i'm gonna have to at some stage soon if it doesn't resolve
v weird though
show your code
o
@restive otter is it in that order?
also that
@sullen nymph my DBL client should automatically push my server count yeah?
If you provide your d.js/Eris client, it should
Try posting manually 
yeah okay
How do i give people the voted role on my server when they vote for my bot?
Wdym
@sullen nymph Where do I go?
A simple API wrapper for top.gg written in Python. Contribute to DiscordBotList/DBL-Python-Library development by creating an account on GitHub.
https://dblpy.rtfd.io documentation page π
would
if voted=1:
work
Hey, I am a bit confused about the stat autoposting. If I provide the client to the constructor, do I still need to set a webhook up? (working with Discord.js)
Providing client for the constructor is for stats autoposting, the webhook is for receiving votes
hello, do i put this in projectname.glitch.me:3000/dblwebhook in URL? ( https://cdn.discordapp.com/attachments/690959512055578684/711215543088054322/unknown.png )
remove :3000
@opal schooner try console.logging something with it posts your count
console.log('Server count posted')
})```
Also log on error so Incase it fails you get an error to work with
console.log(`Oops! ${e}`);
})```
is dbl api dead?
cos i get 401 error
Oops! Error: 401 Unauthorized
for the past two days
@frigid river https://tryitands.ee
Working with webhook π all my votes are posted to my server no problem
How does the JS api wrapper work with sharding?
I believe it just posts the servers of the current shard
also can you use the dbl.hasVoted() like this?
const voted = await dbl.hasVoted(message.author.id);
if (voted) console.log("Voted.");
yes and yes (i think)
Sometimes the website says 900 servers and then other times it says 7.3k servers lol
ayo, I have a single microservice for posting stats to DBL. ```js
dbl.postStats(stats.guilds, 0, stats.shards.length)
if you say shards.length is lets say 10
and you always post from shard 0
it will never receive a count from other shards
and will probably only display a 10th of your servers
so setting id to 0 on all shards will only work if you set length to 1 in all shards
which is basically the same as just sending the count without any shard information
do you know how to make it so that when someone votes for my bot they get x coins
@restive otter shardcount and shard are optional parameters
@gloomy fractal I am logging both of those events - when I run the dbl object on my test application it posts fine
as soon as i run it on production
nothing happens
this is so bizarre
and as a result it now says my servercount is 1 lmao
yoooo WTF
so I have my npm install logs from yesterday
all fine
i just checked npm list
dbl api package not there =\
but require not throwing error either
reinstalled package
all working
π π π π π
how to check if someone voted for ur bot on dbl (discord.js)
ping me if you know how
Why is botblock blocked from using the api?

huh
ta poiola :v
Which part of the API controls how DBL fetches the Bot's status? Example: [Online/Offline], etc
if the bot is in this server
@signal hawk im so confused >w< how is my bot not in this server if its on DBL? 
it might have gotten kicked, you can search your bot's ID in mod-log
@signal hawk oof you're right, so I just reapply after I fix the issue right?
if it wasnt "deleted" and it was just kicked you can fix the issue then dm a mod to have it readded to the server
I would ask you but I'd feel bad since you already helped me right now 
So I'll probably ask a different mod~ thank you~
I am trying to use the API to get the last votes, however it keeps returning [Object object]. I am using snekfetch for it.
const snekfetch = require('snekfetch');
const key = config.secrets.dblkey;
snekfetch.get(`https://discordbots.org/api/bots/${bot.user.id}/votes`)
.set('Authorization', key)
.end((err, response) => {
const embed = new Discord.RichEmbed()
.setColor('#000080')
.setDescription(`${response}`)
.setTimestamp();
message.channel.send(embed);
});
}};```
@upper nebula because response returns a object
Ya I got that
so do response.data.
whatever part you want to get
if your unsure what part your wanting to get do console.log response.data
https://top.gg/api/docs#mybots once it's approved
Where is my dbl token ? how i find
in docs
Can someone help me regarding api
Just ask your question
I am trying to do webhook service with my bot who vote my bot that must post at support guild but it showing port and password what is that
@echo salmon
The webhook service is essentially a little server thats sending data forwards and backwards to DBL, the port is the port number your service should operate out of, for example, http operates on 80, you can choose any port number you want, just ensure its open to the internet
password is the "authorization" section you set on your edit page
it can be anything you want, you probably want to generate a long random string for this
Authorization mean my bot api key?
Then
Authorization
Hi, can someone help me with this?
https://top.gg/api/widget/:610117091894493185.svg
Hello, I'm trying to post the BOT's stats, but it gives me this error:
UnhandledPromiseRejectionWarning: Error: 401 Unauthorized```
My code: ```js
const DBL = require('dblapi.js');
const dbl = new DBL(config.dbl.token, client);
dbl.postStats(client.guilds.cache.size);```
make sure your token is correct
hello my bot is not posting server count Oops! Error: 400 Bad Request i am regenerated token but don't working
what npm package are you using?
if its discordjs
discord.js
v12
dblapi.js
const DBL = require("dblapi.js");
const dbl = new DBL('my token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
my code is here @restive otter
you gotta wait for someone who actually uses discordjs, i use javacord, just wanted to make sure you're using the official npm package
yes
@restive otter whats your dblapi.js version?
yes, you need 2.4
fixed thx @vapid cape
can someone tell me how to get the api key
your bot need to be in DBL first to get api key
why i get taht ? (it's for the server count)
discord js v11
and VPS
Unauthorized means you entered a wrong api key

@restive otter
i have enter the good
what dblapi.js version?
and i have regenerate and after i have change my key
i'd say print your api key after the on error and check if thats the same one
ok
though dont send the results in here ofc 
2.4.0
dblapi
and the apikey check you put in the on error is the same?
nothing
just the error
but
when
i vote
the vote
is in my log
0 error
juste my unauthorized
then you probably have nothing on that variable
go through your code and check if your apikey gets used correctly
look
before implant my bot on my vps
it working without problem and error
I am developing in C# and ran into a problem with the api.
This is in my ReadyAsync:
AuthDiscordBotListApi AuthDBApi = new AuthDiscordBotListApi(_client.CurrentUser.Id, Environment.GetEnvironmentVariable("DBO_TOKEN"));
_ = Task.Run(async () => {
IDblSelfBot DB_Bot = await AuthDBApi.GetMeAsync();
await DB_Bot.UpdateStatsAsync(_client.Guilds.Count);
await Task.Delay(1000 * 60 * 10);
});
But 4th line throws a NullReferenceException. What am I doing wrong?
@restive otter you dont need 2 DBLs
Nope. I checked that ^^
new DBL("token",{webhookPort:port,webhookAuth:auth},bot)
regen it again
Β―_(γ)_/Β―
I'm trying to establish a webhook connection for the dbl upvotes and I currently only have the example from the dbl docs. Am I suppose to change the webhook_path to something else?
I'm running this on a vps so would my webhook_path be ip:port/dblwebhook
http://
is that it?
I mean like other than changing the webhook_path would I be able to get upvote events
or are there other things I have to do other than the code I have right now
because the upvote event is not triggering when I upvote or test
How can I get the ID of some user that vote in the site (using python)
why is my bot saying incorrect login details when I literally copy and pasted it
it won't let me log in
log into what?
lmao yeah
Error: Incorrect login details were provided.
keeps happening with only one of my apps, everything else is fine
are you sure you are putting in the right token
are you regenerating it?
no
does anyone else have access to the bot?
no
it already happened once to me
thats odd
Oi
it's not a problem
that's intentional behavior
every token you see there works
those tokens only stop working when you regenerate it
and it shouldn't cause any problems
@wide herald @restive otter
Why should I set interval when posting the server count?
supposedly I was rate limited
so there aren't any bots in 100 servers? I don't get it
Wot?
Why is it taking so long to post sever count
The code isnt running for some reason cuz i have done a console log statement whenever it starts
module.exports = {
init(client){
let stats = new DBL('my token here', client)
client.logger.info("Started Top.GG Webhook")
setInterval(async function(){
let guilds: number[] = await client.shard!.fetchClientValues('guilds.cache.size')
let bot_guilds: number = guilds.reduce((prev, guildCount) => prev + guildCount, 0)
stats.postStats(bot_guilds);
}, 60000*10);
}
}
Well you see I'm on mobile and mobile formatting is ass
So I'm having a hard time reading
Pls take your time
I am already frustrated cuz of this not working
π
You cant run anything till your bot is approved
^
My frnd's bot is approved
We both work on it together
Are you editing the right file?....
i have made a seperate file called topgg.ts for this
Then the whole code above in that file
But somehow the code isnt running
Its not logging started webhook
Shouldn't it be un your on.ready event.....
If you make it in a separate file
It wont run unless you call it
ok it runs now but its not showing the server count on website
Your bot page?
Yes
do i need to run the code from the same token of the bot thats approved
I am talking about the bot token
Cuz i am running the code rn on beta bot
Pretty sure lol
its still not working
ran from the og bot token but still i cant see server count on my bot's page
Well this is where my knowledge ends on top.gg api
Sorry this is all I can help you with

Where are the moderators
There is noone to help
Prob lurking
If it's a problem with the site itself it's out of our control.
If it's a problem with the site itself it's out of our control.
@hollow edge how much time will it take
Never know
Well, if it's out of their control, then how would they know how long it would take to fix it
Either way, I'm pretty sure it's nothing to do with the site. My bot is updating server count jsut fine
Its their website
@nocturne jay can you pls share the code ?
Or can you check mine
@nocturne jay whats your issue
can someone tell me how to get the api key
@green mantle What do you mean?
idek anymore
lmfao
Hello, I've posted a code here yesterday, that postStats returns unauthorized. I've tried updating dblapi.js to the newest version, but it doesn't work. My code is here:
//DBL - Vote Webhook
const DBL = require('dblapi.js');
const PORT = process.env.PORT || 3000;
const dbl = new DBL(config.dbl.token, { webhookPort: PORT, webhookAuth: config.dbl.password }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
require("./voted.js").run(client, vote.user);
});
client.on('ready', () => {
dbl.postStats(client.guilds.cache.size);
});```
The webhook works fine, but postStats doesn't work.
My BOT is hosted on Heroku.
I've tried to run BOT on my local network, but it still returned unauthorized.
have you used the correct token
How do I print the number of online members to my bot ? can someone help
-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
@median badger i've used this one:
are you sure that's the right website?
fixed
what exactly is the issue?
what language/library?
is your version up to date?
is there any error in the console?
nope
i am not even getting any error -_-
Do you provide client and use postStats at the same time
yeah that's unnecessary
Hello, I found the same module as dblapi.js with exactly the same code as dblapi.js (since it's a fork) it's normal ? Do you agree it ?
people are free to fork stuff on github as long as they follow the original library's license
hey, how can I get the ID of some user that voted (using python)
Does webhook to https work as well as to http?
I have changed webhook url just now and can't get it in bot.
Can api work with self-signed certificate?
it should
But it doesn't
Switched back to http and can receive webhooks again.
Can someone confirm working webhook to https?
I am trying to add my server to the discord servers website but every time I try, it says there's an error
^
Same.
the function of checking if the user voted for the API bot only recognizes if the user voted once and after that it returns a value of "true" every time or resets whenever the user needs to vote?
Example:
I now vote for the bot and use the command to check if I voted. If it recognizes that I voted, it returns the value true. After the 12 hours that the user can vote again, he returns a value false or does it always return true?
what
DBL token is my bot token?
its the api key?
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'my dbl token'
self.dblpy = dbl.DBLClient(self.bot, self.token)
async def update_stats(self):
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info(f'Posted server count ({self.dblpy.guild_count()})')
except Exception as e:
logger.exception(f'Failed to post server count\n{type(e).__name__}: {e}')
await asyncio.sleep(10)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))```
whats wrong with my code
Wasn't the message "Posted server count x" to appear every 10 sec?
You're not calling update_stats anywhere
ah
<@&304313580025544704> Can I send request for API developers to include support of https webhooks with self-signed certificates?
-atmods
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.
Sorry, didn't know that
You don't need to ping Moderators for that.
@willow ruin please tell me why in 2020 you feel the need to use a self signed cert.
use cloudflares free ssl, or certbot and letsencrypt. no excuse.
To establish ssl connection for webhooks
what Brain said
in fact, cloudflare free ssl is as close to zero effort as you can get, you just turn it on in settings and its sorted, free ssl.
not just that but it will hide the ip of your hosting, too
I think there's
interesting, not seen that site, i'll keep it in mind for next time π
oh and something else to note, google actively penalises non-ssl sites now, its hard coded into chrome to be an asshole to plaintext http sites and treat them like the security risk they are... just sayin'
unrelated to webhooks tho
true that
Webhooks just sends plain json w/o any info that can be leaked, why I have to use CA, there are no security reasons, isn't it?
if thats the case, why use https at all?
To cipher the channel
you must be concerned about the security of that data or you wouldnt even consider a self signed cert?
connection channel
enabling ssl on everything is just good internet hygene, its like brushing your teeth twice a day, or washing your armpits.
by that i mean proper ssl
π
even if you dont have security concerns, dont half-ass ssl
there is one actual use for self signed certs, and im surprised nobody has asked for it already: its possible to authenticate via a self signed certs sha-256 hash, which is something i do as secure authentication on an api i wrote, this isnt something you were asking for.
its more confusing why you're even suggesting self signed in that case
but that example above can be so convoluted, its probably better to go oauth2. off topic, lets drop that subject π
"dont half ass it" about sums it all up tbh
Webhooks I used before in other API work fine with self-signed. It's first time I encounter such issue π
Not really sure why they would be fussy about self signed but not enforce https
api key
[18/May/2020 19:41:47] INFO - logging in using static token
[18/May/2020 19:41:49] INFO - Created websocket connected to wss://gateway.discord.gg?encoding=json&v=6&compress=zlib-stream
[18/May/2020 19:41:49] INFO - Shard ID None has sent the IDENTIFY payload.
[18/May/2020 19:41:50] INFO - Shard ID None has connected to Gateway: ["gateway-prd-main-grd7",{"micros":597,"calls":["discord-sessions-prd-1-18",{"micros":5876,"calls":["start_session",{"micros":1243,"calls":["api-prd-main-us-east1-24nh",{"micros":106,"calls":["get_user",{"micros":618},"add_authorized_ip",{"micros":321},"get_guilds",{"micros":496},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":108,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 460ecf6hf8d).
[18/May/2020 19:41:54] WARNING - GUILD_MEMBER_UPDATE referencing an unknown member ID: 365068686624. Discarding.
[18/May/2020 19:42:00] INFO - Processed a chunk for 694 members in guild ID 32569919442849.
[18/May/2020 19:42:00] INFO - Processed a chunk for 329 members in guild ID 40810499538250.
[18/May/2020 19:42:00] INFO - Processed a chunk for 477 members in guild ID 48164773608320.```
can someone explain to me what exactly he is doing here
and why this didn't work
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)```
I used it and someone voted in my bot, and dont show the print in my terminal
2 questions I need, how do I get the bot's total votes, and how do I get the ID of the user who just voted..
can someone using this system in python help me?
I was also trying to figure out how to detect when someone votes for my bot I'm using discord.py
yo are webhooks not working?
i'm not using webhooks
Alright thanks for the information
hey, i have a question. in the api docs, for the votes the exemple is dbl.webhook.on(........ But how can I define webhook ? Or do I have to replace it with something else ?
is « webhook » a const with an url « top.gg/bot/ID/vote » ? (btw i use discordjs)
Check #312614469819826177
How to configure the webhook? I mean, what URL should I enter ? An URL to the server where the bot is hosted ? Where exactly? Thanks.
Read the docs
Well, I did, but if weβre talking about the same docs, I donβt really see what I should be reading.
The docs about the Webhook doesnβt seem to be very complete
WAIT
yes, ok, then i am a complete noob
but it isnβt very precise : they just talk about βthe url when you want the webhook to be sent to
can anyone give me an example of webhook url?
is that just smth like top.gg/api/{authkey} ?
const dbl = new DBL(client.util.api.dbl,
client);
dbl.getBot(client.util.id.client).then(async data => { await home.channels.cache.get(client.util.id.total_vote).setName(`Total Upvotes: ${data.points}`).catch(error => client.send.processes(error)); await home.channels.cache.get(client.util.id.month_vote).setName(`Monthly Upvotes: ${data.monthlyPoints}`).catch(error => client.send.processes(error));
Here is some of the code from my bot
It's for getting votes
kyu
thanks A LOT π
oi its for how many upvotes where done
oh yes youβre right
you typed this? on mobile ?
i wanted to know how would i reward if it was upvoted qwq
Well once you know a user voted
You can give them a reward
Read the rest of the docs
iβll read again
same
but could you tell us how to get the webhook url pls? i still havenβt understood
dbl.hasVoted("95579865788456960").then(voted => { if (voted) console.log("Tonkku has voted!!!") });
whats dis one for owo
Checks if a user has voted
I installed it
dbl webhook is a different thing tho
what dyou mean?
you cant use dbl.hasvoted & dbl webhook on('voted'...) at the same time. dbl webhook is getting data when someone votes, while normal dbl askes if X has voted
dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); });```
do i need to add anything in this
iirc
uh yes iβve understood that
to this line no
but how is dbl.webhook defined?
read above
above where you grabbed https://canary.discordapp.com/channels/264445053596991498/412006692125933568/712195281927798854
oh my god IM SO DUMB
smh
i spent 20 minutes trying to figure out why it didnβt work and the answer was 2 lines above
well, I apologize for having said that the docs werenβt complete
but it still doesnβt explains what url i have to enter in /bot/id/edit...
any answer?
the on i have to enter in my botβs edit page
if you want to enter a url, it's for the dbl webhook
you have to enter smth like https://[YOURIP]:[PORT]/dblwebhook
if you dont know your ip coz ur using glitch, simply entyer [projectname].glitch.me instead of [YOURIP]
what does that test button do in that section?
you have to enter smth like
https://[YOURIP]:[PORT]/dblwebhook
and what port do i give if its glitch?
if you dont know your ip coz ur using glitch, simply entyer [projectname].glitch.me instead of [YOURIP]
Port excluded
Port is 3000
dbl.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
does this work or need to be webhook?
dbl.webhook.on
ok
Not really sure why they would be fussy about self signed but not enforce https
@echo salmon Exactly, if self-signed is not allowed, why plain http is allowed. And vice versa, if http is allowed, why self-signed is restricted.
Β―\_(γ)_/Β―
what are the methods of vote in dbl.webhook.on('vote', vote => { });? And is vote.user and object or a snowflake of the user ID? (i'm asking this because there is no intellisense and I haven't found anything in the docs on top.gg)
I have found this on github:
/**
* Event that fires when the webhook has received a vote.
* @event DBLWehook#vote
* @param {string} bot Id of the bot that was voted for.
* @param {string} user Id of the user that voted.
* @param {boolean} isWeekend Whether the weekend multiplier is in effect, meaning users votes count as two.
* @param {object} [query] The possible querystring parameters from the vote page.
*/```
but there isn't the names.
is this vote.user ?
/**
* @param {string} user Id of the user that voted.
*/```
dbl.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });``` does this work or need to be webhook?
@spark sphinx What is the npm name
i think dblapi.js
someone that use python can help me using on_dbl_vote.. this didn't work
try channel search
i will try using webhooks
exactly what was supposed to be my webhook_path ='/dblwebhook'
and webhook_auth='my password'
i'm hosting my bot in heroku
@mental echo yes
@safe pewter webhook_path = the page component of your webhook url
webhook_auth = the auth headers of your webhook url
for hosting in heroku, your full webhook url will be PROJECTNAME.herokuapp.com/dblwebhook (or whatever you set in your webhook_path)
your webhook_port should be whatever heroku allows you to use, usually port 3000
sumarizing:
in your program: webhook_port=3000, webhook_auth="whatever", webhook_path="mypath"
in top.gg: URL: MYPROJECTNAME.herokuapp.com/mypath Authorization: whatever
and how can I use on_dbl_test, just vote in my bot even when him was already voted ?
last time i checked, dblpy had a separate event for that
test instead of vote
so yeah, when you press the test button in top.gg you should receive a on_dbl_test event
Authorization = whatever you put in your webhook_auth
URL = your heroku url plus whatever you put in your webhook_path
heroku url ?
I need to put https:// in path?
its optional
this is my path then appname.herokuapp.com/dblwebhook
its the same as herokuapp url?
just "/dblwebhook"
yes
heroku uses 3000 by default i believe
they should also have an environment variable for it
idk how you access env variables in python, should be a PORT env variable
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("got event!")
print(data)
logger.info('Received an xx')
well, I clicked in the test and nothing happen
dm me your heroku project name
someone who will help my FIveM is set in Japanese I tried reinstal again it is the same
@safe pewter is your bot online?
yes
hey. I host my bot on an ovh server, and i've set the webhook on its IP. But I have a problem with the server : when I listen to dbl.webhook.on('ready'..., it works but it says the hostname is 0.0.0.0... why?
dblapi.js does not do ip discovery, it doesnt know whats your real ip address
it just shows 0.0.0.0 as a place holder
its your responsibility to provide the correct ip
so it's normal if hook.hostname doesn't work?
ok. thanks π
If I didn't make any error in the code and in the url i gave to top.gg, then where could I have made one?
guys what is webhookAuth? how can i get?
You create one yourself
where can I create it?
in your code
It's a password you decide
like thisβ’οΈ
webhookServer is my server id rigth?
no
webhookServer is a custom webserver if you have one, like express.js
otherwise leave it empty and use webhookPort instead
i dont hve
Hey guys.
So now that I have a token, I add the following to each shard?
new DBL( token, bot )
sure
Is it possible to get a list of bots, but sorted by guild count instead of votes?
Ah
sorts querey
-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
hey, I am trying to check if a user has voted and I keep getting 401 Unauthorized I have checked if the token and everything is correct, when a user votes it receives that okay but checking if a user is voted is the issue. any ideas?
when using .hasVoted() is the issue
I cannot seem to print the vote data when a user votes. but i can view the upvotes with the dblpy.get_bot_upvotes() How do you use on_dbl_vote Because this is my listener @commands.Cog.listener() async def on_dbl_vote(self, data): channel = await self.bot.fetch_channel(<my channel id>) await channel.send(data) print(data)
but whenever i vote no data gets printed or sent to the channel.
webhook_path is the thing right after port and IP in URL
what does this mean?
(node:11434) UnhandledPromiseRejectionWarning: Error: postStats requires 1 argument
it seems like it comes from here
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
@brisk saffron is that the JacaScript one
Java
ffs
I cant type
f;knfporeog
my brain is dead
my condenlences...
how to get password?
you make it
i dont understand
oh
how about URL?
where is your bot hosted?
PROJECTNAME.glitch.me/dblwebhook
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000```
what is that
@vapid cape ur an expert. What does the Webhook on dbl do
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!`);
let embed = new discord.RichEmbed()
.setTitle(`User Voted!`)
.setDescription(`User: <@${vote.user}> just voted!`)
.setFooter(`Your vote helped us!`)
client.channels.get("711903042810937344").send(embed)
});```
This isnt working, what might be the error here?
It should show the error
Ah ok
@restive otter does the console.log not work either?
does the "webhook running at ..." work?
@vapid cape nope
const dbl = new DBL("I've put my token here", { webhookPort: 5000, webhookAuth: 'password' });```
this is my config
You can stream if you're a bot dev, also wrong channel
@restive otter add your client as argument to that function
I guess that's needed to receive votes, although the token already specifies from what client to get the votes
@junior tusk?
const dbl = new DBL("I've put my token here", { webhookPort: 5000, webhookAuth: 'password' }, client);```
@restive otter like this, or do `bot` instead of client. Just whatever your `new Discord.Client()` is called
ok
-api @nocturne fjord @restive otter
@nocturne fjord @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
I did not understand too much the configuration of the webhook could I have help please thanks
which part do you need help with?
for create a link of webhook @vapid cape
I didn't really understand what I had to write.
for receiving webhooks you have to create a webserver
in top.gg you will put the URL of your webserver
the official libraries, such as dblapi.js will create a webserver for you
the URL depends on where your bot is hosted
if at home, or in a vps, the URL will be your ip address and port
if using heroku/glitch/repl, the URL will be your project url
top.gg webhooks are not discord webhooks
I have this problem if anyone can help me. So say I have bot 1 with token xxxx and bot 2 with token yyyyy. Both have the exact same code that tryβs to get the owner ID of the discord which is me. But bot 1 will successfully grab that ID but bot 2 will say that βcannot read property id of null. Why is this?
One has you cached
The other does not
Use the ownerID property instead of owner.id
Thw owner property is nullable
The ownerID property is not
Also wrong channel use #development for that
The api isnt updating my bot guild count anymore for the past 2 days, how can i fix this?
I know that this is answered in docs somewhere, but I can't find it.
Do I need to use the dblapi to make my bot show up as "online" at top.gg?
No
Hello people
hello
hey! my bot is linked to top.gg (the server count works very well), but the test button doesn't work. any idea why?
did you configure your webhook settings properly?
holy crap did I just put my token on this channel
ffff****cccckkk
@vapid cape well, here is my code again without the token js const dbl = new DBL('super confidential token here', { webhookPort: 5000, webhookAuth: 'password' }, client);
and in top.gg, I put http://IP:5000/dblwebhook with the right password
but the tests aren't detected
even if it's linked
where is your bot hosted?
an ovh server
have you checked if it has some kind of firewall in its admin panel?
some hosts have a firewall that needs to be configured to allow port 5000
otherwise try making a POST request to yourself with https://reqbin.com
ReqBin is an online API testing and prototyping tool.
Test your API by posting REST, SOAP, and HTTP API requests right from your browser, and check server responses.
nice idea, I'll do this
if you get unauthorized, the url is working
otherwise, the url is inaccessible or blocked
@restive otter might be because JDA isn't initialized when you post your stats. try JDABuilder[...].build().awaitReady().
(ping me if you reply)
@narrow coral did you solve the status problem ?
@lucid mesa Nope. My bot is still waiting for approval, so that's probably why.
You mean the server count?
btw your bot wasn't even added in here after approval i think 
I already put the widgets on the github page but they don't work
Hmm.
Oh it has to be in the server ?
Is it removed if it says "@ invalid-user" in the logs ?
Yep, for the bot to show up as "online" on a widget, the bot has to be on the server
Why was it removed if it got approved then?
I think the Moderator who approved it forgot to add it in here
API docs specify a ratelimit of 60 per minute. I'm assuming that also relates to .hasVoted( )? So we should probably cache votes we receive via webhook on our end?
Because if I, with every command, check if a user has voted and get 100 commands a minute, I've just blocked myself for an hour
Yeah, it's recommended to use webhooks generally
The example doesn't really support DJS' sharding manager, as once the first shard is launched, the addr is already in use
that's because it doesnt
and it isn't intended to.
I would just have a database, make my own webserver, run it 24/7 and adding the votes to the database so it works while your bot is off if it errors or something
then just from the bot connect to the database as well
Was thinking that's what I'll need to do. Cheers dude
@spiral steeple - If I wanted to do something like "Thanks for voting!", would it not work to use a webhook on the first shard?
Like dming them?
I mean you could, not sure if discerning that the current shard's id is 0 like that works though
With DJS, you can assign shard IDs - so should be safe, I think?
Can anyone recommend me a website to make a discord.js warn system like mee6 and duniya
And
My bot is having problem connecting to my mongodb database it shows the error EREFFUSED
or something like that
Idk read the docs and make one
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
Hey. In the docs, i've found how to get the 1000 last votes, but is there any method to get the number of votes please? Thank you
What's the vote api's ip adress so i can whitelist it through my vps's firewall?
I dont like opening a port to the entire internet basically
you wont get the ip because the api goes through cf
Oh ye but why doesnt the api work the ports are open..
test it with reqbin
Auto post 0n python isnt working
whats your code
-api @cedar otter
@cedar 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
oop
Hey. In the docs, i've found how to get the 1000 last votes, but is there any method to get the number of votes please? Thank you in advance
hi
can someone please help me with autopost server count in topgg
please
ping me if you can
-ask2ask @restive otter
@restive otter
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.
@brisk saffron an array is returned so you could use something similar to .length
i did ask?
so the value won't be over 1000? @sullen nymph
The length won't be over a thousand, you'll have to use webhooks for that :p
@restive otter What exactly do you need help? Posting your bot's server count on top.gg?
what do you mean? I'll have to make my own count system based of the webhooks' events?
ys
i have that
what do you mean? I'll have to make my own count system based of the webhooks' events?
@brisk saffron :p https://top.gg/api/docs#votes
π
You need a top.gg token which is available once you own an approved bot
@sullen nymph then?
-servercount @restive otter
@restive otter
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.
You could use an official library or send your bot's server count yourself
How are you declaring DBLClient
You could use an official library or send your bot's server count yourself
@sullen nymph idk how
Why is that weekend right now ? Votes count twice and the API says it's weekend. Is this an error?
Friday-Sunday
can someone please help?
wwooow but that's great xD one day more in the weekend it's the best idea i've ever heard
you're not initializing a webhook though
@restive otter What's the library you use for your bot
discordpy
You can use dblpy and refer to the official documentation
wait @spring otter you use the same lib right
can you help me with this
As long as the URL you enter on top.gg is correct and your port is open, it should work
There should always be a URL
is there any reason why my bot has 50 votes but the API says there's only one?
i'm using .getVotes()
and I have one more question: why does all the docs links seem dead?
@brisk saffron cache and no they're not
how to clear the cache? and how could there have cache if I never used the method before?
and if the links do work, could you send me a way to get in this one?
What does your DBLClient look like currently
do you actually have it as `http://ip:port/dblwebhook
well by default thats what it is
Edit webhook_path to your needs, just make sure it starts with /
It only accepts POST
Send me the URL in DMs
How i can get VOte value with dblapi.js
.getBot
Refer to https://top.gg/api/docs#jslib
authorization is your choice you can set whatever you want
and, i don't know URL in vps sorry.
Did you read the docs yet
wait
yes
That's the JSON returned
Just access the points key
ok
how can i get the URL? using local host

