#topgg-api
1 messages · Page 19 of 1
hi, just asking if its TOS to be giving users some sort of reward for every time they vote?
its not
but people dont do anything for nothing in return lol
Seems like topggpy isnt on a version that aiohttp has the _conns in?
it can be that cuz topggpy is severely outdated (4y)
I can't really check until the token thing is fixed
But yeah
That thing's outdated as hell
tbh its better to use webhook now
topggpy us very outdated
is
just setup a simple flask server
or aiohttp maybe fastapi
easy
yeah
😭 I learned how to set up a vps 2 weeks ago man
Its gonna break
learning linux a bit at the same time
obv
flask is pretty easy acc
If you can do python u can do flask
i have a rewrite of the top.gg python sdk but it's still not approved by veld to be published to pypi atm
Oh dam
also some of the API's endpoints do not work rn
veld is hard at work and he has priorities
so the api token thing won't be fixed any time soon?
feature-wise, my rewrite is done though! #topgg-open-source message
it's likely that will be fixed before the api is honestly
he recently pushed a fix so that tokens actually show for new bots
that was a side effect
yeah like i got approved, i look at my phone and i can see a token
okay, when i came back home i check the site again
and theres some JWT out of nowhere 😭
It worked after like 1 say after the token being hidden got fixed
if anyone wants to try out my branch of the python sdk, feel free: https://github.com/null8626/python-sdk/tree/v0-public
Then randomly that happened
can i technically use some libraries and host it myself on vps?
yeah?
will give it a try then, thanks
any ETA until the auth token is fixed? thanks!
can you screenshot?
Hes taking about the bug where it shows devoded JWT
Prolly
Yeah that's the issue since yesterday
Hoe does ts works?
hoe
it's a superset of JavaScript to add types, namespaces and enums (for better or worse)
You did it yet?
There's a easier option btw
not yet
well i just used a Webhook service like Hookdeck
then just built a simple aiohttp server
async def receive_votes():
from aiohttp import web
async def handle_vote(request):
data = await request.json()
user_id = data.get("user")
character = get_character(str(user_id))
if character:
character.reward_gold(500)
character.level_up(100)
character.save_to_db(str(user_id))
return web.json_response({"status": "success", "message": "Vote reward given!"})
return web.json_response({"error": "User not found"}, status=404)
app = web.Application()
app.router.add_post("/receive-vote", handle_vote)
runner = web.AppRunner(app)
await runner.setup()
site = web.TCPSite(runner, "0.0.0.0", (your port))
await site.start()
Its pretty easy
😭 never used that from aiohttp before
it just starts a site at ur ip so you can recive POST requests
then you can configure Hookdeck
to get the votes from topgg
the character stuff is from my own files
no
well then I can't figure it out
@cunning dagger can you review my bot please?
@boreal monolith
When will my bot be reviewed?
Our current average review time is 1–2 weeks.
Some bots may take longer to review than others depending on their features. Because of this, we can't guarantee your bot will be reviewed as quickly as someone else's, and there's no exact timeframe for approval. There's also no way to check your position in the queue — but remember, you're not first or last!
You're free to edit your bot's page anytime, both before and after review. This won't affect your place in the queue.
You can read more about our review process here: How the Reviewing Process Works.
In the meantime, please make sure your bot follows all of our Bot Guidelines for a quick and smooth approval!
When will token glitch will be fixed?
Has anyone tried encoding it themselves yet?
Just encode it as base64, see if it works, let us know if it does.
you cant they need to be signed
I will fix it today
This is a stupid bug from me
ugh
haha
its silly
the bug is
i write a sign a token
then return the token object rather than the written token
when did you write the code
I don't suppose it was during a hyperfocus insomnia session
adhd rapid bug fix session
yea, oh well, small bug easy fix
no problem
Also I used vote tracker bot it also Didn't worked it was glitch or something?
Not sure, we dont manage that bot :x
yall are life savers, finally
I appreciate your time on that though!
Heard you're kinda busy but yet you found time to deal with it which is great
Ofcourse!
Generally i want top gg to be stable in all fronts
So we're making big changes to push it in that direction
wrong server?
what server do I go to
okay so apparently topggpy library is still working, even if last update was 4 years ago
I managed to work with voting stuff
gotta love thoses
import { Webhook } from "@top-gg/sdk";
const webhook = new Webhook(env.TOPGG_WEBHOOK_SECRET);
app.post("/vote", webhook.listener(async vote => {
console.log(1);
}));
nothing is being logged in the console when i send a test upvote. TOPGG_WEBHOOK_SECRET logs fine and is set on the dashboard, as is the url. no middleware is present either
is the url publicly accessible
yes
it works fine when i send it myself via postman
app.post("/vote", (req, res) => {
console.log(req.body);
console.log(req.headers);
res.sendStatus(200);
});
even without the library its not logging anything, i dont think top.gg is sending the request in the first place
but again sending via postman works fine
oh weird, it works when i vote normally but not when i send the test vote.. the "test" button must be broken
shouldn't the path be /topgg/vote
nah ive got ```ts
app.use(${apiPrefix}/topgg, topggApiRoutes)
ah ok
i figured out that the test button is just broken
idk how to report that to a dev but yea
can look at it soon
thx love u
import { Api } from "@top-gg/sdk";
const top = new Api(process.env.TOP_TOKEN)
const hasVoted = await top.hasVoted(ctx.message.author.id)
if(!hasVoted) return ctx.error("You must vote for us to use this command, [click here](link is here but automod blocking)");
TopGGAPIError: 404 Not Found
someone can help?
nvm, fixed
glad it has been fixed, but if you havent yet, feel free to see this #topgg-api message
hmm does the "send test" button in the webhook section of the bot edit page is working?
it works fine
i have clicked this many time but it doesn't send anything
I was just checking if anyone had this error, thanks to that I fixed it 🙂
but when i vote for my bot it's still work fine
could be something wrong with your code or wrong address (where top.gg will send the POST request) of yours
oh
perfect!
so i think it maybe something wrong from topgg's website
idk how to report that to topgg dev
uhh let the team know in #support ig 
or just let it here as the team gon check this channel from time to time anyway
idk 
Just use CURL if you rlly need to test it
i used postman
or that
for some reason the GET bots/:bot_id/votes endpoint is not returning any votes even though I know for a fact I have recent votes, all other endpoints work no problem
The votes endpoint isn't working right now, i suggest using webhooks
gotcha thanks
So do you set up the code based on the example in the documentation in your bot's python script?
i know nothing about this library so idk why my script freezed
looks like it didn't freeze, it send back an empty list. are there any votes to count?
but why i wont get print "got votes"?
and on site my bot have 2 votes
I think there was an error in return that was immediately caught by the library(topgg) and did not return either the error or the result and because of this the script freezed
i hope if i get help
iirc the /bots/{id}/votes route is currently broken, and returns an empty array
it means that now impossible get votes?
The best way to handle them is through a webhook, so when you receive the vote you can store them on your end.
okay
You can also fetch the user's specific data /bots/{bot}/votes?userId={user_id}, which will give you a response to check if they have voted.
Isn't it /bots/{bot}/check?userId={user_id}?
Yeah it is
now all done it working fine
/bots/{bot}/check?userId={user_id} dont work?
We also need the top.gg token of the bot given at the web hooks page am I right?
help me
Do u know how I can use the api so my bot can detect who voted?
wait
Why?
|||
do you want to make a checkvote command?
Idk if it helps the bot detect who voted then sure
Cause I’m confused idk how to put a code in my bot that will help it to detect that
Can u give me an example line?
wait
I use chatgpt to code lol
const topggToken = 'zzzz';
const botId = 'zzz';
const userId = message.author.id;
try {
const response = await axios.get(`https://top.gg/api/bots/${botId}/check`, {
params: { userId },
headers: { Authorization: topggToken },
});
and embeds
if (response.data.voted === 1) = vote
else no vote
So just I have to replace the bot I’d and the token in the web hooks page of top,gg right?
yes
I have to add this after this:
yes
idk
Ok so thanks
example
const topggToken = 'zzzz';
const botId = 'zzz';
const userId = message.author.id;
try {
const response = await axios.get(https://top.gg/api/bots/${botId}/check, {
params: { userId },
headers: { Authorization: topggToken },
});
if (response.data.voted === 1) {
const embed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('thx to vote :)')
.setDescription('¡i suck ur dick!')
const voteMessage = await message.channel.send({ embeds: [embed], components: [row] });
const topggToken = 'zzzz';
const botId = 'zzz';
const userId = message.author.id;
try {
const response = await axios.get(`https://top.gg/api/bots/${botId}/check`, {
params: { userId },
headers: { Authorization: topggToken },
});
if (response.data.voted === 1) = vote
else no vote
nono
MD bro
So if someone votes the bot will dm them to suck their dick right?
I’ll use this
Nice.
I am planning to set up this for my bot for the first time. So I thought I will check with someone who did recently 😃
are u trying to require vote in order to use a command ?
Nvm that
** give me a simple python bot script that I can use so if someone votes for my bot they get a dm saying hello thanks for voting, I will modify it later to my needs but rn I completely don’t understand how I will code this so just do that please a simple script that uses my top.gg token and bot I’d. And detects whoever votes for it and the bot dms the person**
@woven coral can u help?
maybe learn how to code?
....
ChatGPT warrior
@quasi gate
oh!
Yes, could you please help me with an answer? I would be happy to reach out to you in DM, if you prefer that. Thanks.
@icy laurel
are you try to implimat it in your bot ?
api response work, the other error is ur code's error
I think so, I dont understand poruguese
send me your code
Give me a script that by which my bot can detect who voted for it and give it a dm msg saying hi thanks for voting
Plz
There isn't enough information in your request, what programming language do you know? What bot library do you know?
Yes. I just learned that I need to add API to let top.gg know about the number of servers my bot is in. I saw some examples on how to setup. More wondering where should I add that code snippet to 😂😬
Hello 👋
Is there a way to fetch the bot's global rating with the api?
Yes, If you fetch this endpoint then you can
API resource for a bots or apps on a platform like Discord
it's average_review_score I believe
or avg, I can't recall right now
Thanks, i wasn't sure because the example (https://docs.top.gg/docs/API/bot/#example-structure) doesn't contains any value for the rating ;/
API resource for a bots or apps on a platform like Discord
Found it, thanks ;)
how are we able to help you out when you don't give us any clues on how you're using the API? :^)
I can give u the script if I want
Would that help?
I'm not familiar with the api but others may help you out when you share the code, and yes this would help because what should we do if we don't have something to work with? 
Perfect
I’ll send it over
Here
Hi Everyone, is there a way to generate a test token for a dev bot??
I want to use it in Rust using autoposter
Someone help?
How can I check the number of votes for my bot using API?
?
No one is helping here
Np
see points and monthlyPoints
points = total votes
monthlyPoints = monthly votes
?
yes
tysm
const res = await fetch(`https://top.gg/api/bots/${client.user.id}/stats`, {
headers: {
Authorization: process.env.TOP_TOKEN
}
});
const data = await res.json()
{ server_count: 4, shards: [], shard_count: null }
hm?
nvm,
xd
@woven coral please help me I don’t know what’s wrong but it’s giving me an error trying to fetch the api
your messages are hide, like you have a ban<
Bruh idk why
"likely spammer"
Yes, i think you spam to much)
which error do you have, give code
I did
Look
idk python, sorry
I’m just tryna make a bot that gives rewards for voting
Well then if u can, give me a code in Java
I’ll take it
Just that it should work
use ChatGPT
i dont use java
I tried
but what you wanna do
I’m a dev too yk
which command or something
I told u alr I want my bot to be able to detect who voted for it
Like !checkvote cmd
Like that
V1 when
Airners the best platform for earning
Is there somewhere I can see the webhook info when someone votes for my bot (the post body)? The webhook tester works but It doesnt show me the info so I dont know how to extract the user from it.
I can call webhook I am using with an API tester so I dont know which parameters to pass in to make it work.
Something like body.user?
Webhook integration for receiving vote data
I found that but it doesn't show me how to data is structured in the JSON. So I can't find specific things
And that is all that is in the body?
yes
I set up the webhook for votes. When I test it, it says it works but nothing goes to the channel Inset up to log the votes. If I trigger the bot webhook with an API tester it works.
How do I know for certain the vote POST actually went off? Is there a log somewhere?
are you using a discord webhook? discord and top.gg webhooks arent compatible
No, it's a botghost webhook.
not sure how to help you with that one 👀 that may be a question for botghost support
Since I can do a post manually to the BG webhook they said it is not their problem. I know it is not exactly Top.ggs question either.
I was hoping there was a log somewhere for the webhook calls so I could debug where the connection is being dropped
I see, thats not possible unfortunately
Yeah, we dont have that log.
We know webhooks are sent though, last I heard no votes were missed for awhile.
Do the vote POSTs work with IFTTT webhooks?
I havent used IFTTT in so long, but I'd assume so
Your bot page, edit > webhooks > token
Thank you!
How to Get Top gg api?
no option there ig
wdym
to get api
what does "get api" even mean
mm i got it
Hello can anyone help me to make a event like when a user vote for my bot it send in a specifyed channel like
Vote count 2```
like this any api? to find it
Or like a api to get recent vote info
Webhook integration for receiving vote data
Did you setup webhooks?
https://topggpy.readthedocs.io/en/stable/webhooks.html#webhookmanager
&
https://docs.top.gg/docs/Resources/webhooks
Webhook integration for receiving vote data
i think yes
like 3 days ago but when i press 'send test' it returns status code 204
Topgg webhooks are not discord webhooks
You need to use your own webhook url and auth
so i need create my own website?
i seem to understand how it works, are there any ways then for it to send a request to my bot? I don't know much about APIs
I was considering doing this. Would this just entail creating a backend api on a webpage that can accept webhook requests?
Error code 500 when posting stats?
Getting error 405 when checking individual votes 😭
Been doing this since god knows when, surely this isn't a fault on my side?
async with self.bot.web_session.post(
url="https://top.gg/api/bots/1094999557110251570/check",
headers={"Authorization": token},
params={"userId": ctx.author.id},
) as resp:
...
Error 405 says that you are using a method that is not allowed. This is most likely because you are using a POST request instead of a GET
5xx errors are server errors, nothing you can fix yourself so you probably just have to wait
ah silly me, used POST like that for a while and was confused why it wasn't working, thanks!
Just wondering how do I setup the webhook URL system?
Do I need to do it through a bot?
or what do I need to do it though?
From what i saw earlier, you need a server that can take the incoming webhook
No, so you have to have a server listening for the webhook. They dont support webhooks directly to discord
okay now how does that work...
You have the have a listening event somewhere for it that's open to http requests. The top.gg api sends a webhook to that open http and then from there whatever you are receiving on should process what you do next with it
You would have to have a open facing http listener
So it depends. What are you hosting your stuff on?
I host using discloud, I don't have a dashboard yet, and I don't have a bot website which isn't coming out until at least version 2 of my bot
Does discloud have a spot to receive http requests?
I actually have to check that
If it does just make an endpoint for the webhook to be sent to
if it doesn't then how would I go then to get it to work another way...
The only way to get it to work is too have an endpoint to receive it on
okay, I'm waiting for a reply from someone in the support server for discloud
btw const webhook = new Topgg.Webhook("your webhook auth") is the webhook token or the webhook url? I think it is the webhook token lol I am not sure
Discloud has http requests
It can be anything, a password or a randomly generated token. The important thing is that it is the same as what you entered on top.gg
This is a safeguard to prevent someone from "accidentally" spamming your webhook. All requests that do not match will be ignored
ah that's very cool!
It seems to me that this is the worst library that I saw, there is not a single working function
Huh
Opps
@gritty bobcat what error codes are you getting?
One message removed from a suspended account.
One message removed from a suspended account.
What are you using to send the data?
One message removed from a suspended account.
Does your postman declare the bot_id variable?
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.
What is your native coding language?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
That's odd. How are you formatting curl? I am completely inexperienced with postman
One message removed from a suspended account.
One message removed from a suspended account.
1 sec testing a curl statement out
Are you on windows?
One message removed from a suspended account.
Heres a powershell curl command
Replace ID with your bot id
Token- with ur auth token make sure the quotes stay around the token
and replace the server count number, since it is an integer it doesnt need quotes.
Then let me know if the response is a 200 or 500
Iirc form data causes this error, use json.
One message removed from a suspended account.
One message removed from a suspended account.
perfect 🙂
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.
Anytime, I am here to help
I'll see if I can make a PR on the docs.
Third time I've seen people use forms for it.
I just wish we gave proper errors 
One message removed from a suspended account.
One message removed from a suspended account.
One day!
True, I dont think I've ever used forms tbh
Is there is any request that tells me if the user voted or not? or should i use webhooks
Webhooks are preferred
Webhooks are nice because all you have to do is be listening rather than sending request after request
What's the problem with sending request after request
ratelimit
Because it takes up requests. If theres an easier way it's better to go that route. You cant spam the api or you get rate limited whereas if you do webhooks it's almost instant
What's the rate limit, how many request in what period time?
what bot id?
nvm im dumb
his 
Why can't I get a token?
Hello , which url should i write here?
I am doing when someone vote i got in specific channel with voter info as a log .Also do i have to install @topgg-SDK package?
how to get your webhook
The url of your webhook (not Discord one) that will receive requests from top.gg
You code it pretty much. A webhook is nothing more than a web server that is used to receive requests from other sources (in this case from top.gg)
How I can get it? Or do you mean
https://serverip:port/votes?
It can be http://ip:port/votes but it can also be http(s)://yourdomain/votes
How you do it is up to you
I am gonna see. Another question now do I required to install @topgg-SDK package?
Also do the test button works well
You mean the npm one?
Yes
This package can create webhook for you and makes it easy to use the API
You can still make a webhook without it, but that decision is up to you
What about ..
Hmmm ok thanks . I am gonna try it now and inform you
is bannerUrl gone from the API?
because it's not in the repo and a quick bot search gave me a bot object that doesn't have bannerUrl
I need help
How can i make vote : true/false
Checks for user if they hsve voted or not
If they havent voted an embed appears tells to vote
After they vote the command executes
(Js)
Just looking at the release notes and I can quote a swap. Any more info than "not working"?
Nvm i made it
cc @vital anvil
not sure, i haven't removed it iirc
do you have plans on removing it?
or deprecating it in some way
because if so, i'll add it to my spreadsheet
@woven coral Does the api even provide that , dont think it ever has?
God, bannerUrl is stone age top.gg
Was probably even before the redesign
It was when the bots were listed as cards
unsure
i saw i have it in my sdks lol
but it's not in the documentation
Ah, been gone a while
the API top.gg/api/bots/id/check check if voted in the last 24 hours or it counts forever?
Do we have an eta for the refresh data being fixed? I know it's a known issue, I'm just curious
Yes
i guess i'll just mark it as removed then
veld if you're reading this, feel free to tell me if i should do otherwise
@scarlet cobalt what do you think?
One message removed from a suspended account.
Out of town celebrating Easter but for sure something I'll handle when home again 
have fun with easter!

Thank you! Don't know if you celebrate, if you do happy Easter and if you don't I hope you've had a good weekend
I don't see any issues w/ you continuing work on the package
Just make sure the code is well documented and or easy to understand and send a PR 
Must admit I'm not up to date on API coverage on most of our libraries save for js and py. We missing features?
thank you!! 
i am currently working on updating the other sdks as well
except php, i don't understand php
Solid
Appreciate it
PHP is a language of the cursed ones
my current progress and coverage can be seen here
#topgg-open-source message
so far most things have been updated, except for maybe the new review object
and most libraries sadly still has not been tested
some of them do compile yes, but that's about it
sure if you're free!
They call me unit test Jesus (they don't)
i appreciate your offer! 
i have found an error on the Edit site when i try to test send a webhook for votes isnt working but when i make a real vote its working and the data can be pushed to my bot webhook server
Bol
This issue was fixed <3
Radhe radhe 🙏🏻
Is it normal that requests to the /stats route time out?
why has the /users endpoint been removed from api?
i literally cannot use it as it throws this, I think you guys should rewrite the package according to the api.
Its marked as deprecated
https://github.com/Top-gg-Community/node-sdk/blob/master/src/structs/Api.ts#L178-L197
An official module for interacting with the Top.gg API - Top-gg-Community/node-sdk
It was deprecated, iirc it wasnt really used
the info was all very very outdated on it anyway
what's your usecase?
are there any known issues with the /stats post endpoint? I've been getting a 500 error for the past few days
A silly one tbh
I was only gonna use it for avatar hash of the voter
So I'm trying to add a discord bot but when I put in the application ID it says it can't find it.
I have triple and quadruple checked, that ID is definitely correct.
Also possibly related question, how are bots that are only user-installable (not guild-installable) handled?
Would I just provide a user count as the server count? That seems like it'd be rather unfair though, much easier to get more users than it is to get more servers.
unfortunately we don't support User-App yet. We plan to sometime in the future but as of current there is no ETA
Hello, just wondering how can I get my bot stats to show up? I am trying to get it setup and I am having a hard time doing so
support specifically says not to use it for development related stuff, i thought this would fall under that
this is support related as it's about the site 
but the server count yeah you can ask here 
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
I've been getting a 500 error posting server/shard count for a few days now, any specific reason for that?
So does this mean that any applications for user-installed bots will be declined? Or will they just suffer from a lack of support (e.g. server count of 1)?
If the bot needs to be guild installable in order to get approved then it would be nice to know that before the review is declined to avoid waiting 1-2 weeks for a review twice. Especially since there would be some design tweaks needed to properly handle guild installs.
or is this the wrong channel for these questions too?
user installed bots will be declined
this channel is for topgg api related questions so id put them in support too yeah, but it's fine 
uh where's the search query parameter?

i was checking my sdks and then i realized that the docs doesn't even have the core search feature documented?
it's still there right?
@untold sparrow what do you think?
hello bot devs, is your server count updating via the api?
Hi, yes it does
POST /bots/stats?
oh is it recently fixed?
no idea tbh

been a long long day w/ exams so wont have the energy to look at this today. I'll try to remember tomorrow otherwise holler at me and I'll take a peek
-botinfo Musical#7063
bruh
Bruhhh
sory
Guys I had the script that posts my discord bot stats on topgg and everything worked perfectly but one day I don't know what changed the bot says posted stats on topgg but it doesn't
My bot stacked on 12k servers
how did you get it to 12k server??????????
It's 16k basically that's why I'm asking
drugs
the topgg autoposter doesnt post my full server count on topgg since I added sharding to my bot
any way to fix this?
broadcast eval
I did do that, but it still did not provide all the servers only the servers on the shard its currently in
const results = await client.shard.broadcastEval(c => c.guilds.cache.size);
this is the correct usage
of the broadcastEval
right?
wdym
like [12, 32, 54, 45]
Ah
.reduce((acc, cur) => acc + cur, 0)
Alright, ill implement that hopefully it works
added a reduce but it still doesnt seem to get all the servers
/**
* Initialize Top.gg stats autoposter (sharding-aware)
* @param {string} topggApiToken - The Top.gg API token
* @param {Client} client - The Discord.js client instance
* @returns {void}
*/
async function initializeAutopost(topggApiToken, client) {
if (client.shard && client.shard.ids[0] !== 0) return;
async function getTotalServerCount() {
if (client.shard) {
const results = await client.shard.broadcastEval(c => c.guilds.cache.size);
return results.reduce((acc, count) => acc + count, 0);
} else {
return client.guilds.cache.size;
}
}
const ap = AutoPoster(topggApiToken, client, { postInterval: 1800000 }); // 30 min
ap.on('autopost', async () => {
const totalServerCount = await getTotalServerCount();
ap._poster._post({ serverCount: totalServerCount });
});
ap.on('posted', (stats) => {
console.log(`✅ Posted stats to Top.gg | ${stats.serverCount} servers`);
});
ap.on('error', (error) => {
console.error('Error posting stats to Top.gg:', error);
});
}
module.exports = { initializeAutopost };```
this is my full code
i have no idea what im doing wrong lol
console.log is your best friend
also why even bother using a library for literally a single http request
is initializeAutopost called, try calling getTotalServerCount outside of autoposter
maybe remove autoposter entierly and just use fetch
alright
do you know what the endpoint is
by any chance
there's nothing inherently wrong with that
Commands for Your Role:
avatar
botinfo
help
ping
roleinfo
serverinfo
userinfo
-botinfo
You need to provide a bot to find
-botinfo 1362995466077208588
"Aranyani – The mystical forest spirit of your server! Calm, wise, and ready to help with fun, chat & moderation."
1362995466077208588
Aranyani
!
0 servers
0 monthly votes
0 total votes
admin, automod, autorole, autoroles, free, gaming-community, level-up, level-up-system, moderation, reaction-roles, small-server, welcomefarewell-messages
@neon basin
Hi guys, is there any daily quota limit for the APi? I'm trying to make a bot that can search glboal bots and in guild
Not that I know of, how do you plan on searching for these bots, as Top.gg does not have an api search route iirc.
You can view the ratelimits here:
https://docs.top.gg/docs/Resources/ratelimits
Global and route-specific rate limits
Ah okay
what about now?
Going fine dining / drinking with uni friends so today is not possible. Could perhaps look into it tomorrow depending on how the day looks
Search on the api has been broken for years iirc.
is it deprecated or not
I think the docs for it should be removed until it's fixed.
because i was concerned when its not mentioned anywhere in the docs
maintaining 9 sdks at once is
so i need to make sure
Is this on the main docs site? Or an sdk
Sadly I don't think updates are working for that right now.
I'll make sure to note it down for the next meeting, or @dapper copper if you get a chance.
I debugged updating the docs like a year ago, but the fix wasn't handled on the team side I guess.
😭
shouldn't this issue also be listed in #support pins?
That the docs are wrong? Probably not.
Search works for users, just not for devs.
I'll look into the docs issue
for users?
but we may very well just rewrite docs as a whole tbh
I can find my notes on it @dapper copper
Its a two second fix on the teams side
Literally just an outdated setting
yea but the docs need refreshing anyway
but it still doesn't work right
would love to get it to something like https://docs.topstats.gg/docs
so we can have brand consistency
A guide to using TopStats.gg's API.
wouldnt be too hard to do either
I'd also talk to Lua since they are pretty decent with documentation and styling
yeah
I mean it hasn't worked properly since before I was on the team.
No one really has complained so it probably needs to be deprecated.
lua is truly the goat
deprecated???
so the purpose of the GET /bots endpoint is just to merely retrieve top bots based on a specific sorting criteria now
i mean if it's deprecated i have no problem removing it from every sdk i've been working on
basically
afaik search hasnt worked for ages tho, as woo said
do they plan on fixing it or deprecating it
No idea, we'll let you know when we know more
alright, please do
i am aware the team has priorities 
since they have huge plans ahead for this year
but don't forget to not leave the devs behind lol
Guys did the api changed cause my bot stopped posting stats like it used to
Does anyone know how to check if the person is logged in to top.gg, if they have never logged in it will say "No" and if they have already logged in it will say "Yes". That's it.
nope doesnt exist
okay
hi
guys
lmao hidden from likely spammer
@abstract moth
hey! I found a mistake in the API. How can I contribute and make a change?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
guys how to post bot stats if our bot is over 16k servers
my bot stoped posting from 13k
There are bots that have many more servers and post statistics without any problems
@iron cosmos hey if u show me ur code i wont mind helping u out 👍
oh wait top gg has their own api? nvm sorry i thought u were referring to discord api im sorry @iron cosmos
It would be good if the API also returned the timestamp of when a user voted.
-
The
/bots/*route has a rate limit of 60 requests per minute. So I can't use it for large bots
-
Sometimes webhooks are missed randomly — some users report that the bot still asks them to vote even after they’ve already voted.
the only way to achieve is this through webhooks
if webhooks are randomly missed then maybe it's a problem from the servers' side?
like POST /bots/stats is not working rn
if you're shifting servers during that downtime, all the webhooks sent will be missed. Top.gg retries failed webhooks, but with some delay that's not good.
why so?
can u on a dm
im using botghost (non-coding bot builder) and after test requesting individual user vote API, it send me this response
Hello, I just have a question regarding your bot's voting system.
Is it possible to get or find out the last voter who voted for the bot?
We are developing a feature that relies on this behavior, and it would be really useful to know the most recent voter.
just curious what s the feature
if /bots/votes doesn't work but /bots/BOT_ID/votes does (by this i mean it gives a 200), is it a part of the bug that caused the endpoint to not work? (as in it's still listed in #support pins)
i've updated several of my sdks to destruct token information to retrieve the bot ID again because of this
i was planning to create a pull request to the Node.js SDK to fix this but i paused at the last minute to see whether this issue is intentional or not
Hello
why am i receiving multiple vote post requests for a same user
Generally top.gg repeats webhooks when you either don't respond with status 200/ the webhook receives a 5xx response or when the request timeouts (you have 5 seconds to respond before the request is considered timeouted)
see #support pins
is anyone else experiencing issues with intermittent webhooks?
Is there any ways to get the votes of a server?
I don't think so as there is only documentation for bots and users atm
Okay
Hey, I use the TopggAPI with Javascript and get the following error with the code await api.getVotes(): TopGGAPIError: 400 Bad Request.
Implements:
const api = new Topgg.Api(“TOKEN”);```
Dependencies:
NodeJS 22.16.0
NPM 10.9.2
Disocrd.JS 14.14.1
TopggAPI 3.1.6
Can anyone help me with this?
It's probably because the library hasn't been updated for a long time and the endpoint used by the .getVotes() function simply doesn't work as null noticed in this message - #topgg-api message
Unfortunately, this "working" endpoint does not work completely because in theory it works but returns nothing afaik
is it possible to make a command like /votes and see how many times you voted for the bot
Then you should probably use this one https://docs.top.gg/docs/API/bot#individual-user-vote
API resource for a bots or apps on a platform like Discord
class ScamBot(commands.AutoShardedBot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
super().__init__(command_prefix="/", intents=intents, shard_count=2)
print("[DEBUG] ScamBot initialized")
self.topgg_token = os.getenv("TOP_GG_TOKEN", "").strip()
self.ready_for_stats = asyncio.Event()
async def setup_hook(self):
self.update_topgg_stats.start()
print("[DEBUG] setup_hook running")
@tasks.loop(minutes=30)
async def update_topgg_stats(self):
await self.ready_for_stats.wait()
url = f"https://top.gg/api/bots/{self.user.id}/stats"
headers = {
"Authorization": self.topgg_token,
"Content-Type": "application/json"
}
try:
shard_counts = [len([g for g in self.guilds if g.shard_id == i]) for i in range(self.shard_count)]
data = {
"server_count": sum(shard_counts),
"shard_count": self.shard_count,
"shards": shard_counts
}
async with aiohttp.ClientSession() as session:
async with session.post(url, headers=headers, json=data) as resp:
if resp.status == 200:
print(f"[TOP.GG] Posted server count: {data['server_count']}")
else:
error = await resp.text()
print(f"[TOP.GG ERROR] Status {resp.status}: {error}")
except Exception as e:
print(f"[TOP.GG EXCEPTION] {e}")```
Any help please!
Figured it out
Nvm
"scam bot"
The bot bans scammers. Thats the idea.
Im having issues with it running @on_ready for some reason. Idk why but it eventually does
It ran eventually so idc
Now my page isent showing the data...
the page is cached iirc
I refreshed the data
And my page dosent even show it
This is a site thing so ima move this to support
bot settings webhook
Got it, ty!!
just wait a little
Is it possible to know what place my bot is in on the leaderboard by votes?
Discover in-depth Discord bot statistics, analytics, and comparisons with TopStats.gg. Track your favorite bots' performance, growth, and popularity in real time.
thanks
still waiting
hi! where can i find the topgg master branch that compatible with py-cord ?
Im sorry ima sound like a jeark here. What the hell did i screw up. Someone please tell me
Hi, I have a problem. I no longer have access to the API link with my bot. When I type: https://top.gg/api/bots/1091794522599596092
It says: {"message":"Unauthorized"}
Is this normal?
you need to use an API token
this ?
yeh
Like that ?
try and see
although I personally recommend using webhooks and storing the voted state yourself
It doesn't show me anything, there have been recent API changes.
👀 thats an undocumented api endpoint
What do you mean? Because before it worked, I went through that to check.
This is what my code does
Well, I have a person using my bot who wants to vote but I have a 404 error.
a 404 is returned when they've never voted
I don't like that they did it like that but yes
Bot says the stats are submitted. Page says otherwise.
class ScamBot(commands.AutoShardedBot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
super().__init__(command_prefix="/", intents=intents, shard_count=2)
print("[DEBUG] ScamBot initialized")
self.topgg_token = os.getenv("TOP_GG_TOKEN", "").strip()
self.ready_for_stats = asyncio.Event()
async def setup_hook(self):
self.update_topgg_stats.start()
print("[DEBUG] setup_hook running")
@tasks.loop(minutes=30)
async def update_topgg_stats(self):
await self.ready_for_stats.wait()
url = f"https://top.gg/api/bots/{self.user.id}/stats"
headers = {
"Authorization": self.topgg_token,
"Content-Type": "application/json"
}
try:
shard_counts = [len([g for g in self.guilds if g.shard_id == i]) for i in range(self.shard_count)]
data = {
"server_count": sum(shard_counts),
"shard_count": self.shard_count,
"shards": shard_counts
}
async with aiohttp.ClientSession() as session:
async with session.post(url, headers=headers, json=data) as resp:
if resp.status == 200:
print(f"[TOP.GG] Posted server count: {data['server_count']}")
else:
error = await resp.text()
print(f"[TOP.GG ERROR] Status {resp.status}: {error}")
except Exception as e:
print(f"[TOP.GG EXCEPTION] {e}")```
Reutrns 190 submitted. But does not show on site. Ive reloaded and cleared cache no luck
This is the only other part
```py
async def on_ready():
print("[DEBUG] on_ready triggered")
if hasattr(bot, "ready_for_stats"):
print("[DEBUG] Setting ready_for_stats event")
bot.ready_for_stats.set()```
The bot reports it has submitted the data to top.gg every time i check my page i dont see any of the stats. Ive reloaded data and checked after a few hours. Help
Maybe try without shards, never seen someone using it tbh
I can try. Still dosent make sence why it says it uploaded my server count and not show. But ive seen crazier
Unfortunately the API is very buggy and I wouldn't be surprised if the API simply didn't return most of the errors
honestly it seems to be buggy.
Yeah for some reson that fixed it
that made 0 sence
bot settings > webhook
Has anyone else encountered a status 500 issue at /api/bots/<bot ID>/stats?
I had seen other people with issues there
found the issue
forgot to format my data as json
still shouldnt be giving an internal server error though
can you show how your passing the data, but hide the key?
and check other endpoints to see if they all return that?
Sure
>>> import requests
>>> requests.post("https://top.gg/api/bots/735147633076863027/stats", headers={"Authorization": ...}) # -> 500 Internal Server Error
>>> requests.post("https://top.gg/api/bots/735147633076863027/stats", headers={"Authorization": ...}, data="not empty") # -> 500 Internal Server Error
>>> requests.post("https://top.gg/api/bots/735147633076863027/stats", headers={"Authorization": ..., "Content-Type": "application/json; charset=utf-8"}) # -> 500 Internal Server Error
these are the variants on /stats giving internal server errors
bet
will get back to you when they respond, sorry about the delay.
no worries
cant able to send npotification to my discord channel who voted my bot
@signal harness
This appears to be hosted by yourself, so method not allowed seems to be on your end because its your code?
Where do you find the API token please?
bot settings > webhook
and with that I will be able to check the members' vote for the bot's commands?
Check the number of times a user has voted yet
Hello, I am looking into making vote rewards for my bot just where do I get started? I am not sure how to get started
There are two ways to approach this matter. A recommended one and a less recommended but possible one
Recommended - receive webhooks from top.gg when someone votes (https://docs.top.gg/docs/Resources/webhooks)
Not entirely recommended due to the rate limits - check if a user voted for your bot using top.gg api (https://docs.top.gg/docs/API/bot#individual-user-vote)
Can you try a new token?
I can just seems odd it randomly got resetted.
I do not believe it does just double check you have the current one
Its the same but now it works. Idk what was happening there. Odd
Hey, i don't use the normal way in package file which should be "discord.js": "^13.17.1" but i made it as "discord13": "npm:discord.js@^13.17.1" and it works with everything but i just noticed that the bot stopped updating stats.
Last time the code i provided below worked 25th May but now it returns error with unsupported client.
So i need to ask, is there still a way of using it the way i prefer or am i forced now to use the first one? 😦
const { Client, Intents } = require('discord13');
const client = new Client({ //intents }); //client exported to the code below
module.exports.topggstats = async function (client) {
const vars = require("./Settings.json");
const { AutoPoster } = require('topgg-autoposter');
try {
const poster = AutoPoster(vars.topgg.token, client);
poster.on('posted', (stats) => {
console.log(`${stats.serverCount}`);
});
} catch (error) {
console.log(error);
};
}
You can try with the official top.gg library, i.e. @top.gg/sdk and make the autoposting logic from scratch, or completely abandon external libraries and create your own API request using the documentation (https://docs.top.gg)
It's possible that top.gg-autoposter does some checks under the hood of the client to choose the right way to obtain information from the client for a particular library and they didn't foresee a situation like yours, although from what I understand it shouldn't be any different from the discord.js client
will do, thank you! 
indeed it resolved the issue, thank you once more! 
Failed to post server count! Status: 500, Error: {"message":"An unknown error occurred, sorry!"}
getting this when trying to post the server count on topgg, can someone is there any fault on my side or from the topgg server-side?
Not without better context, are you using some library perhaps?
can you make sure your bot page doesn't have any issues?
my bot was actually working as expected other than posting the server count on topgg, the only possible reason i could think right now is bcoz of topgg server issue or something, because after i left it for like few hours, i didn't saw that error again
@vital anvil yo sister
?
..
🥺
dashboard -> webhooks
yup
Sister is missing
hi! im trying to create a reward system for whenever users vote for my bot but i have no idea how to test it to see if it works since you can only vote every 12 hours. is there a way to simulate a user voting to test functionality?
there is a test button on the webhook page
hi again! im still trying to get the webhook to work but i keep getting error messages anytime i try to test it. i have like no idea what to do
i followed the example given on the documentation but for some reason, mine doesnt seem to work
Is it possable to use the API to send the # of scammers i have in my db?
I dident know if you could send custom feilds on it
you cant
@woven coral I'm bored so lets just rewrite the python sdk 
https://docs.top.gg/docs/Resources/webhooks maybe this will help
Webhook integration for receiving vote data
kk no problem 👍
i already did tho

😭
I forgot, I only saw that it was last updated 4 years ago mbbb
-# it was 0:44am at that time, eepy
it's alright!

you could try working on my fork's v0-rewrite branch
Will take a look later, I'm at school atm 
While setting up the server count for my bot on top.gg, I noticed that you can enter literally any number. Isn’t that a bit misleading?
You can, yes it is true but just because you can doesn't mean you should. Lying about the number of servers can get your bot removed from the website
Also it is not such a big factor that will better position your bot or something, taking such a risk is simply not worth it
hello! is there any api that return last_vote or smth 
if you want to check when a user last voted, it's probably better to use the webhooks and keeping track of that yourself in your own database
it's faster (as in runtime performance) and you won't hit ratelimiter
what lib are you using
i have no other choices than using aiohttp
how so
ohh wait, i understand now
ok thank you! i fear it might be working! idk how to test if the webhook is working or not...
hmm seem like its not working for me D: do you have any examples at least? im kinda lost
well I don't do python but basically
Guys I've received the vote event like 10 times a few hours ago. Anybody else having this experience?
the same event?
/ from the same user?
Yes
are you responding with a proper 200 status code
I have to check but I'm sure I do
topgg retires events if you fail to respond properly
top.gg also repeats requests if it thinks the request timed out (took you more than 5 seconds to respond)
So you should probably respond to the request first, then do some shenanigans with the database and so on in my opinion
in webhook tab
if your bot is not accepted then you can't get the token
but your answer is to go to docs
Do they have to verify my bot??
have you even submitted your bot to the top.gg ? im asking because your answer shows like you didn't
I added my bot to top.gg and it says it will be verified in 1 or 2 weeks
and after that time you'll gain the access to the token so in the meantime you can just look at the docs, https://docs.top.gg/docs
Oh ok thx
All i need is the api so my antinuke could work
I have bdfd version of my bot
wild partial token
why is your phone icons backwards
Supposed to be like this
Im arab
Hello, I'm getting a TopGGAPIError: 404 Not Found error... I've done everything I can to make it work, updated it, and the API token is valid, but I'm still getting this error. If anyone knows how to fix it, I'd love to hear it!
Thank you very much.
....
Hello, what endpoint is this?
Reset your browser
hello folks, im tryna setup the webhook thing from the example in the github - do i put the webhook url as http://public_ip:port/votes or http://public_ip:port/dblwebhook?
and yes port forwarding is all ok dw
discord.py, python for reference
So I made my own answer
But since I'm using the docs examples, the endpoint no longer workw
Is there an alternative? If so how do I use it
What endpoint exactly?
that one
im basically following a edited version of the github example
Since this API is more outdated than floppy disks, I have forced asked my Dev friend to basically get smth that works, as smooth as possible ideally without requests, so if I get smth working I will probably post it here with some instructions to help others
Websockets?
👀
Allows creating Websockets instead of webhooks for Top.gg bots. Making it easier to get real-time data.
I use python :(
Python works, just no one has made a library for it
Hello
hello where can i get my api token?
You need an approved bot then its under your bot settings -> webhooks
my bot is approved
that is the link you for.
thanks
If anyone here has a working example for the python API, please can you share it?
Recommendations are described on the website
Yeah well not my fault their api examples are 4 years old
I did according to their examples and everything works
their github examples?
youre welcome to share your code for the rest of us
API resource for a bots or apps on a platform like Discord
i was talking about their github examples since they can handle live on vote events
This code (an example of which I shared in the link above) also processes all events in real time and outputs information to the console. I wrote another code that sends this information to a channel on the server and assigns a role.
so you setup something to check for new edits on the bot votes page? since otherwise with that code you cant do that.
I used this information as a starting point for my work.
yoo using this myself to try it, its already a lot easier to use and makes more sense but im having trouble actually installing it.. since its not an official like pip library i figured cloning the git repo, but i cannot figure it out from there - if you could give me a lil help as to how to get started with it that would be much appreciated!
wait wait wait
waits patiently
i still have the base URL set to /v1/ lol
oh lmao
it just works better as is, still tryna figure out how to actually get it working but its easier to use
i'll create a separate branch for it
so future changes wouldn't affect it once veld soon announces updates for v1
since im using like webhooks = topgg.Webhooks(os.getenv('TOPGG_WEBHOOK'), 9500) but since it also needs topgg imported then its a case of like oh topgg has no attribute webhook
everyone, please use this branch for the time being, thanks! https://github.com/null8626/python-sdk/tree/v0-public

cc @steep vigil
pip install git+https://github.com/null8626/python-sdk.git@v0-public
i'm going to sleep now, so i might not reply in 8 hours, good night! 
Good night! Thank you for all the help and the scarily quick response
oh my fuckin god it works

Thanks so much btw, first working API option I've actually found which is intuitive!
can i just get a static number of current active votes?
You should probably check monthlyPoints field value
that's safe to use every 30 minutes right?
Yea, should be fine
mm
apparently I'm not posting correctly
huh
so the API docs default to v1, which isn't currently active, so following the API docs means that my posts return 200 and then don't update the info on my bots page
hi
How do I send embed messages when someone votes for the server using my custom bot?
which language are you using
https://docs.top.gg/docs/Libraries/javascript
use the app.post /dblwebhook and edit console.log to send the embed or do whatever you want
Official Top.gg JavaScript library
Ty
As I understand it, you need a static IP. I have it set up on the hosting and everything works
I wanna track votes for my server using my custom bot.
mmmmm okay
websocket mode when 😔
How do i do that?.
There are recommendations on the official website
And someone previously sent a link to GitHub with a ready-made code
Oh thank you!
i thought top.gg first will approve my bot then i can do further work.
Yes, that's right. Your bot needs to be approved
Can u share the link currently i am on github page. i cant see there
A link to what? For a ready-made code?
Nvm found it
Okay, I'm glad, because I haven't written it down
Hm
where to sent bot approve request
I exactly wanna do is i wanna track votes for my server using my personal bot.
To do this, your bot needs to be approved
I see
where can i send the request




