#topgg-api
1 messages · Page 157 of 1
@rain heart it works now tysm
https://Akaza-1.ace6002.repl.co/Akaza-1.ace6002.repl.co/ :D
pls do 
pls give me the vote api discord.js
Dm me
Guys can somebody help
don't 
I use discord.js and my bot is for economy how can I make it when someone vote my bot it's give him coins? How can I do it 
Like dank memer or other bots
this is not the channel for that, ask that in #development
But iam asking help on topgg Api Bec that's need topgg Api
as I said, that's not related to top.gg api at all, ask that in #development you're most likely to get help there than here, read this channel's description
@pastel raptor uh
I may be blind, but I don't see that user here.
sadge
Pepega
@pastel raptor I need api script or workbook script
I am use node.js
I need node.js api script
Of top.gg
then ask and wait
???
Oh
const express = require('express')
const app = express() // Your express app
const webhook = new Topgg.Webhook('auth') // add your top.gg webhook authorization (not bot token)
app.post('myapp.herokuapp.com/dblwebhook', webhook.listener(vote => {
// vote is your vote object
console.log(vote.user) // 221221226561929217
})) // attach the middleware
app.listen('8000', () => {
console.log('App listening on port 8000');
});
This is ??
read pinned messages
In this script vote.user
paste whose I'd
do you know basic javascript
it seems that you don't
Because I am new create bot
learn basics of language before making bot
Ok but pls tell me what i do
read my message again
do you send 2XX back
can i fetch votes of a user by top.gg-core package??
you can check whether or not a user has voted
but you can't fetch votes of user
you can get last 1000 votes of bot
i want the amount of votes
you have to do yourself
ok
What is the property name for total votes for my bot in the API
Or is that not a understandable question?
points field, /bots/:bot_id endpount
the one for your language
ok
trying to setup webhooks right, port is open (check photo 1)
https://cdn.discordapp.com/attachments/752853649482449016/850071238072205382/unknown.png
but when i go to my ip + webhook (eg: http://[my_ip]:5555 i get this
https://cdn.discordapp.com/attachments/752853649482449016/850071546620936202/unknown.png
here is my code
https://cdn.discordapp.com/attachments/412006692125933568/850073475855024198/unknown.png
https://cdn.discordapp.com/attachments/412006692125933568/850073525880619008/unknown.png
i mean you dont have any get requests sooo
its just a 404
/api/bots
i mean if i do a test vote it doesn't come through
and if i would do a postman test it gives this
Hi how to use api
https://www.freecodecamp.org/news/apis-for-beginners-full-course
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction
https://www.mulesoft.com/resources/api/what-is-an-api
https://snipcart.com/blog/integrating-apis-introduction
https://blog.hubspot.com/website/application-programming-interface-api
https://www.w3schools.com/js/js_api_intro.asp
https://medium.com/the-era-of-apis/how-to-use-an-api-the-complete-guide-d701e32c7c9f
How to get voters ID? Are we supposed to use on_dbl_vote or webhooks?
Any helpful guides on it?
use Webhooks
Any docs or guides you suggest? Examplesm
you'll need to keep listening all the time for a vote and save it in db. then check it from db
You can see the example in their readme.md
heeey
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.listener(vote => {
// vote is your vote object
console.log(vote.user) // 221221226561929217
})) // attach the middleware
app.listen(3000)
in GitHub: https://github.com/top-gg/node-sdk
Docs: https://topggjs.readthedocs.io/en/latest/Webhook.html
do i need a webhook to use on_dbl_vote?
can anyone help me set up a webhook inside my bot?
can i with topgg's api check if someone has voted for the bot or not
do ping me if you reply
i don’t believe topgg holds that data
which is why they provide a webhook to retrieve into your own database and collect that information
incredible
soo how do i implement this?
I did, ive tried it so many times 
that's the thing that is weird, my code looks fine, settings are good everything is saved, but it just doesn't do it 
made sure my cog is loaded etc etc but still...
How to create a api
what api are you talking about?
I don't think there's any "on_dbl_vote"
but yes you'll need to get votes in real time
i cant figure how to get the voter's id
Yada dee let's go through this
How do you think on_dbl_vote is called in the first place
Any app
the only tiny bit problem is im in python
how?
https://www.freecodecamp.org/news/apis-for-beginners-full-course
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction
https://www.mulesoft.com/resources/api/what-is-an-api
https://snipcart.com/blog/integrating-apis-introduction
https://blog.hubspot.com/website/application-programming-interface-api
https://www.w3schools.com/js/js_api_intro.asp
https://medium.com/the-era-of-apis/how-to-use-an-api-the-complete-guide-d701e32c7c9f
also it's an api not a api
yes you can,
I saw ppl doing this with flask
O figured out you don't need flask.
Just do
import topgg
# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.
dbl_token = 'Top.gg token' # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) # this method can be awaited as well
@bot.event
async def on_dbl_vote(data):
"""An event that is called whenever someone votes for the bot on Top.gg."""
if data["type"] == "test":
# this is roughly equivalent to
# return await on_dbl_test(data) in this case
return bot.dispatch('dbl_test', data)
print(f"Received a vote:\n{data}")
@bot.event
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
print(f"Received a test vote:\n{data}")
ohh
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
yes ?
whatever you want
it sends the request there
like if 69.69.69.69 is my ip and the port is 4200 and my path is /dontcuddleher then the request should be sent to
http://69.69.69.69:4200/dontcuddleher
ohhh i got it!
okayy sad but it doesnt work
Hi, I am trying to make my discord bot dm a user when it is voted on top.gg, I'm using python and all I need is how to define what to name the user I am trying to dm them when they have voted. I've got the on_dlb_vote part for the event. Thanks
Hi! Whenever i test the Webhook i get multiple request even if i press the button once. if there some error on your side?
You need to response with a 2xx
Ah Alright. Is that new?
aka. successful
It worked the last couple of weeks
No idea what’s that but glad my webhook works fine
Its the HTTP Status Code. I think top gg retries until it receives an 2xx Statuscode. I had to rewrite the code to send it
Ohh well mine worked after smashing my head onto the wall for 3 hours but still happy
what did the votetracker support team say
Nothing
I have never used votetracker, I really have no idea how it works. its kinda their side, we just send the request to them if you use their urls.
I used the url
Their support team is retarded as fuck and won’t help me
So I came to you guys
then we are sending the requests to them, and we have nothing else to do with it.
their support would have to help you the rest of the way.
we cant help, we dont have any control over their software.
Can you send the support request I don’t think they want to help
It’s a HTTP status code
So are you sending the requesting?
Like you would answer with “Ok, I got it.”
I tried them and they only can send a message of which user voted you
no. its not my place to. Theres nothing i can do to give support for something thats not ours.
I can help you set it up
Ok thanks need a link to my server?
I want you to note that it can only send a message in your channel about some basic info about the voters
Sure
Ok
Hello, I have my bot hosted on Heroku and I have noticed that I need the 2 dynos activated for the webhooks. The problem is that when I activate both the bot executes me 2 times and duplicates the messages. Someone help me?
hi
i used topgg.isVoted fuction of top.gg-core package but it is showing true even after 12hr
pls help me
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.
ok
@waxen widget-gg/sdk right?
One message removed from a suspended account.
kk
One message removed from a suspended account.
ty
One message removed from a suspended account.
One message removed from a suspended account.
ya lol
can any one tell how can i see server count for my bot
it shows N/A
is there any expert to help
How to see ?
Go to your bot page it's showed there
How to post stats ?
const client = Discord.Client() // Your discord.js client
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('Your top.gg token')
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size,
shardId: client.shard.ids[0], // if you're sharding
shardCount: client.options.shardCount
})
}, 1800000) // post every 30 minutes
@smoky martenwhere to post in in event
put the api.postStats() in the event
nothing
and please don't ping top
how to bring server count can anyone help me...
is there anyone who can help
how to solve..
any one
Can you show the code?
I think your code is not properly posting the data
pls help...
I wish i could but i am not familiar with javascript
ok
already tried to put in the index.js?
yeah put it in index
const client = new Discord.Client() and module exports what
I still have't resolved this issue - any help would be appreciated
@lapis pond@graceful lily@restive otterthanks to all who tried to help me the problem is sorted ..
Nps

