#topgg-api
1 messages ยท Page 17 of 1
JS users ๐ฃ๏ธ
i dont even understand the purpose of tuples in py
Think of a database like a spreadsheet.
You have columns and rows.
Rows are individual things(like a player)
Columns are each individual thing related to each player
can i nest stuff
thats a wide column database though
So you can take your dict, and rotate it sideways. That's how your "spreadsheet" would look.
you can have others
Wide is good
i like key
You can have thousands ^-^
๐
Key-value stuff is fine. It just gets complicated with a lot of stuff
can redis store dicts?
yeah
oh so why not store ur whole json into 1 redis and each time ur using it call the redis to retrieve the data then put it back in there again
data does not share between shards
would not be possible to async it innit
my point is why would you read write a whole json in one go when you only need to read write the data youre editing
๐
It's slow, but it works
ofc it works, but kind of makes the point of redis obsolute.
better to just learn how to use it
.-.
well i suppose if your json is never gonna be larger than tens of kilobytes you wont have an issue
im looking for a way to simply bridge JSON from a shard to another
for now
oh wait y do it now its pointless for me atm
๐
Here's the thing, when you need it you'll need it instantly.
Or you'll have to bring your bot offline until you fix it
not really
i can just recode the entire thing and do 1 restart
You don't have to fix it now, but just start thinking about it.
'yeah but its gonna be broken until u restart it
Yeah, but if you don't know how it can take days
if u suddenly need shards
Discord will kick your bot offline yeah
Start thinking about it now, start preparing for it soon, finish it before 1k servers ^-^
The ideal time to be sharded is around 1500 servers
Since this is a big refactor, youll want to work on it early.
After vote rewards i started getting 25 new servers a day, and i only had 25 before that. Suddenly sharding was something that was gonna happen very soon.
Not to mention after a week i might be up to 50 servers a day.
Snowball effect and whatnot
Get reminders working. Next to rewards its the biggest thing that will improve your counts.
Already have vote reminders 
Put that in redis first, thats a good way to start.
Yeah
i see, in what way are you suggesting i implement this?
redis can use expire times.
So, you store the id of the user who voted with an expire time of 12 hours.
After 12 hours it will expire and be deleted from redis automagically.
Pub/Sub to the expire and redis will give you an event and the Users ID.
oh wow! thats sounds like an amazingly easy way to implement reminders
switching to a db improving my script in more than one way
Yeah, itll be 1-2 lines to add the key. and 4-5 to send the reminder message.
yeah local is probably best, whats the point of nano second writes if it takes 150 ms to get the info
only problem is idk if my hoster has support for this
ill have to
see
when im done learning
vps?
nope
ease of use mainly
never expected my bot to get this far, this was just a side project. Never done any of this before.
It stores everything in memory
^
thats expensive
its not
A proper database is better for memory usage.
a discord bot is already a very lightweight application
so dont really need to worry about ur memory size
alr ill hop off the night gn yall
just make sure you have overhead and youre fine
gn!
i mean thats a lot
but servers have way more ram than that
plus topgg has tens of thousands of bots and users and interactions
so it makes sense
I'm sure its mostly caching searches causing that size.
Also yeah
i found ZODB which allows async read-writes but idk if it has any flaws
it uses JSON objects so thats already a plus
SQL has a flaw, that is it does not allow async write
it can only process one write at a time
SQL can pool
Keep in mind things like discord uses SQL, it's great for huge huge workloads, things like async and concurrency are not problems you're likely to run into(at least until you're a company)
i found the multiprocessing just now
@scarlet snow u may want to look into this
apparently this creates a shared variable that can be accessed by different processes, in this context im talking about shards
u can just plug ur JSON file in a variable and use it for the whole bot(?)
idk if this impacts performance in any way but the first thing is that it works like a normal python variable
Huh, cool!
Ive already decided on switching to a vps and REDIS though, spent some time yesterday learning REDIS and im gonna continue today.
Our convo yesterday made me realise that when the bot is bigger that just 5 minutes of progress list could mean a lot to a lot of people.
But this seems perfect for your application, yeah!
One message removed from a suspended account.
because we're very excited.
REDDIISSSSSSS
I dont have a VPS so running redis is not a possible approach
Im looking for absolutely anything with the simplest syntax and also shares between shards. I dont want no SQL cuz Im scared of all those syntaxes :c
mongodb is what you're looking for
Itll be paid pretty quickly though
Simple as it gets.
https://www.mongodb.com/atlas
???
Oh you mean the "free limit" is low?
since they cant host it on their own server they'll hit the free limit quickly.
Redis has community edition which usually means free forever, just with less features ofc
Yeah gotchu
Today ive got tons of redis learning to do
Gonna make a cup of coffee and be learning redis for the next 4-6 hours
Now that im working on switching to AutoShardedBot i run into another problem
@scarlet snow do u know how to reload cogs in all shards?
I depend on bot.reload_extension() to update my cogs but i dont know how to do it across shards yet
oh wait
"Variables defined in the bot instance (bot) are shared across all shards because there is only one bot process unless you run separate process for shards manually. - ChatGPT
@jaunty plank does this mean i can just use a variable defined in bot for all shards that my bot creates?
Theres internal and external sharding.
youll reach limits, but pretty much every bot uses internal sharding early on.
whats external sharding?
im kinda new to discord-based stuff so i dont really know much about them
internal is using a single core, single process. external it uses multiple processes.
and multiple cores
alright
i guess ill just stick with internal sharding for as long as possible or until my bot dies of workload congestion
just be aware the risk of corruption goes up with any sharding
help
0|bot | Error: Cannot find module 'topgg.js'
0|bot | Require stack:
0|bot | - C:\Users\galac\Desktop\SquidGames Bot\bot.js
0|bot | at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
0|bot | at Hook._require.Module.require (C:\Users\galac\AppData\Roaming\npm\node_modules\pm2\node_modules\require-in-the-middle\index.js:81:25)
0|bot | at require (node:internal/modules/helpers:138:16)
0|bot | at Object.<anonymous> (C:\Users\galac\Desktop\SquidGames Bot\bot.js:13:19)
0|bot | at Module._compile (node:internal/modules/cjs/loader:1565:14)
0|bot | at Object..js (node:internal/modules/cjs/loader:1708:10)
0|bot | at Module.load (node:internal/modules/cjs/loader:1318:32)
0|bot | at Function._load (node:internal/modules/cjs/loader:1128:12)
0|bot | at Object.<anonymous> (C:\Users\galac\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:33:23)
0|bot | at Module._compile (node:internal/modules/cjs/loader:1565:14) {
0|bot | code: 'MODULE_NOT_FOUND',
0|bot | requireStack: [ 'C:\\Users\\galac\\Desktop\\SquidGames Bot\\bot.js' ]
0|bot | }```
Seems like the package is missing
topgg.js no found
Because there is no such package, there is something like top-gg/sdk but not topgg.js
It's even official one
Top.gg.js doesnt exists
Why did I get that error?
Yesterday it was working and today it isn't, should I change something?
veld is making some site changes at the moment
it's likely because of that. try again later
oh okay ty
Hi
Is there an official package I can use to interact with the API? If not could someone recommend me one?
Check this
https://docs.top.gg
There should be one for the major lang
@restive otter
Bot Review Notifications
If your bot is approved:
You'll get a DM from @abstract moth, a ping in #logs and you'll be assigned the <@&265125253443878912> role here.
If your bot is declined:
You'll get a DM from @abstract moth and you'll also get a ping in #mod-logs.
๐ก Please make sure you have your DMs activated for this server.
Your bot was denied. #mod-logs message
Hi, I'm using the webhooks system of top.gg to notify when someone votes my bot, but it doesn't work, I put the URL of the discord webhook, I hit Send test and nothing is sent, but I tried with another website (https://webhook.site/) if the POSTs arrive.
(I also tried putting a Authorization key)
Instantly generate a free, unique URL and email address to test, inspect, and automate (with a visual workflow editor and scripts) incoming HTTP requests and emails
I tried to send a webhook using curl and it arrived correctly, so I guess it is top.gg's problem.
Youre sending the post to discord not your script it looks like
Idk if thats intentional but the default way (the one i know of) is to send it to the public ip and port of where your script is executed
http://ipadress:port/dblwebhook
Does that make sense
(Ofc unless youre working through discord webhook system somehow i have no idea)
if i understand things right, that thing not working is what u should expect to happen
in my bot whenever top.gg sends a webhook request i use .json() to convert the request to JSON so i can extract its data
discord webhook however is made for messages, not JSON-like requests(?)
so it should not work because the request is not a message nor contains a message
this (taken from my bot's console) is what top.gg sends u via the webhook url when someone votes
not really
discord just expects a certain json schema, see the dev docs of discord
top.gg doesn't send the json with that schema
although they could do it, just some small backend stuff
top.gg could add an option to either set a discord webhook or your own, and if it's a discord one they could send a json payload with the right schema e.g.
{
"content": "user bla bla voted",
}
and then it would work perfectly fine
honestly surprised it's never been a thing so far
never knew this before, thanks for informing me
How can I make a VOTE system like it says:
When someone voted
A reminder (in 12hr) to vote again
Gives Voter role?
(In python)
Youll need a database, and to use webhooks
Webhook integration for receiving vote data
Just a note, these are not discord webhooks and dont work with discord webhooks.
dont really need a database
in discord.py you can just add this at the end of your vote handler
async sleep(6*3600)
user.send("Reminder to vote")```
If you're doing it properly youll use a database ^-^
a database could be way out of scope of their project
but yes, a database is ideal. But scope is important.
also in discord.py you add roles with the .addroles() function on a member object. But you will have to get the role and guild if you dont have it already.
without ctx:
guild_id = 123456789012345678
guild = bot.get_guild(guild_id)
role_name = "voter role"
role = discord.utils.get(guild.roles, name = role_name)
await member.add_roles(role)
with ctx:
role_name = "voter role"
role = discord.utils.get(ctx.guild.roles, name = role_name)
await member.add_roles(role)
...please dont do it on role name
role_id = "12345678912345678"
role = discord.utils.get(ctx.guild.roles, id = role_id)
await member.add_roles(role)```
right, probably exists a better way
yeah ๐
didnt come to my mind that i could probably just use role id
it just means it doesn't break if anything changes
role ID never changes but name can
true, but if a server manager accidentally deletes the role and just makes a new one. its gonna have a different id but the same name.
just depends on how your server is managed

havent ever thought of this yet lmao how am i so dumb
oh wait never mind it wont work upon restart
yeah its not persistent so if you restart bot often u need a db solution
yea i use json
im so lazy i dont wanna learn a db
unless my bot reaches like 10k+ servers i wont need a database anyway
what type of bot is it
If you have a stable server you can make a seperate bot instance just for reminders
Minigame
Oh right i remember hehe
For posting a bot's statistics, can it be as simple as doing:
curl "https://discord.com/api/v10/application-directory-static/applications/$DISCORD_APP_ID" | jq .directory_entry.guild_count
And posting the server_count every 30 minutes via a scheduled worker?
I don't store my bot's guild count anywhere nor do I use discordjs or a gateway that receives events / updates a cache.
idk if the api endpoint is cached but application directory is cached
pretty sure https://discord.com/api/v6/users/@me/guilds should work better
That's fine โ I'm okay being a little off. The api/v6/users/@me/guilds isn't accurate since I created my discord application originally without a bot. It showcased 0 installed guilds when the static directory showcased the real "install" count. Even after creating the bot, the static directory is still more accurate.
Hello! My bot's token doesn't seem to work anymore, and regenerating it just returns the exact same one that still doesn't work. What should I do?
May we have more specifics to diagnose your issue?
- What error are you receiving?
- What API endpoints are you using?
Seems to be fixed. But now, both tokens (old AND new) works, even though the old one hadn't been working for, like, a week
Using the bots/:bot_id/stats endpoint
Now running into another problem ; despite retuning 200, the update count isn't updated on top.gg
probably a skill issue this time tbh
๐ this doesn't look like a top.gg ratelimit
it's cryptocompare
My bot isnt receiving votes :c i found out y lol
O ok
Hi, im using topgg widget and it shows my bot's current server is only 7 servers, but its already more than 100 servers, how to change that?
Thanks in advance!
You've got to post the amount of servers regularly
You posted it once and never again
may i know how to post it?
im actually losing it, because the project was so old lol, but okay, thanks!
Disregard, I figured it out
Hlo i need a small help how i can count the vote a user done ? i made a voteTracker but i dont know how i can fetch a user done votes
now its like this
increment a number in your database
ohoh i see
hey how to configure server stats on discord js with your api?
Official Top.gg JavaScript library
thx
np
thx bro ๐
np
where i can find this ??
you need to set it in your bot's settings under webhook
https://top.gg/bot/<your bot id>/webhooks
Hi. I need the API for Top.gg. To get the API, I created my Discord bot and added it to Top.gg 3 times. The bot was online 24/7, but it kept getting deleted. The bot was a simple and funny bot with commands like ping, hello, and a default response for unrecognized commands: 'I can't answer that.' However, I noticed that even simpler bots were approved on Top.gg. What do I need to do to get my bot approved?
it needs an help command/obvious point of entry
Thank you bro
you also need more command then that
so what commands and how many command i need to have?
Simple command that respond with fixed message without logic / information does not count
My bot has the following commands:
- 'hello' responds with 'Hello!'
- 'how are you' responds with 'Fine'
- 'ping' responds with 'Pong'
- '/help' gives a list of all commands.
Will this bot be approved?
Nope
All of those is in the informational command category
Does this count as logic?
/todo add <task>
command allows users to add a new task to their personal to-do list. The user types /todo add <task>, where <task> is the task they want to add. The bot then responds with a confirmation message like "Task added: <task>" to indicate the task has been successfully added. This helps users organize and track their tasks within Discord.
As long as the task is saved and you can edit/remove the task
It counts as a feature
So it's not logic?
Yes its a feature if you can edit/delete/addmore task for the command
@empty gazelle can you help explain, my brain is too dead asleep to explain clearly
so if I also add /todo view and /todo remove will it all be logic?
please give me an example of logic command
hi
hi
so the /to do is logic?
i.e
/to do add
/to do remove
/to do view
yes
Thanks
np!
sup
probably a highly requested question, But just looking for more info or someone's example on how you interact with the top.gg api to catch votes on your description. Not looking to plug it into a discord webhook just looking to get the notification that someone has voted
Like a message in a discord server?
nope, I wish to reward for it but that part isn't important, just looking for more info or an example on how you specifically interact to catch when someone has voted on your bot page
Thats what webhooks are for ๐
im not looking to send a message when someone votes
yep, thats what webhooks are fo
okay, Is there any examples around for such
py
help
Are you working on getting a notification for yourself when someone votes?
Do you want the bot to DM you or what
The bot page background link is currently broken. We suggest you use CSS for the time being!
Add the following code to your bot description:
<style>
body {
background: url("INSERT_LINK_HERE");
}
</style>
hi
My bot has declined for this reason: 'Bot Declined
Bot
ToDo (1322620937509670973)
Reviewer
welper (top.gg profile)
Reason
The prefix you've listed on your bot page seems to not match your bot's actual prefix. Please make sure the prefix you list is correct so we are able to test your bot properly.
Your bot doesn't have a (working) help command or obvious point of entry. Please make sure your bot has a help command or has an explanation in the bot description.'
But the prifixes I'v posted right and my bot is working correct and have command help
why it decliend for this reason?
If need I can send ypu invite of server where bot locatied to see that it works correct
When in DM I'm writing my bot.The commands work right
Completely unrelated to the API
DM the reviewer instead ( @silk idol ) and wait some time
Thanks
squid game bot ? imma try this one
yes
With topgg API can get data for other bots? (i.e the same data which I get for my bot I want it for other bots)
My 12k bot went from 12k to 33 servers guys, someone touched the AutoPoster help lmao
havent tried, but u can try using url of a discord bot stats and ur own api key. it might work, and it might not
but u can get other bot's stats with discord api
unless a bot is not public, then u cant
Ok. Thank you
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.
One message removed from a suspended account.
I had it written in a certain way since the bot had 1k servers, never touched it , but I fixed it I just added a post request
const guildCount = await abot.shard.broadcastEval(
bot => bot.guilds.cache.size
);
if (abot.config.status === "GLOBAL") {
axios.post(`https://top.gg/api/bots/${abot.config.id}/stats`, {
server_count: guildCount
}, {
headers: {
Authorization: 'mykey'
}```
I just cant restart the bot yet, will wait a few days
One message removed from a suspended account.
nope I will be rewarding users privatley so I only need their userid. Just want to catch it
token = "YOUR_TOPGG_TOKEN"
client = topgg.DBLClient(YOUR_BOT_OBJECT, token, autopost = True)
webhookman = topgg.WebhookManager(YOUR_BOT_INSTANCE)
webhookman.run(port = YOUR_PORT)
async def on_vote(request):
try:
data = await request.json()
response = web.Response(status = 200, text = "Vote processed successfully.")
id = data.get("user") #this is the user id
#process the vote here
return response
except Exception:
return web.Response(status=500, text="Failed to process vote.")
webhookman.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)```
replace YOUR_TOPGG_TOKEN, YOUR_BOT_INSTANCE and YOUR_PORT with your stuff
zx
Hello
Is there a way when someone votes on the site and using a package make him send a notification in the channel?
you can with webhook
https://top.gg/bot/BOTID/webhooks
under libraries there's examples in multiple languages
https://docs.top.gg/docs/
Welcome to Top.gg
[2025-01-31 11:09:02] [ERROR] root: Failed to fetch Top.gg vote status: Forbidden (status code: 403): You are not allowed to check this bot.
Any ideas for this? Trying to fetch using my API token for my bot to see when a user votes, running into this error.
it means either you're not authenticated or you're trying to get stuff from another bot i think
Weird, I'm using my api token that was made for my bot, it was verified, and should be up to date.
maybe try regenerating it?
Tried regening, still giving me the same arrow that I'm not allowed to check the bot with 403
it's the API token under webhooks, correct?
no that's just for your webhook endpoint to know it's really top.gg
oh then no wonder it's not working 
Where do I get my real API token from?
it'd be this
Yeah, then this is the one I have, strange :/
await self.topgg_client.get_user_vote(user_id)
that's to get votes of a specific user for your bot
then it's just checking true or false and returning those values
Yeah, if a userID has voted, they get a "mini reward"
this is to check example if my user id has voted
class Upvoted(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.topgg_api_token = os.getenv"TOP_GG_Token"
self.topgg_client = topgg.DBLClient(bot, self.topgg_api_token)
async def check_upvote(self, user_id: int) -> bool:
try:
has_voted = await self.topgg_client.get_user_vote(user_id)
return has_voted # True if voted, False if not
except topgg.errors.TopGGException as e:
logging.error(f"Failed to fetch Top.gg vote status: {e}")
return False
It's seeming similar, very curious
sending it manually with my bot works
How are you doing that?
curl
so try this curl -X GET https://top.gg/api/bots/BotID/check?userId=UserID -H "Accept: application/json" -H "Authorization: Bearer TOP.GG TOKEN"
retunred {"voted":1}
LOL
I got the fix.. I feel like a moron
what was it?
Simply was using the wrong bot ID where it is in the url.. was using the bots key instead,
oof LOL
Thank you for your help!
np
Hello, is it possible to make a system that notifies the console when a user has voted and which user it is?
read the conversation just above
Welcome to Top.gg
I already did
In which language?
Oh wait u use js
Nvm
how do you get your bot reviewed?
well i clicked the button but nothing happened
what button? ๐
there's no feedback or anything to say whether or not anything happened
was there an error? success?
yep
Does your long description include html?
how come the API says it can be optional?
๐
ahh
it's cuz it doesn't mention on the text box when i first clicked on it
no worries
alright thats why it wouldnt suggest
now we wait 
1-2 weeks 
@jaunty plank is there a way to fast-track bots or am i just endlessly stuck in queue for 2 weeks
When will my bot be reviewed?
Currently our average bot reviewal time is a few days or more.
Because of this โ and because some bots take longer to review than others due to their features โ we can't guarantee your bot will be reviewed as quickly as someone else's in the past and we also can't guarantee your bot will be reviewed within that timeframe. There is no exact time for how long bot approval can take. There is no way to check your bot's position in our reviewal queue, but remember you're not first and you're not last!
You may edit your bot's page as much as you like both before and after it's reviewed and this will have no impact on its place in queue.
You can read more about our bot reviewal process in this support article: How the Bot Reviewal Process Works.
In the meantime, please make sure your bot follows all of our Bot Guidelines for a quick and smooth approval!
bots are reviewed in order
alright
How can I update my bot's profile picture on topgg?
hello ive encountered a problem, could u help me please?
known bug
The bot page background link is currently broken. We suggest you use CSS for the time being!
Add the following code to your bot description:
<style>
body {
background: url("INSERT_LINK_HERE");
}
</style>
ty
im trying to use the autoposter but its returning an error "unsupported client", ive looked for similar issues in this channel but i cant get any answers, if someone could help id grealty appreciate it :)
AutoPoster(process.env.TOPGGTOKEN, client).on("posted", () => {
console.log("Posted stats to Top.gg!");
});```
this is my client
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
],
shards: "auto",
});```
hi spooder
hi there woo!
latest djs version? ๐
yep
ill try this
I'll look here in like 5 minutes, maybe our lib is just too far out of date with the djs client.
i use discord.js 14.16.3 and the latest of topgg-autoposter without issues personally
are you sharded?
unless between v14.16.3 and v14.17.3 had alot of changes
is your client sharded*
no
Might only be sharded djs clients
is your client sharded spoder?
no
hmm
maybe reinstall the packages?
is your client extended? ๐
did you maybe try deleting node_modules and rerunning npm i?
Yeah, latest version of each works fine.
import { Client, GatewayIntentBits } from 'discord.js'
import { AutoPoster } from 'topgg-autoposter'
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.login("...")
const ap = AutoPoster('...', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
and the exact code they used works for me minus some intents removed cuz my bot has them all disabled in the dev panel
import { Client, GatewayIntentBits } from 'discord.js'
import { AutoPoster } from 'topgg-autoposter'
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.login("...")
const ap = AutoPoster('...', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
the people having that issue must have something in common either device/os/code itself no?
Yeah, I figured its extended clients. But spoder said theirs isnt.
could it possibly be a global install of a package
Anything that would make client not an instance of discordjs would.
Where to get api key
-_+
On your bots edit page, in the "webhooks" section
Thanks
i'm currently trying to wrap top.gg's API and i'm wondering how exactly the webhook stuff is supposed to work, and also the updating server and shard counts, because they're not covered in the docs.
am i forced to just view the source code for the existing topggpy?
what confuses me is why would it not be in docs?
https://docs.top.gg/docs/Resources/webhooks
https://docs.top.gg/docs/API/bot#post-stats
Its on the docs
Webhook integration for receiving vote data
oh wow. what about the webhook stuff for when a user has voted for you?
and is there a sort of empty request that can be used to check if a token is valid or not?
#import topgg
token = "YOUR_TOPGG_TOKEN"
client = topgg.DBLClient(YOUR_BOT_OBJECT, token, autopost = True)
webhookman = topgg.WebhookManager(YOUR_BOT_OBJECT)
webhookman.run(port = YOUR_PORT)
async def on_vote(request):
try:
data = await request.json()
response = web.Response(status = 200, text = "Vote processed successfully.")
id = data.get("user") #discord userID of the person who voted
#process the vote here
return response
except Exception:
return web.Response(status=500, text="Failed to process vote.")
webhookman.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)```
this is what I do
not sure what u mean by this
is there a way to verify whether a token is valid or not before sending any requests
was hoping to catch the issue before runtime
what token r u talking bout
is there something in the docs about this?
nah the docs is kinda broken
i want to wrap it myself, not copy the existing one

webhook token
the one you use for requests
i tried following the docs and it didnt even work even when i copied code straight from the docs
first question is unless u reset ur token everyday y do u even need to check it
to check for an invalid token
i'll just send a dummy request, why not 
yes
reset it once, copy it into ur code then forget about it
unless u touch that reset button ur fine buddy
๐
no need for extra code
trust ur gut ๐
btw its funni how discord dev page doesnt have a button to reveal the token dumb ahh move by me frfr
it used to but they removed it
for "security purpose"
understood the thing right after sending the message ๐ญ
thats y i crossed it out
ahh
https://topggpy.readthedocs.io/en/stable/index.html good luck buddy
I am a mod on other serber, and i seen alot of time in the past that someone ask to screenshare to "help" make bot
and they screenshot it when they get token and keep it (then they use it for bad stuff)
alright, i'll make it error at runtime if an invalid token was paraed
thank you
buddy suspecting his own work ๐ญ
thats what a dumb kid would allow
You forgot this is disocrd
we have alot of dumb people
you forgot this is the internet and even more dumb people lol
You also forgot this is earth, we have so much dumb people that you cant count
lol
for some reason knowing how to use phones/pcs/tvs was/is the first thing many kids learn(ed) to do
i wonder how bad gen beta will be
Webhook integration for receiving vote data
(I'm not sure what super means the docs don't work, I think he means the py library example didn't work for him)
wheres the docs for v1 of the API?
Can any1 send me rumble bot invite
-how2search
@unborn sun
To find a bot that you need, please try searching for it on our website.
You may need to refine your search term, but with just a little effort you can find the bot that you need. Read our Quick Start Guide to Top.gg support article for more information on how to best use our search.
If you still haven't found a bot that suits your needs, then try searching on Google for it.
Oh yes I could have done that sorry ๐
does anyone know how to get your user ID?
this is my user account
but this says "not found"
189037604101341184
why does it say "not found" then?
even with authorization it doesnt say anything
API resource for Top.gg users
i tried my discord ID too
didnt get anything either
i'll try it again later
bottomgg.errors.NotFoundError: the user with the ID 566653183774949395 could not be found.
nope
@willow sphinx
?
yeah
oh my bad
i was tryna figure out how the /users/:user_id endpoint works
cuz my user ID doesn't work with it, despite me having a top.gg account
dude wtf
xetera, since you're available (i'm guessing), do you know why my user ID doesn't work with the API?
you'd probably know more about this than i do, considering you probably helped make the platform
I don't really know, I can't remember how that system works
๐ Thats intresting
A lot of users are not available from the api
The API for users just seems extremely out of date @mighty blaze
My bio via the API is really really old.

i saw the repo was last available for like python 3.9
Afaik users stopped being updated when teams became a thing
its also the same time the bot owner disparity in the api happened
Yeah, that sounds right.
damn so that endpoint just doesn't work or what?
pretty much
We've had a numerous amount of issues with user data on topstats (aka dblstats)
though as far as I know it's a WIP on fixes
wrapping this API was a mistake
Nah it wasnt
Veld recently came back into ownership. So it should get fixed this year
oh alright
Just give it time
will the docs get updated for the webhook stuff?
and could you explain how that works for me?
What specifically?
Oh I know why your discordID doesnt work. Top.gg uses their own ID system now afaik too
so it's likely down to that
Where you can do to top.gg/user/:discord_id is likely doesnt work with the api
how does top.gg notify you when a user votes for your bot
They send you web request to the webhook you setup
cc @jaunty plank you likely have more context on this considering the app you host
The webhook docs are good
Which part are you confused about? ๐
it doesnt say what type of data is sent to you through the webhook
json
or what the webhook is even supposed to look like
yeah i meant the contents of the JSON
Told u to use my code instead
like how Bot is documented
ah maybe i'm just blind
and how do you setup a webhook for yourself?
you host the http server on whatever port and path you want, then top.gg sends the request to that endpoint.
I'd do some research on webhooks itself before working with top.gg webhooks specifically.
so you set the IP address of where you want to receive requests in the website?
seems pretty neat
how do you test vote too?
Click "send test" in the page where u get the token and itll send a dummy request to ur receiving endpoint
R u using a hosting service or ur own pc?
own pc
..
Ayo cool profile deco buddy
Yep, portforward required
you should give cloudflare tunnel a try then
i'll do that later. where do i get the IP for my own PC?
dumb question but i wanna make sure i get this right
with cloudflare tunnel you just need to run the agent on the device and then you need a domain and set it up in there
i dont have a domain
and im not using the tunnel
how can i do it just straight up?
for cloudflare tunnel you go here https://one.dash.cloudflare.com/
then click Networks => Tunnels
then Create a tunnel
then click Select Cloudflared
give it a name then save tunnel
then it tells you how to install it
so you do that then click next
and then there you give it a domain/sub domain
and for service it'd be http with localhost:whatever port you set
๐ but they dont have a domain
true
i think with the agent installed you can also do it in console and be assigned a random cloudflare subdomain unless that stopped
then what you can do is open a port in your router but only do so if you REALLY know what you're doing
cuz you'll need to set some fancy rules so only top.gg can access it
tell me more 
Itll depend on your router.
https://portforward.com/router.htm
^ provides a list of routers, and how to port forward on each of them.
Open ports on your router with our port forwarding guides. We have guides specific to your router.
it mentions using a VPN instead of port forwarding. is that worth it? or should i just open ports?
I dont think that works in this case.
I think thats more for 2 devices you own, this is the top.gg servers sending you a request.
ah i see. got it
just for reference, what do i do after port forwarding?
Have you written the code for the webhook server yet?
iirc you're writing a wrapper for it, so you'll need to do that step next.
yup, see here - https://paste.pythondiscord.com/V6NA
Then fill out your URL and auth on top.gg and send a test ^-^
You can fill it out on your bot page > edit > webhooks
yup, worked perfectly

is this section of the API ever used?
i can't think of a place where this would be used
We used to list servers too not just bots
ohh. so you dont anymore?
Nope
Guys, I switched from axios to another http client and now I'm constantly getting 400: Bad Request errors. Any idea why?
What is needed when updating the guild count? Below you can see my not updated request.
await ky.post(process.env.TOPGG_API_STATS_URI, {
headers: { Authorization: process.env.TOPGG_TOKEN },
body: JSON.stringify({ server_count: guildCount }),
});
Used route is: https://top.gg/api/bots/1082707872565182614/stats
Content type is missing
Is there a way to check if a user has voted in the bot or not with a command?
Oh, seems like axios did that automatically before. Thx
https://docs.top.gg/docs/API/bot#individual-user-vote
Just be aware, it has a pretty strict ratelimit.
ok, ty
how does the /bots searching endpoint work?
my code for wrapping that is this:
class Client:
...
async def search_bots(
self,
*,
limit: int = 50,
offset: int = 0,
search: Params,
sort_by: str | None = None,
reverse_sort: bool = False
) -> list[Bot]:
"""
Search for bots in the Top.gg API
"""
if not 1 <= limit <= 500:
raise InvalidInputError("limit cannot exceed the range 1-500 inclusive.")
params = {
"limit": str(limit),
"offset": str(offset),
"search": ' '.join(f'{k}: {v}' for k, v in search.items())
}
if sort_by:
params |= {
"sort": f"{'-' if reverse_sort else ''}{sort_by}"
}
_, json = await self.http.make_request(
"/bots",
params = params
)
bots_found: list[Bot] = []
for raw_bot_json in json["results"]:
JSONCleaner.clean_bot_json(raw_bot_json)
bots_found.append(Bot(**raw_bot_json))
return bots_found
but for some reason, i always get the same values every time, no matter what i put in the search kwarg: ```py
async def main():
client = Client(open("token.txt").read())
bots = await client.search_bots(
limit = 3,
search = {
"name": "HydraBot"
}
)
print([bot.name for bot in bots])
this just returns `['HydraBot', 'BotGoPvP', 'Discord Fireman']`
it keeps returning that, no matter the data i put into search
IIRC bots endpoint hasnt worked for a long time either.
Most of the api endpoints never got used by anyone, so they never got updated.
ok i'll mark that as under construction then
thanks woo
Is there a python github project that works with py-cord ?
The official python package also install discord.py, which mess up my bot
it install discord.py as well
Then uninstall discord.py
Won't solve the issue
Honestly just make the HTPT requests yourself, it's not super complicated
Why is that
That's a downside I'm not a fan of since the beginning, forcing users to use a library
Does it enforce dpy
The library is dependent on discord.py in its internals. Remove it and it won't work at all
Not a fan of that, I remember the C++ library that was also enforcing D++ or something
Maybe that changed in-between but don't know
Enforcing a lib is just bad
Didnt even know the enforcement exists
ehm actually they removed that enforcement in the py library lmao
Just never got updated on PyPi
awesome
currently writing a modern-day wrapper for this and this is something i didn't consider so thank you for this
as for your question, since i'm writing one, i'm biased to say my own, so thats what i'll say 
Install the version 2.0.0a0, it's a pre-release so not the default version installing from PyPi
pip install topggpy==2.0.0a0
That version is just dependent on aiohttp
Is there a pre-release version like that for all releases?
Otherwise will probably just do the http requests
Oh maybe they should update in that case
it's just the most up to date
there was 1.4.0 then everything else is in 2.0.0a0 i guess
I see perfect ! But and the library is no longer dependent on discord.py right ?
correct
just some specific range of aiohttp
how up-to-date is this?
first vote of the month
3-4 years or something
is it reset at 00:00 UTC+X or is it reset after 24h from the vote
oof. hopefully my lib will be better
alright that works
I mean, there's not many things you can do
fair enough. i still think mine would be better but i'd have to wait and see whether my bias is valid
If someone can help me
-pins
@autumn cipher
thank you so much and sorry to distrub
3 years 2 months.
Get log of reviews, it's possible?
no
#mod-logs is public
Is there any way to get the time remaining of a user to get the next vote using the api?
Or any way to check when was the last time they voted
You'll want to track that in your own database.
Top.gg doesnt provide that info
Oh okay
I mean get my bot reviews, feedback
I dont think the api provides those
Okay
I have one issue of vote thing I had completed the vote but it is not showing and not give pkc
this is not a bot support server. contact the admin of whichever bot you're using for that problem
can you get a test token for top.gg api ?
I don't see any ways to not use the real token
hi <@&412346069675147264>,
the V0 api will have some potentially breaking changes with the rewrite. As we're getting close to launching I figured I'd share these with you.
What changes
/api/bots
sortno longer allows every parameter, by defaultdescendingis enabled, and you can no longer sort ascending.sortonly allows the follow inputs:monthlyPoints,id,date- the following response fields are removed:
defAvatar,discriminator - the following response fields are only returning empty values:
lib,guilds,shards,shard_count,certifiedBot - the following response fields are added
reviews.averageScore: Int,reviews.count: Int.
/api/bots/:id/stats
- no changes
/api/bots/:id/check
- no changes
/api/bots/:id/votes
- the 1000 votes limit is lifted, however by default we only return 100 per page.
- a new
pageparameter is introduced. - votes are sorted by time voted.
Important to know -- these changes are not live yet, but once we move to the rewrite this is what will change. If any library has any issue with this, please let me know and we can make it work before we go live.
You able to give me a heads up for the live deployment date (when you have one) so I can prepare, this'll break the fetcher I have so will need to take that into account when you push it.
most likely next week
๐ I'll prep now tbh
consider this your heads up haha
Uhhh, will shards will still have a value if posted right?
Shards bye bye
welp
so for shards, it'll be [] and for shard_count it'll be 0
guilds too?
while we still allow people to update them
i want to stop doing so
not something we really can do anything with as a platform
yea
Any new values shown with update?
no
๐ thanks
Review count and average review stars if possible? Would be a displayable metric and also gives a general idea on how well a bot is liked
yea fuck it i can do that
Legend
@vital anvil Is it possible to get the counts for each type of review given? (if not ofc all good)
5 stars: 1000 reviews given
4 stars: 200 reviews given
... etc
ye gotchu
will update the sdks!

hi @silk idol
i don't feel like using warnings.warn('this is now deprecated', DeprecationWarning) everywhere so i think i'm just gonna delete them outright
btw is posting shard ID and/or shard count no longer supported?
Supported but not really used anywhere
Yeah
icic
do you have plans on removing fields that only return empty values?
Hi, I wanted to set up the webhook for votes on my bot and I wanted to know if it was possible to test the webhook with โtest votesโ?
webhooks area on your bot in top.gg settings and theres a test button
Ohh yeah i hadn't seen it my bad ^^
Thanks !
No problem ๐
does this mean that posting/viewing bot stats is purely just server count now?
idk if you've done it already but are you able to update the users array with users from the team the bot is apart of (if its in one)?
should we bot devs stop posting shard counts?
TLDR; yes
Hopefully that will be handled gracefully, ie it wont error when its still included.
would be cool to get a field for user installs though
he already said as much, further up ๐
Ah
No it's still works the exact same way the api didn't change it's just not used

So if you submit shards it's still stored in our database
but it's not displayed in the API?
because if so, we have a lot of deprecated in our hands lol
@vital anvil unsure if you saw this
oh i haven't
Hello everyone!! ๐๐,, i hope y'all are doing great.
what is sorting by ID for?
To sort by id
One message removed from a suspended account.
okay but why would you even want to sort by id in the first place
One message removed from a suspended account.
One message removed from a suspended account.

The site is being worked on. #site-status message
Okay
When will it Cรดme back bc i need thรฉ setup bot
Hopefully within a few hours.
Alr bro ty
Is it a few months or hours?
closer to hours than months ^-^
we're back
/webhooks page is still loading please have a look on it
since 2-3 mins i am trying
oh i see, lemme know when it is fixed
hi
@vital anvil sorry for the ping, still not fixed see the image
clear your ssl cache
will be fixed later
You see my image? Say it's fixed ?
I already responded
Clear your ssl cache
We needed to swap ssl certificate
hai veld, is it me or does https://top.gg/api/users/661200758510977084 always return 404?
or does it only accept Top.gg IDs?
i recently realized that clientid always equates to the discord ID, while id sometimes vary between the bot's discord ID and top.gg ID
cc @vital anvil
user id?
what's the difference?
also what caused this
it's already POST ๐ญ
also
GET https://top.gg/api/bots/stats gives { message: 'Bot not found' }
GET https://top.gg/api/bots/1026525568344264724/stats gives { message: 'Not found' }
use bots/:id/stats
Im fixing a bug there now
i already did
is it deployed now
still deploying
sorry the build broke 
its done building native stuff now
it's generating the webserver now
what about this? @vital anvil
users api ded
gonezo
wait you're intentionally removing it from the API altogether?
it's not mentioned here...
yea i kinda forgot about it
that's why the route alltogether was not mentioend 
is it used for anything actually?
maybe some bots use it
for their idk 195th command
Does this deployment fix the inconsistent ranking issue?
not yet
inconsistent?
ah, for lists, yes.
if you plan on removing users i'll remove it from the sdks
search comes with the changes that are proposed in #announcements
yea i'd rather focus on api v1 then
i can't really think of anything useful for the users endpoint that would be an amazing feature
bots i can get
what about teams?
api v1
alrighty
no point updating api v0 and then dropping it a week later
what do you think?
yea sounds good
thanks!
unsure, not really sure what to do with it other than data crawl discord users
which... i kinda wanna avoid
yeah
maybe their banner and bio? who knows if you wanna add more things to user's profiles in the future
I used to have a bot for linked roles that displayed like bots server count and votes, and I needed to get the users bots for a select menu
you can use the graphql api until api v1
probably better data quality in there anyways
nvm I used to use the dblstats api
Bots with fewer votes are ranked higher than a bot with more votes.
~# (Mine isn't even getting listed.) ๐
seems fine?
for me : no
again, for search read the topic here ^
ah odd
I'll take a look when i can
so is the vote change thingy already 'set into stone'?
@vital anvil fire
skill issue fr
testing in production ๐ค
reminds me of another site from few days ago
I mean we could have used it 
Would have been useful for getting the user data that we display
rather than forcing users to login to topstats rofl (I'm being sarcastic dw)
@vital anvil is there by any chance you can give us legacyid in the api response for bot?
because something the client id =/= bot id
and we have no way of actively tracking that now
not always
I mean, for some reason dyno isnt being tracked
and we have 3 different ids for it
161660517914509312
155149108183695360
then we have its top.gg id
We dont get discord id in the api
just id: which is top.gg id I assume
and clientid
you able to add it by chance?
okay thanks
Im still gonna need the discord is but I assume thats gonna be under discordid in the future
we'll get there when we get there
๐
why does topgg even have separate ids. I know that other platforms than discord were planned but still
so we dont need to rely on multiple indices on majority of the querying
Hi
Auto poster is not working it show's 405 method not allowed
scroll up
Bro try to say correct way of fix the issue, I mean it's solved? Or this issues only for me?
Is there an eta
once the site is stable, I'll look at the api
i also have same problem it happens today.
yeah because for some reason the library makes a post request to /bots/stats instead of bots/:id/stats
testing 101
you should make the request yourself tbh with aiohttp
it been working for years it happen today
i think the library working well or need updates idk
there's a pr to update it, though will take some time
can u send me link of it
@woven coral missing bot id in the url?
async def post_guild_count(self, guild_count: Optional[int]) -> None:
"""Posts bot's guild count on Top.gg."""
await self.request("POST", "/bots/stats", json={"server_count": guild_count})
that was intentional
eh, leads to 405s?
you could POST /bots/stats and it would be the same as POST /bots/{id based on top.gg api token}/stats
besides you can't do /bots/{any other id}/stats
so it will use the current auth token to post the bot id's stats?

use a correct auth token then
okayokay
@restive otter at the moment, the following endpoints do not work:
GET /users/{id}
GET /bots/{id}/stats
POST /bots/{id}/stats
@rose briar too
also kyla i think you're using an outdated version of our library
the one on pypi hasn't been updated since november 2021

If anyone can get me a list of the exact error codes, and maybe curl requests.
I'm trying to organize all the bugs and document them fully.
- for
/users/{id}:
#topgg-api message
veld has plans of removing it from the api soon: #topgg-api message
- for
/bots/{id}/stats:
fyi i'm currently removing get_user from all of the sdks i maintain
get user was out of date anyway. the data in that database wasnt updated for years.
Putting this here too, /api/bots endpoint is broke - I know it's not top prio, just pointing this out
I'm only able to fetch 22005 bots
why this eror
Related to the site update. Hopefully this will be fixed soon.
Problem here for POST /bots/{id}/stats. The code has been working over months, but it's suddenly sending 404 code since yesterday
ID is 779311078412255242 just in case
It's server stats posting broken? i get "Internal Server Error"
Is it fixed?
tias
take a peek at the messages above yours ^^
i still see this error @signal hawk
TopGGAPIError: 405 Method Not Allowed it auto bypass vote req
huh?
try it and see
look a few messages above
Hello ๐
when sending stats to bots/:bot_id/stats endpoint it returns an Internal Server Error
It's known issue
When I try to regenerate the token it tells me that it has regenerated it but it always gives me the same one
I have same
everyone has it
Api down bro
so glad to open this channel and find a billion other people having the same issue
lol
i thought it was just a skill issue on my part for using an ancient version of autoposter library


ofc ofc

