#topgg-api
1 messages Β· Page 181 of 1
Ah ok
Does this mean that I have to wait until an hour passes before sending requests again or I have to wait until the current hour passes?
Until an hour passes.
Does anyone have a tut video on this api? just got my bot verified and so I'm looking to learn what to do with the webhooks & stuff
I'm not sure of any, but its a pretty standard api. the webhooks are standard too.
@scarlet cobalt has there been a fix to the java DBL library on the main branch or is it still the link you have in the pin?
One message removed from a suspended account.
One message removed from a suspended account.
oof
Can someone help me with my webhooks? I don't know what I'm doing but I'm trying to reward users once they vote
what part do you need help with?
Which will never happen because lib devs are equal to open source contributors
So I have the url to get the data but I don't know how to actually collect the data
The data is sent to the webserver at the url you provide.
What do I do with that?
I cant really be specific without knowing the programming language you intend to use.
Other than https://docs.top.gg/resources/webhooks/
I use node.js
On replit
If that helps
So that should help is what you are saying?
thats the library and example code for nodejs webhooks yes.
What goes in
Ok. Thanks
webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user)
})
``` it does not log when i vote
need more context
Is this also the right place to ask something about topgg-autoposter?
Yes
So my code looks like this currently:```js
let topggPoster = AutoPoster(process.env.TOPGG_TOKEN, client);
console.log(process.env.TOPGG_TOKEN);
topggPoster.on('posted', stats => {
console.log(Posted stats to Top.gg! | ${stats.serverCount} Servers.);
});
topggPoster.on('error', topggError => {
console.log(topgg-autoposter: Something went wrong:\n${topggError});
});
but i always get this error: ```Error: 401 Unauthorized (You need a token for this endpoint)```
With my env is everything ok, becasue when i log the token its defined
Make sure your env is the correct variable
Try providing your token directly in the constructor
Let me try that!
That worked and the env also works now. The problem was an outdated token 
Thank you & happy easter!
is there a specific IP that top.gg always sends the POST from?
im creating a firewall so i need to know which IP to whitelist
Yeah
what IP is that?
thanks
π
I copied everything from https://docs.top.gg/libraries/javascript/ < posting bot stats
is client defined in the location you copied to?
the autoposter needs access to client to know the stats
?
scream AMOGUS 69 times at 3 AM
and then head over to #announcements
def start_topgg_task(client):
# This example uses topggpy's webhook system.
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook(
client.vote_url, "password"
)
# The port must be a number between 1024 and 49151.
client.topgg_webhook.run(5000) # this method can be awaited as well
update_stats.start()
class TopGgUpdator(commands.Cog):
def __init__(self, client):
self.client = client
@tasks.loop(minutes=30)
async def update_stats():
if not client.is_ready():
await client.wait_until_ready()
try:
await client.topggpy.post_guild_count(guild_count=len(client.guilds), shard_count=client.shard_count)
print(f"Posted server count ({len(client.guilds)})")
except Exception as e:
print(f"Failed to post server count\n{e.__class__.__name__}: {e}")
How can I listen to the Γ²n_dbl_vote event inside of a cog?
Currently I use
@client.event
async def on_dbl_vote(data):
channel = client.get_channel(client.voting_channel)
embed = embed_helper.vote_embed(client, "Thanks for the vote!")
await channel.send(embed=embed)
But this is not inside of a cog, unsure how to get it working inside of one?
is there a way for me to verify if the user voted my server on top.gg, currently i only use roles update to know if they voted or not
like a GET request, i send a get request to top.gg and verify if the given UUID voted or not
i cant find any docs about it, so idk, if you have the answer lmk, if not then i'll stick to role update
Generally speaking the best method is storing it in your own database.
But we also offer a check in the api.
https://docs.top.gg/api/bot/#individual-user-vote
Just be aware of the ratelimit, checking using the api often is not a good idea.
π
my vote event aint treggiring my code: ```js
const express = require('express')
const app = express()
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(Thanks <@!${vote.user}> for voting,You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions)
user.send({ embeds: [embedE]})
db.add(money_${vote.user}, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(60)```
idc i revealed my auth thing
@jaunty plank does it matter
you're using https on your webhook url, entering port 60 on your code
that does not work
ch, method, properties, body
wdym?
This is a list of TCP and UDP port numbers used by protocols for operation of network applications.
The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) only need one port for duplex, bidirectional traffic. They usually use port numbers that match the services of the corresponding TCP or UDP implementation, if they exist....
You cannot use port 60 and try to access something on port 443
append a port to the url
what port is the topgg
Its something you define yourself, it has to be within the normal port range between 1 and 25565, presumably 1024-25565 for non privileged ports
Uniform Resource Identifier (URI): Generic Syntax (RFC )
but on the topgg docs the port is 60
its an example port
but it was working
working != you should use it
if you wish to use port 60, you need to also set it on your url
domain:port/path
ok wait
leme try
if i open https://tryhard.tk:60 it keep loading
but https://tryhard.tk works
@rain heart see
ok
Can't help then, I'd suggest learning the basics of Webservers first
How are you hosting the webhook
app.listen(60)
No I mean like webhosting, vps, pc etc
replit xD
@tidal idol didnt work
@tidal idol
@rain heart i have the 404 error page which when i open http://tryhard.tk:80/dblwebhook it open the 404 error page before it was showing cannot get /dblwebhook
I cannot help
so that could be the error?
oh ok
I am unable to explain it to you
i fixed the erorr
here
where do you even host your site
replit xD
@rain heart can u just read this
and is your bot and your website on the same repl
as I said, I'm unable to explain it to you
yes ofc
ok ty and sorry
@restive otter read
so it aint bc of the 404 error page?
where in topgg package?
no, when you visit that page
sorry for ping
thanks, but im looking for server vote data, it seems like i cant find any in the docs, but its ok, because i made a module on my bot as alternative to read server audit logs and bunch if statement check, to check if the role was given by the @wild lantern and if the reason didnt change from voten on top.gg and vote expire.., i'll should be alright, thanks for the help btw, appreciate that π
server vote data is on the docs
prob you couldnt find it
yea i cant find it
lets see
Did you see yet?
Give em some time
@restive otter
@jaunty plank can u help me?
my vote event aint treggiring my code: ```js
const express = require('express')
const app = express()
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(Thanks <@!${vote.user}> for voting,You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions)
user.send({ embeds: [embedE]})
db.add(money_${vote.user}, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)```
seems something else may be using that page.
wdym?
looks like you have a dashboard, and that's where the request is going to.
no way its legit a def /
like
i puted the url to the /dblwebhook
@jaunty plank i am even using replit so it only allows one port at a time
are you using express for both the dashboard and webhook?
yes
just make them both use the same express instance
i am
if you have ssl you can use https
ssl is what the s in https is for.
try fetch the user
its not cuz of user the code isnt triggering
didnt work
no it didnt
wdym
if you didnt get it, not even an error then it appears to be a code issue, likely related to something done outside the library.
hmm
hwo to use webhooks?
anyway to make my bots server count appear on my bot's page
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
The issue you're experiencing is due to server-side caching. Please wait for up to 1 hour for site cache to clear before trying again. You may also need to clear your browser cache.
what can it be?
ok so I'm trying to make a webhook which sends Thankyou {user} for voting in a channel. I'm referring to the image below, but I'm not sure if I need to replace /dblwebhook with my webhook which I've saved in my bot's page
i didnt understand 
can I use webhook.listener() in a testing bot without express?
ohh
alright thanks :D
ok the bot doesn't send anything thru webhook π
code
The <Webhook>.listener() method doesn't listen to the webhook, it returns a middleware for Express to use
yeah i was referring to this
but
That won't work, it needs Express
so I do need an express server which has the listener inside it
alright
and what about the /dblwebhook
should i replace it with my discord webhook which I saved in my top.gg bot's webhook page?
That's the webhook endpoint you set as your bot's Top.gg webhook, for example http://<your IP address>:<your port>/dblwebhook
Yes, as shown in the example
alright thanks!
You're welcome
my vote event aint treggiring my code: ```js
const express = require('express')
const app = express()
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(Thanks <@!${vote.user}> for voting,You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions)
user.send({ embeds: [embedE]})
db.add(money_${vote.user}, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)```
@restive otter
dashboard working fine aswell
That probably doesn't work because the webhook URL is invalid, the first part which you specified as tryhard.tk is supposed to be your static IP address to receive the payload, or it can be an URL redirecting the request to handle it somewhere else other than your bot
The Send Test button can help you figure out the issue, as it sends a test payload to see if it works or not, if you haven't tried it
i am using replit
i have it does not work
@restive otter before it was wroking it then stop idk who and when
Since you're using replit, the tryhard.tk domain is unknown to it, you're making it send a request to tryhard.tk which is not where you're handling that request, it must send the request to where you're hosting the bot to handle it, since you seem to be handling it in your bot
Documentation for @top-gg/sdk
leme see
so do i use like https://TRYHARD.zeinfarran7.repl.co ?
Try it
Then yeah you need to provide the IP address for the replit server you're hosting on, as said in the documentation
hmmm ok ty
before i was using https://TRYHARD.zeinfarran7.repl.co/dblwebhook it was working now no
hello
const { AutoPoster } = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your discord.js or eris client
// optional
poster.on('posted', (stats) => { // ran when succesfully posted
console.log(`Posted stats to Top.gg | ${stats.serverCount} servers`)
})```
Donβt use the default web port, but instead for example 5000
Is this to modify this?
To modify the number of Shards
The default port is already in use by the webserver of your service provider (replit)
The autoposter automatically posts your shard count if you provided the client instance correctly
What does it mean to put this code in my project?
i was using port 60 before but it wasnt working
ok wait
Make sure to firewall accepts connections on this port
Did you allow inbound connection on that port?
how to?
(the port you specified)
5000
Depends on where you are hosting the app
replit lol
idk how to adjust the firewall over there
just take a look into your dashboard or faq etc
do you have a webserver log on replit?
yes
If so check if a request is coming from topgg when hitting the TEST button
on topgg?
Just use the repl.co link you get. Replit redirects all requests to port 443 anyway iirc
Or, rather, anywhere where it just doesn't matter which port you're using
hmmm
Make sure the request even reaches your endpoint
Hit the test button on topgg and check your replit logs to see if a request was made
i check there was not
Then hit the save button before hitting the test button
same thing
Did you enter the right hostname/IP on topgg?
What's the URL you put?
yes
i even tried https://tryhard.tk/dblwebhook
Are you running two servers on your repl by any chance
Try without ssl even if it will be redirected anyway
http://tryhard.zeinfarran7.repl.co/dblwebhook
Nah that won't work I reckon
Try sending a fake request to that URL with Postman or reqbin
curl -v -X POST http://tryhard.zeinfarran7.repl.co/dblwebhook -d "test1=val"
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 35.186.245.55...
* TCP_NODELAY set
* Connected to tryhard.zeinfarran7.repl.co (35.186.245.55) port 80 (#0)
> POST /dblwebhook HTTP/1.1
> Host: tryhard.zeinfarran7.repl.co
> User-Agent: curl/7.55.1
> Accept: */*
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 9 out of 9 bytes
< HTTP/1.1 308 Permanent Redirect
< Location: https://tryhard.zeinfarran7.repl.co/dblwebhook
< Replit-Cluster: global
< Date: Mon, 18 Apr 2022 18:00:06 GMT
< Content-Length: 0
< Via: 1.1 google
<
* Connection #0 to host tryhard.zeinfarran7.repl.co left intact
π€ what are the odds the code is just erroring?
https://i.imgur.com/zN7vO3n.png
if I add the authorization it doesnt error
since user may not be cached
const user = client.users.cache.get(vote.user)
* connect to 35.186.245.55 port 5000 failed: Timed out
* Failed to connect to tryhard.zeinfarran7.repl.co port 5000: Timed out
* Closing connection 0
curl: (7) Failed to connect to tryhard.zeinfarran7.repl.co port 5000: Timed out
The port ain't correct anyways
I mean, { error: "Unauthorized" }) is the standard error for the library if you don't provide the header
https://github.com/top-gg/node-sdk/blob/master/src/structs/Webhook.ts#L68
which is what I'm getting when sending the request without the header.
An official module for interacting with the Top.gg API - node-sdk/Webhook.ts at master Β· top-gg/node-sdk
I think the codes just erroring
Probably caused by the rest of the code
Just try the webhook listener in a standalone file without all your other code
probably this actually.
if (!user){
return
}
just to clarify, this seems to be the correct webhook url.
the auth is set on line 1356
The issue likely is that you are assuming the user is in cache(not guaranteed), if they are not in cache you are just returning, which means you have no way of validating if you are receiving the webhook.
adding a log
console.log("Received a vote!", vote) to the first line of the vote event & configuring the webhook to the correct url(replied to) and auth.
then save, refresh page and hitting "test webhook" should log "Received a vote!" and the vote data in the replit console.
This problem was encountered when I used the special package for your site.
is there a solution?
use a different port, 3000 is already used
why people never read the error
ye
what do i put
anything that is not used yet
Do you have options to put?
anything between 1025 and 25565
a very large range of numbers
Ok
They all don't work
am sure you didnt check all of them, what error are you getting
can shards cause it?
because i've the same issue
If you're providing webhooks for every single shard, then you should recode your whole webhook setup
you wont need it on each shard
ok tysm u and @plucky lance
@jaunty plank found error but need help
and @plucky lance if u guys can
vote object is empty
Is there a way for me to check, whether my bot is temporarily banned from the api?
Because I receive 401 responses: "Unauthorized" for every request.
I also tried to regenerate the token, but it didn't help either.
Webhooks still work btw
Refresh the page after regenerating the token
Then copy that token, the first part will look the same so don't just go "it won't work" visually
I already did that. I regenerated the token, refreshed the page and copied the new token into my program but it didn't change anything.
@rain heart
Wait for someone who can help
ok ty
Then you're not properly passing the token into the constructor
I am and it has worked for months but suddenly I only received 401 responses. :/
I just regenerated the token once again - the bot will be trying to update his guild count in 10 minutes - hopefully it is just going to work now even though I didn't change anything :D
I usually use an env, yes, but last time I just pasted the String directly into the constructor
Unfortunately nothing changed with the new token...
I'll just try to post my stats directly and not via the library; idk what else to do
Try pasting the new token into the constructor directly
Yeah that's what I have tried
Okay, I'll do that, thanks for your effort!
oof well, I just replaced the whole DBL-Java-Library with "own" posts to the api and it finally works
I don't know what I did wrong with the library, because I have used it for weeks and everything has worked fine...
The main thing is that works now π
You may wanna fix all the errors before going on.
Not sure if there are some related to the webserver or not but they may have an impact.
And please show the code again associated with the webhook listener
wdym ''show the code again associated with the webhook listener"
@rain heart may i ask what is the latest version of topgg package
wait sorry he wont help nvm
Just show what you changed at your code.
Do you use the latest topgg package?
what is it
legit just added js console.log('Recived a vote!', vote) at the first line in my vote event
The one you can find in the docs
The mentioned JS library
Just show the code
The webhook listener
poor fake 
Calm no need to ping me in any message

Well
Canβt open that on mobile anyways
welp
brb
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
console.log('Recived a vote!', vote)
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(`Thanks <@!${vote.user}> for voting`,`You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions`)
user.send({ embeds: [embedE]})
db.add(`money_${vote.user}`, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))```
1st thing is user from cache or return
Users are most likely not cached
So fetch them instead
The password you entered here and on topgg are identical?
yes
Did you try a real vote or the test button?
test button
Hmm try an actual vote
hmmm wait
Who knows if that thing is working anyways
brb
And just take a look into the webserver logs
it doesnt log when i vote
nothing there
whats the npm url for the package
anyone?
give full code
AutoPoster(process.env.topgg_token, client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
module.exports = client;
webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user)
})
this is my webhook
webhook url wrong
ok wht shld i enter
check the npmjs docs
of?
package
top.gg sdk or auto poster?
yes
and :3000 with ur port
I assume it has to do with the rest of your code then
Try to start the webhook listener separately in a file without any other code related to it
Then start it, then try the test vote button after hitting save
I donβt have access to chat channel - what does it say there?
Oh whoops, 3 am me didn't realize that's a message in a staff channel
One of the upcoming maintainers of the java package noticed that the package still used discordbots.org, which caused issues after a recent change on the domain
One message removed from a suspended account.
Or who noticed it?
One message removed from a suspended account.
One message removed from a suspended account.
ohh thank you a lot!
One message removed from a suspended account.
then I'll maybe switch back to the library
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
alright xD
One message removed from a suspended account.
perfect 
Can I somehow remove the server count for my bot or is that not possible?
I believe you can post null or β0β as the count
"remove it" by editing it with css
One message removed from a suspended account.
where can i get my api key?
Under the webhook section of your approved bot
So you need to have an approved bot on the site
Hey
hmm ok wait
layter im lazy atm
Hello, I have just made a test of the api top gg and in the answer there is certifiedBot: false, whereas my bot checks discord, is it normal?
=> https://top.gg/api/bots/822106553183502358 with axios
certifiedBot boolean The certified status of the bot
That is a depricated feature. In the good old days you could have a Top.gg certified bot and get features like a vanity URL
This no longer exsist
ah right, this is not the verification of discord
thank you for your help 
Np
Can I make (python) vote detection using a topgg token instead of a webhook?
i think not as token is only for auto post
@dim kettle right?
the token is only for authenticating requests like posting bot data
so isn't relevant in this case
Think of it as a API call to your servers
So Top.gg sends you a POST request (pretty much the oposit of what you do when sending a POST request to Discords/Top.gg API)
Basically you need a API endpoint for Top.gg to call
No idea of a good Python based web/api server/middleware. So you may want to research what others use
If you want a really hacky solution, you could in theory use https://docs.top.gg/api/bot/#individual-user-vote
Then whenever someone votes, they would run a /claimvote command. You then call the https://top.gg/api/bots/:bot_id/check with the userId param to see if they have voted
https://webhook-topgg.com is great too @shut mauve
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
hi i can get the link i want to setup the vote ping message for discord bot and server were i put the webhook
-ticket
I'm sorry, what are you looking for?
Making your webhook url to your bots server?
Hi, I'm using the dotnet sdk (https://github.com/top-gg/dotnet-sdk) to update the server count, and I call UpdateStatsAsync() (I coded that like 2 years ago, and never touched it), but all of a sudden it stopped working. I tried refreshing the token on top.gg. Everything works in the code, but the count is not updated. Any ideas?
how would i make a vote-role reward?
anyone?
is it possible you havent updated the library in a few years?
if you havent updated since 2019 it wont work anymore, as discordbots.org no longer functions with the api.
https://github.com/top-gg/dotnet-sdk/commit/cbe7b642aceae83fd50acfa6538f1d2ee1de6fc4
I'm using the latest version
this is my code, nothing has changed since it was working:
well i think i might need some help from the one who actually made the python lib
the person who made the py lib doesnt really come here
what does the DiscordBotListAPI.baseEndpoint or something like that return you
if it is not top.gg/api, then you're still on an older version
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.
or actually providing an invalid token/passing it wrong
I'll check it out tomorrow and reply to you here. I'm on mobile rn
I don't think I'm using an older version because the code doesn't even fail. I've debugged it.
theres not at the moment
then im not sure what you're referring to with count not updating
hi
-api
This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.
If you need help with development about your bot or development in general, feel free to use #development.
I'm gonna debug it again tomorrow and come back here if I can't find the issue, if that's ok
I want to post servers
on the top.gg site
how do I?
<@&817055174613794826>
//topgg
AutoPoster('topgg token', client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
I did this
and not got any errors but I am not able to see stats
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
@sage raft norizon does not use Discord anymore
What do you need help with?
As such, there is no maintainer for topggpy
any sample python codes that the bot sends a message in a channel when a user votes the bot? π
https://github.com/shivaco/DBL-python-async-webserver If you're not using topggpy
An aiohttp webserver made for usage in discord.py bot cogs to keep track of upvoters. - GitHub - shivaco/DBL-python-async-webserver: An aiohttp webserver made for usage in discord.py bot cogs to ke...
Hey, it's me again. Here's what AuthDiscordBotListApi.baseEndpoint has when debugging:
Plus, I'm using version 1.5.0 so I don't think that's the problem. And the self object contains all the correct information about my bot.
What else can I check?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Could you make a short version of the API wrapper yourself using requests? Perhaps requests from your server are being blocked
And do you get ANY errors?
no errors at all
the counter just doesn't update
I'd rather avoid that, but that's my plan B in case I can't make the library work at all
-autoposter
Ohβ¦
I wanna prepare for my bot being on topgg
Anyone can help me with the api?
You need an approved bot on the site in order to use the api
Okay
what should i put in webserver_password?
It's the authentication field, so anything you want it to be
As long as it's a string
is MongoClient() necessary in the code?
or is it just for saving the records

total votes, through the bot endpoint, and specific users is not possible
has to be done through tracking with your own webhook
now it does not work at all
@rain heart i found my problem but idk how to fix can u help by any chance?
Iβve literally no clue what you did and how it looks like at the moment
Keep in mind we donβt have a magical glass ball
Whatβs your current code?
Where do you host it?
What works/isnβt working?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
lmao
do I have to define the AutoPoster of the topgg-autoposter (node.js) after the discord.js client is initialized?
fact
my current code: will get it in a sec
host: replit u know
before u told me to put the code in a separatly file my vote object was empty now when i did put it in a separatly file it does not trigger at all
const { client } = require('./client')
const express = require('express')
const app = express()
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
console.log('Recived a vote!', vote)
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(`Thanks <@!${vote.user}> for voting`,`You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions`)
user.send({ embeds: [embedE]})
db.add(`money_${vote.user}`, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))```
ik i am missing the const db
Do you start the webserver somewhere?
I canβt find that line and the port youβre binding it to
so js const app = require('./index') //where i have my main express session
dunno js, thats at least how express works with initializing
const { client } = require('./client')
const express = require('express')
const app = require('./index')
const db = require('quick.db')
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
console.log('Recived a vote!', vote)
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(`Thanks <@!${vote.user}> for voting`,`You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions`)
user.send({ embeds: [embedE]})
db.add(`money_${vote.user}`, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(5000)``` my edited code
@plucky lance
what is this website i need it
thats postman
ok it is i think
is it?
I use the app.
ah
The site doesn't work as well
I'm out of town until Tuesday
ok
Iβm back
ok
Whatβs going on
my edited code: ```js
const { client } = require('./client')
const express = require('express')
const app = require('./index')
const db = require('quick.db')
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('TryHardd')
app.post("/dblwebhook", webhook.listener(vote => {
console.log('Recived a vote!', vote)
// vote will be your vote object, e.g
const user = client.users.cache.get(vote.user)
if (!user){
return
} else {
const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
.addField(Thanks <@!${vote.user}> for voting,You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions)
user.send({ embeds: [embedE]})
db.add(money_${vote.user}, 5000)
console.log(vote) // 395526710101278721 < user who voted\
} // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(5000)```
idk if its correct
Stop including your index
I said you should test this code as standalone code
No need to import the client, the database etc
wdym? like on a new port alone?
Just test the code as you can find it in the api docs
I mean I told you your code might be the issue and you included the code into this
what is this defined as?
Wut?
"I mean I told you your code might be the issue and you included the code into this"
wdym this?
@plucky lance
btw i added my code in my main file again and it trigger but my vote object is empty
Just just the provided code from the docs to test the functionality
ok wait
You donβt need your client or database etc
Just test this code with a different port
i cannot bc replit only support one port
Well then disable the other webserver meanwhile
ok
Press save before hitting the test button as always
same my vote object is empty and i ran it in a separat file it does not trigger at all
The webserver is running?
I am just trying to post my server stats and getting unauthorized, but the token is the same as on the webhooks page, what's the probe?
try regenerating token
regenerated 2 times in a row and still nothing
have the tokens changed on the site
yep
odd
oh wait
it doesn't show full
hm
the token was different from the actual text area and value of the element
mysterious
but it works now
thanks
Try a doing a post request do your endpoint using curl
And watch if your webserver log shows the request
wdym?
Try doing a manual request to your endpoint
To see if you can reach it
I doubt topgg is the issue here, everyone else is receiving his webhooks
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.
Well fae I'm glad you remembered to update me
Thanks
And hope your irl stuff works out
One message removed from a suspended account.
I'll try it out later
One message removed from a suspended account.
thanks for getting it fixed!
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I wasn't I just switched to manual API requests lol
One message removed from a suspended account.
I'll give it a try rq if you'd like
One message removed from a suspended account.
2.1.0 doesn't work
it builds but there's no DiscordBotListAPIImpl class for some reason
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.
One message removed from a suspended account.
it works with 2.0.1 still so I think there's an issue
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
sounds good! hopefully it won't be too difficult to fix
One message removed from a suspended account.
it seems to resolve it
One message removed from a suspended account.
because if I do 2.1.1 it says it can't resolve
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yeah I'm just saying it's definitely up there, it must be something else causing it
One message removed from a suspended account.
could updating the dependencies have caused issues if I'm using an older version of anything?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I'd personally be more apt to blame the tool itself rather than the dependencies, but who knows honestly
One message removed from a suspended account.
I'm not sure what tool is used to publish it but if you have to do any compilation or anything, or if there are any build instructions I could easily see something getting messed up there just because that stuff never just works how it's supposed to
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.
One message removed from a suspended account.
One message removed from a suspended account.
could very well be
One message removed from a suspended account.
Hi if my bot have shard I still use js const { AutoPoster } = require('topgg-autoposter') const poster = AutoPoster('topggtoken', client) // your discord.js or eris client // optional poster.on('posted', (stats) => { // ran when succesfully posted console.log(`Posted stats to Top.gg | ${stats.serverCount} servers`) })?
the newest eclipse is completely broken (unless they updated it in the past month) so I don't even know what my versions are
One message removed from a suspended account.
Anyone please
One message removed from a suspended account.
well I'm not sure how javascript does it specifically but to post your stats when you're sharded you have to provide a list
so instead of just "I have 1,550 servers" it's "I have a list of [750,800]" servers
Hmm...
I'm pretty sure it doesn't, at least, java 17 programs can't run unless you have java 17 installed
One message removed from a suspended account.
my stuff all gets built for really old versions still because java is really horrific with updates
they release new updates but don't at the same time
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I literally just installed this and it's already outdated
lovely
hey maybe that means there's a newer version of eclipse that isn't completely screwed up
I can hope
The latest version of Java isΒ Java 18Β or JDK 18 released on March, 22nd 2022
that explains it
One message removed from a suspended account.
One message removed from a suspended account.
π
Anyone
One message removed from a suspended account.
Can you help now
https://www.npmjs.com/package/topgg-autoposter it seems pretty clear on this website, it handles all the sharding stuff automatically, you don't need to do anything different
Auto-Poster for Top.gg. Latest version: 2.0.1, last published: 5 months ago. Start using topgg-autoposter in your project by running npm i topgg-autoposter. There is 1 other project in the npm registry using topgg-autoposter.
One message removed from a suspended account.
One message removed from a suspended account.
What about this js const sharder = new Discord.ShardingManager(...) const poster = AutoPoster('topggtoken', sharder) sharder.spawn()
I'll stick with my 5 step process to build and copying old projects to make new ones for now because I don't feel like re-installing to discover the new version is even more broken π
One message removed from a suspended account.
well as it says on the website, if you use a traditional discord.js shardingmanager then you need to use that
so in your code if you make one of those objects to start your bot
then yes, you need to use that
I'm not sure how discord.js handles it exactly but it should either be something like:
let b = new Builder("token")
or
let b = new ShardBuilder("token")
Oh it comes now thx
alright nice!
hello, i wanna get some help in here with topgg webhook
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express();
const webhook = new Topgg.Webhook("my token here(from website)")
app.post("/dblwebhook", webhook.listener(vote => {
console.log(vote)
}))
app.listen(6974, "0.0.0.0", null, () => {
console.log("listening on port 6974")
})
this is the current code i have, and a configuration in website with
http://my-ip-adress:6974 (ive also tried
http://my-ip-adress:6974/dblwebhook and https with ssl settings, but none of this worked)
sudo iptables -L INPUT --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- anywhere anywhere tcp dpt:6974```
am pretty sure that i opened port 6974, would there be smth more i should do?
Your default input policy is accept, means you donβt actually need that rule unless you change the policy
Overall it looks accurate
Where do you host that code on?
At home?
in vps, ubuntu 20.04
ah i just noticed that i pushed repo on other vps 
was just viewing codes over and over to find a mistake
im so dumb π
well i still got a problem, sending/receiving test is working well but actual vote doesnt get logged
uhmm... that's weird and sounds like an internal issue of topgg
You may try another vote at another time
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.
May that be the problem?
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.
np π
https://docs.top.gg if you want to code a solution
https://webhook-topgg.com if you want a simple to setup solution
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
Thanks
how does get_bot_votes() work?
does it not work for bots with more than 1000 upvotes a month?
app.post("/vote", dbl.listener(), (req, res) => {
i want that my bot will listen topgg api by req and res method
how can i do
?
Anyone know how i check the user is voted or not in topggpy
is there any update on the java issue of seeing if somebody has voted?
when i try get_bot_info() on a test bot it works, but the command having get_bot_info() does not complete on my main bot
Elaborate not complete
Wdym issue, the Library should still work fine
Several people reported a 401 unauthorized issue in the past few weeks when trying to see if a user has voted, despite them having the correct tokens and having no changes on their end, I also am having the same issue when trying this
Do you have an approved bot?
yes, I'm on my other disc account now
try resetting your token
also i'd recommend not checking if they voted using the API, and instead having a database which logs who voted
On vote, send to webhooks --> get userid and get the current timestamp --> store in database
Then to get if they can vote, get their latest vote from the db, check if 43200 has passed, if it has then they can vote again/needs to vote, if not then they can't vote again/has voted already
There was an issue with the old domain, which was fixed
Make sure you're using the newest version, aka the one currently on the repo
Refer to pins on how to do that
I'm currently using maven to import and it can't resolve either com.github.top-gg:java-sdk:19abf19 (in the pins) or com.github.DiscordBotList:DBL-Java-Library:2.1.1 (the latest release)
import it using jitpack
https://jitpack.io/#top-gg/java-sdk/a3a7508fc8
I don't think it's publishing to Maven looking at the 2.1.1 logs on jitpack (same with 2.1.0), I can import 2.0.0 and 2.0.1 without any issues
The SDK is not on maven is the thing
Older versions probably were, use jitpack instead as the fix was only on the repo itself
Using the 2.1.1 dependency+repository tags provided on the jitpack website in my pom I still get the
Cannot resolve com.github.DiscordBotList:DBL-Java-Library:2.1.1
replace the whole line, DBL-Java-Library is not even a thing anymore
dont forget to reload the maven afterwards
it should be this
I'm using the mvn tags not the gradle way (both should work though right?) and after importing and trying to build I still get
Cannot resolve com.github.top-gg:java-sdk:a3a7508fc8
And you've added the maven repo for jitpack too?
yeh I have
One message removed from a suspended account.
top gg keeps retrying webhook even when i return status code 200, is this happening to someone else too or is it just me?
how fast are you returning the status 200
it might just be retrying because the webhook isn't responding quickly enough
hey, so yea that's what I thought after having a look but I'm getting issues trying to use the maven tags to import it despite using the templates from jitback (both the java-sdk a3a7508fc8 and java-sdk 2.1.1), they both can't be resolved, but it works fine for importing the 2.0.1 and 2.0.0 version
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ah
that might be the reason
thanks 
How can I create a webhook?
When I want to interact with the API to be able to see and confirm that a user voted for my bot, it doesn't let me, does anyone know why?
You don't create a webhook, but receive them from topgg
what?
What do you mean?
yes
how can I do it?
Well then create a webhook listener your own or use the topgg sdk one you can find in the docs
You got these two options
How can I create my own webhook listener?
well depends on the language you're using
what language do you recommend?
lol, the one you're familiar with and want/need to use
ty
Once you received the webhook, you can use your djs client to fetch the user (topgg sends as body with the webhook) and do whatever you want to do
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("link")
app.post("/dblwebhook", webhook.listener(vote => {
console.log(vote.user)
}))
app.listen(80)
So?
Make sure the port 80 is not already taken
Should probably choose a non-reserved one, like 5000 for example
Depending on where you host it make sure incoming connection on that port (TCP) can pass your firewall
(or when hosted at home, the router forwards the port to your local device)
okay, so i am pretty much having the same issue as the guy above - trying to successfully receive webhooks from top.gg. using the sdk but i dont see anything coming through, either from the send test option in the dashboard or from a normal vote. i am using a Vultr VPS and included the IP address found in the Vultr dashboard in the webhook URL (which is blurred). what am i doing wrong? is anyone spotting any issues with my snippet of code or the formatting of the URL?
here's the code in text format:
const Topgg = require("@top-gg/sdk");
const express = require("express");
const app = express();
const webhook = new Topgg.Webhook("my auth");
app.post("/dblwebhook", webhook.listener(vote => {
// console.log(vote.user); // this is the user id
console.log("Webhook received");
console.log(vote);
}));
app.listen(5000);
Make sure to press save before using the test button
And make sure there's no firewall blocking the incoming request
no firewall is setup on the VPS
and i did press save 
but unfortunately still nothing
Some providers also put a firewall in front of their virtual servers
Make sure in your dashboard there's none in place
Once the server is running you can test it yourself, using curl for example
there is none.
curl -v -X POST http://your-endpoint.com/dblwebhook -d "test1=val"
ok then send a manual request to your endpoint
to see if you can reach it
Oh... I'm missing the port in the URL
thats alright, i included it in there. it timed out.
* Trying [my IP]:5000...
* connect to [my IP] port 5000 failed: Timed out
* Failed to connect to [my IP] port 5000 after 21029 ms: Timed out
* Closing connection 0
curl: (28) Failed to connect to [my IP] port 5000 after 21029 ms: Timed out
Just edit the listener to log requests, please
app.post("/dblwebhook", webhook.listener(vote => {
// console.log(vote.user); // this is the user id
console.log("Webhook received");
console.log(vote);
}));
to
app.post("/dblwebhook", (req, res) => {
console.log(req);
}));
and do the request again
to see if something gets logged
okay, thanks. same timeout error and nothing logged.
suppose it has to be some sort of firewall from Vultr itself, i guess, since no connection is made at all.
Yeah there's no other reason then
thanks for your help! hopefully ill figure this out
sure np
are you actually sure the app is running at all?
i am sure, yes
hmm you can try a different port
if you got no webserver running, try port 80
that shouldn't be restricted
const express = require('express')
const app = express()
const port = 80
app.get('/dblwebhook', (req, res) => {
console.log(req, res);
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
and get as method not post
the curl request would then look like curl -v http://your-endpoint.com/dblwebhook
Does anyone have an example of data top.gg sends to your webhook? Because if I understand correctly the data is just;
{
"bot": 1223,
"user": 2334,
"type": "upvote",
"isWeekend": false,
"query": "some_random_args"
}
But just want to confirm with somebody who actually has the data
The body includes the data exactly as described in the docs
so this?
will topggpy update to discord.py 2.0
2.0 have had a lot of breaking changes
Oh well
Pray that it works
If not, good luck getting someone to update it because there's no active maintainer
Yeah I haven't been able to get it to work up to this point whether it's me not being able to figure out the code or it just not supporting it I don't really know
The library?
Aye
It really just needs somebody to update it it's not that hard to do
No one is willing to do it
I would but I don't remember anybody asking
Feel free to create a PR with updates
Whether dev team will do anything or not I can't tell you
π
yea, I don't know much other than importing it in, trying to look to see if I can find the issue with importing the latest changes, thanks for looking and trying any way
Is there another way to post API other than use the library?
You can post the data yourself of course
The body structure and endpoint tho is giving in the docs
Thereβs an example showing the headers you need to include as well as the body of the post request
Yeah I think I'm just not going to post API until the library is updated
Ah I didnβt notice you were referring to py
Iβm sure thereβs a way in py, too to do simple http requests
Hi, It's me again. I made an API wrapper as you suggested. Made a POST to https://top.gg/api/bots/<bot_id>/stats. It returns 200 OK but the count is not changed. Honestly I don't know what else to do. Could you please help me?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Hey @scarlet cobalt , I just refreshed the website after like half an hour and it seems the counter has updated! I don't know what happened but it seems to be working now, so I'll keep monitoring the value in the following days and let you know if something goes wrong. Thanks!
Caching, that's what happened
guys how i can add my bot music to websites topgg ?
First off thats not api related
Secondly you submit it via the website (under add)
https://docs.top.gg using webhooks
Thanks
yes
Port 5000 in your code example and 3000 in the URL above?
π
There is a uncommon issue about api sometimes it trigger votes three times
I have a question about the library, I was in the #commands and typed the botinfo command to view the botinfo for my bot GiveAways. And I saw a Library Line in the embed which is on none specified, how can I specifie it?
You cant , it has been removed
And you dont need it nobody use luca to examine your bot
Oh ok, ty for the information
Read the docs about retrial
Can you send me link ?
-notified
If your bot is approved:
You'll get a DM from @abstract moth and you'll be assigned the <@&265125253443878912> role here.
If your bot is declined:
You'll get a DM from @abstract moth and you'll also get a ping in #mod-logs.
π‘ Please make sure you have your DMs activated for this server.
I was in the 2 equals but they still don't work
i am running the bot right now on my pc and i use my ip for that
well, the thing is your router will not forward requests on that port to your PC
you would need to enable port forwarding and add a firewall to allow inbound rules on that port from topgg
so to start, what should i do with the server count api?
If you wish to post your servercount to our API, read the docs under https://docs.top.gg
yea ik i got the api link
so where to start
First thing to start with is reading the docs as it is documented there on how to post your servercount
When I use the command, the command does not work and gives a voting condition.
should not use the command without voting how do I do
dblapi.js is ancient
use @surreal seal-gg/sdk
ayee nvm top still here 
refer to the pinned messages
Because DBL is not a constructor
so how do i build
Documentation for @top-gg/sdk
okey
Where are you getting that?
# import discord
import topgg
# this can be async too!
@topgg.endpoint("/dblwebhook", topgg.WebhookType.BOT, "youshallnotpass")
def endpoint(
vote_data: topgg.BotVoteData,
# uncomment this if you want to get access to client
# client: discord.Client = topgg.data(discord.Client),
):
# this function will be called whenever someone votes for your bot.
print("Received a vote!", vote_data)
# do anything with client here
# client.dispatch("dbl_vote", vote_data)
what should i put in the "youshallnotpass"?
and why does vs code says Module 'topgg' has no 'endpoint' member, same goes to topgg.WebhookType, topgg.BotVoteData and topgg.data
We do not support that library, please check @topgg/sdk
isnt it for nodejs? 
https://github.com/top-gg/python-sdk oop meant this
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
but i found the example code above there 
thanks lemme check it out 
Quite the opposite
It's documentation for 2.0.0a which never released to PyPi
then how would i know when can u vote to top.gg again