I only have time to schedule in the evenings, could I send DMs when I can?
Yeah sure
Is there a reason why I get ratelimited for posting stats once per minute while it allows once per second? 
The retry-after header also doesn't change, it's being 3173 every time it gets a 429. That is, I'm seeing the same number every minute once
Oh this time I actually see 2933, 1 minute over but only like 200 ms has changed, isn't it a 1 hour block though, if it's being ratelimited, shouldn't numbers he high and decrease by 60000 every minute, instead of decreasing by 200 every minute 
the overall every endpoint is 60 a minute. specific endpoints have different rate limits.
since the website is heavily cached, posting stats more than once every 30 minutes is kinda useless anyway.
Person voted 4 times within few mins. How is this possible?
looks like you are not returning a 200 status, so the api repeats the request.
How do I run 200 status?
depends on the language and library.
Are they documented?
no, but thats pretty common. not even discord documents ratelimits.
And when it's ratelimited from posting, won't retry-after be 1 hour at least at first?
if you hit 60/minute yes
I don't think it hit that
But it's somehow ratelimited
So every minute sending requests results in 429
👀
With retry-after being just like 2 - 5 seconds
the overall every endpoint is 60 a minute. specific endpoints have different rate limits.
But what about retry-after
retry after is when your ratelimit ends.
which the length of the ratelimit depends on the endpoint.
I mean I don't get why it's always under 5 seconds
which is what this means
#topgg-api message
because the ratelimit length is low for that endpoint.

