#topgg-api
1 messages · Page 175 of 1
i didn't created a webhook on my VPS.
I don't think the port are firewalled
is the domain set to the vps ip?
yes of course
Using cloudflare?
Cloudflare only allows specific ports if you are
(If the proxy is enabled)
yes i'm using cloudflare
and if thats the case, consider making a subdomain, unproxied so you can use the subdomain to reach your server without using the proxy
how i enabled the port ?
use a subdomain then, you cant proxy a non http port through cloudflare
make sure that subdomain is not proxied
or just directly use your vps ip for the webhook
i do a certification SSL on the subdomain ?
Http allows a few other ports than 80 on cloudflare.
https://developers.cloudflare.com/fundamentals/get-started/network-ports
But you need to change a few settings
cloudflare's proxy only allows http based ports, not any other
wait
what the fuck
since when
my configuration is good @rain heart ?
Is ur ip static
Probably best to move all your vote restricted commands to use an internal database and use webhooks.
Even if you are not hitting the posted ratelimits you are hitting some ratelimit so best to move what you can off the api onto webhooks.
https://docs.top.gg/resources/webhooks/
The has voted endpoint is supposed to be temporary anyway
@jaunty plank then, i have to create a certification SSL and a new proxy nginx ?
I would use ssl, and proxy nginx if possible, but not strictly necessary
so i have create a cloudflare configuration like this, and i just have to write my webhook url like this http://topgg.xelia.tk:1065/dblwebhook
?
yes
when i send a test, i receive nothing on the discord server. you are sure there is nothing to configure in the nginx configuration for the subdomaine ?
Trying to access the webhook outside of top.gg does not work either
So it's an issue on your end
i have nothing
server {
# root /home/bots/Xelia/website;
# index index.html;
server_name topgg.xelia.tk;
location / {
try_files $uri $uri/ =404;
}
listen [::]:1065;
listen 1065
}```my configuration is ok ?
seems you are not using a proxy(what you need).
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
also since you are using a subdomain with cf you can listen on port 80/443(depending on http vs https)
using the top.gg sdk for nodejs im getting
``` when i use `tsc` to build from typescript to js
anyone have any idea how to fix it
Late update to my troubles: I installed express typings and everything worked fine
Fuck
@dense grail ?

fetch("https://top.gg/api/bots/890605240309661726/stats", {
method: "POST",
body: JSON.stringify({ server_count: bot.guilds.cache.size }),
headers: {
"Content-Type": "application/json",
"Authorization": "[REDACTED]"
}
}).then(res => res.json()).then(res => console.log(res))
``` is returning `{}`, any ideas?
🤔 it looks like the entire response is empty. strange
does that happen when it was successfl?
posting stats does not return any data
thats normal
you could check if it was posted by doing a get request to stats
clear your cache
site display is different from what the api says
the site one is likely cached
ayyy there we go. thanks!
how can i get the amount of votes for an application?
thanks
How do I define my server count on the bot widget? Is there a video tutorial?
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
Hello, suddenly my bot has stopped updating stats so I was trying to make http requests directly, but I'm getting this error (Required parameter server_count or shards missing), even though I'm setting server_count
i can see why
not sure if this is the issue but it might be because you're posting just the server count
and based on the count, you would need to send the shard count too
Shouldn't it be not required according to docs? Anyway, I'm getting the same error
How do I set up the web-hook in my discord bot?
Thanks, but that isn't helpful because I have a hard time reading documentation for anything. I asked if there was a video. Is there a video or something that isn't confusing documentation?
Sorry, I just realized that came off as rude....
didn't mean it like that
The docs provide the endpoint to be able to post Serverstats to
I've tried every combination and I'm getting the same error... Could it be a bug for my bot?
What content type
When I execute the following code within bot's actual code I get an error :
import topgg
# This example uses tasks provided by discord.ext to create a task that posts guild count to Top.gg every 30 minutes.
dbl_token = "Top.gg token" # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token)
@tasks.loop(minutes=30)
async def update_stats():
"""This function runs every 30 minutes to automatically update your server count."""
try:
await bot.topggpy.post_guild_count()
print(f"Posted server count ({bot.topggpy.guild_count})")
except Exception as e:
print(f"Failed to post server count\n{e.__class__.__name__}: {e}")
update_stats.start()```
Error:
```Failed to post server count
Unauthorized: Unauthorized (status code: 401)```
Did you fill in your token.
is it the same as the webhook token?
if yes I did
Nope. On the page you fill in the webhook token theres a spot for the top.gg token.
(Api token)
Might need to regen it to show
This one right?
yep
thanks problem solved. I think I had regenerated the token but it showed the previous token so the error was coming
Yeah, been a common issue. sorry about that.
How much time it would take to reflect the updated stats on website?
it can take a bit, clearing your cache may get it to show sooner.
In order to clear your cache for the site, press CTRL+F5.
If this does not work, try one of these resources below:
Instructions on Microsoft Edge
Instructions on Google Chrome
Instructions on Mozilla Firefox
Instructions on Safari
Instructions on Opera
Instructions on Brave
ok thanks
for "memer" its showing 110 servers for me
yes Thanks for your help 😃
Hello
I was just finally trying to integrate the top.gg token
and according to the doc's
i need to go to https://top.gg/bot/:your-bot-id/webhooks
but when i replace :your-bot-id with my bot id it show's this
Your bot needs to be approved first
oh damn! how much time does it take for it to get approved?
hmm thanks allot seems like time to comment some code
-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.
-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.
@sterile cairn
-api once again
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.
any1 here?
i am using the topgg 2.0.0a and am suddenly getting this error
self.bot.topgg_webhook = topgg.WebhookManager(self.bot).dbl_webhook("xxxxx", "xxxxxxx")
TypeError: init() takes 1 positional argument but 2 were given
Have you seen the examples in the docs?
ofc and remind u that i was running the exact same script
for 2-3 weeks
now when i decided to restart the bot its giving this error
actually it doesnt have to do anything with restart its giving that error now suddenly
Gimme a minute

