#topgg-api
1 messages · Page 16 of 1
You have to save vote counts
But you can fetch votes from API with a webhook
So the api doesn't register?
nop
i save mine with the webhook calls that my bot becomes
nope
I made this website for my bot, and i want to add various stats from my top.gg page on it using topggpy and my auth key. How would i be able to do such a thing?
I would like to have it like a small copy of my topgg page (votes, reviews, etc as well), but with a link to the official page if possible.
not possible to get the reviews, the votes you can get without needing to use topggpy - just make an HTTP request
Can you give me an example of it by chance?
It's just a basic HTTP request to the endpoint
import requests
r = requests.get(
"https://top.gg/api/bots/bot_id",
headers={
"Authorization": "topggtokenhere",
},
)
print(r.json())
no
And I'm assuming if I were to use one of my other bots API it wouldn't work on the code so great
"server_count" and "shards" isnt the same?
Shards is websockets for discord and shards only can have 1500 server each shard
2500* 1500 is the recommended split
hy sir
here i have something important to tell you
luffy Luke is not staff
if its what you've posted in #general, i would open a ticket on https://support.top.gg or email support@top.gg and wait for a reply
i alredy opened a ticket but it's around 12 th day no one is responding mee
who is the mod ?
i can report him
@tidal idol
export interface VoteUser1 {
user: string
type: 'upvote' | 'test'
query: string
isWeekend: boolean
bot: string
}
export interface VoteUser2 {
admin: boolean
avatar: string
username: string
id: string
}
export interface VoteUser {
user_id: string
type: 'vote' | 'test'
source: 'topgg' | 'discordbotlist'
}
VoteUser.ts ^
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
getCollection("votes").updateOne({id: data.user_id}, {"$push": {votes: {at: Date.now(), source: data.source}}}, {upsert: true});
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}
vote.ts
can anyone help
it isnt adding votes to the database
It's more about your code than the top.gg api
If there is nothing in your database, .updateOne() will not work. You would first have to check whether a document with such an id field exists and if not, you would have to create it
they also arent awaiting update one
You can also do ```js
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
await getCollection("votes").findOneAndUopdate({
id: data.user_id
},
{ "$set": {
votes: {
at: Date.now(),
source: data.source
}
}
},
{
upsert: true,
new: true
}
);
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}
Hey @rose sierra
just saw your deleted post(smelly automod)
That query param is generated by cloudflare and can be ignored.
would this just work?
oh typo
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
await getCollection("votes").findOneAndUpdate(
{ id: data.user_id },
{
"$push": {
votes: { at: Date.now(), source: data.source }
}
},
{
upsert: true
}
);
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}
should this work?
Should do
It didn’t work
I hate coding
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
await getCollection("votes").findOneAndUpdate({
id: data.user_id
},
{ "$set": {
votes: {
at: Date.now(),
source: data.source
}
}
},
{
upsert: true,
new: true
}
);
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}```
this didnt work
actually i'll go to #development
Hello, I just set up the configuration of webhook, the test button is working fine, it sent the test request successfully, but when someone votes it doesn't send anything at all
Show your code? ^-^
i can see if any incoming requests from console, but when someone vote there are no incoming requests
router.post("/webhook", authUpvote(), async (c) => {
try {
const body = await c.req.json();
const parseData = voteWebhookSchema.parse(body);
if (parseData.type == "test") {
info("Upvote test recived");
return c.json({ success: true }, 200);
}
return c.json({ success: true }, 200);
} catch (err) {
error(err);
return c.json({ success: false, error: 500, message: "Internal Server Error" }, 500);
}
});```
You don't seem to be logging anything when a normal vote happens. Just returning right away.
they seem to be logging all post requests anyway. Which is what I think they mean
they dont see any other POST requests coming in other than for test votes
"504 Gateaway Timeout" what tf is that
server not responding, means you gotta try again later
Oke thx
After I added this, I can't edit the site anymore
I tried removed the team still no luck
yo
Yo
Hello, I have a question. How can I have a reward for voting like the rest of the bots?
Webhook integration for receiving vote data
I included a query in the vote link but query was null in the request to my webhoook
can you add other custom params to the voting url?
(an be returned back those params on the webhook on vote)
thats what the query field is.
Sometimes my post to the api for server count doesn't post and it drops down to 123 servers which i've heards is the default value or something, anyone know why?
dbl = DBLClient(client, (the token was here), autopost=True, post_shard_count=True, autopost_interval=1800)
await dbl.post_guild_count()
can anyone help me on this?
btw, there is no real id in there. i just screenshot it because it got blocked.
probably tripped it as a phone number
Will the top.gg API support sending update requests for user counts?
My bot is primarily user installed and is installed by quite a few more users than it is on servers and not being able to send user count means it only paints part of the picture of how much use it has
Good idea tbh, might want to make a post at https://feedback.top.gg
Although it would only be possible to update once every 12 hours because that's the delay between the approximate user count being updated
Probably won't as it seems to be non optional to give it my email (which already gets enough spam as is) (top.gg itself can have its login URL edited to remove unnecessary scopes and then it will let you sign in and prompts you when you try an action that apparently requires more scopes)
A custom redirect once user votes for the bot is possible?
or any sort of message displayed for next step info
nop
+ Fixed the redirect after voting whilst in other spaces
#site-status message
It was about the normal behavior which was a redirect on top.gg after a vote, not people able to redirect to external websites. It redirected to the wrong space (back when DAOs were existing)
This is why you need a spam email 😄
But, send me a DM with what you want to say. I'll add it anyway because I agree.
Can we use python in the bot page ?
👀 how can you use python in a website?
Oh we can't ok
I was just curious I'm not much into programming but just started
I heard that one could make websites using python
Make backend for websites sure.
There might even be compilers for frontend to JS, but at that point just use JS 😄
Oh 😆
Context - Suggested by a user(ItsPadar), submitted by me. Since Discord supports user installs, it would be a good idea to add the ability to do the user count for your bot like you can with server counts. For instance: - Being able to send a usercount in a post stats request like server_count - Being able to view user count on the bot's page li...
how can i make vote tracker reward system in py can anyone help?
Vote tracker reward system? Simply put, reward users when people vote your bot?
It doesnt seem to work though, or is that only me?
I dont think its broken, I can check in a bit.
thank you
query seems to be working for me, what query are you using?
Heres the URL I used to get that query result.
yes
Hello good Day.
how can I go by adding the voting button on my page and how can I make each person gain reward from voting?
what library / language are you using?
It's in Javascript w/ Node.
this guide should help you out
https://www.youtube.com/watch?v=wqlU2KOxQws
Quick showcase on how the top.gg API can be easily used with the help of the top.gg javascript SDK to give users a reward for voting for your bot as well as how you can easily implement the autoposter library to keep your bot stats up to date on the website.
Credits
Produced...
Thank you
nah 5xx you broke the server bun
Alr
not always
Server can still be up and return 5xx errors
Yes sir i am here
@old jasper Can you show the code you're using to post your bots stats via the API?
<a href="https://top.gg/bot/1013771497157972008">
<img src="https://top.gg/api/widget/1013771497157972008.svg">
</a>
@jaunty plank
Thats not posting stats, thats just html.
What programming language does your bot use?
Currently python
why would one post stats to topgg? Is that benefitial when it comes to getting discorvered better or any?
thats htis thing, isnt it?
If you want your server and shard count to show up.
It can help, but it doesn't mean it will.
Yeah that's a server count
That doesnt sound legit. So is it accounted or not?
I don't think we have any search params for server count.
Its mostly for users who want to see your server count before inviting.
When I added it to my old bot I got more servers quickly.
Vote rewards and vote reminders are more important.
I just launched like 2 weeks ago. at first it went up good and i was satisfied... but since 5 days its not worth meantioning. maybe 2 installs in 2 days.
Do you know if there is any information on what influences the bot's discoverability most?
Yeah, I just released voterewards with my last big update. I heared the votes count double on weekends?
Here is my statistics
Yeah, Friday sat sun UTC is double votes
Votes and good seo on your bot page is the most important
Reminders for voting in your bot helps a ton.
Mhhm, ok, then i might need to setup a dm system to annoy all bot users regularly 🤔
but my statistics dosnt seem to fit that votes are important.
Although I definitely need to SEO.
If you plan to DM regularly you'll want an opt in system.
If you want to do reminders 12 hours after voting you can do an opt out system.
is that top.gg or discord regulations? or suggestions?
😄
We have guidelines for vote reminders
Thank you very much for your help 🙏
Guideline 15
I seen them 😄
okay, but nothing about the opt in /opt out thingy tied to 12h
Thanks ! 🙏
If you're sending mass DMS periodically discord can disable your bot. So you'll want opt in.
Unsubscribe in our guidelines is an opt out system.
It can be every 24 hours, 48, 64, whatever. We just don't like people being spammed reminders. 99% of bots use a 12 hour reminder system.
12 hours after voting*
One you can look at is pixxiebot.
Invite it to a server and vote for it. After 12 hours you'll get a reminder.
don't worry, Im not here to screw up. I just need to know the exact regulations and then I can make it work. So thank you very much for your advice ❤️
Also I havent yet looked into any dm system specific commands or whatever. I do not know anything about that yet ^^ Just got that info from another discord bot developer and am curiouse since then. didnt know such a thing it possible.
i have a theory
the internet is dead
One message removed from a suspended account.
You fucking weeb
oh shit weong channel
One message removed from a suspended account.
It says you fucking weeb
One message removed from a suspended account.
I said wrong channel
^
One message removed from a suspended account.
mods can you ban qt for trying -api me
jk

can anyone send that vote logging creating website, which was user friendly and it was lot easier to create voting logs, i can't remember it's url
@jaunty plank
hm
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
is there any test methode ?
curl -X POST https://virtualzombiesurvival.top/dblwebhook -H "Authorization: XXX" -H "Content-Type: application/json" -d "{\"user\":\"1062481086782906478\"}"
yea press test vote in webhook page on your bot edit page
Thanks ❤️
your welcome
Thanks ❤️
uw ❤️
could also be useful to debug on your server... 127.0.0.1 (if you want ports being opened to the public) and localhost (if posts closed up and it gets thrugh another port (80 or 443) thus you want to test the internal routing)
oh i see 
Loool I have NEVER seen this 'send test' -button 😱
It’s been there
I trust you. im just schocked to havent seen it before! thanks for notifying me about this
hahah haha I can troll my staff with this
Glad it helps you keep being motivated! 🫶 😂
Whenever I don't post my server count it appears as 123, why?
Because you didn't post it, and that's the old value that has been posted
no
My bot is at 1.4k
sometimes it posts the real number
and then when the bot is offline or smth it magically goes to 123
like every time
for weeks
123
The most popular reason that I have noticed is that people have their own test version of the bot, which also has a script for sending the number of servers to top.gg api, and they overwrite the information that was previously sent by their main bot
no
Wdym no @runic creek is completely right
saying no to the test version of the bot 😄
that is nt whats happening
this is literally all I have it to do
dbl = DBLClient(client, thetokenishere, autopost=True)
majority of the time it posts properly, but sometimes no like https://gyazo.com/eb4f65cadf91a291fc5aaadad5fae94a
you can see it posts like the actual count then for some reason it goes to 123
I am not posting a different bot, it is the same bot, and my code is only the DBLclient.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
not sharded as of rn
client = commands.Bot(command_prefix=".", intents=intents, activity=custom_activity)
🤷♀️
I'd log every post using https://topggpy.readthedocs.io/en/stable/api.html?highlight=autopost#topgg.on_autopost_success
Log what your bot is reporting as the server count.
All the library does is check what your bot is reporting as the server count, not using the discord API directly.
The number is gets is from the bot session itself, which is why it asks for client.
That's also why they asked if you have a testing bot/other bot that you put this code into, as you'd post that bots stats from time to time.
dbl = DBLClient(client, thetokenishere, autopost=True)
question?
question?
can i do like muit query?
Wdym sorry?
Didn't know this. Will add thanks!
muit query?
I'd include the number of servers your bot is in with the on_autopost_success event.
wdym like the client.server count or like what the bot is posting to top.gg wdym
the on_autopost_success has no paramaters so a bit confused, would be nice if had a paramatere for what it posted tho surely thats doable
The client server count, thats the number top.gg pulls.
make a git request 😄
Multiple *
does topgg just use the server count like this
server_count = len(client.guilds)
using the client object that i pass in the dbl object
A simple API wrapper for top.gg written in Python. Contribute to Top-gg-Community/python-sdk development by creating an account on GitHub.
Thanks!
unrealated: Any idea with the review system on top.gg will be fixed?
Hello guys !
const webhook = new Topgg.Webhook(process.env.TOPGG_WEBHOOK);
// Define the webhook listener
app.post('/dblwebhook', webhook.listener(async vote => {
console.log('Vote received from user:', vote.user); // Logs the user who voted
await client.utils.getReward(client, vote);
}));
const port = process.env.PORT || 3000;
app.listen(port, () => {
client.logger.start(`Webhook listener running on port ${port}`);
});
anyone can help me about this case
I get this exact error too when i develop. So when my other bot got 2 installs (which he does)... he will overwritte the actual bots server count... might it be that u got dev environment and still be hooking up to topgg like me? and then your bot token of the testing bot you got has 123 servers installed?
what do u want?
what?
whats that
who this?
I aint got no issues
@jaunty plank
@tidal mulch @young cedar Whats that for an advertisement and spam?
@jaunty plank ngl... can u ban @tidal mulch and @young cedar ?
They deleted their messages but try hard to get devs to join some other servers which are strange... without even knowing what we be writting here.
sorry that i cant provide screenshot for u to look at
Ill send a notif in br chat
With thr pic
thanks mate ❤️
@young cedar is a scammer so dont join the server
💀
what's that
Yup he is desprate
A known scam
At some point inv should be blocked
can you help me about track the user have vote bot brother
don't ping me
i don't like you
I dont suggest you chatting here atm
Its a bot thay ping peeps who is in the chat
-purge 10
No I am 100% certain it has nothing to do with a test bot
Then check out how many server installs your testbot has 🙂 I'd like to see if that number differs or not
It has 2 servers, it’s a test bot after all
Additionally for it to be in 123 servers I would have had to verify it to with my ID, I only verified one bot my main one
Like I am 100% certain it has nothing to do with a test bot idk why people keep suggesting that
One message removed from a suspended account.
That is the only time a bot has this issue, other than token leaks and sharding issues.
The only other suggestion is to reset your top.gg token
okay thanks
your welcome
is there any documentation on how i can know when someone votes for my bot?
YH which part
If you want to use API which may involve ratelimit - https://docs.top.gg/docs/API/bot#individual-user-vote
or if you want to use a webhook to receive information that someone has voted (recommended) - https://docs.top.gg/docs/Resources/webhooks
Webhook integration for receiving vote data
API resource for a bots or apps on a platform like Discord
@outer cliff
One message removed from a suspended account.
One message removed from a suspended account.
I noticed in the API documentation that the time when the user voted for bot is not returned on the HTTP response back on the check: https://docs.top.gg/docs/API/bot#individual-user-vote
API resource for a bots or apps on a platform like Discord
Is this intentional to drive people to use webhooks instead?
If I could get a timestamp on the vote, I could skip the webhook implementation altogether.
Although I don't know the details of the backend, it seems as though some sort of "fetch" from the database / cache is already happening. I'm making an assumption that the timestamp of the action may be at your disposal.
If it was implemented, the webhook wouldn't be necessary anymore if the UI of the bot had a "check" / "verify vote" / "claim" button.
Tbh, the ratelimit is so low on the check anyway its really only meant to support webhooks.
Oh! Is there a rate limit on that?
Yeah
Damn, I must have missed the documentation on that.
Global and route-specific rate limits
Where is that rate limit documented?
They are reliable; however, it puts more strain on the implementer ... which is likely recommended for TopGG's scale.
strain? 👀
The implementer now has to handle spinning up an endpoint to receive webhook requests, handle downtime, scale it separately as a bot scales, etc.
It's not bad at all, just calling out that it pushes more of the work onto the consumer. Which is likely the only way TopGG can handle it for it ... considering the scale of votes they receive per second / minute
Plus, at the scale of my bot, it'll be trivial to run a webhook implementation that receives fewer than a hundred or two requests.
Its event driven, for events. Theres a reason webhooks are standard practice for this kind of stuff.
Polling is just awful, at any scale.
In my implementation, it wouldn't be a poll. It would be initiated as a check when the user clicks the "verify".
Well, let me take that back: it would be a "poll". But TopGG opening something like that up to consumers would be subject to people polling.
That's a good point.
Cool. Thanks for your thoughts / discussion, Woo!
Webhook setup was aweful ngl... but since then its smoother and more userfriendly... people like to vote more (probably because of my vote messages channel too xd)
Im using a serverless option:
- AWS Lambda with a function URL that updates my database directly
mhhm, havent done anything with aws yet... I host all myself... aws seems expensive to me tbh... Or at least not like its understandible... But they got shit ton of service which i never heared of xd
The architecture I’m describing is free for the webhook implementation.
Regardless, pleasure speaking with you!
Out of curiosity, was it your first time making a webhook listener?
I feel like it's rough for everyone the first time, no matter the platform.
Then if you do it once its easy everywhere.
actually yes... but it has been on my todo list for quite some time ^^ specially regarding CI/CD
I don't know if my way is the right one or if there is more easy ways... But I had to configure nginx to route properly to the application... Which wasn't that easy, as I got some weird imports I have left in there before and was edditing the wrong file.
Additionally when I tried to get an example on the top.gg api running... it was rather aweful... in the internet there were several ways of doing it and i did not really appreciate any... Now I am using the WebhookManager from top.gg and letit do the work. In my opinion the topgg api documentation is bad and could have some extensive example code. Or maybe I have been dumb and did not find it right away 🤷♀️
Additionally it's disencourging that we also got the other solution on hand to just ask if someone voted... I implemented this first... Now I am using both kinda. Just to make sure I havent missed any xd
You want example code in the api docs? Or example code in the library docs?
The api isn't specific to any programming language, so example code is better off in the library docs
On the library side, it's all community run. I'd love to see you add examples to the docs of whatever library you're using.
Hello i hava a question im using discord hybrid sharding and now top gg displays me 145 servers but my bot has 430 servers when i remove sharding its working how can i fix that i need to use await client.cluster.broadcastEval('this.users.cache.size'); to get the total guilds?
topgg autoposer
cross posting won't be more useful
what npm package are you using
Auto-Poster for Top.gg. Latest version: 2.0.2, last published: 10 months ago. Start using topgg-autoposter in your project by running npm i topgg-autoposter. There are 4 other projects in the npm registry using topgg-autoposter.
I use this
do you know you dont have to do that https://nettybyte.企业/api/file/cm45uzihq008fjxcdutbxsgm1
But im using discord hybrid sharding
you dont need sharding yet
or really clusters
I just want to fix the error you have an ideas?
i dont use discord hybrid sharding, i use discord.js Sharding Manager
oh okay
I fixed it
That helped
Hello, when trying to post stats to top.gg api but im getting the error You are not allowed to update this bot anyone know why?
Hey! are you possibly using the token for another bot?
tokens are specific to their bot
No sir, I'm using the token from the web hooks of the only bot I have posted on top.gg. I even double checked.
As well as double checked my bot ID.
Regen token keeps giving me the same token over and over even after it saying it has sucessfully changed.
refresh the page just after
That works however im still now allowed to update the bot. I'm using Post: https://top.gg/api/bots/:1300879223354953779/stats I have the headers as Authorization mytoken and i have the request body as server_count. not sure whats wrong.
Nevermind its suddenly working now idk lol
Wait, using https://top.gg/api/bots/:bot_id/stats is the same as using https://top.gg/api/bots/{bot.user.id}/stats ??
wdym
For getting server counts
I’m sending the request to this url https://top.gg/api/bots/{bot.user.id}/stats
but on the docs I see that it’s https://top.gg/api/bots/:bot_id/stats
just wondering if it’s the same thing
Cos I used this https://top.gg/api/bots/:bot_id/stats first and I wasn’t sure if it worked cos my server counts showed 0 , then I changed and used the other one , then I saw my server count finally updated
:bot_id is just an example, you replace :bot_id with your bots ID
it doesn't matter if you use :bot_id or {bot.user.id} as an example, it works if you replace the ID
Ahh I see cheers 
So I set my bot to post server stats to topgg every hour, yet the number has only updated once in 2 days. What am I doing wrong?
Show your code please
is this the place for feature requests?
is voting webhook bugged today?
no
its your end
sending sample webhook works, im not getting it back when an actual user votes, and he was able to vote multiple times (Im assuming his vote was not registering)
I'd suggest telling them to try another browser
Is there a py version for this? I'm also struggling to set this up
Top.gg Python library
Not yet unfortunately as I don't really know python. I have making one of these for python on my todo list tho
Can always see if someone content inclined would be happy to record a video for it
yeah I've been using the topgg library, tried with both a source installation and a pip installation and there's just countless errors like "topgg module has no endpoint", "topgg module has no data"
it doesnt seem like the module downloads everything
why when i get user info return 404?
its mean you're not allowed
ooh ok
That means the user is not found
if it returns json { "error": "Not found" }
that means the user is not on Top.gg
i use my own user id
and i've tried using someone else's id but still got nothing
what is the response body returning
check if its returning HTML - if so, you've messed up the API url somewhere
ohhb i thought the id was the same

https://top.gg/user/394452374337777664
It's the ID in the URL
Sometimes the same as Discord but not always
Are there any fine tutorials for covering Python API?
Since I don't understand what is a topgg.DBLClient
^
Also the GitHub repo has examples iirc
The people that collect and reuse your data 
hi
can someone ping me with python setup code snippet for stats
How to post server count with api?

^
And the API key you get one when you have a bot listed on the website
How can i get a API Key?
Have an approved bot then you can check it in your bot page
Oh ok 👍
im trying to add voter rewards to my bot, how do i find my webhook url?
or do i just need the api key
i try to import it (py) and it says theres no module named topgg or topggpy, its definetely been installed. Am i using the right name for th 1.14 version? i find it weird why you would name the module and import different things
Any help guys 
Im not stupid so it wont be a pain to explain, ive just never worked with APIs before. Data science bachelor (i prolly should learn it proper either way for web scraping)
Your webhook url is the url to your host(vps, replit, etc)
IE, http://YOURVPSIP:PORT/PATH
The port is set in code, the path is set in code. Your vps ip is provided by your vps host.
The api has pretty restrictive ratelimits, webhooks are the way to go
I see, thanks!
Holy working with webhooks is a pain
Spent 30 minutes trying to figure out how to correctly implement with my spaghetti code
And now im not getting the POST, and when i try to check my router to open my port it doesnt connect to the admin panel….
these lines exist in the community topggpy examples:
def stats(client: discord.Client = topgg.data(discord.Client)):
return topgg.StatsWrapper(guild_count=len(client.guilds))```
however:
Traceback (most recent call last):
File "/home/container/######.py", line 3, in <module>
from callbacks import autopost, webhook
File "/home/container/callbacks/autopost.py", line 10, in <module>
def stats(bot: commands.Bot = topgg.data(commands.Bot)):
^^^^^^^^^^
AttributeError: module 'topgg' has no attribute 'data'```
what did i do wrong here
im using the example file itself and it isnt working
you get data from a POST not from the module istelf.
-# everything i know i learned the past 48 hrs so take it with a grain of salt
try:
# Parse incoming vote data
data = await request.json()
print(f"Webhook triggered! Received data: {data}")
# Extract user ID (the voter)
user_id = data.get("user")
# Trigger func
if user_id:
print(f"User {user_id} just voted on Top.gg!")
await vote_rewards(user_id, bot)
else:
print("No user ID found in the webhook payload.")
# Send a success response back to Top.gg
return web.Response(status=200, text="Vote processed successfully.")
except Exception as e:
print(f"Error in on_vote handler: {e}")
return web.Response(status=500, text="Failed to process vote.")```
i found the example files to not work either, its poorly documented hehe.
what are you trying to do? I am in no way well versed API's but ive wrapped my head around using TopGG's
I could help you if you told me your end goal @robust root
im just trying to handle the votes
i find the tutorials/docs either hard to understand or just not work
well, then you can just copy my code haha. just make your own "vote_rewards" function
this is all the code you need
and on top.gg just set the link to "http://yourpublicip:openport/dblwebhook"
make sense?
alright ill try this out thanks for helping
np
wait do i need a decorator or does this run by itself
i mean do i need to trigger it somewhere
you probably know but you will have to open a port on your router to get this to work, just change the port in the .run() to your open one.
yeah call topgg_setup in your main
alright
the on_vote() is attached to the "/dblwebhook" path
so whenever you get a POST with the path "/dblwebhook" its gonna trigger on_vote
webhook_manager.webserver.router.add_post(path="/dblwebhook", handler=on_vote)
oh actually this is the wrong code, you have to respond with a 200 to the POST immediately or its gonna error out.
So remember to respond first
try:
# Parse incoming vote data
data = await request.json()
print(f"Webhook triggered! Received data: {data}")
# Extract user ID (the voter)
user_id = data.get("user")
#
response = web.Response(status=200, text="Vote processed successfully.")
if user_id:
print(f"User {user_id} just voted on Top.gg!")
asyncio.create_task(vote_rewards(user_id, bot)) # This runs in the background
else:
print("No user ID found in the webhook payload.")
return response
except Exception as e:
print(f"Error in on_vote handler: {e}")
return web.Response(status=500, text="Failed to process vote.")```
this is the correct code for the vote handler
am i making sense 😆 im horrible at explenations
no worries i understand what ur saying
sweet, lmk if u get it to work
great, i hit "send test" and nothing popped up in console
either i called the function wrong or the port is not open
im using a hosting service, not my own hardware so things are complicated
am i stupid or something
include your bot in topgg_setup
so
topgg_setup(bot)
if you have access to a terminal you should also check if your script is actually listening to your port
forgot to say that i did try that but still nothing
^
i dont think i have access to the terminal
async def topgg_setup(bot):
topgg_token = "nuh uh"
topgg_client = topgg.DBLClient(bot, topgg_token, autopost = True)
webhook_manager = topgg.WebhookManager(bot)
webhook_manager.run(port = 1039)
async def on_vote(request):
try:
data = await request.json()
print(f"Webhook received data: {data}")
id = data.get("user")
response = web.Response(status=200, text="Vote processed successfully.")
if id and id in bot.data:
reward = randint(50000, 100000)
if bot.weekend:
reward = int(reward * 1.5)
bot.data[id]["cash"] += reward
embed = discord.Embed(...)
dm = await bot.fetch_user(id)
try:
await dm.send(embed = embed)
except Exception:
pass
return response
except Exception:
return web.Response(status=500, text="Failed to process vote.")
webhook_manager.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)
return webhook_manager```
the problem is probably in the connection and not the script
cause if the script actually received a POST it would tell you
where do you host?
uhhh id rather not say
but im afraid the port is not opened or something
most server hosters will give you a ip and port thats open
yeah mine does give me one
its an address and i used ping (cmd) to get the ip
oh ok
Port checker is a utility used to identify your external IP address and detect open ports on your connection. This tool is useful for finding out if your port forwarding is setup correctly or if your server applications are being blocked by a firewall.
plug the port and ip into this
will tell u if the port is open
it says open
hmm
and what link do you have on topgg?
and do you have the same webhook auth on script and topgg?
right... the code u sent me doesnt have a place for the auth
this one*
youre absolutely correct
oh
uh
so usually
when you initiate webhookmanager on topgg
you add the dbl webhook
thats what they tell you to do anyways
webhook_manager = topgg.WebhookManager(bot).dbl_webhook(route = "/dblwebhook, auth_key = WEBHOOKAUTH)
right? this is how you would do it, BUT the way it worked for me was to add the webhook later
usinbg
webhook_manager.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)
which doesnt ask for an auth key
afaik
and i gotta be honest ive got no idea why it works i just know it does
but it shouldnt actually matter, as you see "All requests are allowed if this is not set."
So the only remaining solutions are:
- Your script is not listening to your port, which you cannot check because you cant run commands on the terminal.
oh
yeah remove the manager.dblwebhook
key
only have the router.addpost line
no one will ever find out the ip and port of the webhook anyway so whats the point for an auth right
the .dbl_webhook function is the same as adding a post on router, and you cant add 2 post checks with the same path/rout if you understand.
does this button do anything
yeah, only problem is if they do. but i wouldnt worry to much about it
...
havent you been sending tests 😆
if you click that it will send a test POST
i been spamming it since this convo started
oh ok
yeah it sends a fake vote with your @
are you sure u cant tell me ur server provider? it wont let me hack you 😆
nothing poppin up in console
your other solution is NGROK
RIP topgg
which can ignore the need for a port
first its a smol one so knowing it wont help
second the emoji 😆 is my crush's famous emoji
😭
ngrok is free to use
so i recomend trying to run the bot on your pc
and then test it out with ngrok
and if it works
thats great
idk
your code should work, if youre not getting errors. So the problem is that its not getting the POST, which means either :
- your port is not open
- your link to your server ip and port is wrong
- or your script is listening to the wrong port.
test all these out first and see if any of those solve it.
sent the link in ur DMs
the IP is obtained when i ping the host's address
port is the same in the script/link/host
and ofc its open as I checked it
Auth should be just a string of random characters. I like the just hit my keyboard a few times approach.
Ejidnwozheianxifjw8z8r2nzudhwkoa9wk29smeid83
Perfect ^-^
It's just a good security practice
it wont work with/without the auth
Does your host have limited ports?
no idea
im asking the host owner about this
One way we sometimes handle these situations is just visiting the url in your browser.
It should give an error in your browser about not having a GET method.
If it gives that kind of error it means the request should be reaching your server.
If it gives an unreachable error it means the request is blocked somewhere
host owner said the port is dedicated
Dedicated as in you only have one port?
Then their panel should tell you which port you need to use.
im using that port and its open
wont work
hit "send test" and nothing showed up
Try this ^-^
blocked right
the host is running on linux
Id check your firewall settings, see if thats blocking requests.
i dont have access to this
welp i may be out of choices here
Interesting, not on a vps?
I hate suggesting my own services, but look into my website.
https://webhook-topgg.com/
It just forwards the request to a discord webhook.
If you want the event in your bot, you can read the message my service sends out and handle it any way you want. Its not recommended but a lot of people do it.
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
now i have to figure out how to actually get my bot to read the message
https://discordpy.readthedocs.io/en/stable/api.html?highlight=on_message#discord.on_message
Use the on_message event
filter for your webhook ID.
https://discordpy.readthedocs.io/en/stable/api.html?highlight=on_message#discord.Message.webhook_id
Then parse the embed.
Sadly I dont know python and cant really help any more than linking to the docs
alright thanks for all these info ill try to make use of them later
its well over 11pm for me
ima head to bed
hey! Is there a way to request a users vote cooldown with webhooks? or should i just store their votes on the server for concurrency.
That's something you store on your side, I like using redis for that kind of stuff, but any database works. Or if you don't mind losing reminders when your bot restarts it can even be in memory
yeah, im just using asyncio.sleep(12x3600) for when to send reminder rn 😆
i want to add the timer, but i hate working with datetime. messes with my head. But i suppose theres no other way.
One of these days I'll be upgrading my site to websockets and include reminder events.
I just need to stop being lazy about it.
lol yeah
the sleep function doesnt require much overhead and is incredibly easy to implement.
so i guess youve gotta decide between checking every single stored datetime every minute or just the sleep.
CPU vs RAM
in my case im prolly gonna do both, CPU and RAM.
my poor servers
Just chuck it in a database ^-^ or redis
yeah ive already got a cooldowns database for various other commands, its just a bother. Each time theres a new cooldown i alway think "but yeah this is the last one" and dont bother making a function for it and so i always gotta make it custom 😭
good coding practices are not allowed in my codebase
database cooldowns?
Hey guys
I just woke up
So my host provider confirmed that there is nothing that could possibly block the requests
This is real messed up now cuz idk what is wrong: my code or the host
I cant port forward so cant really check it
you can
Yeah but i dont have access to my home router
run the code locally and visit localhost:<port> in your browser
Cuz it aint mine
you dont need access to test it locally
What does this do exactly?
it means you can test if your code works
because if you can visit the URL in your browser locally, then its a host issue
Alright where do i get the port from
well no its not a database sorry, but ive got a system for storing cooldowns already is what i mean. I just dont have a system for handling cooldowns, so i gotta make a custom func each time.
you can use ngrok to circumvent having to open your ports, so you can test locally.
its whatever port you set in your code
By test locally, I think bun means sending the request from you local machine to a locally run instance of the code ^-^
Unable to connect
yep this
oh i was just telling him how he could receive POST without having to open a port, this way he could test the TopGG implementation locally.
then your code isn't working
Ok so question is how do i get it to work
is this in javascript?
No its python
python, hes using my probably shitty code
lol
thats python in a nutshell
;p
Oh yeah and somehow it works for you but not for me
yep
and i had the same problems he had
with the test sending and getting no response at all
for me it was an issue with my port (shitty provider) so using NGROK fixed it for me locally, and it worked just fine on server
exactly in the on_ready()
lol
he couldnt check if anything was actually listening to the ports on his server because he doesnt have access to a terminal
👀 no ssh access?
but the port was open on the ip and he had the same ip in top.gg
so either the script didnt connect correctly or yes, something was blocking the POST after it reached the server
This has to be the single worst host 👀
lol
😆
and he cant run netstat because, no terminal.
so his only solution is to assume the script is listening and work from there
and thats why i suggested starting the test locally first, using ngrok as its very simple work around.
cus if it works locally with ngrok, we know the script isnt the problem.
@robust root https://ngrok.com/use-cases/webhook-testing
test it with ngrok
its super easy
I have school right now 👀
allows you to just send the POST to ngrok instead, and they will send it to the app running on your PC, and then that app will locally send it to the port you need.
lol, yeah test it at home. But check out ngrok its very nice.
Hopefully I'll finish websockets one of these days so we can avoid this problem
since its the app receiving the data it can just reroute it to the port you need on your pc, the port isnt actually being used from an external connection and so it doesnt need to be open.
its what i did when i couldnt get my ports opened either
Found out my provider had the admin panel on a login from their website, instead of just writing the default gateway into your browser like any normal provider.
question: can the topgg be laggy / overloaded at times? when i was testing it right now it sometimes wouldnt go through for 30 seconds, and sometimes it wouldnt go through but then i when i sent another they both came at the same time instantly.
Just asking cus i wanna know if this is a issue with my script, cus if so i gotta fix it 😆
@jaunty plank @scarlet snow the problem is solved
it was the host thats blocking requests
the host owner fixed it and now its working
classic
what
future: <Task finished name='Task-1889' coro=<WebhookManager._run() done, defined at /home/container/.local/lib/python3.12/site-packages/topgg/webhook.py:144> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 1039): [errno 98] address already in use")>
Traceback (most recent call last):
File "/home/container/.local/lib/python3.12/site-packages/topgg/webhook.py", line 150, in _run
await self._webserver.start()
File "/home/container/.local/lib/python3.12/site-packages/aiohttp/web_runner.py", line 121, in start
self._server = await loop.create_server(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1577, in create_server
raise OSError(err.errno, msg) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 1039): [errno 98] address already in use```
this randomly appeared
I started getting these errors today while checking if the user voted. This didn’t happen before?
im also getting errors with the autopost thing and its giving me hella lot of random characters (looks like some HTML code)
oh yeah and 403 forbidden too
yeah i have the same problem
Bit late response but I was trying to implement the query again today and it's still not working for me. I even tried the exact same query as you. Any ideas?
https://top.gg/bot/942858850850205717/vote?wee=woo
{
"bot": "942858850850205717",
"user": "1324330109078999070",
"type": "upvote",
"isWeekend": false,
"query?": null
}
Also interesting that in the json the query contains a question mark next to it. In your screenshot it's just called query not query?. I would personally only expect the question mark to be in the docs to indicate optional not in the actual code.
But that shouldn't make a difference for me since I am logging the entire json.

same
same
Topgg servers messing up then, if everyone suddenly had the same problem 😂
I see, I thought I was the only one who got it😭
Same 😅

bro suddenly getting so many errors.
cc @normal hedge ^
or if it's a fetch 
its showing 403 error. and its failing to verify te votes.
yeah I know, I am asking for some other information e.g. what your web request looks like
[2025-1-2 17:55:30] [INTERACTION_CREATE] Please check you are using the correct execute method: "async execute(interaction, client)": Error: Unable to connect to the Top.gg API.
at verifyVote (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\utils\topgg.js:50:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\commands\Music\play.js:37:30)
at async Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:78:13)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖ error [ERROR] UNCAUGHT EXCEPTION: TypeError: Cannot read properties of undefined (reading 'send')
at Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:151:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖ error [ERROR] UNCAUGHT EXCEPTION: TypeError: Cannot read properties of undefined (reading 'send')
at Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:151:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖ error Uncaught Exception:```
im using AutoPoster from the topgg-autoposter package
lovely!
thank you
thanks for you help
no worries
how you made the autoposter? can you help me
im pretty sure theres documentation on it but its just a package from topgg-autoposter
thanks bro ❤️
import it and then get your token from your bot page and use the AutoPoster function
https://docs.top.gg/ this should have good info!
That's so wild.
I'm wondering if that's why I'm getting some errors from time to time(I never fixed it, it was so uncommon for me)
Query used to never be null. It would just not be in the body at all.
Something is up, I'll keep messing around with the issue before it has to be escalated.
I've been running the SDK for about a year with no problems, and now I get out of work and my users are complaining that the bot isn't really working. This seems to be the main issue at hand, especially because it NEVER STOPS FIRING
I haven't touched the bot for months, so I'm not sure where this comes from
Regen your token and use the new token. See if that works.
Has the "IsWeekend" endpoint been closed off? I really only used the built in version because it was right there, but it's currently the only thing failing as far as I can see.
Not that I'm aware of
Alright, thanks 🙂 I'll try the token thing then 😄
Actually CC @vital anvil
Same thing you looked into earlier this morning
Funny thing is, getVotes works just fine, but the IsWeekend doesn't 😄
ah, sorry. this seems to not be a documented endpoint 
Really? Oh damn, I've been using it for a long ass time
Doesn't matter, I replaced it with something a bit more simple.
new Date().getDay() % 6 == 0
done! :)
should be open again
ah that also works lol
🤔 doens't this only handle one day?
not two days
<@&412346069675147264> might be good to replace that with actual logic.
const weekendDays = [0, 5, 6];
const isWeekend = () => {
const day = new Date().getUTCDay();
return weekendDays.includes(day);
};
here's the logic to replicate the endpoint
UTC time ofcourse. I'll keep the endpoint but since it hasn't been documented in the docs for like... four years, 
If I'm not wrong the counters goes from 0 -> 6, where 0 is Sunday and 6 is Saturday, which means 0 % 6 = 0 and 6 / 6 = 0 🙂
valid, but 5 is also a valid day for top.gg -- see the code snippet above
how do you use the webhooks on the website to grant a user a role when they vote for your bot?
your server would listen for the webhook being sent through, inside there is metadata that includes the user information, you would then do a post request to Discords API to assign a role
https://docs.top.gg/docs/Resources/webhooks
this is what’s being passed through, and how to set it up
Webhook integration for receiving vote data
Does the API send 2 POST in the weekend?
no
your API is not responding to Top.gg fast enough so it's resending the request
always send the 200 response BEFORE doing anything like issuing rewards, DMing, or any DB inserts
Hmm, this is the first time this happened. And i do send the 200 first.
Musta been a server glitch or something
Error
If your server is far away, or it gets delayed at all it can cause this.
^
top.gg only send duplicate requests in the instance of not receiving a response within 3 seconds
Mines in Finland and I'm just waiting for the right time to move it back to New York.
Wheres the topgg server? I have the option of moving server location.
New York ^-^
Webhook requests that time out or return a 5XX status response (like 500) will be retried up to 10 times. The retry delay is increased exponentially per retry by 2^N seconds, from a minimum delay of 1 second for the first retry up to 17 minutes for the tenth.
If you take some time you can track down the exact data center it's in ^-^
Gotchu, thanks. Mine is in paris rn so ill move to NY.
Only one second before retry? Seems short, i guess the distance delay would explain it.
You can also cache the request and respond to duplicates and ignore any more.
Ill also check for any raised errors, maybe the script just didnt work for some weird reason although its really barebones and has fall backs so there shouldnt be any issues.
Smart! Ill look into that thanks
First time working with APIs 😂
I've had it happen a ton.
I wish it followed the docs a bit more accurately.
A timeout should start at 5 seconds.
Responses to webhooks must be returned within 5 seconds, otherwise they are considered a timeout and will be queued for a retry (if available).
wait @scarlet snow when u define topgg_setup() whats the purpose of return webhook_manager (the final line)?
ehem alright
Huh yeah 5 seconds seems more apt.
Not just me thats a bit frustrated with the docs then, they barely helped me when implementing.
they may be easier to follow if youve already got some experience in API’s is my guess.
I dont remember rn why i have it actually
But did you get it to work?
its working (told u a few days back)
Right 
Yeah i remember
One day I'll add a guide for js to the actual docs.
The guide I have is for another library that doesn't get much use ^-^
Yeah one thing about the docs is that the examples just dont work, they didnt for me at least. Always got errors.
Might have been more of a me problem than doc problem though.
any suggestions on data management cuz im using json atm
any baby-mode database i can use
I prefer just starting with SQL.
Postgres is great.
But mongodb is easier
i get confused reading SQL docs for 5 minutes
I'd like to do something like this with the actual docs.
A specific section just for more indepth guides
https://top-gg.gitbook.io/top.gg-voting-node-sdk/faq/what-are-webhooks
For most people this is the first time they've worked with webhooks, and it can be quite hard.
Once you do a webhook once it's easy, but that first time takes time without proper resources.
Personally ive settled on JSONs as a permanent solution, you can load it all into memory and have instant acess. Only issues is with bot crashing but just save often and it shouldt be a major issue 
Plus most bot libraries will never totally crash unless youre doing something really really wonky thanks to error handling
Well, you can still run into issues with json as storage without crashing.
text based databases can corrupt themselves very easily unless you take a LOT of time to properly implement it.
You'll need write locks in place
(to do it properly)
permanent solution until your bot hits 2500 servers (wont happen anytime soon)
but JSON is still a great simple database with like instant access unlike those databases where u have to SELECT and commit() and stuff
Yeah write locks is something im gonna add
Its easier to learn a real database tbh
Why would 2500 servers fuck with, oh shards right.
😂
lmao
Yeah
Regarding the query issue, should I re-post that in #1314012335320596520 to prevent it being forgotten?
Honestly, I've tried everything possible to recreate it and I cant 😦
Are shards two different instances of the script? Or just two different connections within the same instance.
If its the latter then it shouldn’t be an issue with write locks no?
Do you have logs for your votes that you can see what is in query? Let me try voting, if it doesnt work yeah make a forum post.
shards are Bot()'s twins with their own connections and their own data, they dont share data with each other (works independently)
Usually I only log votes for the people in my support server, but I can implement logs real quick
even if u set a shared var bot.variable they wont share between shards
I dont need to see it, just you can confirm on your side.
So two instances, gotchu. I really need a database then.
Or I can join your server. DM the link 😄
if ur bot is getting 2.5k servers u really have to get a db otherwise json on top
Whats the best database to use? I should get this migration done before doing anything else.
Will involve a total refactor of the script 
Is my guess
I use postgres. mongodb is good too, but it can get frustrating as you scale up.
I don't log the raw json though I need to change that, but that's no problem.
my bot is a minigame bot so recoding the whole thing would be a NIGHTMARE
thats y im looking for a way not to use databases
Okay, just let me know whenever you're ready
will do
Yeah mines a game, with progression and whatnot. So basically every single command is editing the players info somehow…..
Yikes, imagine losing that due to corruption 👀
Lol, it saves often dont worry 
i still wish we used https://topgg-docs.vercel.app/ 
Integrate the Top.gg API into your bot!
yeah a real db would help.
You might even go with redis
Often enough.. i hope
yeah
being a minigame bot means the code is constantly updating and retrieving info
making a db for all of that would hurt
Nah, relations are easy.
Its really really fun making a database graph. So satisfying.
So postgres, mongo and redis thanks. Ill look into them and see what i decide is the best.
With the frequent writes and reads im mainly looking for whats fastest, im fine with obscure and hard to use databases as long as the result is fast hehe.
writing an execute() line to retrieve/update player info every 5 lines of code is PAIN
Love graphs
sqlite3
Alright I'm ready
https://top.gg/bot/942858850850205717/vote?wee=woo
voted
10k servers damn
wtf, yeah make a fourm post
Just DRY, dont repeat yourself.
man :/ I'm sorry
dry?
I dont know if im remembering it right
But dont repeat yourself, if youre doing something often just make it a function
All your db queries should be functions
^
I'll swap to my work machine real quick
worked for me
i cant really make a function tho, each part of my code retrieves a different part of data or sometimes inserts/remove data
It might be bot specific
You can use a function that takes a dotpath to easily navigate to the data u need