100/second inb4
there is an overall ratelimit, and an endpoint specific endpoint
no idea tbh
Nah not yet
You can implement a local ratelimiter for this still
you should be posting at once every 30 minutes anyway.
I mean sure, but question is when it allows that much, why is it suddenly getting ratelimited while for the past months it didn't 
the sites not actually updating every 30 minutes with you posting so fast.
caching and whatnot, itll show the old result still for longer than you are posting.
for you, the number jumps around for awhile.
Did anything change in the API today though? I never saw it getting ratelimited but today I am 
how do i use topgg api to get the amount of votes on a bot
and see who voted
@lean gyro
For me I always see the right counts in search pages, none of them jumps back and forth
In bot pages, it's not right count, yes
But in search pages, it's always right ones
At least for me
not sure what else you want me to say.
your spamming the api more than you need to.
I'm just expecting an answer to why today out of all days it did the same thing tbh
well, the ratelimit maybe was fixed? 
Probs try logging when you send requests and what data you send
Maybe you have whatever hell of a loop that accidentally yells at top.gg more than it needs to
Best way to debug shit is to log shit ezpz
lol aight
this has a few answers. if you want an event youll want a webhook. if you want just to see a list, youll need to use
https://docs.top.gg/api/bot/#last-1000-votes or https://docs.top.gg/api/bot/#individual-user-vote
Tried sending requests myself, every request ends in a 429 
And retry after being like 1500
are you still sending requests every minute?
I am, but I also changed token this time so I guess it shouldn't throw 429 for invalid token ones?
Tried from another system, it posted but my server seems to be weirdly ratelimited tho 
maybe being ip ratelimited?
Like idk if it prioritizes 429 over 401, if it were spam sending requests, I should see 401 in my logs in any case if it's really spamming
I mean understandable if it was showing a higher retry-after but it's always being lesser than like 5 seconds and still returning 429s to me
👀 if you try decreasing the rate to our minimum suggested rate of 15 minutes, or the suggested rate of 30 minutes does the ratelimit stop?
or even just decreasing the rate to a few minutes.
Might work, idk, I just didn't code it like I could change it without having to restart the bot, that's why don't wanna restart it yet
are there any discord bots that make giveaways and the requirement is to vote on topgg
After mins of testing stuff, found that retry-after actually returns seconds and not milliseconds
So it was a 1 hour ban this whole time, decrementing from 3600 (seconds in 1 hour) to 0 instead of 3600000 (milliseconds in 1 hour)
is it reccomended to POST server count in on_ready or is there a more appropriate place to do that
I post when the bot is added to a new server, you need to be careful with on_ready in case theres a bug which makes your bot constantly reconnect, though i suppose that goes with any event
true. ive yet to encounter one of those tho
There’s only one unique ready event
Any reconnection will trigger a resume event
Ah, i see what you mean
You can safely post your stats in the ready event or better great an interval
In cases you manually restart your bot a lot of times it doesn’t post the data until the interval reaches it’s value
thats what ill do
Btw. one interval should be enough.
Also sending the count again if a guild was added can end in a rate limit.
All missed events will be passed if your bot comes online again.
Just sending the server count every hour or 30 min should be enough.
make the lonkest rely
Anyone know how to catch the dark Pokémon that appear wild?
Appear in the wild *
Missed a few , keeps saying typing wrong pokemon
-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.
how to get started with using the topgg api?(python)
the real question was this
How to set this up? (webhook URL)
For now free options preferred
It's deprecated by the way, refer to https://topggpy.rtfd.io and its readme https://github.com/top-gg/python-sdk#topgg-python-library instead
@restive otter not on this server
nvm
smh
just read the error smh
what should i doo broo
this is api problem i think api ping high,...
what can i do
please properly read the documentation before jumping into coding, as you're missing alot of important things you need to interact with it
@rain heartcan you tell which doc
Server count posted.
Server count posted for disbot
401 Unauthorized
(node:2134) UnhandledPromiseRejectionWarning: TopGGApiError: 401
at request (/home/runner/JAM-1/node_modules/top.gg-core/util/request.js:46:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Client.post (/home/runner/JAM-1/node_modules/top.gg-core/lib/TopClient.js:51:9)
(node:2134) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2134) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
401 Unauthorized
(node:2134) UnhandledPromiseRejectionWarning: TopGGApiError: 401
at request (/home/runner/JAM-1/node_modules/top.gg-core/util/request.js:46:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Client.post (/home/runner/JAM-1/node_modules/top.gg-core/lib/TopClient.js:51:9)
(node:2134) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)```
i have read the docs but unable to undestand the problem any expert pls help
@rain heartthis is all what it tell
What do you think Unauthorized means
i dont know..
after abouve code the bot start
but wont give the correct server count
@sullen nymphare you saying to mee
Hey guys, I've been looking over the topggpy documentation, and I'm looking at the on_dbl_test event.
How do you trigger this event?
show your code
With latest version you do it yourself by checking data.type
if it's test it's a test request
if it's upvote then it's a vote
No, I'm asking how to TRIGGER the test request
Oh
can you come to repliy
Test button on your bot's Edit page's webhooks section
yes but show your code dude
bro i reolve the error btw thanks for help
👍
one friend suggest that regenerate the token and thats all my code dont have any error
😐
@heady fiber learn basics of language before making bot
i knoww... broo the problem was just api code,...
#dont become gyani baba
thats the reason
yaa...
is there a server api? for getting server votes and things like that
No
unfortunate, is there a plan to?
Not that I've heard of

@jolly hornet what do you say
?
Is there a way I can tell when the last time someone voted for my bot was?
Nope, unless you track votes yourself using webhooks, then storing the time
I found HasVoted in the DotNET API. Does that check if the user has voted ever or in the past 12 hours?
past 12 hours.
Thanks
anyone know how to use the API using discord.net?
I've only just started exploring it
AutoPoster is not a function ```js
const { AutoPoster } = require('topgg-autoposter')
const post = AutoPoster("topgg token", client)
poster.on('posted', (stats) => {
console.log(Posted stats to Top.gg | ${stats.serverCount} servers)
})```
Looks like you tried to do extract import. Just do const AutoPoster = require('topgg-autoposter')
ok
it was in the readme of the package
:/
I just looked at this
@vast minnow if it works let me know and I'll ping Berry to let him know.
ok
Looking at the repo code the above should work.
what happens if you run a test? does the webhook also recive a empty object?
Yes
const { Webhook } = require("@top-gg/sdk");
const wk = new Webhook(config.topAuth);
app.post("/dblwebhook", wk.listener(vote=>{
console.log(vote);
}))```
you also added the correct url to the webpage? http://yourip:port/dblwebhook
did you use a proxy to point the webhook corectly?
-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.
stop the spam
the URL
const webhook = new Topgg.Webhook("webhook's auth")
app.post("/dblwebhook", webhook.listener(vote => {
const wc = new WebhookClient('id', 'password')
const votembed2 = new Discord.MessageEmbed()
.setTitle('Thank you for voting for Global Economy:money_with_wings:')
.setDescription(`User: ${vote.username} just voted!\nand got 10,000 coins!`)
wc.send(
votembed2
)
db.add(`money_${vote.user.id}`, 10000)
}))
app.listen(port)
any idea why isnt it working?
i want that everytime someone votes for the bot it will send a message in a specific channel that i made a webhook for, and its not sending nor doing anything
it is open
Is it open on your computer though?
If you're on an ubuntu server you can use ufw to allow specific ports.
sudo ufw allow 25565 (Minecraft default port)
it looks like:
https://discord.com/api/webhooks/id here/lots of numbers and letters
then what?
Does anyone know if ratelimits in stats posting endpoint changed or not recently?
I was posting stats every minute once which obviously isn't suggested to do but still, it was working fine but still getting ratelimited from like 2 days when it posts once per minute 
just post every 30 minutes, there's no need to post every minute
I do understand, I'm honestly wondering like why since 2 days instead of this whole time
I guess the number of allowed requests are lowered then 
Or is it a bug maybe 
This error only appears a few times, and the api works as normal, but why does the error appear?
502
five o' two server done a boo
5 ecks ecks servers met its ex
Seriously though it's 5xx meaning it's on top.gg side
Hi, I'm trying to use the Python dbl module to keep my guild count up-to-date on top.gg. I'm using the autopost method shown in the API. Specifically, what I'm doing:
bot.dblpy = dbl.DBLClient(bot, dbl_token, autopost=True)
bot.run(bot_token)
However, top.gg never updates, even after half an hour has elapsed, and no error messages are logged
I also tried the @bot.event on_guild_post() asynchronous function, and it never gets called, either
Use topggpy instead
Okay, I've done that. It looks like I should change to on_autopost_success(), as well, which I've also done. How long after launch until that function is supposed to be called?
Whoops, never mind, just posted
Thank you!

