#topgg-api
1 messages · Page 128 of 1
use the libraries example listed on the npmjs site i linked to, fill in the auth and port.
auth and port?
then on your bots edit page in the webhook section fill in the url and auth
app.listen(3000) // your port
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
?

¯_(ツ)_/¯
you can leave it at 3000 if you want, if 3000 is open and available
k
the auth is the auth between your bot and top.gg
it can be any string as long as its secure.
Eh im still dont understand
i would suggest doing some research on http servers and how they work then.
I dont understand grammar
but js const webhook = new Topgg.Webhook('topggauth123')
Topggauth123 for?
verifying requests
think of it like the password of the webhook
thats what auth's are, just authentication of a thing.
i have no idea i can think of password
that works too
ikr
its how i make all my passwords ;p
i did change password then what
i got the superior password method
fill it in on the website in the webhook section
QQERAHERWsjtrt23y546t7iy8ghj
with the url
[...Array(4)].map(() => Math.random().toString(16).substr(3)).join('')
Pasword with hex chars
ooooooohkkk
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('Ialreadypasteherepasswordlol') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware
app.listen(3000) // your port
then what
that's it
did you fill in the url and auth on the website?
no
you can do stuff with the req.vote object
do that.
am i on the 4th time saying this now?
your bots edit page
in the webhook section
yep, fill it in with your info.
any firewalls youll need to open port 3000 on
my bot console crashed
internal/modules/cjs/loader.js:834
throw err;
^
i start my bot
but it crashed
i need add javascript login?
whats the full error?
found 4 vulnerabilities (1 moderate, 3 high)
run npm audit fix to fix them, or npm audit for details
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module '@waxen widget-gg/sdk'
Require stack:
- /home/container/server.js
i use dbd.js
did you install the module?
i need add JavaScript Login?
you need to install the top.gg sdk
https://www.npmjs.com/package/@top-gg/sdk
npm i @waxen widget-gg/sdk
well
i did
that failed
the error says its not installed
ok
someone can change @waxen widget 's username turn to nickname something
so we can use easy
k
@top-gg/sdk
are you installing in the correct directory?
yeah
your bots directory.
whats your package.json look like?
"name": "-asdf",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"engines": {
"node": "12.x"
},
"author": "",
"license": "ISC",
"dependencies": {
"dbd.js": "^1.2.0",
"canvacord": "^5.0.8"
}
}
any sus?
looks like you didnt install the library.
i did
your package.json says you didnt
what
you have these two installed
"dependencies": {
"dbd.js": "^1.2.0",
"canvacord": "^5.0.8"
}
only those two
does it error when you install it?
@jaunty plank well?
npm i @waxen widget-gg/sdk..] / preinstall:-asdf: info lifecycle -asdf@1.0.0~preinstall:
npm WARN -asdf@1.0.0 No description
npm WARN -asdf@1.0.0 No repository field.
How does one go about getting the overview server count with the API.
i get this npm i @top-gg/sdk..] / preinstall:-asdf: info lifecycle -asdf@1.0.0~preinstall: npm WARN -asdf@1.0.0 No description npm WARN -asdf@1.0.0 No repository field.
@jaunty plank u can help me?