So you could do
user.stats.wins
Or
user.inventory.money
To easily edit the data u want
im using pure dict values data[player]["cash"] and such
im thinking about the implementation of DBs
Same
Ive got no idea about that hehe, better ask woo
Ive gotta do some learning 
WOOOOOOOO is a JS dude?
Idk
Ye
But i think best database practices transcend your language
^
I only know PANDAS but its not a database just a database editor
What would you call pandas actually
idek what pandas is
you use it mainly for datascience afaik
Well, thats the use of it i know. Probably way more
Its just a library for storing and manipulating that can easily be used to do machine learning and data representation
I like how the first option is use redis 😄
o hell nah how do i make databases process dicts
how big is ur userdata? im at 180 players and 1.1 MiB rn
mines at kilobytes (so smol)
😆 it grows fast
with the current rate i dont think so
Databases can get complex quick. But once you get it down its easy ^-^
I have a database file with all my functions, it just uses a single client.
my bot is relatively new
gotchu, in any servers yet? I implemented vote rewards and my server count doubled overnight 😆
49 servers but player count is small
Itll grow, just takes time.
im having exams atm after that i plan to reskin my bot
it currently looks like it was made by a toddler
gotta rewrite some functions
bot was going well around 4 months ago when i have to shut it down
now i basically have to restart from the beginning
gaining popularity and such
irl stuff and the old code was buggy and messy
gotchu
Everyone views their own code as buggy and messy ^-^
haha yeah
oh yeah if u cramp every functions in a file it will automatically be messy
mine is so spaghetti, sometimes i go back to update code i havent touched in 2 weeks and literally go "wtf"
i use cogs now which sorts things out a bit
Ah, well thats just a refactor.
damn what the hell did i make here hmm how tf does this work ahh reaction
had it sometimes too
Does py have a JSDoc alternative?
yeah i gotta migrate to cogs too... i started messing around with a second bot for fun and learnt cogs for it and was like "oh god this is so much easier" and then i went "oh god its gonna be such a pain to refactor into cogs"
no idea what jsdoc is 😆
u can just copy ur whole command function to a new cog and itll work (needs some adjustments to variables tho)
Its a way of tagging functions that explain things well.
Provide an example of how to use a documented item.
yeah, just gotta do that 50 times.
So, I can make a function, leave for 6 months and it will describe the function, its inputs, its outputs
oh i see, yeah i think it does.
you can definetely decide what type is returned
and of course you can always comment
i should comment more
i dont even comment
JSDoc is just comments. But it communicates with your IDE, so I can understand a function without looking at the function itself.
wait if mongodb uses JSON can i just copy paste, really hope so.
theres not a single comment in my code (except those so that i can remember the keys of a dict or smth)
dunno if thats good or bad practice
😭 im a bit better than that
when i read my code i simply execute them in my mind
"its called mongo because of its use for humongous data loads"
Mongo does support json, but not in the way you're thinking.
You'll want to write your own handler for it, which isnt hard.
hmm
Ie, something that reads your entire json file, then create the mongo docs from that.
as an unexperienced coder i can confidently say that ill employ ChatGPT for anything outside of writing a command function
just be weary of using chatgpt. Learning these things on your own without chatgpt is a good way to get more experince.
using chatgpt slows down learning.
Do the new bot developer forums mean that topgg is being worked on again?
I had the impression that since the app directory, topgg hasn't been getting any updates anymore
i dont just ChatGPT the whole thing then paste it into my code
i use ChatGPT mainly to learn the function syntax, then comparing with the docs i make adjustments or make functions my way
We've had significant backend upgrades 😄
I wouldn't say the App Directory necessarily - However the first part 
no new features though
ic
yea haha
i know a lot of backend changes are being made because i've seen them change features subtly