How can i make a bot that will track votes of my server?
i cant find one for servers there is only for bots?
but when i do https://top.gg/servers/my-server-id/webhooks it dosent work
then?
nvm i found out
thanks
is there a way to make a downtime notification with the api
What downtime?
guys
do you want to see something cool
who listening kpop
blackpink
see this..
@jolly hornet
@urban pebble
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.
Dies the java api get any updates anymore?
what am i supposed to put here??
i think im gonna be waiting for a while to get a reply
The public IP of the machine your webhook service is running on.
can i use a subdomain there? my hosting doesn't have a static ip and instead gives a subdomain
ok. one last question. does it matter if i have a website hosted on the machine using the same subdomain??
No
ok
But
Make sure to define a path the webhook service will listen to, which is not already in use by your webserver
ok
why is the webhook test not working. i believe i have set eveything up correctly. here is the code
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook('/dblwebhook', "aPassword")
bot.topgg_webhook.run(5000)
@bot.event
async def on_dbl_test(data):
print(data)
There's no such event
this is from the topggpy PyPi page
Because there's also this.
Is having a reward system which increases the more you vote for the bot allowed? i just wanna make sure before i implement such thing.
yeah, as long as you don't share rewards between bots, for example, voting for one bot to get rewards on another
alr, ty <3
hello?
No it doesn't as there's no active maintainers
if you wish to maintain it, feel free to dm veld
though the java one is still working with the current api features
still has
or at least the person who used to maintain it still has a role
no idea if hes actually planning to maintain it though
One message removed from a suspended account.
One message removed from a suspended account.
idk if im allowed to say this here
but i need help
with the api
i put this
but i get this error
you can ping me if you want
Why does this happen? It worked before, but now it just doesn't
read #site-status
Oh, my bad
my bot is not updating and is not joining my sever
It's because the endpoint returns a list, _json_or_text tries to cast the list to a DataDict
Oh my dumb tired ass
Kinda fixed it, I'll make a PR if you haven't worked on it
Yeah my laptop hasn't been doing well for the past week and I can't really fix it
Would appreciate a PR 🙏
quick question: can i try the vote api while my bot is in the approval queue?
ight thanks
yea but i read somewhere that the topgg api doesnt work with discord.net, the lib that im using and it only works for DSharpPlus
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.
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.
One message removed from a suspended account.
Yup
One message removed from a suspended account.
One message removed from a suspended account.
Lemme test that rn
One message removed from a suspended account.
yea i got it done with no errors but how would i know if it is working
One message removed from a suspended account.
alright
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.
of course, thanks for the help
top.gg had a 504 error when my bot tried to post, and the message printed to my logs as strings of HTML. How can I suppress these messages?
here: https://docs.top.gg/libraries/python/ it says to install with pip install dblpy
but on the git repo, it says pip install topggpy
which one should i use?
topggpy is newer i think
do i need to anything else besides
dbl_token = os.getenv('TopGG') # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) # this method can be awaited as well
@bot.event
async def on_dbl_vote(data):
"""An event that is called whenever someone votes for the bot on Top.gg."""
if data["type"] == "test":
# this is roughly equivalent to
# return await on_dbl_test(data) in this case
return bot.dispatch('dbl_test', data)
print(f"Received a vote:\n{data}")
@bot.event
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
print(f"Received a test vote:\n{data}")
because when i did a test vote, nothing printed.
hi, im trying to send a test vote webhook to myself, however i'm not receiving anything. anyone have any idea?
Hi, my easy application bot is offline and will not come back online. Any ideas?
Save the settings on topgg before hitting test
And make sure your webhook service can receive requests
Aka. port opening / forwarding
If your default inbound policy is DROP
Make sure to add the actual public IP of the machine the webhook service is running on
ah, it was the case of hitting save before hitting test
thanks !
👍
List git+https://github.com/top-gg/python-sdk@9782796b869144b24dc58526f89048ecdfdf1b26#egg=topggpy in your requirements.txt instead or pip install it until the PR is merged (which then you can install the master branch instead) or it gets released to pypi.
i dont understand
what is requirements.txt
never used it before
Ah, then just pip install it
also what is pr
PR -> Pull Request
Pip install this git+https://github.com/top-gg/python-sdk@9782796b869144b24dc58526f89048ecdfdf1b26#egg=topggpy which is the PR's commit
Have you installed that specific commit?
yes
i did pip install git+https://github.com/top-gg/python-sdk@9782796b869144b24dc58526f89048ecdfdf1b26#egg=topggpy
the page doesnt exist on github tho
Ofc, it's not the tree URL
This is the actual URL https://github.com/top-gg/python-sdk/tree/9782796b869144b24dc58526f89048ecdfdf1b26
It's indeed on the lib side, that's why I told you to install the patch
What doesn't?
well i still get the same error
even after i installed it
oh wait
now it works
so
originally i had the topggpy and the patch
but i uninstalled topggpy so i only had the patch
it works now
Cool, this is the workaround until it gets pushed to pypi
thanks
lol this isnt working either
i get the post thing
but the function isnt being called
lol
POST should be an allowed method, are you sure you entered the right path?
to what are you making a request to
e.g., /dblwebhook, it's currently requesting to the root path
Mind sending how you set WebhookManager up?
you probably forgot the path
what is webhook manager
The topgg.WebhookManager class
DBLClient doesn't take in such parameters
It's prob your keep_alive thing or whatever it is to keep the repl alive then
what are the parameters
thats what it said on the docs
wait these arguments are completely different in the docs
dblpy which is what you see on docs.top.gg is deprecated, this one is what you should use
If you doesn't need it to autopost, yes
Refer to this for examples https://github.com/top-gg/python-sdk/#examples
(someone should probably update the link on docs.top.gg in that case)
I'm not sure if shiv has made a PR
Doesn't seem to be
I haven't
I've been very busy and my laptop isn't in good condition + I'm on a vacation
Yeah, I kinda mixed it up, turned out it was a PR about examples without cogs xd. Take your time, shiv
I believe it would be appreciated if someone did it soon 🤣
Well, I think I might do it
If you think you have time, I'm not stopping you 👀
What about this btw https://github.com/top-gg/docs/pull/41
https://dblpy.readthedocs.io/en/latest/whats_new.html#v1-0-0
It says
BREAKING CHANGE: Renamed the module folder from dbl to topgg
The replacements aren't really correct though, such as the way it still has some deprecated parameters
Yeah that's a no
So, make a new one?
Kindly review it when you got time 
what's your webhook url now
try it and see
The URL doesn't seem to point to port 5000
I don't get why so many people try to host bots on replit
it seems like a bad idea, doesn't it go down all the time or something?
it just doesn't make sense to me for something that needs to be up all the time
Doesn't apply to replit
Reverse proxy
I saw people saying stuff about pinging it every so often to wake it up or something, is it a great value or something? I just don't understand why it would be worthwhile to setup a ping system and deal with all that when you can get a real server pretty cheap these days
huh
oh yeah I guess
0.2 vCPU
yikes
I guess for a single simple bot it could work
I thought it was more of an IDE than a hosting system
hi
like the hosting was just designed for you to test and you have a production system for real hosting
idk just doesn't make much sense to me...even for free, you can get a basic EC2 system that can run your bot and you won't have to constantly be waking it up
What will be my webhook url if I am running my bot on computer ?
Yeah, I was aware of that. Wasn't really talking about the URL, but the content it had
Does anyone know? I am pretty stuck 😵💫
@misty wind your public ip but you'll need to host a webserver
and setup port forwarding
a webhook is just them sending you a POST req whenever someone votes or whatever
Hey! I don't understand what should I put on "Authorization" on my bot edit form, webhook. And how for me to get the things that I should put in it?
Could you give me an example of a webserver ? 
Would a Hosting server do the job? 
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Yeah. Sure 👍
Thanks.
Hey can someone help mr
Me
I use discord.js, replit.com and i want to make a system where when a person votes, there is message in the console giving the name of the user
If possible pls can u provide the source code
Pls mention my username if u can help
Only if you make multiple accounts and handle multiple cogs within multiple accounts to split up memory
Helps me from running out of memory
Read the docs?
And you do need a webhook
See i am new to coding
You have fucking examples in the docs
So i kinda dont understand the docs
I tried it does not work
If you can use common sense or if you have it you'll know where to put the examples
Well you still have to change some factors
Ok no i am not new
lmao smart
Ay im just lucky it works😂
This is my code
Um no
https://yeehaw.xyz/THIS_IS_MY_PATH
Can u tell
Guess what the path is
And whether it includes a slash
You have Google mate why are you all so stubborn on having everything given to you personally
Js looks much difficult than py
×
◇
See if the repl name is test
I don't care what the repl's name is
So it will be replname/Path right ?
Ik
well, yes
Ok
hey shivaco, what's the proper way to post guild count for top.gg when running multiple instances of the bot (multiprocess w python)?
Ok thanks
with /something_path appended to it
I will try
I think example is the best way?
So according to the code the path is repl.co/dblwebhook right ?
Hmm... do you have a master process that can retrieve guild count from all shards (I assume your bot is sharded) and then post it as a list[int]?
In your case /dblwebhook
Nothing ELSE
what im doing rn is just having 1 of the instances handling top.gg so I only get 1/process of the amt of guilds
makes sense ofc
Ehh... I'm not sure if posting per shard ID works KEKW
so is there no other way but to make an empty master process ig?
No to put in the webhook section on the top.gg page
You can have a local API that receives information from all shards and once that's done, posts it as a list to top.gg. Only needs requests or aiohttp, whichever you prefer
In your top.gg webhook panel put your replit hosted web link with the path, suppose https://itswebhook.repl.co/dblwebhook
Say, 1st shard said "start" and last shard said "stop and post", if you see what I mean
Or you can inherit DBLClient and override its guild_count property so that it fetches from your local API instead
That's possible too
I'm in an area with bad cell service so don't expect me to be online for long kekw
Actually, I think we should go back to make it method exdee, just for the sake making the sense out
And, we could utilize d.py's utils.maybe_coroutine, so that it can be a coroutine, perhaps we can add get_shard_count as well.
Hi, how can I log into the top.gg API?
When I make a request he replies with "Not authorized"
let {body} = await superagent.get(`http://top.gg/api/bots/766631717078564886`);
console.log(${body.monthlyPoints})```
you need to also provide authorization through the Authorization header with your top.gg token
Hi
Will Danny kill us? 😛

A huge thankyou to comhad for providing us with this method.
Important links mentioned in the video
- Integromato :- https://www.integromat.com/en
Comhad github tutorial with code snippet:-
https://gist.github.com/comhad/bd42b56a0399dbfa645aa83fe3cf4c8a
Support me by upvoting my bot here :- https://top.gg/bot/819838809318621184/vote
Joi...
if anyone wants , for vote rewards ( discord.py)
third party service called integromat is being used
isn't integromat (or whatever it is) same as Zapier ?
no
Yea they might not be the same
but similar I guess
anyway it's getting off topic
Discord messages based webhook 
Oh ok, how do I authorize via webhook (I know how to get the token)
authorization header
couldn't you literally just use the webhook?
I don't see why anyone needs a third party to parse a JSON request...
you can't use discord webhooks
Discords webhooks are focussed only to a specific channel
oi
@high wing nice pfp you have there
lmao
What is the API link
Base URL: https://top.gg/api
ERROR: Could not find a version that satisfies the requirement topgg (from versions: none)
ERROR: No matching distribution found for topgg
I get this
When I do pip3 install topgg
You install topggpy, but the package name is topgg
All good
Anywhere docs to see upvoting one?
I don't really understand the webhook part tbh
To check if the user has voted or what?
Do you want to check if a user has voted (eg votelocked command) or do something when a user votes?
Do something when a user votes
Something like Thank you for voting
(A bot btw, not server)
You need a simple webserver running next to your bot to recieve the webhooks
And make sure it is accessible externally
Could be dbl one right?
Refer to the example on https://github.com/top-gg/python-sdk#using-webhook
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
You mean your IP address?
Uh
I don't understand
I have a webserver
And I have the password to it
I know the IP
Where is the webhook
In order to receive events you need to do the following
-
Setup a webserver wich handles incoming events (see example)
-
Have the port of the webserver forwarded and opened in your firewall to allow external connections
-
Fill in your IP address and port in the topgg webhook field
seems to get timed out while making the request, make sure your token is correct and your firewall lets your connection through
what url are you making a request to
when a person vote i retrieve the name of the user with the topgg api, so i make a request to users/:user_id
post your code you're using to make a request
635551799058890773
https://top.gg/api/users/635551799058890773
yeah returns a 404 when trying to get them
they exist and not, i can add a vote token to them but can't get his name iwith topgg
i have this issue for few people
discordid
yeah really weird then
uh no its topgg id excuse me
try to get their discord id
i retrive the id i retrive with the webhook
or one sec
635551799058890773 is their discord id
yeah nah that's weird
hey @vital anvil quick question about the api, not sure if you're the one working on it:
Since you can both use the discord id and top.gg id of a user to go to their profile, does that apply to the api aswell?
because trying to get 635551799058890773 through the api does not work, but they do show up on top.gg itself (https://top.gg/user/635551799058890773)
ohh so that would be a thing on the next api version then?
so actually new users don't appear in the api ? oo
how do i create a webhook?
So I can't make 4 vote required commands?
Where can i find my auth token in topgg?
Look at pinned messages
Thanks
https://normal-api.ml/topgg/hasvoted?bot=My bot id&user=user_id&token= my token
I am having some problems here (i deleted the bot id/token in this case)
The api wont work it would still say user did not vote
Why you dont use normal top gg api
You mean this? https://top.gg/api/bots/:bot_id/check
Yea
are you sending the auth token ?
Also what's the response ?
Thats why im using the normal-api.ml
Im not getting an error to find a solution
Can't you send the auth token directly to top.gg/api/bots ??
like a POST request
with Auth Header
Hmm ill try
Do i need the auth token when fetching bot stats? so for example when hitting https://top.gg/api/bots/658566989077544970 i need to provide a authorization token?
Yes
Any examples for using VoteDataDict ?
Ping me if anyone replies
Just like a dictionary
the data you have is listed on the docs page
You can access it either via data.someattr or data['somekey'], both work
What's the rate limit on getting all bot votes?
should be 60/min
i think
@jovial kiln added some comments to your PR
@vital anvil Sorry for this ping.
I'm new here, What do i do?
Just asking, Please don't mute.
@restive otter check #rules-and-info
import topgg
dbl_token = 'TOKEN' # set this to your bot's Top.gg token
bot.topgg_webhook=topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) # this method can be awaited as well
@bot.event
async def on_dbl_vote(data):
if data["type"] == "test":
return bot.dispatch('dbl_test', data)
print(f"Received a vote:\n{data}")
@bot.event
async def on_dbl_test(data):
print(f"Received a test vote:\n{data}")
```To what values, should I change in the "`/dblwebhook`,`password` and in `PORT` ?" I am pretty confused, since I am new to it.
/dblwebhook should be the endpoint you want it to listen on, password should be your auth token that you set in your bot's settings on the site, and PORT is just the port the webserver should be hosted on
i think thats right
Well, then should I host it somewhere?
if its just on your bot it will be hosted on whatever your bot is running on
You mean if its on my computer running?
yes
So, will the values change if I run it on computer ?
no
other than your bot settings
on top.gg
if you want it to send post requests to your pc
http://ip:port/dblwebhook 🙃
and then Authorization should be your 'password'
Also, how to get the IP?
its the public ip of whatever your bot is running on
How to get it? 
what os is your bot running on
Windows
you could prob just google 'what is my ip' 





