#topgg-api
1 messages · Page 9 of 1

sanz left 
who is sanz
the core maintainer of the C++ SDK
The official C++ wrapper for the Top.gg API. Contribute to top-gg/cpp-sdk development by creating an account on GitHub.
oh :c
wooooohoooo yet another ded library
just like
inspect elements on the preview link
its using a tailwindui template but modified quite a bit

yes
no mac already replied and said it won't be happening 
i don't see where the maintenance will be needed seeing as it will be rendered as a static site because its not making db requests etc
but yeah thats the ruling
i'm not gonna bother contesting it 
I should start a seer service
If it were docs for a lib I wouldn't have an issue with it but since this is for the API docs, there's no reason to. "If it ain't broke don't fix it" is the approach here. What we have has worked perfectly fine up until now so there's no reason to take the risk of completely overhauling it.
Again, if it were a lib this would already be merged because it does look better and it's not as big a problem if it breaks. I really do appreciate the time and effort put in! I just wish we had had this conversation about such a major change before sinking your time into it. But since this is about our core API docs, we cannot take that risk. I hope you understand that reasoning, but unfortunately it's not up for debate.
cc @tidal idol
My question is why have years old PRs never been merged. Worth noting that those are PRs that are needed.
If someone would actually care about the documentation, those would've been merged since a long time.
Now I have to admit that if people don't merge the most basic and needed PRs, the complete redesign will be a mess in keeping it maintained and up-to-date, even if bun would actively work on it and opening PRs consistently.
-refreshdata
Fetching Your New Bot Data
To fetch your bot's new name or avatar, please follow these steps:
Click the Refresh Data button in the sidebar on the right.
Click Edit on your bot page and then Save.
💡 Please note: If it still doesn't seem to change, make sure you actually changed the bot's avatar / name on your Discord Developer Portal and not the application's icon / name.
thank u
-api
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
please read up on what i said in the discussion on this
by the way, was referring to another user who posted a gif, which I deleted
there's nothing broken, everything broken is in the content not the site #topgg-open-source message
maintenance is inevitable #topgg-open-source message
being a maintainer #topgg-open-source message
being a "copy" #topgg-open-source message
@lament pawn
server count is not updating even i used topgg-autoposter
it can take time to update due to cache
ok
for the api server count, does it count how many servers the bot in, or how many people invites the bot since i put the Authorization?
The server count is posted by you
By literally guilds.length, so thr current amount of guilds your bot has
The site does not track that itself
Cache should take half an hour to an hour
Again, it does not update itself, you need to post the statistics yourself
More on https://docs.top.gg
I can currently see 8 servers on the statistics you have posted
Yeah
alright thanks
Can anyone help me with the /dblwebhook webhook stuff?
as i am currently having issues
It would be easier if you wrote what issues you have instead of writing that you have them because it doesn't make things easier
And they were never heard from again, typical
re: posting the stats, I've got some current logic for including stats in presence updates, but obviously that errs on the side of more frequent potentially partial updates around a shard restart, would it be fine on top.gg to just hook that in the same place, or should I try and be careful to not post partial numbers and wait some time for them to stabilise?
no
No ads
Can anyone tell why isWeekend is returning undefined? (I'm new to webhook stuff)
no self promotion
app.post(
"/dblwebhook",
webhook.listener(async (vote) => {
console.log(vote);
console.log(vote.isWeekend);
let olduser = await User.findOne({ userId: vote.user }) || new User({userId: vote.user }).save();
// olduser.corals += 2;
//await olduser.save();
if (!vote.isWeekend) {
olduser.voteTime = Date.now();
olduser.voteStreak += 1;
olduser.corals+= 1;
await olduser.save();
} else if (vote.isWeekend) {
olduser.voteTime = Date.now();
olduser.corals += 2;
olduser.voteStreak += 2;
await olduser.save();
}
Here's the code
@rustic whale hello can u help?
sry no idea 😩
Uh 🥲
@restive otter but the embed that is sending says that it is weekend lol
Embed?
wait what
isn't isWeekend documented as a required property
ig another known issue no eta again 
yeh
The property isWeekend will not/never be sent with the test webhook
@novel yoke
It will (only) be available when receiving a regular webhook (not your test webhook)
In other words if somebody actually votes
oh ;-; then the system is actually working ;-;
i was sending a test webhook and it was only giving one credit
so i was confused
isWeekend is not provided on thr zest webhooks
What FakE said
Cant be bothered to fix the grammatical error if the answer was already given lmao
But yeah consider it a bug
@woven coral 
I mean why shouldn't it be in it when its used as a test
how to setup commands that requires vote in js ?
nah the docs being shit again :^)
prs left abandoned for years

@restive otter apparently i wasn't the first one https://github.com/top-gg/rust-sdk/pull/1
also this doesn't make any sense
The client methods should not be async as it serves no benefits, just makes it more difficult to debug and test.
most discord bots written in Rust are async anyway 
None
lmfao
Also your merge
me when no rebase done when getting merged 
You should not be targeting the dev branch if your implementation deviates mine, especially modifying cargo manifest.
Not sure what's up with this
Sounds like someone just didn't wanted to get their implementation edited
When you publish something that isn't working in the first place 
@woven coral how about you just ask for collaborator lmao
other sdks just merge when they believe it's fine, can do the same for yours

wym?
yeah your pr had all those commits
normally when someone merges
they merge as a single commit
hence rebase and merge
eh that's fine
yeah, though just horrible 
you rebase nowadays when you want to merge a pr
especially when you made some commits in response to reviews or issues you've seen
though real chads just force push into main
fr
hmm
Pada
@restive otter it's here!
https://crates.io/crates/topgg https://docs.rs/topgg/latest/topgg/
what
isn't 1.0.3 the latest
Cargo automatically resolves it to the latest version iirc
ah okay
topgg = "1" also does the same
what
Xetera got a fair point as well
yeah rebase would've preventing such commits from showing up basically
idk how to rebase 
you are not the one who's supposed to do it
it's when you merge
instead of just clicking on the merge button
you click on rebase and merge
icic
that should be fixed in https://github.com/top-gg/rust-sdk/pull/8
Well you've changed nothing other than the crate's version 
FFS

i hate git sometimes
@golden adder sorry, but can you change it yourself? i don't think i wanna make another pull request :)))) i'll make another one
Should be HTTP/2
HTTP/2.0?
oh alright
@restive otter ok so apparently HTTP/2 returns a 505 (HTTP Version Not Supported) and HTTP/1.1 just never returns

guess it's a wontfix
squash
nvm apparently i was dumb
@restive otter apparently i forgot to add the Connection: close header
HTTP/1.1 uses Connection: keep-alive by default https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
Interesting that is allows you though
Meaning the server doesn't respond with anything
Just hangs
that's the point of keep-alive 
yeah but there's surely something that drops it in the end
other than you stopping/cancelling the request
Wow man verify my bot Anison
Wow man wait longer

@exotic wyvern
are you possibly setting the auth header/url to something that contains an accented character?
ex: á
Old issue we dont see often.
Nope, I just realised that it was error on my end, I got the bot new domain and was making the old domain redirect to the new one which was causing this error
Sorry!
ah, well glad you figured it out ^_^
Thank you!
Will the endpoint return a 403 if this condition occurs or nothing will happen and everything will return as intended (but everything is truncated to 1000 votes)?
i don't have a bot with over 1000 monthly votes to test this 
i dont think it returns 403, the bot just won't see more than 1000 votes using that endpoint
but you cannot use this endpoint sounds otherwise
it should've been worded as "you shouldn't use this endpoint"
emm
Thanks
Hey guys - regarding the votes endpoint /bot/{id}/check?userID
How up to date is the information queried? For example, if a user votes and then I trigger this endpoint around ~5 seconds later, will I get the most up to date information about a user's voting status? What's a reasonable timeframe in which the read on this endpoint will be accurate after the vote occurs?
Should be basically instant
Hey, im using 2.1.2 API for Java, but when i want to call method Builder() it wont found.
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("token")
.botId("botId")
.build();
Can someone help me?
Then you did not install the dependency
so how i imported the DiscordBotListAPI() 🤔
Does it actually go to the class if you inspect it?
can anyone help me?
when i try to go to applications it takes me to a discord login page
you would have to login, assuming you're in the discord developer portal?
Is it possible to have a command that votes for the user instead of them going to the site? I want to make it easier for them to vote
That sort of is on the line of topgg TOS
Bot Page > Edit > Webhook
Then you cannot use the API
You need an approved bot to use the api
hm
Wdym
Not allowed, so no
Not possible either
How does this work
Like how do i use it?
to send the webhook to a channel i want to send it to?
address of your webhook server which handles vote events
second one is password to make sure that request came from top.gg
What kind of address?
Like a https:// website or a webhook url
it could be a https website or your server's IP
you can use https://webhook-topgg.com/ if you want
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
it is 3rd party source but it is useful
so how do i use it in an actual code?
I use Javascript @willow spindle
like a https:// domain that i own
04.05 09:39:03 [Bot] Hybrid command raised an error: Command 'freelance' raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0) - started happening with my votecheck command - is this a api overload? Command has been working fine ever since last morning
i get 04.05 10:26:35 [Bot] Error checking vote for user 1098285669937315910: 'voted'
04.05 10:26:35 [Bot] Response content: b'{"error":"Unauthorized"}'
Reset the token x2
Press regenerate, refresh the site, then copy that token
The site does not directly show the new token
I have - same error
Then you're not correctly providing the token within your code
Can it get overloaded
Or does it take a while to active token?
It does not
No
You can get ratelimited
But thats not the error
If you're getting unauthorized while doing this to obtain the token
You're either not passing the token correctly or using the still invalid one
Post your code
import discord
from discord.ext import commands
import requests
import time
import asyncio
class Topgg(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.top_gg_api_token = 'TOKEN HERE'
self.last_voted = {}
self.thanked_users = {}
@commands.Cog.listener()
async def on_ready(self):
print('VoteCog is ready!')
async def has_voted(self, user_id):
if user_id in self.last_voted and time.time() - self.last_voted[user_id] <= 43200:
return True
headers = {'Authorization': f'Bearer {self.top_gg_api_token}'}
try:
response = requests.get(f'https://top.gg/api/bots/{self.bot.user.id}/check?userId={user_id}', headers=headers)
voted = response.json()['voted'] == 1
if voted:
self.last_voted[user_id] = time.time()
return voted
except Exception as e:
print(f'Error checking vote for user {user_id}: {e}')
print(f'Response content: {response.content}')
return False
async def check_votes(self):
await self.bot.wait_until_ready()
while not self.bot.is_closed():
for user_id in self.last_voted.keys():
voted = await self.has_voted(user_id)
if voted:
if user_id in self.thanked_users:
# check if 12 hours have passed since the user was last thanked
if time.time() - self.thanked_users[user_id] >= 43200:
self.thanked_users.pop(user_id)
else:
continue
channel = self.bot.get_channel(1103061831465046076) # Replace with your channel ID
member = self.bot.get_user(int(user_id))
await channel.send(f'Dear {member.mention}, I want to express my heartfelt gratitude for taking the time to vote. Your contribution is highly valued and appreciated. Thank you so much! :redheart:')
self.thanked_users[user_id] = time.time()
await asyncio.sleep(10) # Check every 60 seconds
@commands.hybrid_command()
async def votecheck(self, ctx):
"""To check if you have voted."""
has_voted = await self.has_voted(ctx.author.id)
if has_voted:
await ctx.send("`You have voted for the bot!`")
else:
await ctx.send("`You haven't voted for the bot yet.`")
async def setup(bot):
cog = Topgg(bot)
bot.loop.create_task(cog.check_votes())
await bot.add_cog(cog)
async def has_voted(self, user_id):
if user_id in self.last_voted and time.time() - self.last_voted[user_id] <= 43200:
return True
headers = {'Authorization': f'Bearer {self.top_gg_api_token}', 'Content-Type': 'application/json'}
try:
response = requests.get(f'https://top.gg/api/bots/{self.bot.user.id}/check?userId={user_id}', headers=headers)
voted = response.json()['voted'] == 1
if voted:
self.last_voted[user_id] = time.time()
return voted
except Exception as e:
print(f'Error checking vote for user {user_id}: {e}')
print(f'Response content: {response.content}')
return False
```?
Yes
i get '04.05 10:52:55 [Bot] Error checking vote for user 276793117481369610: 'voted'
04.05 10:52:55 [Bot] Response content: b'{"error":"Unauthorized"}''
token is correct 100%
04.05 10:59:59 [Bot] Error checking vote for user 276793117481369610: 'voted'
04.05 10:59:59 [Bot] Response content: b'{"error":"Unauthorized"}'
@commands.Cog.listener()
async def has_voted(self, user_id):
if user_id in self.last_voted and time.time() - self.last_voted[user_id] <= 43200:
return True
headers = {'Authorization': f'{self.top_gg_api_token}', 'Content-Type': 'application/json'}
try:
response = requests.get(f'https://top.gg/api/bots/{self.bot.user.id}/check?userId={user_id}', headers=headers)
voted = response.json()['voted'] == 1
if voted:
self.last_voted[user_id] = time.time()
return voted
except Exception as e:
print(f'Error checking vote for user {user_id}: {e}')
print(f'Response content: {response.content}')
return False```
I think the api is just 🪦
It's not, its either your token still being invalid or still something wrong in the code
Same code was working fine all yesterday and days before untill it stopped this morning
Get a new api key and try again
i have 3 times
How did you obtain them
then copy
Ensure it doesn't have any weird characters in it
If it is the api itself, other people would start complaining in support
ive regenrated it but so don't worry:
self.top_gg_api_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjczMzgwODAyNzY1MTgwMTExMCIsImJvdCI6dHJ1ZSwiaWF0IjoxNjgzMTk1ODEwfQ.mu4dAteuZOgy03dDcBIXuy1v8jvnrwGamKsyuD7f31Q'```
Looks fine ^
I ran it through GPT4, and all it says the code is the correct contact top.gg support team for further assistance with backend API
Well gpt isn’t always right
I know but as a human i see nothing wrong either - the same code has been working all week 💀
Well idk maybe there’s something wrong with the api time will tell
I think rate limit, overloading or api 🪦 - the command is used over 100 times weekly so idk
People are not to happy in my server 💀
Shouldn’t be a issue
I know
Why do they need to vote? Some sort of premium ?
economy bonuses - roles on the server and to enter giveaways 💀
Just give it to them until u fixed it
everyone hates when they cannot get the bonuses lmao
to many users to do that
Then idk
How long does it take for the token to start working? maybe thats the issue
I will have to wait for TOP.GG staff members to look into it
Just keep getting ```
04.05 11:26:54 [Bot] Error checking vote for user 276793117481369610: 'voted'
04.05 11:26:54 [Bot] Response content: b'{"error":"Unauthorized"}'
04.05 11:26:57 [Bot] Error checking vote for user 276793117481369610: 'voted'
04.05 11:26:57 [Bot] Response content: b'{"error":"Unauthorized"}'
Are you sending the auth header? https://docs.top.gg/api/@reference/#authentication
{
"Authorization": "your-topgg-token-here"
}
@commands.Cog.listener()
async def has_voted(self, user_id):
if user_id in self.last_voted and time.time() - self.last_voted[user_id] <= 43200:
return True
headers = {'Authorization': f'{self.top_gg_api_token}', 'Content-Type': 'application/json'}
try:
response = requests.get(f'https://top.gg/api/bots/{self.bot.user.id}/check?userId={user_id}', headers=headers)
voted = response.json()['voted'] == 1
if voted:
self.last_voted[user_id] = time.time()
return voted
except Exception as e:
print(f'Error checking vote for user {user_id}: {e}')
print(f'Response content: {response.content}')
return False```
Yeh
Try re-generating the token for your bot. (You may want to refresh the site before copying the new token)
i have x3 times Last staff member told me to - still the same
same code has been working for a week now but stopped this morning
Thats weird. Stupid question, have you validated self.bot.user.id returns the correct ID?
Also may be worth logging self.top_gg_api_token to make sure thats also being passed
Ill try setting it as the direct id
It is
otherwise it would not print the errors in exception im pretty sure
Checked ID passes correctly
Hummm... the only thing I can think of is the token being incorrect
What bot are you trying to check for? https://top.gg/bot/733808027651801110 ?
Is the token even the correct one for the corresponding id? Keep in mind you cant use the same token for different bots
You could try the following steps too
- Sign into your account
- Go to https://top.gg/bot/33808027651801110/webhooks
- Click the "Click here to regenerate this token"
- Sign out of your account https://top.gg/logout
- Clear cache and cookies
- Sign back into your account https://top.gg/login
- Go to https://top.gg/bot/33808027651801110/webhooks and copy the token (dont re-generate it this time)
That bot yes
Token is correct.
How to clear browser cache
In order to clear your cache for the site, press CTRL+F5.
If this does not work, try one of these resources below:
Instructions on Microsoft Edge
Instructions on Google Chrome
Instructions on Mozilla Firefox
Instructions on Safari on iOS or Safari on MacOS
Instructions on Opera
Instructions on Brave
If you are unable to find instructions for your specific browser above, please refer to your browser's manual or help documentation to find out how to clear your browsers cache.
Last link doesn't work from my webhook page - token matches the one in my bots code. followed all steps im 100% that the token is correct.
Also just used GPT4 to check if code token matches with the one on top.gg and it matches correctly.
Then I got no idea
Make sure when your checking if they match that you are looking at the entire string, as only part of it changes
Try logging the raw outgoing response to make sure all headers get sent etc, or try doing the call in curl, postman etc to see if the token on the site works elsewhere
What are the api rate limits/ activation for a token
That's actually possible with my bot usage in servers ngl
Still does not fit the error tho so idk
The best approach is to use webhooks
That way there is no rate-limit
I know - but voting gives access to users bonuses in the eco module of the bot
Yeah, with webhooks you would be able to get votes sent to your webserver/bot :)
That way you can give rewards without asking the API for vote info
So if you need to store rewards over time, just push the votes into your own db when you receive a webhook
Are you arl to help implement that with me if i get any errors
I am about to head out to camp in 30min until Sunday evening 😅
So I wont be able to unfortunatly
no worries
Now that have restarted the bot loads of times and the api has given me other problems
The vote command now works - but the freelance command that i have now does not its like the api breaking has swapped commands lmao
& if i reset the bot again the vote command does not work and the freelance command does and this can be completely random both commands use the same logic
I guess i will give it 24hrs or smth for it to calm down & both commands might work then
Hi guys, i want to make the vote system inside the bot in py, ik only the way with the webhook but i seen it inside the bot without webhook and i was curious how
Only way is using the check endpoint, which is subject to ratelimits
The best way is webhooks nonetheless
anyone has a code example, how i can trigger a function in python nextcord when someone votes for my bot?
Can i also use this with nextcord?
Seems uncompatible to me idk
Idk, i don't use Python
why can't lib devs make their library work with every discord library 
ah yes lemme just
support 10-20 libs
especially support libs that love to have breaking changes
cough djs
i mean like instead of passing in a lib-specific bot object just pass in like a discord ID or something
oh yeah

so is there a alternativ to do it without the topgg module?
does this consume alot of perfomance?
u got any code examples or so? xD no clue how flask works
just check their docs, its not difficult
only me or is the top.gg api documentation outdated with both missing paths and paths that are not working as they should?
Which ones?
/api/bots -> always getting the same results with searches.
/api/bots/stats & /api/weekend -> not in docs
First one is a bug
Known issue
Don't know about the others
api/bots should return your own bots stats correct?
And api weekend is in the docs though no?
Considering the API documentation doesn't get any attention at all, wouldn't be surprised it's not documented yet could be useful
Isn't
its not
it should allow for a search query
Probably meant /api/bots/stats
oh yea then yes it should be your own bot
The search endpoint giving the same results is a known bug as mentioned above
Yeah it's good information to know, not worth creating a PR or whatever
PRs that are needed don't get merged, and that for years - documentation is pretty much dead and nobody really cares
add /stats to that, mistyped
feel free to pr if you want to
yea, im just adding tests to the node sdk and find these errors while creating them
and pong mac then
2-3 years old PRs never got merged 
Asked a question around those and why they never get merged, never got a response and still waiting for one
But when it's regarding an entire, good, rewrite of the documentation - there the refusal is instant at least
yea i saw that someone is doing that
Should probably ask my question there so that maybe it gets some more attention as it's on GitHub and can't be ghosted like on Discord 🙃
no reason in not trying 😉
Just sad that it has to go like that to not get your question ghosted for no reason
But yeah, I guess it's the only solution
if you look at an inactive github and think it can manage a completely repo-maintained site ur very wrong lol
the reason the answer was quick was because i was active about it and expressed my problems with it, mac agreed
im going to try and get some solutions for docs when mac gets back
need a new system but there needs to be some discussion around it first obviously
the individual sdks are maintained alright
Well my question was for Mac, no you
But yeah I do agree that a complete rewrite can't be better managed than an already completely dead project, as already said previously as well
yeah, i’m saying the reason the answer was so quick was because while this was going on, i said what i had to say, and then when everyone was asking mac about it i brought it up and be agreed. mac isn’t necessarily inactive, but we had to push for an answer but once he was there it was ez to answer
the issue isn’t with anyone here right now like mac, it’s that OSS was severely deprioritized when people were shifted and leaving
Absolutely, though I'd expect a small question to be at least answered ^-^ I guess it's not something I should expect in the the future and it's good knowing it
the hope is there's a better system in the future
to atleast get through the PRs there and have somebody able to merge in changes
definitely yeah
you must code a script to acces it
Oque que eu tenho que colocar, aqui no Webhook URL, porque quando eu mando um teste, não retorna nada no terminal.
@restive otter i don't think you appreciate how I can't be working 2 jobs for 2 companies at the same time and do them both to 100%, especially when one of the companies you work for has a workload that used to be for a team of about 13 people who you now basically have to stand in for on a part-time basis with one other colleague. So sorry if I missed your question, but that exact situation I explained above is also why we won't be overhauling something that already works in its current state.
Things will get better from here but @hearty lintel very much hit the nail on the head when he said OSS was deprioritized. The truth is it wasn't even considered (and barely still is although I've also been trying my hardest to improve this), because we have bigger issues to deal with.
I don't think maintaining a docs repo is a high priority when the API itself hasn't seen any updates or changes since it first released.
that's very sad
I think it's necessary to have at least someone or multiple people have the ability to merge in docs. "when the API itself hasn't seen any updates or changes since it first released" also isn't true, there are multiple changes, some of which are sitting in the PRs right now. Server webhooks are still not documented for example. Even if this was true, general maintenance, language updating, library updates (big one) are all things that still change in the docs often enough to warrant some kind of mechanism to get change onto the site. Even if it's not fast that's fine, because really there aren't that many changes coming in, but at least something. PRs can't even build today
We were talking in os chat about mechanisms for which merges can be made, there were only really two. 3+ library developers approve = merge or a specific mod who can merge. I agree I don't think it's fair to make you the defacto merger. These wouldn't be fast but they'd at least allow for some kind of mergeability. Though, again, it certainly wouldn't be fast enough to maintain a complete rewrite of the site
I can't grant mods access to this since only employees have access to the Top.gg org. I'm aware of the Netlify issues and I'm doing my best to escalate this but the person who can fix it has higher priorities on the Medal side right now. Hopefully there'll be more time for this over the summer and we can work something out.
-wrongserver
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord Support Server" button on the bot's page of the bot you need support for. If there isn't a button that says "Discord Support Server" or nothing else mentioned about a support server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
I know you can’t, but I think it’d be really nice if we just got some kind of meeting or time with you and Galkon maybe to come up with a solution and implement it. Hopefully one where they can be handsoff after it’s setup
hi
-api
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
Sure
-m @restive otter decided to react "Fuck yo" on my message for no reason | 3 days
Sammy Lammy#9508 was successfully muted
Hi
One message removed from a suspended account.
-api again
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.

Let me see if I understand, do I need to make a server using express, and connect from my bot to see the member who voted for my bot?
Yes, but not sure what you mean by the “connecting your bot part”
Basically Top.gg will make a POST request to the url you provide in the webhooks page of your bot. That url is your webhook server url where you listen for requests
Once you do get a request, verify it’s from top.gg and voila, you’ll get real-time updates whenever someone votes for your bot/server
Question about this actually if you dont mind, apologies for the ping, I have a node js server up and running, with it properly recieving the webhook however the webhook does not contain the authorization string I have inputted
Though I am using the 'Send test' as a test, unless that does not include the authorization string
It includes the bot, the user, the type, query is empty and thats all
I most likely think auth isn’t included because it’s a test webhook
Now that you mention it, I’ll prolly test in a few hours
A test webhook and an actual one
Auth is included when testing webhook requests
As testing it would otherwise not make sense
auth as in what
the authorization header?
Yes
The one you provided in your webhook settings
I'm pretty certain that gets sent too
Hi, in Top.gg Python library, autopost doesn't support shard_id, right?
I got 5 shards each one handling a little bit more of 1k guilds but, only the amount of a single shard is being posted on the website, they do not add up
The endpoint for shards or guilds don't add up. It just takes in the value you give to it so you could put 1 shard or 1 server and it accepts that I believe
Ideally you want to calculate the total shards and total guilds across all shards and post that to the API.
I'm not sure what the top.gg python lib does but you could implement this fairly easily without a lib if necessary
Oh, I thought it worked different depending on py or node.js
I asked a js dev and she told me that in her bot, every shard reported their guilds and top.gg adds them up
so I was trying to accomplish that with autopost
Not that I know of 🤔
I post my guild count to Top.gg everyday at 12:00 am and it's never added up
Though I use raw requests and not an auto poster so py or node js shouldn't affect it
I'd say calculate all the guilds from the shards and then post the full number
maybe submitting some array works but that's something I never did myself so I'm unsure on that one
alr, tysm 🙂
no worries
how to when anyone vote my bot my bot send message in member dm?
Read pinned 
No, sounds like a clear path to a tos violation
help
their backend is down for some reason maybe back soon
TopGGAPIError: 504 Gateway Timeout
at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:61:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Api.postStats (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:86:9) {
response: {
statusCode: 504,
headers: {
date: 'Fri, 12 May 2023 11:50:50 GMT',
'content-type': 'text/plain',
'content-length': '14',
connection: 'keep-alive',
'cf-cache-status': 'DYNAMIC',
'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
server: 'cloudflare',
'cf-ray': '7c6270cc9a0f23e8-LHR',
'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'
},
trailers: {},
opaque: null,
body: BodyReadable {
_readableState: [ReadableState],
_read: [Function: bound resume],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
[Symbol(abort)]: [Function (anonymous)],
[Symbol(kConsume)]: [Object],
[Symbol(kBody)]: null,
[Symbol(kContentType)]: 'text/plain',
[Symbol(kReading)]: false
},
context: undefined
}
}
anyone knkows why im getting this error?
where can i find my token for the Authorization?
Check the pinned messages
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.
after working normally again this started to happen
pls topgg config your cloudflare
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.
??
like for sometime bot was working fine after the issue was fixed in #site-status but now its again showing either Gateway Timeout or Forbidden
Deleted message, quote:
I want to ask if the account has a unique token that can be registered with automatically, better than doing auth every time I log in to the site - 19 hours ago
One message removed from a suspended account.
Yeah dw
so it means i have to wait for topgg to fix it?
Yeah
can any1 give me the docs to topgg new vote required cmd system?
New vote required command system?
I've not heard of a new system?
the code keeps saying me its deprecated
in a library? or an api endpoint?
@wild lantern invite
@subtle pulsar ^
all channels 
what do I have to put in here? await topgg_webhook.run(HERE)
port
trying to get a webhook running with my express server but it doesn't seem to be working. I tried using the public ip for my vps to no avail, I've also tried using my websites domain with nothing working yet everything else on the site works fine. I can't seem to get my bot to receive a post request test submitted by top.gg. I do however have several other post requests that work on my website :/
To confirm, you can access the URL on your browser correct?
and the request is 100% post and not GET
You need to just put your webserver url and endpoint in the webhooks section and ideally it should work 🤔
well any of my other post requests automatically show my 404 error page for not found when trying to navigate manually. However if you're using let's say the dashboard to update your settings the post request works it just redirects after the settings have updated.
Try to verify that your endpoint works first by sending a POST request to it
okay so I found out what it was
I had something that restricted http traffic and automatically routed it to https
so I have fixed it to allow the webhook to actually post. Thanks!
can someone help me setting up the vote webhook?
ask what you need help with
I switched to a vps and the vote messages stopped working. I changed the webhook url but it does not work
In topgg.webhook.run() what do I have to put in the brackets? And what do i have to put as the webhook url on topgg

I have a similar question? Where do I get started with using webhooks on a VPS?
Your webserver is receiving the POST request aka. webhook from topgg and then it's up to you to do whatever u like with the content you get
Very simple forms of webhook listeners (webservers) can be found in the api docs
The URL u have to enter is your endpoint, literally your server IP (and/or port) or hostname topgg sends the requests to
is there a way to simulate votes so i can test my webhook implementation, i havent seen anything about it on the website or docs?
make a post req to your webserver
The test button on the webhook settings
Yes, there's a "Test" button right next to "Save" on the website sending u a test webhook
What port do I choose? I'm on a shared vps? Can I just choose any?
It generally depends on your setup.
Assuming you're not using something that restricts ports you can use any valid port.
I guess if I choose the port 1555 and my vps ip is 127.0.0.1 (for example) and my path is /dblwebhook then my address is http://127.0.0.1:1555/dblwebhook right?
yep
i'll go and check that now
Hey how do i show user tag and total votes on webhook server
Well u should probably save the votes yourself but I guess u get the id of the user that voted idk for sure
get the id of the user who voted, fetch the user, use the tag
the id is provided in the webhook data sent
const Topgg = require('@top-gg/sdk');
const app = express();
const webhook = new Topgg.Webhook('hddidjdn5');
app.post('/vote', webhook.listener(async (vote) => {
console.log("User with id - " + vote.user + " Voted!");
const ProfileImgUrl = 'https://media.discordapp.net/attachments/1071392326355800126/1107763713173360670/topgg.png?width=250&height=250';
let value = JSON.stringify({
embeds: [
{
//title: "Another Vote!!",
description: `[Vote](https://top.gg/bot/810540985032627248/vote) Added For @carmine wedge :shiba_tada:`, // Replace YourBotID with your bot's ID and YourCustomEmoji with your desired emoji ID or name
color: "7815903", // Hex -> Decimal
author: {
name: `Top.gg`,
icon_url: ProfileImgUrl,
},
},
],
});
try {
const { default: fetch } = await import('node-fetch');
const response = await fetch("https://discord.com/api/webhooks/", {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: value,
});
if (response.ok) {
console.log('Webhook posted successfully');
} else {
console.log('Error occurred while posting webhook. Status:', response.status);
}
} catch (error) {
console.log('Error occurred while posting webhook:', error);
}
}));
app.listen(56887); // Port
console.log("Your app is ready to log votes :D");```
Here is my code
What i have to change here?
Idk if you discord bot is in the same file but if it is you could do let user <bot/client>.users.cache.find(u => u.id == vote.user) and then include it in you message
And what about total votes?
You save them in a json file or something and every time the user id is the same as in the database/json file and add the count
oh my chirst use a paste bin
😂
For testing purposes he could use json
Check the pinned messages
What's wrong with json?
Ive used json for a bot with over 100 guilds😂😂
Just because im to lazy to setup a db xD
Just add stuff to make sure it doesn’t
There
Navigate to /webhooks on your bot link
Of course, the bot must be approved on top.gg
@commands.Cog.listener('on_dbl_vote')
async def on_dbl_vote(self, data):
print(1)
bot = self.bot.get_user(1059793976271577229)
if int(data['bot']) != bot.id: return
user_id = int(data['user'])
user = await self.bot.fetch_user(int(user_id))
vote_url = 'https://top.gg/bot/1059793976271577229/vote'
embed = discord.Embed(color=config.color)
embed.add_field(
name=f"New Vote",
value=f"`{user} [{user.id}]`\nThanks for the vote! Your single vote is very precious for us!",
inline=False
)
embed.set_author(
name=user,
icon_url=user.display_avatar.url,
url=f"https://discord.com/users/{user.id}"
)
embed.timestamp = datetime.datetime.utcnow()
channel = self.bot.get_channel(1108334800730849372)
view = discord.ui.View().add_item(discord.ui.Button(label="Vote", url=vote_url))
await channel.send(embed=embed, view=view)
this event is not getting triggered
@runic creek
I'm not familiar with python so I can't help you with that
ok
someone?
how do i transfer team ownership to another account?
i see dam
..
Where does the webhooks option exist?
Ofc my bot is approved
Thank you very much
If your bot is on topgg you must use this code
npm i @top-gg/sdk
Index.js part >>>
const topgg = require('@top-gg/sdk');
const topggtoken = "Your Top.gg Bot Api Key";
client.topgg = new topgg.Api(`${topggtoken}`);
const { AutoPoster } = require("topgg-autoposter");
AutoPoster(`${topggtoken}`, client).on("posted", () => {
console.log("Posted stats to Top.gg");
});```
**InteractionCreate.js part**
```js
let hasVoted = await client.topgg.hasVoted(interaction.user.id);
const voteme = new EmbedBuilder()
.setTitle('Vote me to use this command')
.setDescription(`You must vote me on [TOP.GG](https://top.gg/bot/1016392200516550736/vote) to use this command`)
.setColor('#03fcdb')
const actionRow = new ActionRowBuilder()
.addComponents([
new ButtonBuilder()
.setLabel('Vote')
.setURL("https://top.gg/bot/1016392200516550736")
.setStyle(ButtonStyle.Link)
.setEmoji('1056991776428282027')
.setDisabled(false)
])
if(slashCommand.voters && !hasVoted){
return interaction.reply({embeds: [voteme] , components: [actionRow]}
);
}```
You need to setup a webserver so top.gg can send a request every time someone has voted
Like this one
Okay but what's the problem?
Can anyone help me with this error please?
Error: Missing Server Count
at Api.postStats (/workspace/FWbot/node_modules/@top-gg/sdk/dist/structs/Api.js:84:19)
at DJSPoster.post (/workspace/FWbot/node_modules/topgg-autoposter/dist/structs/BasePoster.js:64:18)
You can't add member count
The number of members on the server is sent by top.gg bot
As for the number of servers your bot is on, read the pinned messages
There are all the links you need along with code examples
Do you know how to fix this?
Did you read it
Not required becouse my code is working without web server
You require a webserver to receive a webhook request from top.gg
Aka live vote events
Hello, my bot is the economy bot, I want the bot to give money when they vote on top.gg, what is the code for this?
you can read the docs for that: https://docs.top.gg
Thanks you
Channel Create js code?
-api
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
this is the wrong channel
sorry Aurel 😄
@jaunty plank can you help me
Please write a question first and wait for someone to answer you, you don't have to ping the team right away, thank you.
Ok
if someone voted for my bot for the first time API return {"voted":1} after the 12h if someone voted again what should API return?
Read top.gg docs first
Ok
1 if they've voted in the last 12 hours
0 if they haven't
idk why it isn't boolean

Thank you very much
because
also the api has been like that for years, would be worse to just switch one day
there was going to be a new api version but we are still waiting for that
well do remember it used to be a passion project
e
@queen isle basically
What if someone votes without this parameter, let's say from a notification on the website?
Great question, I think he must upvote through the link I provide to him
thanks man really appreciate it
no worries!
well, yeah, that time there's no way to get the required info
topggpy doesnt work?
Hi everyone am new here
how do you set which channel top gg displays when someone votes for your server?
nvm i remember now
Hello, welcome!
Thanks man
i got a question how can i setup a webhook channel wich sends if a user votes for my bot?
or have i to code it by myself?
You have to code it yourself
hello I have do this code to detect webhook from top.gg with fastapi
but topgg made everytime a post request 😦
even If I rep with 200 status
then you're not properly responding to it
I have tested a lot of thing xD
top.gg will retry the request if it either timed out of was not responded to it at all
check your logs if it is correctly responded to
Some status codes also will cause a retry, typically people use 200 or 204.
I'm not 100% sure 201 is on the list
what was it? so we know if this comes up in the future.
My fault, when I send the event to the ipc I have added an asyncio.sleep in my code so ipc_client.request(route="on_vote", source='Alpha', user_id=data.user) take 30 seconds to make a response
and during this time topgg retry
Ah, I see.
Good to know
/stats
Hello, I couldn't find the bdfd API on the site, can someone send it to me or show it to me?
Theres none for that library
This is probably the only option to use top.gg api
But I have no idea how exactly to do it with this script
You'd have to handle it yourself
[ERROR] Failed to fetch server count from top.gg: TypeError: topggAPI.getMe is not a function
Doesn't sound like a official Library
@rain heart hey where do i get the api
docs? token?
token
check the pinned messages
alr
https://cdn.upload.systems/uploads/LNniH6Nt.png
does anyone know if it can be used to check if the user has EVER voted before? or is this to check if you have voted in the last 12 hours
last 12 hours
if you want to check if someone has ever voted, consider using webhooks and tracking that yourself
no, thats good with 12 hours, Thank you!
How can add vote reward?
Setup a webhook and give a reward to the user that voted
Can i setup webhook inside bot event?
Why would you want that?
Just but the code for the webhook above your ready event or something
To send a dm massage to voted user
But you won’t have to
..
Any way to log vot throw bot?
Not webhook?
@onyx locust you have any idea?
Just use the webhook
Then when you receive the webhook get the userid and then find the user and then send the message 🤷♂️
Can i use inside bot index.js file?
Yes
But not working
Then you did something wrong
Oh
Show your code and error message
No error
Otherwise nobody is gonna be able to help you
const express = require('express');
const Topgg = require('@top-gg/sdk');
const app = express();
const webhook = new Topgg.Webhook('count');
app.post('/vote', webhook.listener(async (vote) => {
console.log(vote.user);
}));
app.listen(19261);
@onyx locust
I add this under the index
Where do you host it
Not vps
Where do you host it?
Panel
Yes where
Only with an approved bot
ok
get what
In this I'm doing like premium users can bypass the voting requirement but it is not working can anyone help me?
if (slashCommand.voters && !hasVoted || !premiumuser) {
return interaction.reply({ embeds: [voteme], components: [actionRow] });
}```
The logic isn't correct
Assuming your conditions are correct, then u need to add parentheses around the first conditions and the AND operator
if ((slashCommand.voters && !hasVoted) || !premiumuser) {
premiumuser is for bypass that hasVoted so is used ||
When the var Premiumuser is always available then edit the logic like so (other than i wrote above)
if (slashCommand.voters && !hasVoted && !premiumuser) {
This didn't worked i tried before
Without providing details what the vars return this is only guessing expecting a result based on the vars name
That's why I added #topgg-api message
let premiumuser = client.premium.get(interaction.user.id);
let hasVoted = await client.topgg.hasVoted(interaction.user.id);
if (slashCommand.voters && !hasVoted && !premiumuser) {
return interaction.reply({ embeds: [voteme], components: [actionRow] });
}```
@plucky lance
This. Is the full code
@lament pawn
Yeah this logic is about right
If voters is true AND user has not voted AND is not premium
I just slightly misunderstood what the var does regarding my first message
Once one condition will fail let's say the user has premium then your vote embed isn't shown
Is this correct?
Hey guys would this be a correct way to get when a user has voted ?
const express = require('express');
const app = express();
const port = 3000; // Replace with your desired port
// Handle POST requests to the webhook URL
app.post('/webhook', (req, res) => {
// Check if the request is coming from top.gg
if (req.header('Authorization') === 'YOUR_TOPGG_WEBHOOK_AUTH') {
// Retrieve the payload data
const voteData = req.body;
// Process the vote data
console.log('User voted:', voteData.user);
// You can perform additional actions here, such as granting rewards or sending a thank-you message to the user
res.sendStatus(200); // Respond with a success status code
} else {
res.sendStatus(401); // Respond with an unauthorized status code if the request is not from top.gg
}
});
// Start the server
app.listen(port, () => {
console.log(`Webhook server listening on port ${port}`);
});```
generally recommended you use the webhook inside of the top-gg sdk
but this looks like it’d work
req.header('Authorization')
why not just req.header.authorization
Thnx I’ll give it a try
const express = require('express');
const app = express();
const port = 3000; // Replace with your desired port
// Handle POST requests to the webhook URL
app.post('/webhook', (req, res) => {
// Check if the request is coming from top.gg
if (req.headers.authorization === 'YOUR_TOPGG_WEBHOOK_AUTH') {
// Retrieve the payload data
const { user } = req.body
// Process the vote data
console.log('User voted:', user);
// You can perform additional actions here, such as granting rewards or sending a thank-you message to the user
res.sendStatus(200); // Respond with a success status code
} else {
res.sendStatus(401); // Respond with an unauthorized status code if the request is not from top.gg
}
});
// Start the server
app.listen(port, () => {
console.log(`Webhook server listening on port ${port}`);
});```
or yeah the main lib
probably makes more sense to use the package
req.headers*


don’t have to worry about cases
Thnx guys
It is chatgpt
i do
👀 I hope you dont
i leave comments
at least on my newer projects
mostly because i have the memory of a goldfish and will forget when i've implimented something
Ideally code should just be readable though.
res.sendStatus(200); // Respond with a success status code
will take longer to read and understand than
res.sendStatus(200);
Sure, if you have a function or some weird bit of code comment, but not every line
well in CS class for GCSEs we were forced to add comments too
we were told to add comments under everything
same as the first few months of the college class for CS before I dropped out
thats what is taught? wtf 👀
we were not given marks until comments added
yeah
we were told it was industry standard 😭
this was both Python and C#
Thats actually wild
I love documenting stuff, but that's so overkill to the point its useless.
this was two diff teachers with two diff langs in two diff schools
Hello!
I've been sending tests, and I've been receiving them, now how do I make it so that when someone votes for my bot, it returns a message in a channel?
Fetch the channel you wanna send it in, then just send it
But I put the app.post part in my api, and I wanted to add a value in the db as well
Do I have to use axios or something like that even in my bot's file?
ohh so your webhook webserver isnt directly within your bot itself?
Yes
then I'd suggest just using webhooks
aka discord webhooks
to send the message in a channel
But I also want to save information in mongoDB, when someone votes for it
Theres no reason you cant use mongodb and add a discord webhook to your code
I want to add a value to the user who voted
are you asking for help with doing that?
then connect your server handling the vote requests to your mongodb and just write to your database
And then how do I do it right after voting for him that a message is sent on the channel
After having saved the value in the database of course
add value to database
make webhook request to said discord webhook
It is just wanted an example 
id = interaction.user.id
load_dotenv()
key = str(os.environ.get("TOPTOKEN"))
url = f"https://top.gg/api/bots/1063461122553942077/check?userId={id}"
print(url)
payload = {"Authorization": key}
response = requests.get(url=url,headers=payload)
print(response)
Error 401 ,key is correct
if I open the url in the webrowser it works
the webbrowser one is entirely different from the api requests
also ensure to provide the content type json
in the headers
response = requests.get(url=url,json=payload)
```same result
what do you mean?
Ensure to provide Content-Type: application/json on your headers
sorry I do not understand.Like so? ```py
payload = {"Authorization": key,
"Content-Type": "application/json"}
yes
same result
then the token is actually invalid, press regenerate, refresh the site, then use the token visible
it dosent give me a new one
the first part of your api token is always the same
just press regenerate, then refresh the site and the token there is then the new one
ah sorry
Ah than you.I didn't realized it,regenerated it,thinked it didn#t changed and used the old one
what means 1?I voted in the past 12 hours or,I voted in sum one time?
ah very good thank you
Topggapi 😭
I want to made a command,that checks if the user voted.Is it possible to change the value after executing the command again to zero?
It does so after 12 hours
If you're planning on tracking if someone has voted and tried to use the command, either check that locally or use webhooks
webhooks?
Okay I read the docs
Is there something like a test mode?To send fake votes,only for the api and nor for the bot
not webhooks,the api
nope not possible
okay thank you very much
Hey,
How can i set the Authorization in Webhooks?
I set the Authorization Header right?
yes
One message removed from a suspended account.
Hey folks,
how to test bot vote on development, with query parameters added to the url
TIA
On the top.gg website you should find a button “test” or something next to the webhook
Thanks for your response, but isn't that will send a test request to the url I provide?
if so I'm working on localhost:8000 so it can't send it to that right?
Noted, thank you!

Interesting, thanks for sharing this 💡
Edit bot > Webhooks tab
I didn't do anything, but I was blocked by a probot, so they asked me to contact them via email on the probot site, what is the email?
-wrongserver
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord Support Server" button on the bot's page of the bot you need support for. If there isn't a button that says "Discord Support Server" or nothing else mentioned about a support server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
we cannot help
Hello, I'm coding in Discord.js and have difficulties setting up an event listener for votes using webhooks.
In the dashboard in top.gg I've filled out my webhook URL to http://replace.this.my.public.ip:3000/vote using the IPv4 as IP from this https://whatismyipaddress.com/
In Authorization I've put in a random string or numbers and letters.
This is my code
const express = require('express');
const Topgg = require('@top-gg/sdk');
const app = express();
const webhook = new Topgg.Webhook(process.env.TopGG_Auth);
app.post('/vote', webhook.listener(async (vote) => {
console.log(vote.user);
}));
app.listen(3000, () => {
console.log('Webhook server is running.');
});
When I click "Send test" my bot doesn't do anything. What did I do wrong? I don't get any errors either.
Also it does log "Webhook server is running"
Ok I simplified it because that first code was ass 
I think it might have to do with my IP, but not sure
Do you run your code on PC at home or on a server with a static IP address?
Either way you have to allow incoming connections for this port (TCP)
A muss on your PC but optional on a server depending on your default INBOUND policy
The requirements of hosting at home is a public accessible IPv4 and port forwarding in your router
pc at home
Ah so I also need port forwarding on top of the public IPv4?
Yes else your router will drop the incoming connection on this port as it doesn't know where it belongs to
Oh makes sense now why I didn't recieve anything when I hit send test

That's literally the worst advice you can give anyone
Opening a tunnel to a shady provider giving them access to your network
In the past they were at least an open source project but not anymore
Also there's nothing known about the company, employees etc.
You're literally allowing a stranger network to bypass NAT mapping and firewall restrictions
Is it safe to just port forward in my router settings like so?
Or should I use something else like some kind of service?
I plan to also run the bot on my raspberri pi later
Well for now I added it and it seems to work, thanks for the help FaKE!
Also, do I also need to add something in my code to send back responses to top.gg after getting the webhook or is it good to go like this? Because on my end it does work now as intended.
Just a 200/204 status code response.
Our webhooks retry if no response is sent
It only logs the test once, does that mean it automatically sends a response when the code finishes?
When the code crashes within the listener it keeps trying to resending it and the same happens when the bot is offline. while when online with no crashes it only logs once.
const express = require('express');
const Topgg = require('@top-gg/sdk');
const app = express();
const webhook = new Topgg.Webhook(process.env.TopGG_Auth);
app.post('/vote', webhook.listener(async (vote) => {
console.log(vote);
}));
app.listen(3000, () => {
console.log('Webhook server is running.');
});
Mb if it's a dumb question, I'm still kinda new to this stuff 
I dont belive test votes use the retrial system, since they are not "critical"
Only real votes
No it's okay (and safe)
Your local system firewall needs to accept connections on that port too, but since it works already as u said, it's all done correctly
you can port forward it like that but make sure not to share your ip 
No he's successfully using his public IP together with his port forwarding
That's a controlled way of access not like exposing your device and network to some shady tunnel provider that been abused in past and today
It's technically even easier to use a 6to4 broker if you don't have a native IPv4 anymore than using such a service
I would also never recommend anyone routing his traffic through cloudflare
Not through any US company at all, especially not through services you can expect to fail
Exactly
But respecting GDPR is far more complicated than that
This is api not development 
If parts of the name still contains your search pattern then yes it's correct
having a problem with the topgg auto poster on nodejs
We are presently encountering a service disruption.
For additional details, kindly refer to the #site-status channel.
To receive notifications regarding future incidents or updates, you may assign the "Site Status" role to yourself by going here: id:customize.
ah ok thanks
there ain't no time without issues 
not sure if this is API related, but how do i add my bot's server count to top.gg?
for comparison, here's one that has server count
and here's mine that doesn't have server count
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
Im not sure if this is an issue with my end or topgg, but I got an error saying "No server is available to hand this request", is there any way of knowing what caused it?
The API might have some issues at the moment
Not sure if it's still up to date but probably
Alright, thank you
Hello, I need help with the api that checks if the user has voted, I'm doing a vote reward for my bot, but the api should be working, but in my case it always says: {"error":"Unauthorized"} , what could it be? a friend of mine said that it could be the bot not approved, but the bot was approved, could you help me with that?
I don’t think it was approved since you don’t have the bot dev role
The logs say it was approved
Idk
When getting your token, press regenerate, refresh the page, then copy the one there
You would not be able to obtain a API key in the first place if your bot isn't approved
late response but you could use dblstatistics API (https://dblstatistics.com/)
Yeah I’ve done that like 2 months ago already lol

But I regenerated the token and it keeps giving this error
Thank you, now it's working normally!
Not working for me
What not working for you
Hello, I am wondering is this the correct way to post my bots server count to Top.gg? First I created a function called update_topgg() here: async def update_topgg():
url = f"https://top.gg/api/bots/{bot.user.id}/stats"
headers = {
"Authorization": config['topgg']['token'] # Use token from config
}
payload = {
"server_count" : len(bot.guilds)
}
async with aiohttp.ClientSession() as session:
await session.post(url, data=payload, headers=headers) Then I create a call to that function when the bot starts here: @bot.event
async def on_ready():
try:
await bot.tree.sync()
logging.info('Bot is ready')
await update_topgg() # Update server count on top.gg
except Exception as e:
logging.error(f'Error occurred during on_ready event: {e}\n{traceback.format_exc()}') As a side note I don't know how to wrap code in this server so sorry for the incorrect formatting
Thank you
Once I call this how long should I expect it to take for top.gg to update the server count? Also how do you guys handle people coding the message to lie and say the bot is in a hugh number of servers when it is not?
They remove the bot if the number of servers on the site does not match the actual state of affairs
#mod-logs message like that
we do not remove the bot directly, we will reach out first
but yes we do not allow posting the wrong servercount
if it does happen accidentally or just varies between the actual servercount, thats entirely fine
unless its something like servercount being 50 on the bot, but posted was 50000
How do you guys cross check the number of servers the bot is in?
discord provides server counts on the invite link
yeah, i see that thank you 🙂
-servercount
im having a problem with my server count i dont know how to fix it can anyone help me?
there's no issue with it, you have to actively post your server count to the topgg api
how?
Read the docs: https://docs.top.gg
you simple send a post request to topgg including your stats (https://docs.top.gg/api/bot/#post-stats) or using a library that does this automatically
u gotta post them frequently of course
ty
ty
it's on the website, edit your bot -> left menu -> webhook(s)
hi, how can i display on how many servers my bot is? like this: https://cdn.discordapp.com/attachments/714045415707770900/1115302555329761280/ice_screenshot_20230605-173400.png
https://docs.top.gg by using the api
?
It’s the top of the g
Esque me aparecía error en la pagina
What error
resolve Promise { { error: 'Unauthorized' } } undefined
TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)
anyone knows why im getting this?
dont remember providing any tokens
wait lemme recheck
If that's the correct path to your endpoint then yes, adding your public IP(v4) will work
Make sure to allow incoming connections on your system for port 8080
Is this a (static) server IP or your home IP?
Ok, so when trying to contact your own public IP form home 2 things need to be done/work
1st you need to forward the incoming port (8080) to the right network device (your PC) or the router will drop the packages as it doesn't know the recipient, since any of your network devices has the same public IP
2nd the router needs to support hairpinning aka NAT loopback in order to resolve your own public IP which many cheaper routers do not support
To "bypass" the 2nd issue you can try accessing this from your mobile phone for example not being connected to your home WiFi
However the 1st thing is necessary needed
Port forwarding can be done accessing your router's control panel/website
You simply configure to forward incoming data on TCP port 8080 being sent to your network device (PC)
Then this is technically impossible
Any carrier around the world uses it's mobile network just as gateway to get access their own network
Port forwarding is not possible here
how to enable ad blocker
const par = {
method: "POST",
headers: {
Authorization: "token_top_gg",
},
body: JSON.stringify({
server_count: client.guilds.cache.size,
}),
};
await fetch("https://top.gg/api/bots/id_bot/stats", par)
.then((r) => r.json())
.then(console.log);```
```json
{ "error": "Required parameter server_count or shards missing" }```
Looks like you're missing the content-type header
How can I make my bot send a message on my server when someone vote for the bot ?
@jaunty plank
You'll want to use webhooks
https://docs.top.gg/resources/webhooks/
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("My Top.gg bot webhook")
app.post("MyHostIP/dblwebhook", webhook.listener(vote => {
console.log(vote.user)
}))
app.listen()
I tried this but it didn't log anything
app.post just needs to be the path of the url, you do not need to include the ip
my webhook url ?
Just the path you want to use.
/dblwebhook
/webhook
/anything
As long as its the same path you use in your url
wdym by my url ?
I don't understand what url I should use
The url will be to your host.
ie; http://SERVERIP:PORT/PATH
The webhook url goes in the red area
Your authorization goes here & in the blue area
const webhook = new Topgg.Webhook("your webhook auth")
The auth can be anything as long as its the same between both.
should I put this in the website and in my code ?
That url is just for you to find the page in the screenshot
Webhooks work by sending an http(s) request to your code.
The URL needs to be a URL to the http server created in your code here.
How do I know the ip and port, since I'm hosting a bot and not the site?
The IP is the public IP of your hosting method.
For example using a VPS they will provide you a public IP.
Some hosting methods will not provide an IP; in those cases it will depend.
Replit provides a URL you'll want to use
The port again kind of depends on your host. Most VPS hosts you can use any port you want.
If you're unsure about your specific hosting method I might be able to look into it for you.
even after giving token this is the error .. can anyone help?
yup, needs a token
press regenerate, then refresh the page, then copy the token from there
pls can someone tell me which webhook its asking for like discord server webhook ?
its not a discord webhook, its a webhook hosted by yourself through a webserver
you mean VPS ?
a webserver hosted on a vps for example yes
kk so what should be in the ULR cause its nothing there in the VPS called webhook
server address ?
still having the same error
same problem even the test on the top.gg website says unauhorized when it goes through for me
is it possible to fetch reviews with the api?
no
self.bot_webhook = topgg.WebhookManager(self).dbl_webhook("/dblwebook", str(read_json("databases","secrets")["topgg"]))
async def setup_hook(self):
print(await self.bot_webhook.run(30854)) ```
```py
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(f"Received a test vote:\n{data}")
could you pease tell me if this is the correct way to implement webhook
ive tried this its printing None (and obviously not triggering the test vote event)
What is the easiest Methode to Trigger a Event one time per User Vote?
Webhook
i do every 10 min
Every hour is fine too, many bots also do daily.
It's not really something that needs to be updated extremely often.
I usually update it once a day
Where can I suggest things? I am wondering why this endpoint wouldn't include something like last_voted timestamp:
can be done by having your own webhook track that
Let us know how we can improve. Vote on existing ideas or suggest new ones. If you require support or would like to report a bug, please go to our Support Page · Make a suggestion · Top.gg
I am aware of that
ا
is there a way for when a user vote or someone write a review it send in a channel with the webhook ?
because when i click on test nothing happen
Because it's not that kind of webhook if you mean top.gg votes
You have to host such a webhook yourself on your vps to receive votes
Read the pinned messages, if you only need the messages without adding anything to the database then you can use the page that is given in the pinned