trust me a lot is going on and its going very well 
sounds promising
the most effective change resulted in https://status.top.gg/ being 99.9% so 
Welcome to Top.gg status page for real-time and historical data on system performance.
bring back 75% uptime 😠
lol
99.94% is impressive
The last patchnote being in 2022 just gives me that impression 😂
but I think it's the last day of 2022 actually
well mid december
I think we've had quite a few upgrades in 2024 that have no patchnotes that users needed to see.
Its mostly been reliability and speed.
I assume topgg gets more more traffic than the app directory right? Since most people will google for a discord bot and topgg ranks first
I mean you can't know for sure but I'm guessing
The volunteer team really wouldn't know anything like that.
yea
@jaunty plank it looks like REDIS is the thing im looking for, nano second access times ❤️
lots of modules as well, even for AI which is just perfect for me. Gonna data science tf out of my players.
Redis is great, just remember it stores everything in memory
So if something isn't accessed for weeks it's taking up memory
You'll want to learn to configure it before depending on it.
yeah i know, for a discord bot i think its fine. Even at 180k players it would only be a gb of information which i will have the overhead for.
wdym
with my bot's small scale I dont think Ill be learning DBs anytime soon D:
😆 better sooner than later i say
gonna be a PIA to switch to a db now, wish i did it from the start.
Since it's a cache system more than a database.
You can store stuff long term, but it doesn't always store right away.
It puts it in memory and stores it later.
Just do your research and you'll be fine.
Even if I use hosting and don't use replit, should I still use express's npm or not? And how would it be?, I am hosting the bot on a hosting and I want to make the system say that I already voted
Express works pretty much anywhere
getting started on the "redis university" courses rn haha
and if I am using my PC to host, what URL should I put in "Webhook URL" localhost or which one?
how is ur player data structured? mine has a lot of values and i dont want them to get complicated with read-write processes
its just dicts no deeper than 3
wym by no deeper than 3
as in
idk
like
a normal dict
is 1 deep
and then
if u have a dict in that dict
thats 2 deep
also yeah its no deeper than 2 not 3
ah nested dicts
i also use nested dicts but however i also use lists
lists in dicts and dicts in dicts
dont think so actually
👀 dicts are [item, item, item] right?
{
key: value
}
Ah objects



