#topgg-api
1 messages · Page 12 of 1
nice
Now you just need the votes and you're ready xd
yes...
i love this one commit
There's many like it
there's moments where I forget everything
and do 5 commits in 5 minutes
like forgetting to remove debug purpose console.log
lel
How come sometimes when users vote, it doesn't get sent to my webhook? I think it started happening recently.
also, does this show if user voted in the past 12 hours?
I'm using this code but is not working
const express = require("express");
const Topgg = require("@top-gg/sdk");
const app = express(); // Your express app
const webhook = new Topgg.Webhook("my auth is here"); // add your Top.gg webhook authorization (not bot token)
app.post(
"/dblwebhook",
webhook.listener((vote) => {
console.log(vote.user);
const channel = client.guilds.channel.cache.get('1102644556190716025')
channel.send(`${vote.user} Voted Treo`)
})
);
app.listen(2022);
Change your client.guilds.channel.cache.get('#') to client.channels.cache.get('#')
Bro when I clicked on send test it didn't logged in the console
@fierce zenith
Ok now it is work
Hey what is the variable of getting monthly bot votes, weekly bot votes, total votes, voters total vote, when that voter voted !
what do you mean with variable
that information is not provided in a webhook
only in the api itself, https://docs.top.gg
weekly bot votes [..] ,voters total vote
is also not provided by the api
@rain heart brother how can I get them?
this
@signal hawk multiple channels
error: } reason: Error: 504 Gateway Timeout
code: js const pre = await db.fetch(`premium_${message.author.id}`, 'pre') const Topgg = require("@top-gg/sdk"); const topgg = new Topgg.Api("token is here"); const oy = await topgg.hasVoted(message.author.id) if (!oy && !pre) {
Try again
now works but how to avoid of this error completely?
You can't, it's top.gg side error
Such errors are inevitable
You can try to catch them and tell the user that the top.gg api has temporary problems, but you won't get rid of them completely.
ask and wait for someone who can help
if you read the error, you'd see you'd need a token, and if you do have a token, you probably have a malformed one
what ???
What do you mean "what"
Looks to be an issue where you are unable to connect to top.gg. Could have been a temporary internet issue on your end or on top.ggs end
yeah its from top.gg cause i tried 3 times but each time same error
looks like an issue on your end though
if you're the only one experiencing it
make sure your server is able to reach it
Why did it say something like that? I didn't understand.
bro, read your error messages
Bro it’s #development
what
Why my this bot has 403 err while others can check if user has voted or not
Refer to my previous answer I gave you
Ok but like, i asked for an alternate solution for this
Making the API client yourself, as the current one uses the logged in bots user id, which is a section of the API path
You can't use the token on a different bot than it was generated for, nor can use any other bots id and still receive the same data
whys it still erroring for me?
im using this to test and its not working
"error": "Required parameter shard_count missing or invalid value"
in the bot's code, i just need to specify the server count for that shard and it'll add it up for me right? why is it saying the parmter shard_coiunt isnt there
how could i listen to vote events(discord.js)
With webhooks https://docs.top.gg/resources/webhooks/
hi
To put the servers where the bot is in a github readme, i use:
<a href="https://top.gg/bot/1041159026324545566">
<img src="https://top.gg/api/widget/servers/1041159026324545566.svg">
</a>```
but it comes out *undefined*. any ideas?
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
but how would i know shard_count if, for instance, the bot isnt fully started yet
if i update it to different values of shard_count will it take the highest one? im so confused
I don't quite understand. If you are afraid that the bot will not start before the statistics are sent, set it so that, for example, it posts statistics 30 minutes after the bot is turned on.
It doesn't have to be an exact number, an approximate number is fine too.
Hi there Topgg webhook how it work?
Guys in js, how do u send the request to the api to update server count
What data do I send to it
shut up
why does he need to "shut up"
bc i felt like saying that
yea cry abt it
Why would I?
bc ur bitching on discod.com
im not?
So me asking you a question is bitching?
I think you need to touch grass
do you see a dev role on me?
Lmao Timed out
-b @halcyon wind racism
xlsr#0 was successfully banned.
Good luck getting your server unlocked now lol
Thanks
please help
i requsted but "error": "Unauthorized"
this my code
const Topgg = require("@top-gg/sdk");
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("auth");
console.log(webhook.listener);
app.post(
"/dblwebhook",
webhook.listener(async (vote) => {
// vote will be your vote object, e.g
console.log(vote.user); // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
})
);```i replaced my auth on webhook auth but idk why not workin i use server ip
i use it http://127.0.0.1:8080/dblwebhook
What is work on Topgg?
I use local host to test it is accessible url?
the key is in the name, you can only access localhost locally, only your PC can access it right now
What if I test in repl it Does it work ?
should do
can i get vote count via webhook?
im submitting an api request to see how many times a user has voted for my bot, and even if they have voted it says 0, any ideas?
and when i submit the request to https://top.gg/api/bots/BOT_ID/votes their username also comes up
async function checkUser(user) {
const BOT_ID = 'REDACTED';
try {
const response = await axios.get(
`https://top.gg/api/bots/${BOT_ID}/check?userId=${user}`,
{
headers: {
'Content-Type': 'application/json',
'Authorization': "REDACTED",
},
}
);
const votes = response.data.voted
console.log(response.data)
console.log(`${user} has voted ${votes} times.`)
} catch (error) {
console.error('Error checking votes:', error.message);
}
}
when calling the function, user is the id of a user
as a string
hey, i've got a question...
will Individual User Vote check whether a user voted or not in the last 12 hours or is it timeless?
i mean if it's just saying if the user ever voted or not?
how i have the api?
??
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
Why is "bot" underlined in red?
Does it need py bot = commands.Bot(command_prefix=prefix, intents=intents)
did u ever get yours working, having issues trying to get mien working
haha no i gave up
it never worked
their docs is outdated btw ive noticed for python
i had it setup right on my non cog bot but struggling to get it to setup with my new one ive made with cogs
lol, i have to get this working so ima work on it osm emore
was just hoping you may of got it done
So, haven't looked much into the API yet, are you able to set a embed displaying things like votes, server count, ect.
Your a absolute legend. Ty very much
no worries
ended up getting it working
Hey, um... I'm sorry to disturb you but could you please help with autoposter? I mean cause when im using this code in bot.js file, it's not working but when im using it in a command, it works as it should... If you have any ideas, please let me know, i would be grateful 
const { AutoPoster } = require('topgg-autoposter')
const poster = AutoPoster(token, client)
poster.on('posted', (stats) => {
console.log(`Posted stats to Top.gg | ${stats.serverCount} servers`)
});```
It is very possible that the code is executed before the bot is actually initialized. If it doesn't connect in time, there is nothing to send to top.gg. For me, the best choice would be to put this entire autoposter in client.on("ready") but I see that you are using some kind of editor so I have no idea how you will do it
mine is in index.js
you mentioned about client.onand i did a lot of testing... finally!
so thank you for your help ❤️
/generate water
Successfully generated Water (took 4 Minutes and 35 Seconds)
Please use a different channel next time
ah left anyways, rip joke
Makes u feel better @rain heart I thought it was funny 😁
Any more experienced developers out there that could help me with the Vote Rewards API?
I knew you were an AI and not a real human
Just ask your question and maybe someone will answer
uh, that is normal ? i click one time on send test and i got that
and continue receive new
ah fixed
i just forgot do return in the app.post and topgg retry send again
hey, is it normal api refuse return my user when specify my discord id ?
if i try with id of my friend, i got correct awnser
?
Is there a way to use the API without it installing discord.py directly with it? Because I'm using discord4py and that's just a fork of d.py but not exactly the same.
Or how can I update my bot's servercount without using the API?
Anyone host their bot with Sparkedhost.us and successfully used the top-gg/sdk to do vote rewards?
Does SparkedHost have unique limitations compared to a VPS?
Sounds like a shared game panel host, like paradactyl so I presume so
Looks like they may not provide dedicated IPs unless you pay extra, so you'll likely need to do that, and you may also need to request them to open a port.
The Python SDK should've not depended on the discord.py library
or any Top.gg SDK really
How do I do that?
It installs the d.py directly with it.
Or can I just use a normal HTTP-Client and do a request with a url, a header and a body?
Like
header = {
"???": "???"
}
body = {
"???": "???"
}
client.post("https://top.gg/api/AUTH_TOKEN/???", header=header, body=body)
I haven't done this kind of HTTP before
y'all just ignoring my text
Magical thing called maybe people can't help as they don't know how to fix it yet?
there's a way to count the upvotes with the API?
How can we update the webhook url on top.gg via Nodejs? Is there a specific API or something?
Helou
You can do it yourself and it is the only option
Hi, how can I receive an API key ?
check the pinned messages
how do i fix this issue?
app.post(
"/dblwebhook",
webhook.listener((vote) => {
// vote is your vote object
console.log(vote.user); // 221221226561929217
})
);```
I does'nt find
literally the first pinned message
And you are not testing it locally right?
Hi my vote problem
?
Owo vote problem
I cant help with that info
Owo vote
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord Support Server" button on the bot's page of the bot you need support for. If there isn't a button that says "Discord Support Server" or nothing else mentioned about a support server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
ask their support with whatever you're trying to ask
Okey thank you
Can I somehow do a http-request to update the guild-count of my bot on the website?
And someone said, I could just use the "RAW API". WHERE can I find this?
Just the 1st line here without python-sdk/ ?: https://docs.top.gg/libraries/python/#install-from-source
Have you ever sent any request to any API?
Read this https://docs.top.gg/api/@reference/ and this https://docs.top.gg/api/bot/#post-body
The second link specifies the adress to which you should send the request and what may be in the body. The first one tells you what header you need to provide during the request
try TOPGG_TOKEN instead of Yoken
No, not really 😅
At least, I haven't done anything with an HTTP-Client before but I would find a way to do this over the holidays...
I suppose I do
await my_http_client.post(
url="https:top.gg/api/AUTH-KEY/???",
header={some dictionary?},
body={
"server_count": len(self.bot.guilds)
}
)
But that's just an idea and nothing precise.
Hi there, for topggpy, why is the old package (topggpy 1.4.0) on pypi not being updated, and why is the last commit for the python sdk on 2021?
topggpy 1.4.0 was released Nov 6, 2021. Latest commit using 2.0.0a1 on master from top-gg/python-sdk is Nov 26, 2021
also topggpy how do i use .autopost?
it's no longer maintained afaik
what are people supposed to use instead, then?
both maintainers have either got banned or left
other than that, what are the things to add/change?
the API hasn't been updated in years
different question, in DBLClient.post_guild_count is guild_count meant to be per-shard count or entire count?
then what are the alternatives?
general incompatiblities with dpy v2 afaik. i'll test it with dpy v2 to see if there if there is any issues
ah icic
the library's only dependence on discord.py (especially older versions) is a problem
hopefully new maintainers like @restive otter can resolve it
otherwise you can also make a pull request if you want
for now you can just use the raw API
oh topggpy? I’m sorry I’ve been busy these days. Will do alot of pr tho once I’m done
thank you
though your blog needs more content
besides just focusing on your discord bot
like learning new things, thoughts on new technology, etc
true thanks for the suggestion
I have this here, how long does the website need to update the new server-count?
httpx.post(
url=f"https://top.gg/api/bots/{self.bot.user.id}/stats",
headers={"Authorization": self.load_token("config.json", True)},
json={
"server_count": len(self.bot.guilds)
}
)
are you getting an error in the response staus code?
does httpException include status code errors?
it looks like you may be missing the content type header, which is why I ask
or Exception.
It got the header 😅
at least, it says "headers"
I have to check real quick
Okay, I changed it to "header" and "json" to "body" ...
nope, doesn't work
nevermind.
Found the issue
~~I dont use python/know how httpx works, which is why I was asking about it. Httpx might handle ~~ Good ^-^
Whats the status code on response?
200
ah well
After I have clicked on "Refresh data" for about 200 times and once on "Edit" and then only on "Save", it worked. 
which webhook do I put there and what is this authorization? What do I need to put?
Webhook url is the url of your webserver. This is usually http://yourvpsip:port/dblwebhook. Authorization is your string thanks to which you can be sure that top.gg is sending you the request and not someone else
?
@restive otter sorry for the ping, but are there any plans in order to get topggpy up to date?
currently aiohttp is planning to release 3.9.0 stable soon, so it would be advisable to update the aiohttp requirements in order to futureproof the lib for 3.12 support
The list of tasks that needs to be done are the following:
- Move configurations to pyproject.toml, as recommended and addressed by PEP 518
- Migrate from mypy to pyright, as mypy's type checking results in inaccurate types and is not recommended due to various reasons
- Merge requirements-dev.txt and requirements-docs.txt into extra groups to ease the installation process
- Update the severely outdated examples
looks like some masked links are slipping through 
the masked link in question (which is wrapped in <> to supress embeds) is this: https://peps.python.org/pep-0518/
Python Enhancement Proposals (PEPs)
so it seems like supressing embeds using <> doesn't work here...
correct, the intention is to block all URLs that are masked like this as they've been abused too much
Spice up your Discord experience with our diverse range of Discord Bots and Servers as well as other spaces to discover DAOs.
I see
no idea for me, i'll be able to mass send pr when i got the time to. Feel free to open a PR tho
Yea I already have a PR open to hopefully update aiohttp to not break things
Why am i getting 401 unauthorized even when i am using correct token 🙃
Are you using the content type json
Not what I meant, but if you're using a library, you're using the wrong token
Press regenerate, refresh the page, then copy the token
It will initially show the incorrect one, and the one it shows is always the same on the first section
still same error
Are you using your token on a different bot?
Keep in mind that you cannot use it for other bots
no
Then your API token is likely invalid yeah, can't help really
Ensure you're correctly loading it from your environment variables or however you're using it
its not
Token is matching with what is showed in the webhook page
const Topgg = require("@top-gg/sdk");
const api = new Topgg.Api('my token');```
this is how i am using it like in documentation
Try regenerating the token, then refreshing the page before copying it.
To clarify, you're using the token inside the blue box, and are copying the whole thing?
The token is wider than the text area
yes
CTRL + A => CTRL + C
and you are reloading the page after regenerating it?
yes
is that even an official library?
and where does it tell you "unauthorized"
you're trying to call something somewhere that tells you unauthorized
can you send the actual error stack trace you're getting
One message removed from a suspended account.
Yeah saw it on the docs now
One message removed from a suspended account.
Works fine on my end to make a simple request using a freshly generated token and making a request to a bot that I own
One message removed from a suspended account.
One message removed from a suspended account.
java stinks
One message removed from a suspended account.
same on other bots
One message removed from a suspended account.
One message removed from a suspended account.
their token is invalid, unauthorized should only happen when the token is invalid
trying to post stats would say forbidden
One message removed from a suspended account.
deez nu
wait i will provide a screen recording...
Console
Yes but what does your console say? Where does the error originate from?
a stack trace could help
wait making paste bin
contains some important headers you shouldn't share, so I'll delete it
but will look into it in a sec
Exactly what I assumed, you're not even providing a token in the library
Looks like going to lose the single brain cell i was left with :)
api = new Topgg.Api('TOKEN');
//token replaced with the webhook page token```
One message removed from a suspended account.
or a recent commit on the library managed to break everything
now what can i do more to provide in library ;-;
cc @restive otter if you wanna look into it
nah its an issue on your end
Even tried it with the newest version of the library
works fine
ensure you're properly copying the token
bro imma DM you a recording wait
a recording still would not help
as long as you do it the following way:
regenerate it
refresh the page
then copy the token there
doing that, I have no problems at all
I did everything
Still same
i have 2 more bots on top.gg and this is the first time i am facing this problem
where are you trying to even call the api
since the error only shows up when you actually try fetching something from the api
i calling the api to check if a user has voted or not
const userID = interaction.member.id
return console.log(api.hasVoted(`${userID}`))```
hasVoted requires you to input your bot id somewhere
where have you done that
wait
how the fuck is that library supposed to work
this is so far understandable
then you have this
but top.gg requires the actual bot id
??????????????????????
Token provides that
yes and no
Documentation for @top-gg/sdk
you still need to provide the bot ID in the url
Again you're not understanding
This is the API docs provided by top.gg, you are required to provide the bot id in the url, the library doesn't seem to do that
Where will i put the url
and my other 2 bots are working fine
with this same code
welp cant help you otherwise
...
consider just doing it manually through a request client
I will but can you make sure that they check if there is any problem with the library?
theres not
it works fine on my end
you're using an invalid token
try testing it manually through for example postman
it works fine on my end with a freshly generated token
what do you mean with "post is working fine"
i mean "GET"
or you're incorrectly passing your token onto the library
echo out the token and see if it is the same as what you have pasted in
i fixed the error with fetch and got the result but few seconds later still got the error and then i removed the package and now its working fine
Need a smoke after this mindfuck
How can I connect my bot to server webhook on topgg?
:)
funny undocumented top.gg api behavior
/bot/check fills in the bot id
if there was a problem in the library everybody using it would be in this chat yelling about it
lmao discovered that while reading the node sdk and immediately used it for my rust sdk 
honestly there is no reason to use other people's bot IDs in /bot/check anyway
does anyone know if its possible/has code for having logs for when people vote for the bot
in js
Ehy not just use the web hooks they provide
-pins
@hallow knoll
Hello, can anyone else confirm they've experienced errors with the DBLApi? For some reason, DBL API also seemed to fail at the import of the package in my Node.JS backend.
In summary:
-
Operation timeouts had a trickle down effect for sharding which is another issue with my application.
-
The shards have NOT been spawning regularly for some reason since shard #4, and we are now at over 10k servers (so we should approximately be at 12 shards).
2023-10-28T12:16:01: DBL.hasVoted failed, skipping. Error: Operation timed out after 1500 ms
2023-10-28T12:16:43: /root/Euphony/node_modules/dblapi.js/src/index.js:114
2023-10-28T12:16:43: response.body = res.headers['content-type'].includes('application/json') ? JSON.parse(response.raw) : response.raw;
2023-10-28T12:16:43: ^
2023-10-28T12:16:43:
2023-10-28T12:16:43: TypeError: Cannot read properties of undefined (reading 'includes')
2023-10-28T12:16:43: at IncomingMessage.<anonymous> (/root/Euphony/node_modules/dblapi.js/src/index.js:114:55)
2023-10-28T12:16:43: at IncomingMessage.emit (node:events:525:35)
2023-10-28T12:16:43: at endReadableNT (node:internal/streams/readable:1359:12)
2023-10-28T12:16:43: at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-10-28T12:16:43:
2023-10-28T12:16:43: Node.js v18.13.0
2023-10-28T12:16:45: /root/Euphony/node_modules/@discordjs/ws/dist/index.js:1114
2023-10-28T12:16:45: error: new Error("Sharding is required")
Hey! Appreciate all the details. dblapi.js has been deprecated for awhile, check out https://npmjs.com/@top-gg/sdk let me know if you have any issues with this one too. It should be more obvious what’s going on if the error doesn’t go away.
Official Top.gg Node SDK. Latest version: 3.1.6, last published: 2 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 9 other projects in the npm registry using @top-gg/sdk.
Awesome, thank you @hearty lintel that was the solution! You're a life saver 🙏
👍
So this will automatically get your guild count and post it to the stats?
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const { AutoPoster } = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
Once the client is logged in yes.
I made a minor adjustment to it
if (client.id === '1092249040558751866') {
ap.on('posted', () => {
console.log('Posted stats to Top.gg!');
});
} else {
console.log('Client is testing application. Not posting stats.');
}```
this would still post the stats tho
you're just adding an event listener only if the client id is the one you provided
unless that's what you want, it will still post stats
what is this error and how to fix
I have this:
` manager = new ShardingManager('./src/music_bot_v2.js', { token: discordToken });
// Have auto stat updater for top.gg page
const ap = AutoPoster(topGGApiKey, manager);
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
});`
But then I check the top gg page and the proper shard/server count is still not updated 😢
how can i track my bot votes ?
on the vote event add 1 to a stored number (database) and if vote.weekend is true, add 2. Make sure to reset the number on midnight UTC of the first of each month
huh ?
wtf
ok 1 sec
how can i post the server number on top.gg
oh well that's different than bot votes
i want to do it both
well you don't have to post bot votes, so what did you want to do with them
if you just want to have the number outside of topgg, something like how I said before works for that
you have a ready code ?
no
can you tell me step by step what i do ?
I don't remember from way back when I did it
https://docs.top.gg/ check out the docs and I actually think I used a youtube video. Otherwise im sure someone else will be able to help 
i thought you just needed to track the number of votes to save it
i want when a user vote he will get role and the bot send a message in specific channel
yup that's all stuff you can do with the topgg api, I just don't want to incorrectly guide you
id edit out ur topgg token. Also, try refreshing the page/ clearing cookies ect
Reset your token @inland wyvern

okeyy!
how can i get "your webhook auth"
That's something you create yourself
i create it
and put it in top.gg website and in the code
and i vote nothing will be in the console.log
what is that
Where the path is on
this ?
there are many
The one that is talking about webhooks
can u check if https://top.gg/bot/1154077045903593555 has posted the stats or not ?
Server count of 110
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 121919449996460033
}) // attach the middleware
app.listen(3000) // your port
this will work ?
replace topggauth123 with the one i get it from https://webhook-topgg.com/ ?
I cannot help you
Correct
Does anyone have a vote verification example for Python?
vote verification?
Hello
How do you make it so that when someone votes for Booty, it is sent that someone voted for Booty?
He probably means his own vote log bot using top.gg webhooks
In /check do you give me the daily data or monthly?
returns 1 if the user has voted in the last 12 hours
Thanks
i need help plz
b
example
const { AutoPoster } = require('topgg-autoposter');
const ap = AutoPoster(client.config.basic.TopGG, client);
ap.on('posted', () => {
console.log('Posted stats to Top.gg! 🟢 SUCCESSFUL');
});
ap.on('error', (err) => {
console.error(`Posted stats to Top.gg! 🟢 FAILED - ${err}`);
});
thank you
what should i use for client.config.basic.TopGG
the token form the topgg website
sure
i just have mine in client.config = require('config.json') then call it from there
do you have vote tracker + reward
yea yea
i do but its broken atm
what is betterlog
#development having issues with it only working on test and myself
const betterlog = require('betterlog.js'); if you wanna use it
i changed the example to use console.log instead
oww
what is better config.json or .env
doesnt really matter but .env if using something like repl
oh
i use .env
but i don't use repl.it
i use a vps so doesnt matter to me
you know free hosting
lik diva
or silly
i use a paid service
oracle cloud tbh
but if you wanna scale its useless
free is never good if you wanna grow
oh
brb
yea when the bot get popular i will change
ok that failed
oracle cloud is the best free then
bro, 24gb ram and 200gb storage for a discord bot is just way too much
I have 64gb and 1tb woops
same
Not really
I got 16 GB with 3TB
jk that’s my pc
can i get the code for take my bot vote count
Not after you scale it's not
recommended stats upload interval? its 5min right now
30 minutes I would reccomend as a minimum.
can i get the code for take my bot vote count
Is this like 1 = true and 0 = false?
You will need to fetch the bot, /bots/botid
server count not updating
//-------------------------------------------------------------------------
const { AutoPoster } = require('topgg-autoposter');
const betterlog = require('betterlog.js');
const ap = AutoPoster(topgg, client);
ap.on('posted', () => {
betterlog.event('Posted stats to Top.gg! 🟢 SUCCESSFUL');
});
ap.on('error', (err) => {
betterlog.error(`Posted stats to Top.gg! 🔴 FAILED - ${err}`);
});
//-------------------------------------------------------------------------
<@&817055174613794826>
the server count can take a bit to update on the website, want to check now?
still the same
Why this err coming in my code
you cant get roles from client
So I need to defined guild first ?
const guild = client.guilds.cache.get("GUILDID")
const roleToAdd = guild.roles.cache.get("ROLEID")```
yes
Yeah now working
why does it say i’m forbidden??
are u sure u added the header properly?
How to setup vote requested command?
why am I getting 504: Gateway time-out sometimes.
its a common thing, try again later
I mean my Discord bot is getting it
yes, that's expected sometimes, you can feel free to ignore gateway errors from top.gg
to ignore, do I just remove this?
would be better to check for the error message than to ignore all errors
how would you do that? use on_error()?
the error function will be called with the error object, you'll have to check what that says
I just noticed this error:
wdym?
How can I setup a command for discord bot that is enabled once he/she votes on top.gg in python?
depends on how you want to do it. I would strongly recommend not to do this as a consumer such as me, I don't want to be walled off and not able to use the commands unless i vote
Are there any rules except ratelimits on how to use the api?
hi
trying to setup vote logs on my discord bot was wondering how i go about doing that
instead of thru webhook it goes thru the bot?
using discord.js v14
using
ApplicationCommandOptionType bot not slashcommandbuilder
why is my app not receiving the webhooks?
Good question, we don't know the answer unless you give us more information
can someone help me
I don't really understand what you want to do. Votes can only be received via webhooks. If you want to check whether someone voted for your bot while using the command, you must use the API
Traceback (most recent call last):
File "/Users/fizzy/Desktop/Bots/nword/Anzu.py", line 56, in <module>
dbl_client = topgg.DBLClient(bot, topggtoken)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fizzy/Desktop/Bots/nword/.venv/lib/python3.11/site-packages/topgg/client.py", line 98, in __init__
self.http = HTTPClient(token, loop=self.loop, session=kwargs.get("session"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fizzy/Desktop/Bots/nword/.venv/lib/python3.11/site-packages/topgg/http.py", line 84, in __init__
self.session = kwargs.get("session") or aiohttp.ClientSession(loop=self.loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fizzy/Desktop/Bots/nword/.venv/lib/python3.11/site-packages/aiohttp/client.py", line 252, in __init__
loop = get_running_loop(loop)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fizzy/Desktop/Bots/nword/.venv/lib/python3.11/site-packages/aiohttp/helpers.py", line 293, in get_running_loop
if not loop.is_running():
^^^^^^^^^^^^^^^
File "/Users/fizzy/Desktop/Bots/nword/.venv/lib/python3.11/site-packages/discord/client.py", line 140, in __getattr__
raise AttributeError(msg)
AttributeError: loop attribute cannot be accessed in non-async contexts. Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook```
I am using topggpy. I cant get it up running. I would really appreciate any help.
can also be sent thru the discord bots its self
by integrating in to ur bot
how to make the embed look like this (example from my friends bot but they use webhook)
using package topgg-votes
I don't understand what you mean "through a bot". A webhook listener is nothing more than an http server that receives POST requests. You can implement something like this as long as your bot is located on a publicly available and has static IP address
yes i figured that out but how to make my embed using topgg-votes package like tha
Everything is explained in their README
This is probably not the official top.gg library so we are not helping with that
oh idk how to use the official 1 tho
is @top-gg/sdk the offical 1? @runic creek
@subtle pulsar is topgg-votes an official one made by top.gg?
it does not show how you do this
It's a regular embed. You do it as you normally would with a bot, except that some of the information here comes from the Discord API/database
You take the time in which you received the vote, add 12 hours to it and you have it
There are probably plenty of ways to do something like this
idk how to do that 😦
Then you need to educate yourself. Read stackoverflow or look for answers on reddit. I don't even mean any courses, just look for an answer on how to add x hours to a date
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@runic creek it is topgg official the package toppp-votes
on there website uses exact same code
for this how to get the data? https://top.gg/api/bots/1054492523025936525
What data?
from this url https://top.gg/api/bots/1054492523025936525
i need the monthlyPoints data
how to get the data from my friends bot https://top.gg/api/bots/1054492523025936525
Did you even add the "authorization" header to your request?
Also what kind of error
ah
i just did this
@runic creek ``` const axios = require('axios')
const helllllo = axios.get('https://top.gg/api/bots/1054492523025936525')
As I thought, there is no "authorization" header here
i have
my bots connected to it rn
be right back
back
@runic creek my bot has it connected to it rn
defined as client.topgg
Well, then use this token as the "authorization" header in the request you are making
axios is just like me viewing the website we see the same thing
this shows abunch of things https://top.gg/api/bots/1054492523025936525
You can google it
how do i get the data from const axios = require('axios')
const helllllo = axios.get('https://top.gg/api/bots/1054492523025936525')
we dont need token to see this as i can see it rn
Nah, man
Listen
Try to make request to this link via postman
And you are gonna see the error
Yes, because you are opening it on browser
ok
You can see it because you are still logged it
Clear cookies and it won’t work
how to see if a user is voting for your bot using topggpy lib
is there a way to check if the user voted for a discord server instead for a bot (also via webhooks) preferably using topgg sdk
or is it just the same
actually nvm
h

Can I make my discord.js discord bot have vote only commands?
I belive you could use this to check whether the user has voted or not.
Alright, thanks.
Np
Just make a function with the api above and call it on each command. As far as I know there's no simple way of making every command a vote command
your application isn’t public
You have to change that in developer portal
i don’t know then.
has it been fixed??
yea
Good For You Bro
How do I get my botid?
-id
An ID is a unique number which is used to identify a user, bot, channel, or message. To obtain an ID, right click on it and click "Copy ID"; this can be done from mobile by holding down.
Should you not see the option to acquire an ID, you need to enable "Developer Mode" which can be done from your user settings, under "appearance".
You can also find it in your developer portal's application details section
is there a way to stylize top gg description of bot like this https://top.gg/bot/646937666251915264
Yes There Is One Way , You Can Stylize Your Bot in Embeds buy adding emojis , different fonts , and bold letter or words in your bot's short description.
is there no way to do something like customized css, adding images, etc?
You can't add images in description but you can use emojis and stuff , however you can add images in your bot's profile banner but that feature is also currentlty not working
is there a tutorial or documentation somewhere for customized fonts and styles?
I don't think so but you can search online for multiple tools which change a text font into stylish ones
Alright thanks!
Ohh so apparently you can add html tags to stylize the description
Yes you can like for example double asterisk on both side mean bold , single asterisk on both side mean italic and triple asterisk on both side mean bold italic
no i mean like actual html tags <html></html>
Oh yes you can apparently
is there a reason why i'm getting Unauthorized error? My token and endpoint are correct: https://pastebin.com/9K3npWET
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@ me if you respond
ahhhhh nvm its /stats
i have a question
hello everyone
does the api of the bot in the vote using the checkuserid
like go from when voted back to 0 when the user didnt vote after the 12 hours?
i just voted and the json changed to
{"voted":1}
after 12 hopurs will it got to 0?
or just adds a number?
Nah It Goes Back To 0 , 1 = True, 0 = False
thank god
if it was + each time then i would need new tables for db so THANKS top.gg
Yea
do you write any bots?
Yes I have one
nice do you want talk about it om the #development ?
Actually I am a Little busy right now
yeah no problem have a nice day and thanks for the answer
I need my bot to detect when someone votes on Topgg. I can't setup the Topgg client and the on_dbl_vote event is not working. I would appreicate any kind of help. Thank you in advance
from discord.ext import commands
from topgg import DBLClient
class TopGGCog(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.topggtoken = "TOKEN"
self.topgg_client = DBLClient(self.bot, self.topggtoken, autopost=True)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(f"Received a vote: {data}")
async def setup(bot):
await bot.add_cog(TopGGCog(bot))```
You receive the vote payload through Top.gg webhooks, check the webhook section of https://docs.top.gg/libraries/python
okay, how to set up the web hook?
I'm new to this.
For information about the webhook URL, check #topgg-api message
I'm looking for a video or someone who can explain me the steps in setting up the topgg client
my bot is hosted on Google console and it is coded in discord.py
hello devs
question is there a way to see the reviews with api?
because i can check the votes
https://top.gg/api/bots/1084543171905736814/check?userId=1
but i dont know if i can do this withb the reveiws
or something like it
Hello
hey
do you know about any api that sees the reviews like the reviews**?
Vote tracker
sorry i copied wrong word 😂
Tutorials are fundamentally flawed in concept when it comes to teaching you something like a programming language. The simple reason for this is a programming language is how you create whatever you want, a tutorial is something that teaches you how to do what the tutorial is teaching.
I recommend reading through all of these points if you want to understand why
A couple of points against tutorials...especially video tutorials:
-
Tutorials teach you how to create a project, a specific program, a specific script, etc. This causes many many people to only know how to do this one specific thing.
-
A programming language is an entire language itself, this is obvious in of itself but for this point think of this compared to a real language...people have accents, there's multiple ways to say the same thing, there's multiple pronunciations for some words. This same kind of concept applies to programming languages, there are many ways to achieve the same thing, there are code styles which people pick up from learning. Sometimes...these practices can be bad and if you're just learning, how would you know if the tutorial is using some bad practice? Trust me...this happens a lot
-
Tutorials are made for that specific version of whatever it's using...whether this be python, the discord.py library, some other library it's using...etc. As time goes on that can very quickly become outdated
-
Sometimes there are "advanced" or hard concepts that are covered in a tutorial, you're not guaranteed to understand all of it right off the bat. It is extremely hard to provide the relevant documentation for every single concept covered....there would be so much.
-
Specifically for this library, the people who look for tutorials are typically new to the language...this library is not meant for beginners, there are some advanced concepts (EG asyncio) that are covered, and jumping straight into that as a beginner is very bad.
const Topgg = require("@top-gg/sdk");
const webhook = new Topgg.Webhook("webhook fine and working here");
app.post(
"/dblwebhook",
webhook.listener((vote) => {
console.log("Recived a vote!", vote); //this is empty in console
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user);
if (!user) {
return;
} else {
const embedE = new MessageEmbed()
.setTitle("VOTING SYSTEM")
.addField(
`Thanks <@!${vote.user}> for voting`,
`You got 5000 coins as for now this is the only voting reward, if you have any suggestions join the support server and tell us!`,
);
user.send({ embeds: [embedE] });
db.add(`money_${vote.user}`, 5000);
// console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}),
);
console: Recived a vote! {}
whenever i vote
do you know how i can get the reviews?
because i cant find doc about it
thankss
same
thats the bad thing because i would like to give people some awards if they reviewed
idk if that is possible
and its dumbd what if they gave a bad review?
do it for voting
i already did
one choice i have which i dont know if its correct
is i can create code that gets in the website sees the stars and the user id but i will not do it because i dont know if it is legal
if it is your bot's page not another bot it should be idk ask someone else
i think it counts as scraping so i will not
nice css...
ty
@keyframes glow {
0% {
box-shadow: 0 0 5px red;
}
100% {
box-shadow: 0 0 5px red, 0 0 10px red, 0 0 20px red;
}
}
is it allowed??
yup it works fine and i asked the team its allowed as long as there is no harm such as very high light or too much blinking ect... and please move the chat somewhere other than here
yeah true
WHAAT
?
permanently borrowed:)
i thought it wasnt allowed
no it is
welp
......
he is my homie dont worry
k
thats mine....
the css code
i aint using these things
ok go to general again pls ty
k np
I’m a programmer myself. I understand what you mean but tutorials give us a good start. Tutorials give an idea of something.
It depends on how good the tutorial is
I feel like that if someone is going to a tutorial to just copy the code for example and not actually learning from it, so it will not give any good for him, but i think tutorials can be useful for ppl who want to learn and checking what do what and why and how.
and the tutorials do need to be good and not just someone not explaining anything and just type cuz it will not help someone to actually learn what is he doing and why is he doing it.
what's is topgg api?
The top.gg api is a way for you to get information from top.gg. This can be how many votes your bot has, if a certain user has voted for your bot, and much more! You can read more on https://docs.top.gg
i was joking familyfriendly
but users doesn’t know here ^
Didn't notice it was you 💀

On top.gg site my bot guild stats are bugged like it show only 1 cluster guilds not other 4 guilds like it shows very less guild count how I can fix that
Why would the topgg autoposter be sending me Unsupported Client if I am sending it a discord.js v13 client? I tried with v14 as well just in case
and how quickly does the serverCount update on the website
Maybe you haven't uploaded your stats in a while. Are you sure you're actually posting stats?
setInterval(async () => {
if (!isProd) return;
await topGGAPI.postStats({
serverCount: globalBotInfo.guildCount,
shardCount: bot.gateway.shards.size,
});
}, 600000);```
```Unhandled rejection:
PromiseRejectionEvent {
bubbles: false,
cancelable: true,
composed: false,
currentTarget: Window {},
defaultPrevented: false,
eventPhase: 2,
srcElement: null,
target: Window {},
returnValue: true,
timeStamp: 0,
type: "unhandledrejection",
promise: Promise {
<rejected> AssertionError [ERR_ASSERTION]
at new AssertionError (ext:deno_node/assertion_error.ts:414:11)
at toNode (node:assert:44:15)
at assert (node:assert:61:3)
at new Parser (file:///root/.cache/deno/npm/registry.npmjs.org/undici/5.27.2/lib/client.js:568:5)
at connect (file:///root/.cache/deno/npm/registry.npmjs.org/undici/5.27.2/lib/client.js:1271:25)
at eventLoopTick (ext:core/01_core.js:178:11) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: undefined
}
},
reason: AssertionError [ERR_ASSERTION]
at new AssertionError (ext:deno_node/assertion_error.ts:414:11)
at toNode (node:assert:44:15)
at assert (node:assert:61:3)
at new Parser (file:///root/.cache/deno/npm/registry.npmjs.org/undici/5.27.2/lib/client.js:568:5)
at connect (file:///root/.cache/deno/npm/registry.npmjs.org/undici/5.27.2/lib/client.js:1271:25)
at eventLoopTick (ext:core/01_core.js:178:11) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: undefined
}
}```
I'm not sure if this is a Deno issue or a top.gg library issue
where did you get the notion of setting an interval for posting stats
Why is updating the stats every 10min wrong?
im using a slightly different setup but im pretty sure you don't set an interval for it
what's your full setup for this function? (remember to remove tokens/ sensitive info)
yeah show everything involved in this context, but again make sure to remove tokens n stuff
export const topGGAPI = new Api(environment_variables.topGGAPIToken);
isProd is true
Hm, maybe do you think one of the values may be undefined?
Let me check
mm I don't quite know. I don't want to say your setup is wrong because it looks like you're just going about it differently than I am (I'm using js btw)
Yeah no, they are not undefined
but ive just never seen the setInterval use for it. i thought all the ways to do autoposting,, well autoposts it on its own
Do you use Node.js or Deno?
just node js. I suspect that's why it's different and I just haven't seen anyone use deno and the autoposter
Deno needs to use a compatibility layer to work with npm modules. I suspect there is an issue with the top.gg library <-> Deno compatibility
perhaps. could I ask why you're using deno? searching through messages here it's a similar idea as like bun or other node alternatives. im just curious why you picked that over node?
I picked it because it has a built-in formatter (deno fmt), and I do not have to transpile my code into JS before running (with the tsc command). Deno accepts raw TS code and can run it.
Which means less time wasted waiting for TS -> JS compilation
oh, did you write your bot originally in ts?
Python -> TS -> TS -> F# -> PureScript -> F# -> Dart -> TS (I'm never rewriting again)
Those were all my rewrites
wow
ok now I'm curious, why all the changes between ts (after python)?
sorry im like grilling u lol im just super intrigued
Well after I made the first version in Python (I was like 13/14 at the time), I wanted to learn a new language. I saw other people using TS, so I just learned that next. First iteration in TS was sloppy because it was my first time using TS, so I started over again, this time with better TS skills. And then I got intrigued with functional programming (and I wanted to be special), so I rewrote my bot in F#. That rewrite was an absolute flop. I never got it to work, so I scrapped it entirely. I then used PureScript to write my bot on another platform (Guilded). I wrote it in F# again because the previous F# version didn't work. The code was messy, so I picked Dart because it had a lot of Rust features + I didn't have to deal with a borrow checker. But the library I used when making the Dart version had a lot of issues. So, I just gave up on my special languages and "did it right" with TS.
interesting
Well at least I have a lot of exp with weird languages
i was gonna say, it could be one heck of a resume
heyyy can u send me the link please
As far as I know, you need to add your credit card there
Correct
Their free tier is looks like 24gb ram with 4x aarch64 cores
I don't recall their x86-64 free tier
Even then you have to be lucky to get a free tier vps because of how popular they are
so how do we check if the user has voted for the last 12 hours, I only could find how to check if the user has voted in general
the checks the past 12 hours
https://docs.top.gg/api/bot/#individual-user-vote
figure it out , thank you!
Is there a way to allow tokens to a development version of a bot? Or is the only solution creating a new page for the development version of the bot?
For context, I have 2 bots with different IDs, one for production and one for development, I would like to test some features on my development bot before releasing it to prod
thank you
wrong support server
no, this isn’t invite-role bot support server
https://discord.gg/B6yRAtJ is their support server
Hi, I'm trying to create a functionality in python within my discord bot that when someone votes for my bot sends an announcement to the server but I don't know how to do it

@old forge this look funny to scan
Hi, I'm trying to create a functionality in python within my discord bot that when someone votes for my bot sends an announcement to the server but I don't know how to do it
hey how can i make my bot to listen to vote event? like I wanna send a message to a channel if someone votes for my bot
Official Top.gg Node SDK. Latest version: 3.1.6, last published: 3 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 9 other projects in the npm registry using @top-gg/sdk.
top.gg giving error code 504 when fetching if user has voted or not, only stopped working in the past 30 mins
topgg is down or idk
nope it wasnt working after it was back up but now it is
hey, how would I go about getting the webhook data for a server vote, formatting it then posting it to a Discord webhook via a website?
Hi friends. My bot is on DiscordJS V14. How can I get the user to vote for the bot on TopGG in a command I specify? I just couldn't do it. Even though I reviewed the TopGG Api Documentation, I couldn't do it. Can you help? Thanks :)
Official Top.gg Node SDK. Latest version: 3.1.6, last published: 3 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 9 other projects in the npm registry using @top-gg/sdk.
in that app.post you can see the user of each votes and make a database of the voters, and check if the user is in that database
thanks
I want to give some coins to users when they vote for our bot. How can I do this?
have you fixed this?
Hm
no
dont ping me please thanks
be patient for a response, post a message here or in #development and make sure you refer to the docs too
It's pretty well explained on docs.top.gg
thanks
Has anyone implemented a function where if a user votes for a bot, they will be given some gifts?
its down again
sites not down but its giving errors on my bot
What wrote
saying website gave 504
ik but its letting me on the website still
Some pages are intentionally cached
Looks like it came back up within about 10 minutes
ok
hey?
i would also like the ability to use it for multiple different listing sites
You should be writing each webhook on its own.
If you want something dynamic between various list services you would have to do that on your own too.
yeah but im not 100% sure how i would do it
since i want it going through a website
Im running thought issues with my bot so idk if i did tbh ill let u know when im on my pc
One message removed from a suspended account.
One message removed from a suspended account.
Yes help me please 🥲
you can go to https://top.gg/bot/YOUR_BOT_ID_HERE/webhooks to fetch your api token 
One message removed from a suspended account.
One message removed from a suspended account.
what luca thing?
yeah what luca thing? I was sleeping
One message removed from a suspended account.
Hii.. is https://docs.top.gg/libraries/dotnet/ up to date?
thanks for the help.
Why this?
Why that??
Someone can help me?
you have push them
How??
what’s your bot language
Js
Auto-Poster for Top.gg. Latest version: 2.0.1, last published: 2 years ago. Start using topgg-autoposter in your project by running npm i topgg-autoposter. There are 4 other projects in the npm registry using topgg-autoposter.
This package is in my code what to do?
Can I use localhost to test votes?
No, no one from outside can access your localhost unless you do a port forwarding on your router
How do I get my webhook auth?
Yes, I opened a port with visual code and it's working
Once your bot has been authenticated on topgg, go to edit, select webhook, enter Webhook URL code, and Authorize
What kind of webhook url I have to enter?
Discord webhook?
Discord channel webhook or webhook created from @topgg/sdk you can find instructions on npm
use @topgg/sdk and express\
Discord webhook won't work
This is usually http://yourvpsip:port/dblwebhook
How do I get my vps ip or whatever it is
I wrote code like this, when I click on the test to vote, it is repeated continuously?
Read the documentation carefully. success is probably not what top.gg expects in response
return console.log('Invalid request!');
will also cause repeated requests, assuming the auth is incorrect.

Bro i have created this and still server count doesn't shows
How can I give members reward instantly when they vote without running any command?
As for question number one, a webhook is used for this purpose, i.e. a web server thanks to which you will receive information from top.gg if someone votes
As for the second message, it is probably due to the fact that your bot does not have an avatar on the website. At least in these cases I have observed this error
It have a avatar on the website
How do you fix it
how to chek if the user has voted rn or not
If you have around 1k votes/month then
https://docs.top.gg/api/bot/#individual-user-vote
I'd suggest setting up a webhook
https://docs.top.gg/resources/webhooks/
How do I integrate a system that announces votes on my discord bot?
I dont think anyones gonna spoonfeed you code, but you should use these webhooks: https://docs.top.gg/resources/webhooks/
I use the users api to check the topgg user but it still gives me a 404 error while that person still votes for the bot.
guild count you should realistically be pulling from your bots gateway connection. Vote data can be pulled from https://docs.top.gg/api/bot/#find-one-bot
Ideally that data should be cached, otherwise you risk getting a ratelimit.
Hmm, and how am I able to put them in one image?
@jaunty plank ?
In an image or embed?
Either way it would depend on your programming language, library used etc.
Djs and in a image
Image generation isnt something I can really give an answer to. It's really out of the scope of an API question. #development might be able to help you with image generation.
How often does the autoposter send stats, just wondering bc my console doesn't have timestamps
every 30 mins
ty
Hello, I want to know the IDs of the people who voted and commented on my bot. How can I do it?
we dont provide an api endpoint for getting the IDs of commenters.
What are you looking for with votes ids? an event? or just a list of voters?
List of the last 1000 votes: https://docs.top.gg/api/bot/#last-1000-votes
An event inside your bot when someone votes: https://docs.top.gg/resources/webhooks/
Yea I wanna give some exp this person
Youll want webhooks, as that will give you an event to give xp with
Thank u, Ill do it
@jaunty plank this looks fun to click
can I see the vote count with the api?
k but i was reading but i didn't find the vote count
points & monthlypoints
For the endpoint that checks if an individual user upvoted your bot, will it return 1 if the user voted for your bot in the past month or past 12 hours?
past 12 hours.
Thx
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

get your bot approved
Is there a link or smt that would be used
no