Or a few
did this change happen in the past week?
topgg.WebhookManager()
.endpoint()
.type(topgg.WebhookType.BOT)
.route("/dblwebhook")
.auth("youshallnotpass")
)```
What does type refer to here?
You wanna give 'em the stable docs shiv
^
The enum has 2 members https://topggpy.readthedocs.io/en/latest/api/webhook.html#topgg.webhook.WebhookType
It implies what to pass to the callback, either bot vote payload or server/guild vote payload
alright
also you know why i am getting this error suddenly??
Did some changes happen in 2.0.0a in last week?
?
No, you must've been using v1.4 or earlier before
i am pretty sure i was using the latest version
The WebhookManager takes no argument, so you should've got that error if you were
one more question where to provide port number?
e
What is the different between shard and shardCount? "the id of this shard" why do you need this information
shard id is the index of the shard you're posting, this allows you to post stats from multiple shards onto the site and just have all the shards sum up
shard is the shard index and shardCount the count of servers that shard is serving
But i post my stats only from one shard with the global guildCount
i dont use the guildCount of the shard
then only post one shard id and then the total server count
ok thanks
can we ask questions for the api wrappers here?
sure, as long as you're asking questions about official ones
its the official one i think.
so i was using the python one and it was working fine but recently it started spitting this error regarding the webhook, but when i try to reload the cog it says that my given port is already registered, when it isnt.
https://pls-help.me/JuJ-I86OtgQXkemt/db9jEOdp.png
im on version 1.4
https://pls-help.me/9uGN3H0wOtmCjcsu/s7FvRtpy.png
which is the latest version on pypi
Mind sending the relevant code?
yea sure wait
oh wait
i think i found out the problem
yup that
i didnt notice that before-
sorry for wasting ur time
All good, glad you've found the issue
also i see that the github has version 2.0 when will that be released?
if its even planned to be released
ETA: ask God
^ 
I'm still considering the style, currently it's builder-like. I don't think it's Pythonic
IDK, I'll be more than happy to hear feedback on it
I havent thoroughly read through it, however ill do so when i get the free time and get back to u 
I'd really appreciate that 
I'm sorry, I've just read the message. What do you mean?
What does your Content-Type header happen to be?
text/plain
application/json
@west shoal
Thanks, I'm getting no error but the count is not getting updated, if I try to refresh it it will load infinitely
to note: refresh data does not affect the server count at all, it simply refreshes your bot avatar and name, which is not functional right now
if you make a change towards your server count, it will require you to clear your cache as you might be viewing a cached server count
I had tried with another value actually
It has updated now though
Hi
Need any API help?
3.1.3 stable
https://github.com/top-gg/node-sdk
See giit commmit logs for changes
Ty
np
k ty
How can I use vote updates (on_dbl_vote) without a webhook? any example code would help.
I am using python
You simply can't
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
What would you put for the password I'm trying to do a auto vote thing
you are the one who decides it, its a password
Ok
Would also put the password in the authorization thing in your topgg bot portal thing
Yep, the authorization field just below the webhook url
As long as they are set the same
The url to your server, including path and port
?
I was just wondering for like testing reasons to make sure it all works
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
client.topgg_webhook.run(5000)
so what we would put in the webhook url is [vps ip]:5000/dblwebhook?
Correct
then for the Authorization you would put what ever you have in the password area
Yes you can use a password but you don’t have to
The authorization layer just makes sure the request comes from topgg
ok
This can also be archived by whitelisting the IP address the request comes from if your default inbound policy is set to drop
ok
Which I guess isn’t a thing here at all but just to say
Anyways make sure requests on port 5000 can pass your firewall
Or hosting service firewall, whatever you use
refresh the page
Ah clear your cache and reload the site a few times
If you haven’t setup SSL then yes
Hello
I'm getting this error:
Error: 401 Unauthorized (You need a token for this endpoint)
but i'm sure i put the right token in my code
i already tried to regenerate the token several times!
are you passing it through an env variable?
no, its not in a variable
share your code then
with token?
const DBL = require('@top-gg/sdk')
const dbl = new DBL.Api('---', { webhookAuth: '---' });
dbl.postStats({ serverCount: client.guilds.cache.size })
that constructor doesn't look correct, check the docs again
btw its working now
Hi i'm trying to check if discord user has upvoted the bot. I'm doing this request:
GET https://top.gg/api/bots/:botid/check?userId=USERID
My header:
Authorization TOKEN
Response: 401 Unauthorized
I picked up the bot token in the webhooks page of my bot but the api still send me 401 response code
you cannot use the api when your bot is not approved
the bot is approved
yup just realized nvm
Are you sure the token is valid
also are you using the botid of your own bot, not a different one
I've fixed the problem by regenerating the token. Maybe there was a bug on the old one 🤔
What's the format for creating a webhook url to send the vote data to my bot? I thought I had the right webhook url for my bot, but apparently not? I'm running my bot on Replit. Do I need more than https://{host}:{port}/{webhook_path}? Please ping me w/ your response. There's no guarantee I will see your reply if I'm not pinged.
I am trying to make server upvote reward systems(using topggpy)
How do I get my DBL Token for my server(It is uploaded on top.gg)?
top.gg/servers does not have an api, you need to use webhooks
okay
Check pins
if I am not bot owner, I can't get token ?
If you do not have a bot on our site, you cannot get a token to use
There's no other reason why you'd need one nonetheless
okay
It's saying Topgg.api is not a constructor
does the topggpy library not work with disnake?
Do you test the webhook listener at home or on a server?
don't need to hide the port as we don't know your IP anyways
Does the server firewall allows incoming requests on that TCP port?
Try to define a different path, edit it in your code and on topgg, click save before hitting the test button
I understand that, but how do I actually integrate it into my code? Do I need to do a GET or POST or what? I've never worked with webhooks before, so I don't really know what I need to code in order for it to work. Top.gg successfully sends the webhooks, yet I never recieve them.
You might wanna use the pre release/the alpha version
anyone here make bot from bdfd? if yes how you can use top.gg api im so confuse how to use it
Heyyy I have a problem. I have a domain name on my VPS xelia.tk. I don't know what I have to write in the webhook url on top.gg.
Someone 🥺
Somebody once told me...
It depends on your settings for the webhook
And whether you have HTTPS or not
https://github.com/top-gg/Java-SDK is this still maintained?
An API wrapper for https://discordbots.org/api/docs that works in Java - GitHub - top-gg/java-sdk: An API wrapper for https://discordbots.org/api/docs that works in Java
Is this a known issue?
code + error in here: https://paste.gg/p/anonymous/a1d0d739d0a547698978115b4e07917a
is there anything for java?
const Topgg = require("@top-gg/sdk");
const express = require("express");
const app = express();
const webhook = new Topgg.Webhook("MY_AUTORIZATION");
app.post("/dbl", webhook.listener(async vote => {
console.log('passssssss')
let channel = client.guilds.cache.get("670189312687603723").channels.cache.get("715120187690582017");
let user = await client.users.fetch(vote.user);
channel?.send({ embeds: [await client.info("🔔 New vote", `Thank you **${user.username + '#' + user.discriminator || user.id}** for your voting ${client.user.username}.\nYou won a coin which can use in ${client.channels.cache.get('919705157741199370')}.`, {})] });
}));
app.listen(3000);
I receive nothing
someone knows why ?
doesn't work
port ? in the webhoook url ?
yes
like this ?
host:port, your webhook is hosted on a non http default port
also try an actual vote instead of a testvote
like this ?
still not working
test it using something like reqbin for postman then
reqbin ?
I don't have a token in my code ? it's normal
?
that should not matter
test your webhook using a normal request outside of top.gg
to test if it works
yes
then your webhook is not properly setup
make sure the port is open/not used already and the firewall allows it aswell
cant help with it
you can't ? or you don't have the information required ?
I cannot help, as I'm not available to help nor have any idea how it would work on your server/local network
i don't think anything is live at http://xelia.tk:3000/dbl
what do you mean ?
it would usually give an error because i'm trying to GET the webpage not POST it
which basically is a sign that its not accessible, and Top.gg can't send the webhook request to it
so how can i fix it ?
VPS
why 5000 ?
yes
here @tidal idol ?
here ?
does it not send a post request
no
it's normal that i have an error here ?
no
if i just put the ip
again that does not work
80/443 is used by your webserver
your webhook runs on 3000, it is entirely separate from your webserver
you need to connect to 3000 instead of 80, you cannot run stuff on the same port
Ubuntu is an open source software operating system that runs from the desktop, to the cloud, to all your internet connected things.
is what I'd drop in here as I have no clue about what you're using
then your dns was not setup properly
you should be able to use that for the webhook, it says that message as you cannot make a get request to that
yeah exactly
you can only send a POST request
which is what Top.gg does
put that in the topgg webhook field
const mySecret = process.env['Token'];
const client = new Discord.Client();
const { AutoPoster } = require('topgg-autoposter');
const ap = AutoPoster('top_ggtoken', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
client.login(mySecret);```
Why isnt this code working :/
it just says `Promise { <pending> }`
it was working fine a while ago 🤔
@restive otter try not to ghost ping the server owner please
sry friend
@jaunty plank someone ghostpinging kristin and trying to mention hidden channels (against tos
)
please dont ghostping anyone, or break tos
sorry :c
if i only wanna use the top.gg api, i still need to submit my bot application? (i dont wanna make it a public bot)
Not sure why you'd need the API otherwise
A bot on our site is required to use the api
to get voters for a guild
so i cant track who voted for the guild?
Only with webhooks
alr then
And tracking it yourself
Can anyone tell me how can I setup a webhook for vote logs on Heroku
(or)
can I directly send message with the bot without using the webhook?
@rough crater #development as well
Mods are dead
New Year time!
True
yes
:(
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const { AutoPoster } = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
it says Shards 1 but it's Actually 5
Is this a known issue?
code + error: https://paste.gg/p/anonymous/a1d0d739d0a547698978115b4e07917a
lol
Yeah I don't want ppl to try to make a get request on the dblwebhook xD
only happening on the top.gg post request?
when i make a request, yes
using the vote button correct?
are you using any characters with accents in the url/auth?
or well, anything outside
a-z A-Z 0-9
(and obviously standard url stuff : / . are permitted)
you mean the password for the votes?
yep, or in the url
one second
so like
ÀtêstPassword
wouldnt work
AtestPassword
does work
we just use numbers and letters
my next suggestion would be double checking you are updated to the most recent version.
if not, I would rewrite your code to this
app.post("/dblwebhook", async (req, res) => {
console.log(req);
res.send(201);
});
and see what the req sends
let me try
i dont even get a request
oh 👀
or may the app.use(express.json()); cause something
nvm im fucking stupid had a typo in my ip address
i got a request in my console
what node.js version are you using?
16.13.0
@jaunty plank would this cause the issue?
a lot of the time these types of issues are caused by the version of node
aaaaaaaaa
you couldnt get that issue if you updated the code.
as the code I gave doesnt use the top.gg lib
its unlikely its a node issue, as you are practically on LTS version(16.13.1)
yeah
any chance you can update your code to
so we can actually see whats going on without the error?
If you really wanted to just handle it yourself without the lib I guess.
if (req.headers.authorization !== "YOURAUTHHERE") return res.status(403).json({ error: "Unauthorized" });
const vote = req.body;
this is not all the checks, like checking the body exists would be a good idea.
ohooooooo
op, youll also need to send a response
yea i send back a 201
yep, should be it then.
thank you so much!
vote API?
I have an endpoint that has been working for months to update my topgg server count and suddenly it has stopped working, has the API been changed?
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let result = (await lib.discord.guilds['@0.1.0'].list()).length;
let token = process.env.token;
const Topgg = require(`@top-gg/sdk`);
const api = new Topgg.Api('place API key here');
console.log(result);
await api.postStats({
serverCount: 666
})
Running from autocode
It shouldn't have changed.
What is returned from api.postStats
probably just api downtime
Nada. Only 1
for post bots/:bot_id/stats
how do I get this from discord.py?
bot.shard_count
it depends on the way you shard on py right? 👀
I've already got shard_count down which is this
oh
Ohhh I see
I'm using internal sharding with what dpy has provided me with
the AutoShardedClient
AutoShardedBot(shard_count=shardCount)
oh well, dosen't seem all that necessary
I'll just leave it out
🤔 weird, not seeing how to do it
also does it take time for the server count to finally show up on the bot page?
^ I'm getting response 200's but I still don't see the server count stats on the bot page
you may need to clear cache
In order to clear your cache for the site, press CTRL+F5.
If this does not work, try one of these resources below:
Instructions on Microsoft Edge
Instructions on Google Chrome
Instructions on Mozilla Firefox
Instructions on Safari
Instructions on Opera
Instructions on Brave
ah I see
no wonder, gotcha ty
@jaunty plank weiiirrd, I cleared my cache on my brave browser and it still dosen't show up
I even tried loading it on my other browsers firefox and edge which I haven't ever opened top.gg in those sites
and it still dosen't show up
could you tell me if it's just me or does it not show up for you either?
https://top.gg/bot/886196406761693204
nope nothing,
any errors?
none
Check the api instead
gotcha
The visual servercount is cached
this is what I'm getting
I'll just pray that it'll show up on the page later
Then your server/shard count wasn't properly posted if that doesn't match what you sent
Why I can't vote
You're not worthy of receiving the rewards for being good, Santa said
Already voted in top.gg site but in my checklist in discord it is available
it's really annoying
What checklist?
on pokemeow
I can't claim new years promo because of that.
its not
https://top.gg/api returns hello world for me, indicating the api does work
what endpoint are you making a request to
Hi
Hi... Im trying to use the API via the webhook method. But I can't get it working.
I'm not getting any errors... The port is forwarded
Any ideas on how to see whats wrong?
Did you fill in the webhook url and auth?
Ye I did, everything exactly like the github. Maybe somehow my port is not open even though its forwarded, who knows..
I ended up doing it the "opposite way" by sending a request instead
I feel like putting that on the github or like getting started too would make things smoother
possible firewall issue then?
there's so many reasons it might not function, and so many various ways of doing things which is probably why we dont have a "getting started"
I'm assuming that I can't just directly put in a discord webhook url to the webhook url in the bot's settings right? 
correct
know in what way?
we know what it is.
How can i use it to send a vote?
To log a vote*
if autocode supports hosting webhooks to receive vote data, sure can be done
ask their support about it
Do i just copy this?
im not clicking that
@rain heart really sus link
vt says nothing
@old pike we cannot help with that
top.gg is not an official top.gg module, you should use top gg sdk https://www.npmjs.com/package/@top-gg/sdk
can someone help me with something
sure
can i dm u rq
sure
I keep getting an 401 unauthorised error when posting to https://top.gg/api/bots/678881455883026463/stats
I have Authorization header set
How are you passing the header?
And where have you obtained the token?
is there a way to get votes for a server?
like a webhook is sent to our server when a discord member votes for a server
not without coding one, or using third party tools.
I mean with coding, I have done with bots, for servers I didn't see any Webhook url field when creating them
its on the edit page, in the webhook section.
https://i.imgur.com/GLGVHPr.png
oh mb, didn't realise that, so I assume they work the same way as bot votes right?
yep, just uses the guild property for guild id, not bot.
ah alright, thanks
how long does it take to get your bot approved
@proper blaze
The average up-to-date approval times are stated [here](#support message).
This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.
There is no exact time for how long bot approval will take.
There is a queue and you're not first, nor are you last.
Read more about our reviewal process here
ok
Any chance the webhook is going down sometimes?
should i send this field as an average guild count per shard?
like total guild count / total shard count
its an array, so
lets say you have 3 shards, shard 1 has 1700 guilds, shard 2 has 2000, shard 3 has 1600
you would send [1700, 2000, 1600]
and how would i calculate that

it kind of depends, if your bot library supports broadcast eval, I would just broadcast eval.
i mean i could use alot of things and fors but thatll block the loop
i can get the shard id of each guild yet i cant map the guilds by a shard id without using some whiles
no need to map anything
Yep should be what you need for that.
Can someone help me with topgg autoposter and get the bot token from the webhook page and make sure the client is named client but it still won't send anything or confirm that anything is being posted
show code
is it a way to give currency rewards with nadeko for my server votes on top.gg?
i have a open source edited nadekobot and i want setup vote rewards or need an verified bot on top.gg for this system?
yes you need to get verified
This snippet isn't working. Can someone help me find a fix?
alr
can you just explain it how it works
the webhook and /dblwebhook placeholders
I cant find the description in documentation
I cannot help
Hello how can i create a vote log? (autocode)
https://top.gg/api/bots/664508672713424926/check?userId=787541309250076692 why is it showing forbbiden
ping me if u say
Welp this really isn't going well
did you authorize?
no
i didn't
yeah then you should
Is there such a thing as a socket? I want to make a command that detects if a user voted in but it seems strange to keep sending a request.
Webhooks oh
https://docs.top.gg/api/bot/#individual-user-vote will this give me a response if the user's vote was more than 12 hours ago?
Are there any examples for topggpy v2.0.0a?
I don't really get how to recieve the votes in that version
this doesn't work anymore
https://mystb.in/CommunicationBasketballPosting.python
ah
thats a problem
not because of what u might think but because i wrote the bot to work
with top.gg
and now i have to tear it down its for a private company
oh well
does anyone know why im getting this error
\node_modules\@top-gg\sdk\dist\structs\Api.js:93
throw new Error('Missing Server Count');```
(im not missing server count)
Show code
Why can I only decide under a few roles at Role Rewards?
so I just need to put the bots role higher right?
yup
Okay thx^^
await dbl.postStats({
serverCount: client.guilds.size,
shardCount: client.shards.size
});
const dbl = new DBL.Api('token');
Maybe it couldn't read client.guilds.size. Have you import Discord.js?
will try
I'm pretty sure the autoposter supports eris.
https://www.npmjs.com/package/topgg-autoposter
Update your package then
how can i get an event of a vote
it says i need to use bot id althought i want server votes
you can just use your server id
or go to your servers page, click edit then go to the webhooks section
how will the webhook communicate with my bot though? im used to using discord.py package so its just a builtin feature to the wrapper to listen for messages for example
youd need to use the topggpy library, or code your own webhook receiver.
dw im using ur website to do webhooks and il just use onmessage and split it
that works too
How can I get a token?
look up top.gg api and follow the steps they go through it step by step
Well how can I do this
I don't know what happened but today after voting for cg my players were not added to my squad
How can I get my rewards back
-wrongserver @restive otter
@restive otter
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says "Discord" or nothing else mentioned about a support server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
Hey Can someone tell me how to get a webhook for vote event ?
I already have this code but not sure what should i give as the weebhook Url
from discord.ext import commands
import os
import dbl
class TopGG(commands.Cog):
"""
This example uses dblpy's webhook system.
In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
"""
def __init__(self, bot):
self.bot = bot
self.token = os.environ['dbl_token'] # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path= os.environ['dbl_webhook'], webhook_auth= os.environ['dbl_password'], webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print("Received an upvote:", "\n", data, sep="")
@commands.Cog.listener()
async def on_dbl_test(self, data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:", "\n", data, sep="")
def setup(bot):
bot.add_cog(TopGG(bot))```
the resulting webhook url by your code, http://yourip:port/path
Umm... How do i get that ? I use replit
@dense grail bro you speak in hindi
thanks
btw how did a bot reply to me like that
is there a way to check if a person can vote (hasn't voted in the past 12 hours)
nvm fixed
Is this the method for java? I was confused whether "hasVoted" means its in the past 12 hours or not.
I was looking at the raw api
That should work in the Same way
okay, thanks!
I tryed the top.gg autoposter on my testing bot but then when i pushed the code to the production version, it's stuck on the stats from the testing bot
cache
so can i clear the cache somehow?
In order to clear your cache for the site, press CTRL+F5.
If this does not work, try one of these resources below:
Instructions on Microsoft Edge
Instructions on Google Chrome
Instructions on Mozilla Firefox
Instructions on Safari
Instructions on Opera
Instructions on Brave
-botinfo 923332113812561951
-botcommands
@verbal cape
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.
Oh lol sorry did not check the channel
Is there a good documentation for shards on discord.py?
Are there any examples for topggpy v2.0.0a?
I don't really get how to recieve the votes in that version
this doesn't work anymore
https://mystb.in/CommunicationBasketballPosting.python
I think docs?
nope
show me the docs
Once my bots os verified
i cant find them
:.
1.4 docs are there
They havent updated?
Ohh kay
Flash bang warning 
Light theme superior
from discord.ext import commands, tasks
import os
import dbl
token = os.environ['topggtoken']
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = token
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
def cog_unload(self):
self.update_stats.cancel()
@tasks.loop(seconds=3)
async def update_stats(self):
await self.bot.wait_until_ready()
try:
server_count = len(self.bot.guilds)
await self.dblpy.post_guild_count(server_count)
print('Posted server count ({})'.format(server_count))
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
def setup(bot):
bot.add_cog(TopGG(bot))
Im using the dblpy library to update my server count on top.gg. When I run the code, it says "Server Count Posted" but when I see the top.gg page it doesnt show up, if anyone knows why this is happening kindly ping me
ayo, anyone can tell me how to use top.gg's webhooks to send voting logs
start with servers cuz my bot is yet to be approved.
Os there a way to check if user has vote using pycord
hey, what's up with my bot's image?
https://top.gg/bot/601347755046076427
also my widget shows 404
-refreshdata
In order to re-fetch data about your bot (Avatar, Name), please use the Refresh Data button on the right sidebar. If it still doesn't seem to change, make sure you actually changed the bot avatar and not the application icon / changed the bot name and not the application name on your Discord Developer Portal.
Please note that it may take 30 minutes up to an hour for the site-cache to also update.
read the last part
simple, cache
oh alr, so I should clear my cache and it should load
Thank you so much, it works now
np
There are no examples i guess
can you give a more detailed explanation about this if possible, thanks!
The dude above scrolled all the way to 2020^^

Hey guys, when you vote on top.gg is it 12 hours for the user? Or the votes for everyone resets every 12 hours?
is @top-gg/sdk like dblapi.js? if yes then will this work? js client.dbl = new Topgg(process.env.DBL_TOKEN, client); accessing ```js
client.dbl.hasVoted(message.author.id)
yes
but with await
dbl_webhook(route: str = '/dbl', auth_key: str = '')
what is this route exactly ?
where do we get this route from ?
How to config the webhook url in Topgg site settings when we are using the topggpy sdk
py or js?
it depends, what are you using to host?
topgg-py
does that mean, even after using the sdk, we need to host another server ?
well, yeah your bot needs to be hosted somewhere the SDK can be used on the same process(and server) as the bot.
if thats home, a vps, replit, heroku etc.
just to clarify, i am asking about your bot host or the host you want to have the webhook on.
if they are the same, then its just the bot host.
my bot host is me
my localhost
XD
If i understand how the sdk is working in localhost, i can replicate it anywhere
http://yourvpsip:port/dbl
(or home ip)
XD
thanks, will get back after testing
and btw, why is Topgg Bot teams so buggy
i need that test but for developemnet purposes and the owner is someone else
Unintended new feature
It shows a 403 Error when i goto Bot -> Edit (via teams) i am not the owner of the bot
Magic
It's a known issue as far as I recall but in any case go to #support for that shitshow
Thats called Caching
Give it around an hour to clear on Top.gg's side
Then clear cache on your sid
i am always using Ctrl+F5 to prevent my browser from loading any cache
on Topggsite
😌
js
https://discordjs.guide/sharding/#sharding-file
your webbook receiver would go here, or in another program.
s
client.dbl = new Topgg(process.env.DBL_TOKEN, client);
^
TypeError: Topgg is not a constructor
const api = new Api('yourtopggtoken')
const vote = await api.hasVoted(message.author.id) // or whatever```
Hi
Need any help?
No
Hello, I am using the dbl module for voting, but it is pulling the votes as undefined, how can I fix it?
show code
I used it in it but it still says undefined
how you use the new one is not the same though
check the example code on the npm package website
and make sure you use and import it correctly
the new package is not a drop in replacement
I Want To Get User Has Been Voted ?
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print("Received an upvote:", "\n", data, sep="")
data["user"] ?
!!!
Hey so I am trying to access my bot's webhook page but it's giving me a 403
Is everything OK?
Also, are teams broken?
403 means unauthorised
Meaning it’s likely an issue with authentication on your end. Make sure the token is correct, and try resetting it
I mean
I co-own the bot through a team
So I should have access to it right?
We've had certain issues with the API listener thingamagigbob, and I needed to test the API
ty
One message removed from a suspended account.
Umm so im trying to see how to make it where when someone votes for my bot it gets posted to a channel in the bots support server, but i know it can be done for discord.js, but what about eris?
It is approved, we have used the API previously
Id?
isn't there any way for Vote Rewards/Logs through Heroku?
else please suggest Free webhook services
Is it possible to make a bot dm you after voting?
Yes, but only possible when that user has DMS enabled and has a server in common
How do i make it dm the user?
Okay
Fetch the user using your bots library and then send as normal.
Can you help me how to get dbl token
Read pins
ok
does this api support server votes?..
oh ok so how do i do it
https://webhook-topgg.com is the easiest way
thank you..
Hello,
I'm making a request as written in the Get Started and i still receive a 403.
My bot is approved.
The token given for the webhook configuration on the bot settings page
Example using Express in JS: https://docs.top.gg/libraries/javascript/#webhooks
does the api return how much time a user has to wait before voting again?
cant help
On the my bot's page I went to Edit > Bot Info > Use New Design set to off and Save, now the bot's avatar is back
Unsure if this is an official workaround.
maybe the users not cached on your bot
ayo guys, how this thing work?
I'm getting topgg.errors.unauthorized when trying to update my server count using the following code that is built off of the example provided by you guys
from discord.ext.commands import Cog
from discord.ext.tasks import loop
class Topgg(Cog):
def __init__(self, bot):
self.BlackHole = bot
self.update_stats.start()
def cog_unload(self):
self.update_stats.cancel()
# Update the server count on Top.gg every 24 hours
@loop(hours=24)
async def update_stats(self):
try:
await self.BlackHole.TopggAPI.post_guild_count()
except Exception as e:
self.BlackHole.log.error(
f"Failed to update server count on Top.gg:\n {type(e)}: {e}")
def setup(bot):
bot.add_cog(Topgg(bot))
(I defined BlackHole.TopggAPI in my main bot code, so don't worry about it being defined incorrectly.)
I am also providing it with the correct token
BlackHole.TopggAPI = topgg.DBLClient(BlackHole, topggToken)
(please ping me when you respond)
@rain heart
@true oasis #memes-and-media
?
There was someone shitposting memes, nothing related to your request don't worry
gotcha, i got slightly worried
@queen solar
TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)
at Api._request (E:\Recreation-Beta\node_modules\@top-gg\sdk\dist\structs\Api.js:76:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Api.postStats (E:\Recreation-Beta\node_modules\@top-gg\sdk\dist\structs\Api.js:99:9) {
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'https://top.gg/api/bots/stats',
status: 401,
statusText: 'Unauthorized',
headers: [Headers],
counter: 0
}
}
}
what does this mean ?
Did you provide a topgg token?
If you did, regenerate it and use that.
yes , actually it the test bot and i m using the main bot token
so is there any issue in it ?
or it is token issue only ?
How are you passing the token
One message removed from a suspended account.
Unnecessary
like it is given in the example
So the token is passed through what? A string or an eval?
just copy paste
Show your code while replacing the token with just "token" and wait for someone who can help
const client = require('../index.js');
const { AutoPoster } = require('topgg-autoposter');
AutoPoster('token', client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
i did this
You will not be able to do that on a second bot. You are trying to send a status update to a bot the token doesn't apply to.
import topgg
# This example uses tasks provided by discord.ext to create a task that posts guild count to Top.gg every 30 minutes.
dbl_token = "Top.gg token" # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token)
@tasks.loop(minutes=30)
async def update_stats():
"""This function runs every 30 minutes to automatically update your server count."""
try:
await bot.topggpy.post_guild_count()
print(f"Posted server count ({bot.topggpy.guild_count})")
except Exception as e:
print(f"Failed to post server count\n{e.__class__.__name__}: {e}")
update_stats.start()```i've done this but the bot count me 2 servers while my bot is on 145 servers
and also it doesn't show on the top gg page of my bot
why would we need to use a brand new token?
should update instantly, might not show instantly on the site due to caching
How do i fetch the amount of votes a user has?
it updated, thanks!
If I get no response, aka just {} when posting server_count, it should mean I'm good to go, yes?
that means it was successful
Ah perfect
how
can i handle a post request
i mean not express
i already did one but
what is the requests body
im logging req.body and it is undefined
where is the id of the voter?
app.post('/vote', (req, res) => {
if (req.headers.authorization === process.env.AUTH_PASS) {
console.log(req.body)
// => undefined
}
res.send("Recieved.")
});
i also tried logging params
also req.data => undefined
i already read all of the page :'
i know the schema
i just dont know where it is in the request
this doesnt say where the body is
request.body is undefined
from where is that request
use an actual vote
cant help then
i will reverse engineer the topgg.webhook server
gotcha
this is the parser for those who needs it
if you are still getting empty bodies, are you using characters outside of a-z 0-9 and a few special characters in your url or auth? you may not receive the body if those are included.
âsadasdsad as your auth will cause issues with the webhook.
asadasdsad wont
How do i check if a valid token is passed into topgg.DBLClient without calling "update server count"?
what do you really mean by webhook?
is it a websocket connection?
is top.gg will send the request?
or is i gonna send a post request to webhook?
it sends a post request with data about who voted and for what bot
oh ok so i need to setup a flask to handling those data?
Yes
Anything that allows you to process that post request and handle what you need from there will work
okay cool
Yes
You can't check if your token is valid without any requests
I want to post bot stats , i need top.gg provided bot token or authorization secret ?
As token
To post your stats manually you need an authorization token to interact with the API
Edit your bot on topgg, then hit Webhooks
You can generate a token there
The token provided by top.gg or the secret thing which we wrote ?
Damn that long token one ?
I guess i have to fix that issue in my npm package
Yes that's your authorization token
Thanks for the info 👍
Do you wanna post the stats manually or are you using the sdk?
It's bot token i guess
Manually , i made a public npm package for all discord botlists so I am doing everything manually
No, it's an...
authorization token to interact with the API
May be
Alright, so you gonna send a POST request to the API including the authorization token (webhook token) in the header of your request.
Those 2 URLs should show you the general structure of the request
Does Test Webhook gives correct data now? Because previously it was sending wrong data