how do i fix this
Does anyone have a Discord.js example of how to check when someone has voted?
https://top.gg/api/docs has one
though if you're referring to discord.js
#topgg-api message read this
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Are the ports random?
Like does it matter what I put as that value?
use the top.gg/sdk
and yes, the webhook port matters
as it is important for the request url
webhook url being the webhook url from your bot, in your example it would be http://yourserverip:5000/dblwebhook
What is server.ip?
K, thanks
Would the webhookAuth be the "Authorization" value that I put in?
correct
Alr, ty
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
What should I put on (yourDBLTokenHere)?
your dbl token
Help?
hey, whatcha need?
Do u have to have a approved bot on dbl to know ur dbl token??
you can find your bots dbl token on the docs
Hmm, i can't find it, it says i don't have bot
is it approved?
in the api to see the top.gg bot status, my bot has the lib "undefined"
the library option has been deprecated on top.gg
I understand
Hey
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
What does Password at webhookauth mean?
Like what kind of password?
const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path}); }); dbl.webhook.on('vote', vote => { console.log(User with ID ${vote.user} just voted!); });
What is DBL token and password and where can I get them?
Same question lmao
I don't really understand lmao
U Get token from the docs I think
How about password?
Not sure
Just change dbl token and password in this code?
Yh I guess
what pass do we enter though? lol
@violet panther
wait nvm
pass can be anything
i'm getting this error any1 able to help
read the error
i did but do not get it lol
i installed the api
i did dblapi@latest
or do i need to add it to package.json?
if so what version
@restive otter
yh i did do dblapi.js
then install the new sdk
look at the pins
hey guys can anyone guide me thru it?
i'm lost lmao
const DBL = require('dblapi.js');
const dbl = new DBL(config.DBL_TOKEN, { webhookPort: 5000, webhookAuth: config.AUTH_PASS });
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!`);
const webhook = new Discord.webhookClient("..", "..")
webhook.send(`${vote.user} has voted Pogy!`)
});
so first, is this correct?
i think so
this is the one i'm using
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
and yours work?
can we keep the webhook auth password?
or should i change it?
any1?
what would the webhook url be?
const Topgg = require('@top-gg/sdk')
const app = express()
const webhook = new Topgg.Webhook('')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote.user)
})
app.listen(1111)
this also doesnt work
i give up -.-
wait i need to fill something in my bot section?
yep.
yeah, the url will look something like
http://ip:1111/dblwebhook
and your auth seems to be empty
alr did
maybe because im not using a vps?
if you have a firewall youll need to open that port too through the firewall*.
ah
where would i find my dbl token?
and i assume its the token set for the bot?
yh
Hello! I'm updating my bot and adding to it shards, but, on in the newest version of discord.js (v12 stable) client.shards.id and client.shards.total are undefined
How can I take that ?
client.shard.id shows the current server's shard's id as far i know.
I think its client.shard and not client.shards
client.shard I think it doesn't return id
Wait, let me check
Nope, it doesn't return the id
Maybe because i extended it ?
I don't think there is a .id property for discord.js, are you looking for the ids instead (or even the total count using client.shard.count?)
The id it's easy to take, just go in client.options.shards
And it returns an array with one item inside
(And that's the id)
There is the shardCount too but, I don't know if it auto-updated itself
When a new shard spawns
Bonjour,
Y-a-t'il des français svp ?
C'est pour de l'aide pour le webhook de vote
It is for help for the vote webhook ^^
But if there is french people, it is better.. ^^
#general-int for french
I have in my console log : "(id) have voted for me !"
Like : 320611120484188162 have voted for me !
But how can i use "dbl.getUser(id)" for have the discord username of the voter ?
ok so i speak in english ^^
either get it from the cache or fetch from the gateway, you're not getting it using dbl client 
So i can't take the username with dbl ? I'm forced to use the cache of the bot ?
My english is bad sorry
It's a Discord ID.
yes but if the person is not in the cache of my bot ?
You need to ping Discord for the information regarding whom the ID belongs to
Coding language?
1
With that I have for example : "320611120484188162 a voté pour moi !"
In my VPS console
But I want the discord username of the person with this id without use the cache of my bot..
Note I don't use JavaScript. But 5 minutes of Google search says this
Client.fetchUser(id)
I know it ^^
Actually, I think you can fetch the user from top.gg as well, as they have logged in to the site. Though the discord rest is probably more reliable /s
u mean <Client>.users.fetch(id)
i will test, but i think i have already test it
i think too with dbl.js but i'm blocked to use the doc..
Should probably check if there's a java binding for the API at some point 
in the dlb doc api i have found :
dbl.getUser("95579865788456960").then(user => {
console.log(user.username) // "Tonkku"
});
but "user" seems undefined
Are you using that specific example?
no it make me a error
With :
dbl.webhook.on('vote', vote => {
const voteur = vote.user
const user = client.users.fetch(voteur)
console.log(`${user} a voté pour moi !`);
I have :
[object Promise] a voté pour moi !
But I want :
@tough chasm a voté pour moi !
await fetch
hum ok
it says to me "await is only valid in async function"
where I put "async" ?
i'm in the main.js
does anyone have example code of how to print the latest votes on top,gg? docs aint helping
yes
python
I was curious. Is there a way to test the API before hand?
Like seeing how everything works before uploading it to my main server?
Or are the states and stuff I upload just going to be a little wacky until I run the update?
You can make a seperate program for testing the api.
It is what i do too ^^
I do have a test bot.
because i can't reload "my" 1000 servers bot all the time
check if the request is being received in the first place
do a console.log or something
send link i vote
It is because my bot appears in the server N / A And I want it to put the rales as I do?
https://top.gg/api/docs#intro you need to post your server count.
how i can make vote messages?
wym
Quand tu as une promise, soit tu await dans une fontion async, soit tu .then(m => m.TA_DATA)
D'accord un collègue m'a dis pareil. Merci @merry oracle et pour récupérer le nombre de votes, savez vous comment je dois utiliser ".points" ?
ça je ne sait pas, je n'utilise pas l'api dbl 
d'accord merci quand même ^^
Tien
const request = require("request");
const cheerio = require("cheerio");
request('https://top.gg/bot/<BotID>', (err, response, body) => {
if (err) throw new Error("Une erreur est survenue. . .");
const $ = cheerio.load(body);
console.log($("span > b").text());
});
``` Je t'ai fait ça rapidos.
humm bizarre comme code, moi j'ai fait ça, j'y suis finalement arrivé
dbl.webhook.on('vote', vote => {
client.users.fetch(vote.user).then(userr => {
dbl.getUser(vote.user).then(user => {
dbl.getBot("id").then(bot => {
console.log(`${user.username} a voté pour moi !`)
const embedVote = new MessageEmbed()
.setColor("BLUE")
.setTitle("Top.gg | Discord Bot List")
.setThumbnail("https://cdn.discordapp.com/attachments/769306794001563688/798264505590743060/dblnew.png")
.setDescription(`:arrow_up: • \`${user.username}#${user.discriminator}\` a voté pour \`Scord\`, merci !\n\n__Total__ : **${bot.points} votes**\n\n[Votez vous aussi !](https://top.gg/bot/id/vote)`)
.setFooter(user.username, userr.displayAvatarURL())
.setTimestamp()
client.channels.cache.get("797885128076034058").send(embedVote);
vote.user.roles.add("798274785809268817")
})})
})});
ça va juste scrapper la page web de top.gg, et récup la balise <b></b> contenant le nombre de votes
ah bien vu
moi j'ai directement fait avec le module de bdl.js
MErci quand meme bcp
Hi, i try currently the api and I would get infos from the api. If I do following
curl -H 'Authorization: *API_KEY*' https://top.gg/api/bots/*BOTID*/stats
I got this error:
{"error":"Not Found"}
*API_KEY* is my top.gg api key
*BOTID* is my client id of my bot. is this correct and why I got this error?
how i can make vote messages?
Re-ckeck the api about the endpoints
I checked it. with other bot ids its work, but only not with mine. Maybe because my bot is currently not reviewed
Your bot is not approved
unapproved bots do not work
which i can tell by you not having the dev role @split marten
Ok thanks ^^
discord.js v12:
const client = new Discord.Client({
sync: true,
ws: { intents: 1537 }
});
const AutoPoster = require(`topgg-autoposter`);
AutoPoster(my_topgg_token, client);
Error: Unsupported Client
does anyone know why?
ping me if you know
um
can I use the same webhook
and server side handling
for my server?
because i already have a backend set up
using the node sdk
but whenever i test the webhook
for my new server
it doesnt work
I see that server vote tracking is possible but I only see vote.bot as an option; not something like vote.server. Am I missing a page? I only see bot info but I've seen bots that have server vote info.
i think the lib doesn't support server vote webhooks
@app.route('/dbl', methods=["get"])
def dbl_get():
return make_response("", 204)
@app.route('/dbl', methods=["post"])
def dbl_post():
requests.post("https://discord.com/api/webhooks/channelid/your.webhook.token.here",
json={"content": f"<@!{request.json['user']}> upvoted. ty!",
"allowed_mentions": {
"parse": []
}
})
return make_response("", 204)
my flask webhook
i hope it helps someone
https://github.com/shivaco/DBL-python-webhook/blob/master/listener.py It's not hard to create one
Flask script mainly to handle POST requests from top.gg - shivaco/DBL-python-webhook
You could also take into account test requests
self.bot_id = 738436499866910803
self.token = 'token' # set this to your DBL token
self.dblpy = DBLClient(self.bot, self.token, bot_id = self.bot_id)
@commands.command()
async def check(self,ctx):
try:
await ctx.send(await DBLClient.get_user_vote(self.dblpy, user_id=ctx.author.id))
except Exception as e:
await ctx.send(e)```
I'm trying to pass a custom id of the bot but it seems that it isn't reaching `self.bot_id` variable in DBLClient. Any idea on how it is properly done?
and don't mind the spaces and plz ping me
how can i get dbl token?
That is something you define yourself
If you don't use webhooks for your voting, you can ignore it
topgg-autoposter?
yeah
ignore it
self.dblpy.get_user_vote plz ty
oh great
Anyhow, DBLClient doesn't utilize a bot_id arg
yeah i was guessing that too but could not think of any other way
dblpy takes .user.id of the provided bot/client object
Hello everyone,
In https://top.gg/api/docs, in the "bot" section I can find MonthlyPoint & Points. I have put it in my code but It not seems work.
Can someone explain me the goal and how to use it please ? Because when two people are voting I have this:
"15" for the 2 votes, and I have put "MonthlyPoint"
(Sorry for my bad english, I'm french)
This is caused through caching.
Only way to fix this is tracking the amount of votes yourself
oh okey, so it is the same for "Points" ?
ok thanks for your time
I find that dlb is not very well optimized, it is rather complicated to understand in their documentation
so i'm trying to make a vote tracker using @waxen widget-gg/sdk
wait nooo i didn't mean to ping
i wanted to ask for help with setting up a webhook
i don't understand how to set up a webhook in top.gg lol can anyone help
yeah
There is a page like https://top.gg/bot/idOfYourBot/webhooks
ok i'm at the page
You have to put a "password" in authorization
i already have the password and stuff i'm just struggling with like putting in the webhook url
and put the adress of your bot like for example http://151.151.515.151:5000/dblwebhooks
151.151.. is the adresse of your VPS
uh how would you get your address
In your vps you have an ip
how can i show server count for my bot?
if you mean like in an embed or something else then try (Client).guilds.cache.size where (Client) is a client object
why it is not showing server counts?
Spice up your Discord experience with our diverse range of Discord bots
you need to post that yourself
Do i need to add python library to my codes
yes if you wish to use the api through a existing library
or you could do it manually through requests
where can i find that?
can anyone help me regarding automatic server count for python
<@&304313580025544704>
-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.
you can ask your question here and wait for someone to respond.
ok sorry
can anyone help???
@restive otter maybe this?
how can i get the html code like this widgets?
ty
9
const webhook = new Topgg.Webhook(`what i have to put here ? my top.gg token or the authorization key ?`)
pls can anyone help me
authorization key
hmm ok
hi
Oh shoot sorry!
I'm good thanks
Won’t happen again
np
whats the error?
ReferenceError: Cannot access 'bot' before initialization
@jaunty plank
bot is my client
well, there you go, put your usage of bot after initlization
^
oh ok
you cant use something before its declared.
i mean 3 months are a lot but k
this is going to take a me a long time to know how to declare my bot
you already do.
i do know?
yep, your just doing it after you use it
this is real confusing
you know what variables are right?
a little bit of variables
yeah well
when you do let myVariable = 'foo', you're declaring the variable
you can't use variables before you declare them
so declaring a variable is like declaring a bot?
your bot variable is a variable.
yeah
after you use it
after i use it?
yeah, so in the programming world theres an order to things.
if you want to use a variable you must declare it, then use it.
you cannot use a variable that doesnt exist yet.
think about it from the computers perspective.
you are telling the computer "I want to use bot! heres what i want to do!" before you tell it what bot is, or that bot even exists.
eek dont get it
guess i have to figure it on my own
//declaring the variable then using it.
let variable = "some string"; //declaring a variable named variable
variable = "some other string"; // using said variable
//using the variable then declaring it, resulting in an error
variable = "some other string"; // using said variable
let variable = "some string"; //declaring a variable named variable
in the second example, the computer wont be able to understand what "variable" is because i havent told it what it is yet.
atleast at the time it was used.
this is a javascript thing, not a discordjs thing.
OMG I THINK I FOUND IT
ok there is no errors
now how do i know
nope did not come
dbl statistics did not say how many servers
Does anyone know why I am randomly getting spammed with this at times?
Ah, could it be due to the API being down?
Yep, will have too
So what is a top.gg token
so do I insert client id of my bot or token of my bot or is it completely different
When you click the button 'test' to test the webook on topgg, what is supposed to come up?
a little window saying "test successful"
it says that if you have put the correct webhook auth and url or not.
Uh, could you help me with that? :x
Is this the right syntax? https://top.gg/bot/:781034602533879838/webhooks
https://top.gg/bot/781034602533879838/webhooks
^ will just take you to the webhook section of your bot
its not the url you should put in the webhook url section
ohh i have to get rid of the ":"
yep, but its not the url that goes here. https://i.imgur.com/CjSlQvH.png
oh, what am i supposed to put in there
the url to your webhook receiver.
sorry im dumb, how do i create a webhook receiver
what programming language?
discord.js
using the sdk https://www.npmjs.com/package/@top-gg/sdk
How could I find my express app because I got this error:
Error: Cannot find module 'express'
nvm I actually had to install it
Yeah, you’ve gotta install it in order for it to work.
how do we make this show my server count (discord.py)
your bot needs to be verified first, however https://top.gg/api/docs#pylib
and that first automatic one
just putting that code in there should do it
and of course importing dbl
i sure hope so 😄
you will need to fill in your bots top.gg token in which will show here once approved.
https://top.gg/api/docs#mybots
ok ty
im only 40% until verified
but already done 2 major updates in the time waiting
what programming language is the bot written in?
java Script
you can use this https://www.npmjs.com/package/topgg-autoposter
install with this. npm i topgg-autoposter
only two lines you really need.
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('topggtoken', client) // your discord.js or eris client
you can find your top.gg token here https://top.gg/api/docs#mybots
Do i have to install the API? Yes sure
the autoposter has to be installed yes
What i do is i use the api docs method but set it to refresh at a rate
bevore i use that i have to do this, right?
yes
thx
it works
but its no longer the right thing to use
true
and is more complex than the two lines this lib uses
who?
how do i get the bot to console log when testing, my code:
const DBL = require('dblapi.js');
const dbl = new DBL(`my topgg api token`, { webhookPort: 5000, webhookAuth: '03190319' });
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('03190319')
app.webhook.on('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 121919449996460033
}) // attach the middleware
app.listen(3000) // your port
});
ping me pls
How can i make vote messages? Ping me pls
setInterval(() => {
dbl.on("posted", () => {
console.log("Dbl posted");
});
}, 900000);
If I Use This, will my data refresh every 15 minutes? 🤔
you need to use setInterval on posting the data, rather than console logging
Edit: use dbl.postStats
Can you help me cause I don't think I understand 😑
.postStats basically uploads data to top.gg, so in your case, you want to upload data every 15 mins, so you would use setInterval on posting the data
ok i understand thanks
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 900000);
});
I guess that way
yes, but it's client.guilds.cache.size
ok
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); what is the password there?
if you're using webhooks, change it to whatever you want
it should match the password you entered on your bot page webhook settings
on your bot page settings
oh yea
i got it
thanks
uh https://top.gg/bot/:ID/webhooks what do i change here?
kk
So what do i put in the webhook url? see, im new to this, so i dont know anything
It should be http://yourserverip:port/dblwebhook
replacing yourserverip with your servers ip and the port with the webhook port
The server you're hosting your bot on
чего блять
Why is the server counter inaccurate?
it can't be inaccurate, unless you're wrongly posting your server count
It is wrong by 3 numbers
then you posted it wrong
How so? It has been working fine until yesterday?
(node:39) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.<anonymous> (/home/container/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39) 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: 11)
[dblapi.js] Warning: No DBL token has been provided.
How do i fix this?
Add your dbl token
oh ok
thanks
Can someone please help us program a discord bot? (I would LOVE if @gritty jasper can)
what
#development for development help.
Busy, sorry
first, this chanel is top.gg api,
Second, what in the world makes you think carl would help at coding your bot
Hi
How can I lock commands only to people that voted (discord.py)
your best bet is to keep track of voted users in a database
then just check if they are in it.
ok
how does the on_dbl_vote event work with the python library. how do i need to have the webhook path set and all that to make it work.
mod commands op
ok so i made the dbl client with webhook_path="/dblwebhook" webhook_auth="auth" webhook_port=32485 and port forwarded 32485 and set the webhook url to http://mypublicip:32485/dblwebhook then sent a test but the event isnt being executed. is there something wrong with my port forward options? Protocols: TCP. Start, End, and Target Port: 32485.
hey, do you use the test event in your code anywhere?
yeah i have this
@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:", "\n", data, sep="")
im gonna redo my port forwards maybe i did something wrong
you can always try making the request yourself and see if it reaches it
need help with a stats command
let guilds = bot.guilds.cache.array().join('\n')
const serverlist = new Discord.MessageEmbed()
.setTitle(`HyVerify Server Count:`)
.setDescription(guilds)
.setFooter(`Thanks for using HyVerify! :heart:`)
message.channel.send(serverlist)
}```
i'm getting this error with the first line
Hello how can I use get_user_vote in python to make vote to use commands
hi, i'm getting this error (for the first time ever). I've waited over 3 hours but it still keeps on throwing this error.
how long will "temporarily" last, and will I have to contact discord support?
my bot is in python by the way
5-10 mins
about an hour or a few
next time ask anything about something that's not top.gg API in #development
Yes I read but I'm unclear how to use it in a command so when the command is run , it will check if user has voted if voted then only execute
I suggest you use the webhooks unless you have some sort of a caching system you will rely on to reduce the number of API requests you're going to make via commands
Ok.... Can I find examples somewhere cuz I'm very new to this api
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
Refer to the webhook example
P.S. make sure your port is open via TCP protocol
Ok thanks
Can anyone give an example of what the webhook looks like?
py right?
Yes, just the webhook Tho, like the test one?
Like what does the request look like?
Yes
https://top.gg/api/docs#webhooks data format section.
All the data is sent in the url?
its sent in the body, not as query parameters(in the url)
O ok ty
i think you are more looking how http requests work, which this might be useful for you. this article mostly talks about get requests, which webhooks generally are post requests, and are slightly different.
https://medium.com/better-programming/the-anatomy-of-an-http-request-728a469ecba9
Hmm
Interesting mindfuckery for future reference... every JSON key in the request passed as a function parameter.
static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "BAKIM MOD:ON";
discordPresence.details = "BAKIMDA";
discordPresence.largeImageKey = "unnamed";
discordPresence.smallImageKey = "unnamed";
discordPresence.smallImageText = "işteee";
discordPresence.partyId = "ae488379-351d
me turkish bot
yok ED KRAL
me English-speaking bots and I can see the channel topic that says "TOP.GG API ONLY"
Also, Turkish in #general-int
oki
webhooks
and pinned messages
i did it
i console logged where the webhook is running
dbl.webhook?.on('ready', (hook: { hostname: any; port: any; path: any; }) => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook?.on('vote', (vote: { user: any; }) => {
this.client.channels.cache.get(`799201317154455573`).send(`User with ID ${vote.user} just voted!`);
});
i wanted to know why isnt the bot sending message when someone votes it? 🤔
you need to add your webhook url to your bot page settings
also, don't do port: any, path: any
you need to provide a webhook port and path
Though use the newest library https://github.com/top-gg/node-sdk
My bot is no longer able to recieve data and send data to top.gg.
Is there a reason this might be?
@analog bison https://github.com/top-gg/python-sdk
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
@rain heart Thank you!
discord.js v12:
const client = new Discord.Client({
ws: { intents: 1537 }
});
const AutoPoster = require(`topgg-autoposter`);
AutoPoster(my_topgg_token, client);
Error: Unsupported Client
does anyone know why?
ping me if you know
what do you mean?
can i see the full code?
there's a ton of crap in between
none of it has to do with that though i would think
where you define Discord might
it's at the top
using require('discord.js') right?
yes
hm
alright try and do this
const ap = new AutoPoster.DJSPoster(my_topgg_token, client)
so yeah it's something to do with how you require('discord.js')
do you mess with the require.cache at all?
i haven't had any issues with discord.js so far so i'm not sure what i could be doing wrong
maybe just try and do npm i discord.js again
Error: Not a discord.js client.
Does my bot need to be approved for me to get my api key? And what does an api key do?
is there any reason why you think this would happen?
Is it possible to make a bot send a message into chat everytime somone votes for my srver using the api? (discord.py)
you sure you're not accidentally redefining client somewhere, try putting the ap definition right below defining client
ok i'll try that
lets you access the api, and yes you do need to be approved first
webhooks
How do I setup a webhook?
https://pypi.org/project/dblpy/ second example
Like the one in the editing page?
same error, not a discord.js client
ok tysm
it's in a cog, i'll just convert it doe
const client = new Discord.Client({
ws: { intents: 1537 }
});
const AutoPoster = require(`topgg-autoposter`);
const ap = new AutoPoster.DJSPoster(process.env.DBL_TOKEN, client)
```Error: Not a discord.js client.
that's very strange
is there still a way to do it manually
what does the shardId option do
you can remove it if you're not sharding
i am sharding
what kind of sharding?
i just put it on the shard that posts the stats, that's fine right
are you using the ShardingManager?
yes
ok im gonna recommend you use the AutoPoster one more time lol
you can pass the ShardingManager instead of client on the master process
@client.event
async def on_dbl_vote(data):
channel = 798293384133214240
await channel.send('USER VOTED')
print("Received an upvote:", "\n", data, sep="")
@client.event
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:", "\n", data, sep="")
channel = 798293384133214240
await channel.send('WEBHOOK TESTED')```
Would this be valid
i'll try that
if you get that same discord.js error you can always just broadcastEval your own stats tbh
try it
i'm just gonna stick with doing it manually ¯_(ツ)_/¯
kk
yea
How do I get my port
Port you define in the code
are you using a vps?
what're you using
just runnning it off my wifi
alright well unless you wanna port forward your local internet it will not work, your bot also has to be approved before you can actually use the webhook
o i just want to make a webhook everytime somone votes for my bot
*server
not bot
is there any way to get # of request that bot can made? rateLimit is emitted only when hits the limit
you can put an auth inside of your code as well or leave it blank
is there a way to make a vote api work with dbd.js
for ex. if bot gets voted the bot gives that user coins a variable etc
dbd.js?
yes.
oh nice to see you again
ok.
idk about dbd.js but you probably will need a webhook
k oof
How would I make it so my bot can check if a user voted (for vote locked commands) thanks!
you wont be able to use it yet though
as you need to have your bot approved
I know.
Just planning ahead.
What specific part of the docs would this be listed around?
Ight, thanks.
!help
hey why the webhooks not work
they do
does anyone know what is the server count API?
ITs called the top.gg api
no-
What language r u using?
Lamguage speak?
Scripting?
programming language
ok now go to the JS Section
Ok, thanks.
Ok, obrigado.
If u follow that then it will work, lmk if u have any issues
have several examples, which one should I take?
Tem vários exemplos, qual deles devo pegar?
@loud jewel
The 1 i'm most farmiular with is the 1st option
Where should I put it in index.js?
Before ur ready event
could you help me in private?
poderia me ajudar via privado?
No, its easier here
Ok
What do u need help with
I give up "-" I don't know how to do that
I’m out rn so dm me and I’ll lend a hand
how new are you
You should know where
By looking at the code
Like I even know your mistake, and it's just an accountant.
Dm me & I'll lend a hand
oh sorry
I got a ClientConnectorError: Cannot connect to host top.gg:443 ssl:default [Temporary failure in name resolution] error trying to post server count, any way to solve this error?
my code's basically the same as the manual example one
python 3.8.7 btw
i suggest getting it from https://top.gg/api/docs#mybots instead
as you can also regenerate it from there
Does anyone know if there is any way to determine if a vote is being cast for a specific server?
check pins for the guild vote schema
oooh nice
thanks
Come fast bro and tell plz
This isnt for general apis
huh
using the api how would i get the date that a user voted for a guild?
would i constantly be checking if a user voted for a guils?
use the webhooks
ill use the wrapper, https://dblpy.readthedocs.io/en/latest/api.html#event-reference does the on_dbl_vote include dsl
so can i provide
a guild id
the wrapper* doesn't support dsl afaik
you will need to make your own webhook for the dsl
mk thanks
soooon
This/next week I'll release a few changes and some other stuff
DSL webhook included
pog
I will update the docs later so throw me DMs if you have questions with future changes and the docs are outdated
ok
what can i use here as a webhook url?
or do i actually have to create one myself?
you have to create one yourself
hello , i forgot how to to get my bots dbl token
hello , i have 2 bots hosted on the same machine , i prepared 2 seperate files for automatic server count , but the count is overwriting for one bot
i checked the dbl tokens but they are ok
Is there some issue with webhooks? My bot page says 37 votes, but I've only recieved 25 webhooks on my server...
was your bot down for any period of time?
oh wait I didn't count the weekends
No, it was not.
I think what happened is that I didn't count the weekend votes as 2 votes, so those would be inconsistent
Alright, I just used the /votes endpoint and that showed I got the correct number of webhooks
so the weekends was the issue.
Also, what time does the weekend bonus take effect?
and when does it end
I see Fridays, Saturdays and Sundays on the docs, but what time zone?
Friday 00:00 - Sunday 23:59 UTC
hey what are all the events from the top.gg sdk
or is it just vote?
guild post, vote, test iirc
ready event also iirc
rtfd doe 
We're currently discussing stuff to make most common libs consistent and sort of. Added plenty of stuff yesterday, just need to finish the rest and we're good to go
poggies
i ran this message.client.topgg.eventNames() but it returns an empty array
why?
Webhook for vote?
hello , i have 2 bots hosted on the same machine , i prepared 2 seperate files for automatic server count , but the count is overwriting for one bot
i checked the dbl tokens but they are ok
if it works then ig its fine
i just fixed it , i guess it dosent like the cogs directory name to be anything but cogs ... weird
is there an issue with getting vote stats? have users reporting my votelocked commands are not working, but they work for me
!api
Is it not there?


