#topgg-api
1 messages · Page 144 of 1
You don't need a website and Glitch links work, too
Then why do you need a webhook URL
What have you tried with the autoposter package
i just installed autoposter package
Have you tried actually setting it up in your code?
Have you tried reading the example?
It's also quite literally on the package page
do i have add my token to 'token'?
oh ok
See last pinned message for it
i know how to get my token

`const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 121919449996460033
}) // attach the middleware
app.listen(3000) // your port`
@sullen nymph now i adding this to my main?
('topggauth123') i have to change this?
Why do you need the webhook?
idk
how i can add server count thing to my website?
`const AutoPoster = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client`
i added it
but i cant still
saw server count thing top gg
oh
i can saw it now
tysm @sullen nymph a

how can i code the bot send a message to a specific channel when someone vote it?
Ñaña
Hello, may I get some help about making a webhook for the votes?
It would send a message like {user} just voted!
I was actually there, lost tbh, and then I found that
what should i put as my webhook url
Your public IP or FQDN of the device your webhook service is running on.
And make sure to configure the firewall for incoming TCP connections on your specified port
How do I also add user count to this?
Do you guys know what the e-date server link is
You can't post user count.
can you make the name of who vote come out?
:v
how to gamble?
@dull thicket https://docs.top.gg/resources/ratelimits/
Thanks! Also, I saw that u use use a post request to the api to update your server count of your bot. Are there ppl who lie about how many servers their bot is in?
some they do but we're moderating it too. Also if you're using js you can use a npm package called topgg-autoposter which posts the data automatically every 30 mins
python has that too
why this dont work
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express()
const webhook = new Topgg.Webhook('...')
app.post('/web', webhook.middleware(), (req, res) => {
console.log(req.vote.user)
bot.channels.cache.get("795394146143043584").send(`<@${req.vote.user}> has voted for me on top.gg!`)
});
app.listen(1251)```
why don't you do a ratelimit system like discord does? it's mutch more easier
posting to the API https://docs.top.gg/api/bot/#post-stats
From you posting it
are top.gg vote webhooks tcp or udp?
also im confused about this
do i need to confirm ive received the webhook or something?
Yes, you need to respond with a 2xx HTTP response, otherwise it's going to keep re-sending the webhook
I would assume TCP, but I can't say for sure
ok thanks
Most likely TCP
https://docs.top.gg/
Check the API page for whatever lib you're using
its good ?
Does it work?

well I have this error when I install a module
but I don't know where to install this simpleText
I reinstall Node but nothing changes
does top.gg webooks allow query ? like:
https://domain.com/test?usage=vote
indeed they allow it
bereload page
I recorded it again, it didn't happen
-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 do you listen on many auth keys?
error 401 means what?
Unauthorized
yea and that means?
The request probably had some authentication headers that were incorrect, such as a token
okok
just ping me, when somebody has an anwser
it's in your package.json so you have to remove it cuz it tries to audit it everytime you npm i
thank
you
but
in the website
i don't view the stats
x/
okay, stats take a bit to update visually so just wait a few minutes and try again probably
Okay x)
in the log
i don't view
the message
ht++
Yo-yo
-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.
YEET
read above
The Test Webhook button doesn't seem to be working, for some reason I'm seeing nothing on my server logs. When I manually test my webhook from another source I do see server logs
Well that's the issue, there is no error, I'm just not getting any confirmation that any request is passing through. When I do curl -X POST https://my-web-address I get confirmation that a request was received, but not when I click Test when providing the exact same web address as my webhook URL
It used to be, but I just installed nginx to port forward for me
It is, I spent a few hours getting my certificate set up this morning
https://messagescheduler.xyz is the base web address
If you click there you can check my certificate, all the root page says is "We're live!" as confirmation that the web server is working
so the test button doesn't work, but a manual request does?
also don't forget to acknowledge the request with a 2xx to avoid pain later on
Right. At the route I have set for webhooks, I immediately have a print('topgg post request received'). That print statement triggers when I manually POST to the full address, but nothing prints when I click Test
I had the whole setup working two days ago with my old address, I'm just having problems now that I've moved addresses
Does it just take a day or two for my webhook URL to update when I change it? That's the only thing I could imagine. Although the old address should technically still trigger the same POST listener
make sure to press save before testing 
Yeah I have, and closed/reloaded the page multiple times
bot id?
One moment let me try something real quick
810918366045798451
Yeah still nothing
Unrelated but I also noticed that when I try to update the number of servers the bot is in from the website, it isn't saving anything I type even when I click Save on that page
Using https://apitester.com/ with {"user":"324273473360887808","isWeekend":false,"type":"test"} as the data it's triggering everything I need it to. I just don't know why the Test button on the website isn't working
lemme test it on my own bot, one sec
nah test vote goes through fine https://i.imgur.com/ff9sHpa.png
What if you change the URL?
I'm wondering if maybe it isn't saved correctly on my bot or something. Because I'm directly copy/pasting my URL from the bot webhook settings page into https://apitester.com/ and it's working fine on apitester but not top.gg
Let me try another browser or something
that's why i asked, i thought i was able to check if it saved properly
didn't know me as a mod can't siteperms-wise
can you dm me the webhook url if you're comfortable with it? I'll try setting it on my bot even if it doesn't sound smart to begin with
just to confirm it isn't a bot-page specific issue
Hello, how may I make it working? I got told to come on this channel
Yeah let me try this other browser first but then I'll do that
-servercount
@fallen mirage
To have your bot's server count displayed on DBL, please read the documentation on server/shard posting.
thank you, let me read it
I'm not sure about how it works, not even sure I'm at the right place
I know
Sorry but.. I'm lost
@tardy junco went something through?
Nope, nothing
really weird
Still working at apitester with the exact address I gave you though
Yeah
Well. I guess I'll take a break and come back later and see if I somehow missed something obvious. Thanks for trying, feel free to @ me if you think of something I should try
I've never used any API, not sure about how it works
Is this even the right place? https://docs.top.gg/api/@reference/
Hmm ok, I feel like you won't answer. I'll come back later. Have a really good day / night.
Just wait for someone who can help
It's ok, don't worry. + I'm going to sleep soon
Hahah well, I changed my address back to the direct IP address + port and it's working again. I guess I'll just leave my webhook URL as the raw IP:port even though the domain name is working fine on apitester
@rain heart sorry for the ping but
I'm using the top.gg API but when someone votes for my bot, the user ID appears but I want the name to appear
how can I do that?
what method did you use?
autopost?
Real esport 👀
oh
Ya
You should post it using api
Do u use node.js or python?
Anyone help me in post server stats to my bot
js
posting server count
Thanks Alot :D
The autoposter will post after 30mins from when the bot was started?
is adding members to development team still broken?
What coding language is the #topgg-api in?
oh yeah sorry
np, thats just how api's work. there is no language. that's true for every rest api, its just an interface.
okay thanks
Would this work if i have made a function for my token
API is the function
variable*
You're passing it as a string
in the screenshot
but yes it would work with a variable of course
-api
who's the one developing dblpy again? i cant remember
wanna know when the autopost's gonna be fixed
@sullen nymph is
I mean, there's nothing stopping you from cloning the repo from GitHub and using that until I officially releaes v1.0
cc @steady delta
releaes
does the ratelimits work on this?
and if i pass it i get blocked for 1 hour
ok so is there a webhook tameplate cuz i can't find any in the github
im already there
but there is no template
video would also work
"If you need help setting up webhooks inside of your bot don't be afraid to ask in our discord server in the #topgg-api channel." - help?
i already asked this
i want a template or video if possible (for webhooks)
or some way to use it with C#
Does anyone know why this is not working?
TOKEN2 is a variable
For the token
Is it because I am passing it through as a string?
possibly
That is a string yes
What should I data type should I pass it through
If I am using a variable
for the token
String
string?
yeah
Yeah my variable is Token2=token>
Oh okay
if you have the varible token2 then
replace 'Token2' to Token2
Sorry im new to python
im not a python developer but ik how strings work
yeah it is just that im New to coding
-api
No
anyone have an issue with the webhooks firing twice?
for the votes
it just started happening for me in the past few days, doesn't happen always
my webhooks dont fire at all
i don't have a website how can i use webhooks?
You don't need a website, you can set up a webhook listener and use the public IP of the machine you're running it on
so its like sending the request to my network and receive it from my pc?
It will send the webhook to your network's IP through whatever port you specify
Does my token need to be in a string so like "<token>" or '<token>' I am no longer using a variable
If you're not using a variable, yes, you need to surround it with quotation marks to make it a string
okay thanks
Do I only need the Authorisation and The import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
for the servers counter
Yes
Okay thanks
Sorry I should be fine after this You know the Authorisation does that come before or after the python code
So the authorization is atter the python code
thanks
this
?
You don't need that with dblpy
oh okay thanks
dblpy sets the self.token that you pass as an Authorization header
This is for help with the API, move to #development
How do I geo locate
Geo locate?
@night ingot help me please
I told you to move to #development
Ty
How do you do that? Is it just commands.cog in the brackets?
@commands.Cog.listener()
Like this right
It's an instance method, shouldn't it have self parameter? 
Yes
I'm currently going over the Python library documentation on the docs repo to rework some stuff
I have gotten this message " * Serving Flask app "" (lazy loading)
- Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead."
Is this meant to happen?
Yeah
Are you using keep_alive
yeah
Will the API still work?
Is there anyway i could check
I am guessing it is Because of the Use a production WSGI server instead.
I might just get repl "hacker edition"
True
@kindred walrus I forked the nodesdk api for top.gg
When I add it to replit (using it as a webhok)
it gives me the error.
Is replit compatible with TS?
yeah, why wouldnt it?
you do know TS doesnt run anywhere right?
you CANT run ts
you need to transpile it first
either tsc or ts-node it
@vocal robin

Perfect! Newbie in ts, thanks a lot
is anyone else having issues with double post requests?
I checked my logs, and it shows some people vote, and it's showing 2 different servers
but it's not happening all the time
just randomly
and it started about a week ago
when the update happened I guess
yeah probably another server using your webhook
okay have it installed, and how do I begin the comply process?
#development message its having the errorr, bc I did not comply
@kindred walrus Cant I theoretically compile the full top.gg libary to js?
Use threads
Just curious if anyone has been able to get voting done with sharding and if so how they did it 😅 I am kind of too stupid to solve it
compile*, not comply
like i said, you use TSC or TS-LIB to run ts files
why would you to do that?
I get a blank response:
Url: https://top.gg/api/bots/$clientID/check?userId=$authorID
type: voted
Message sent: Authorization:eyJhbGciO...
Are you reading the response as JSON?
yep
What lang are you using?
js
ok...
Just got this from the AutoPoster API
TopGGAPIError [Top.GG API Error]: 429 Too Many Requests
at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Api.postStats (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:96:9) {
response: '<!DOCTYPE html>\n' +
'<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\n' +
'<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->\n' +
'<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->\n' +
'<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->\n' +
'<head>\n' +
'<title>Access denied | top.gg used Cloudflare to restrict access</title>\n' +
'<meta charset="UTF-8" />\n' +
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n' +
'<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />\n' +
'<meta name="robots" content="noindex, nofollow" />\n' +
'<meta name="viewport" content="width=device-width,initial-scale=1" />\n' +
'<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" type="text/css" media="screen,projection" />\n' +
'\n' +
'\n' +
'</head>\n' +
'<body>\n' +
' <div id="cf-wrapper">\n' +
' <div class="cf-alert cf-alert-error cf-cookie-error hidden" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>\n' +
' <div id="cf-error-details" class="p-0">\n' +
' <header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-15 antialiased">\n' +
' <h1 class="inline-block md:block mr-2 md:mb-2 font-light text-60 md:text-3xl text-black-dark leading-tight">\n' +
' <span data-translate="error">Error</span>\n' +
' <span>1015</span>\n' +
' </h1>\n' +```
' <span class="inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed">Ray ID: 6387103e58800e4a •</span>\n' +
' <span class="inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed">2021-03-31 05:09:04 UTC</span>\n' +
' <h2 class="text-gray-600 leading-1.3 text-3xl lg:text-2xl font-light">You are being rate limited</h2>\n' +
' </header>\n' +
'\n' +
' <section class="w-240 lg:w-full mx-auto mb-8 lg:px-8">\n' +
' <div id="what-happened-section" class="w-1/2 md:w-full">\n' +
' <h2 class="text-3xl leading-tight font-normal mb-4 text-black-dark antialiased" data-translate="what_happened">What happened?</h2>\n' +
' <p>The owner of this website (top.gg) has banned you temporarily from accessing this website.</p>\n' +
' \n' +
' </div>\n' +
'\n' +
' \n' +
' </section>\n' +
'\n' +
' <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">\n' +
' <p class="text-13">\n' +
' <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">6387103e58800e4a</strong></span>\n' +
' <span class="cf-footer-separator sm:hidden">•</span>\n' +
' <span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 66.11.118.47</span>\n' +
' <span class="cf-footer-separator sm:hidden">•</span>\n' +
' <span class="cf-footer-item sm:block sm:mb-1"><span>Performance & security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>\n' +
' \n' +
' </p>\n' +
'</div><!-- /.error-footer -->\n' +
'\n' +
'\n' +```
' </div><!-- /#cf-error-details -->\n' +
' </div><!-- /#cf-wrapper -->\n' +
'\n' +
' <script type="text/javascript">\n' +
' window._cf_translation = {};\n' +
' \n' +
' \n' +
'</script>\n' +
'\n' +
'</body>\n' +
'</html>\n'
}
I've got the same thing
@full ruin what is your post interval
oops soz i got it fixed. I had to regenerate my api token.
should've mentioned this sooner, soz for the late update.
how to do a voting command in discord.py
and checking whether the person has voted
get_user_upvote in dblpy or a manual GET request
I changed my webhook url and some people still have duplicate requests
I used ts-node? (did not worked) or should use something else?
is that for me?
is it supposed to be doing duplicate requests?
giving this error rip
tsc, transpile it first
also this means your path is wrong
const Topgg = require('./top/src/index.ts')
hmm, thats suspicous
thats relative path not absolute
its relative to where your source folder is
How do I do the voting command in Discord.js-Commando. The faq doesn't show anything about it for javascript.
ok yeah this guide doesnt help much for explaining how to actually build the commands. i think ima just gonna forgoe this.
Yeah unfortunately their documentation is a tad garbage so it's not very useful when trying to utilize something that isn't part of discord.js-commando sadly.
hmm i think i know a simpler way to do this actually. without needing to utilize the api at all lmfao
I think this should actually work fine for what I'm trying to get:
const { MessageEmbed } = require('discord.js');
const { Command } = require('discord.js-commando');
const config = require('../../config.json')
module.exports = class BumpCommand extends Command {
constructor(client) {
super(client, {
name: 'bump',
aliases: ['upvote'],
memberName: 'bump',
group: 'other',
description: "Vote for TwitchBot on Top.GG"
});
}
run(message) {
let embed = new MessageEmbed()
.setTitle('TwitchBot')
.setDescription('Vote for TwitchBot.\nYou can vote once every 12 hours.')
.addField('Top.GG', '[Link](https://top.gg/bot/' + config.topgg_client_id + '/vote)', false)
.setThumbnail(this.client.user.displayAvatarURL())
.setColor('RANDOM')
.setTimestamp(new Date().toISOString())
.setFooter(this.client.user.username, this.client.user.displayAvatarURL())
message.channel.send(embed)
} catch (err) {
console.error(err)
channel.send(
'...'
)
}
};
alas my error handler is weird to discord lmfao
I mean, if it works
yip should be fine 🙂

yip, works perfectly 🙂
You can either post via individual shards or just send a list where each element is each shard's guild count
Oh you're the guy from yesterday
I'm not joining the server you sent me in DMs
You can perfectly work with just screenshots
What checks
wait
const AutoPoster = require('topgg-autoposter')
const Topgg = require(`@top-gg/sdk`)```
it says @top-gg/sdk or topgg-autoposter module not found idk why and i cant fix it!
install it using npm
i allready did that
you probably mistyped the names then
i did not mistyped the name
run npm i @top-gg/sdk topgg-autoposter just in case
if it's works
well its hosted on heroku and the files are on github
then add those to the dependencies property in the package.json file
Hello everyone, it is definitely the most asked question that I am definitely asking here. Nevertheless, I put it up, how is that done with the vote. I have a global chat bot that communicates via several servers. And would like to use it in the chat to always show who is voting. Who has what in stock? My bot is written in Python 
I know the docs are there, but this time I really don't understand what to do 😄
Okay! Sorry
So if I have multiple shards (say 3), do i post {server_count: [1000,1000,1000], shard_count:3} ?
or do I need to pass shards too?
that would post your server count to 3k as far as i know
if that's correct
but yes it would do so
Ight, its just internal sharding, so I guess its better to pass shard_count rather than filtering servers per shard

Does anyone know why this is not working? have put in my token I have took it out so No one can see it in the screen shot
I have*
Does it give you any errors?
no
Did you try leaving it on for a while, since it only posts every 30 minutes?
I have done some changes to the code
ima wait a other half an hour
wait do I need Privileged Gateway Intents
For posting the server count? No, you don't
Oh okay thanks
Privileged intents are only presences and server members
Okay ty
thats all the code I need right for the server count
As long as you're loading that cog, yes, that should be all
So like this?
That event isn't absolutely necessary, it's just there to tell you that it actually posted the count
it's the stuff in the init method that sets up the autoposter
What do you mean by that like this
Well, that's just a description of the class, which also isn't necessary.
This is what matters
Then it should be fine
Missing Permissions
req.vote.type will be test
ah, sometimes I should turn on my brain , sorry for asking lol

Can I know, who ran the test?
in req.vote?
or in the query?
req.vote
See your own screenshot
the user id on req.vote.user is not my user id
I reckon it's top.gg ID

I want to change a thing in the nodesdk libary
the libary has "this.authorization === req.headers.authorization"
Although I want to allow to listen to many auth keys
I forked the repo
Solved:
but I have no Idea how to compile it for node.js since its typescript
I am using tsc
compiling it gives this error
Does anyone know why this is not working, it is saying i do not have permissions
It is this token right?
Hello, What is the "webhookAuth" ? It's my password ?
@jaunty plank here as well
hek
You need to set up your own webhook listener with whatever language you're using
how about the authoration?
setup a webhook on a server you mean?
You can put something in that field so that you can make sure the webhook comes from Top.gg. It's not required to have it though
about the webhook thing im confuzed
the webhook url
is it a channel webhook or what
You don't use a discord webhook, you need to actually code your own
ou ight i can do that
ty
Yes
No clue why it is telling me why i do not have permissions
The forbidden error you posted before is seemingly an exception with Discord, not Top.gg
And it comes from the on_message event
DBLWebhook {
_events: [Object: null prototype] { ready: [Function], vote: [AsyncFunction] },
_eventsCount: 2,
_maxListeners: undefined,
port: 5000,
path: '/dblwebhook',
auth: '5000',
_server: Server {
insecureHTTPParser: undefined,
_events: [Object: null prototype] {
request: [Function: bound _handleRequest],
connection: [Function: connectionListener],
listening: [Function]
},
_eventsCount: 3,
_maxListeners: undefined,
_connections: 0,
_handle: TCP {
reading: false,
onconnection: [Function: onconnection],
[Symbol(owner_symbol)]: [Circular]
},
_usingWorkers: false,
_workers: [],
_unref: false,
allowHalfOpen: true,
pauseOnConnect: false,
httpAllowHalfOpen: false,
timeout: 120000,
keepAliveTimeout: 5000,
maxHeadersCount: null,
headersTimeout: 60000,
_connectionKey: '6::::5000',
[Symbol(IncomingMessage)]: [Function: IncomingMessage],
[Symbol(ServerResponse)]: [Function: ServerResponse],
[Symbol(kCapture)]: false,
[Symbol(asyncId)]: 3
},
attached: false,
[Symbol(kCapture)]: false
}
Webhook running at http://0.0.0.0:5000/dblwebhook```
is that good?
im using a guide from google since im dumb
how do i get the api
you need an approved bot to get an api token
My servers count is bugged, the bot is in 91 servers and it shows it is in 70.
It only updates every 30 minutes
It's been like that since a month or so
if it doesn't update properly then there's something wrong with your code
make sure you're posting correctly
import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post(self):
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
This is my code
I replaced dbl_token with my token
does it still say "Server count posted successfully?"
because this can only be the cause of bad code as posting works perfectly for me
As I said, it was working weeks ago
i mean if your logs aren't saying anything, then it is your code
import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = "token"
# Autopost will post your guild count every 30 minutes
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post(self):
channel = self.client.get_channel(781665482033725450)
await channel.send("Updated servers count on top.gg successfully")
def setup(client):
client.add_cog(TopGG(client))
@rain heart I changed it to that, I believe this would be more recognizable.
well are you getting the message that it was successfully posted?
Will it wait for 30 minutes after last post or after running the bot?
30 minutes after running
I didn't get anything until now, I just restarted the bot
Okay I will wait for 30 minutes then let you know
Basicly i have a script for an html website to fetch the api url then return a json file to get and use the server count, i am getting a 401 error in the console why?
401 means unauthorized, you probably have the incorrect token in the headers
How can i have the token in a html website without showing it though sorry for this question
You'd probably need to use php, but I'm not too sharp of a web developer so there might be another way
Okay, thank you for your help😄
You forgot Cog listener decorator for the guild post event
I thought it's not needed since the documentation didn't have it-
Nah my dumb ass forgot to include it
You also forgot to include a self in the on_guild_post function ;D
Yup
In the self part I was like "Oh maybe they just forgot, it's okay" but in the event itself I thought it doesn't need a decorator because a whole decorator? xD
Anyways, hope you have a good day!
And thanks for the help!
didn't think twice when writing that example, my apologies
from discord.ext import commands
import aiohttp
import dbl
import discordlists.py # imports (must be over the code)
class discordbotlists(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = 'api-token' # botsfordiscord
self.token2 = 'api-token' # discord bot list
self.dblpy = dbl.DBLClient(self.bot, self.token2, autopost=True) ## passed in the api token of the discord bot list bot
self.api = discordlists.Client(self.bot) ## creates an instance of a discordlists client
self.api.set_auth("botsfordiscord.com", self.token) ## passed in the api token of the botsfordiscord bot
self.api.start_loop() ## loops every 30 mins
def setup(bot):
bot.add_cog(discordbotlists(bot))
is that sufficient for server count on top.gg?
please tell me help us
@sullen nymph
Yes
this code is right bro
for top.gg
guild count in my bot
@sullen nymph
It should work
@sullen nymph
self.token = 'api-token' # botsfordiscord
self.token2 = 'api-token' # discord bot list
where i get
api token
See last pinned message
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = "<my dbl token>"
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
Should this work?
yeah I have posted it, just waiting
30 mins
@acoustic lark did it work?
no
ima check for errors
these are all the errors
For some reason my token refreshed Ima wait a other 30 mins
I put in the new one
The error has nothing to do with you posting the guild count, and tbh you don't need to wait for 30 minutes, because it tries to post before sleeping for 30 minutes and keep repeating it. I'd suggest you test it by manually calling the post_guild_count method because the loop suppresses any HTTP exceptions.
So just do post_guild_count()
yesn't
async def _auto_post(self):
await self._ensure_bot_user()
while not self.bot.is_closed():
try:
log.debug(f'Attempting')
await self.post_guild_count(shard_count=self.bot.shard_count if self._post_shard_count else None)
event_name = 'autopost_success'
log.debug(f'Dispatching {event_name} event')
self.bot.dispatch(event_name)
except Exception as e:
event_name = 'autopost_error'
self.bot.dispatch(event_name, e)
await asyncio.sleep(1800)
@restive otter 👀
noice, when is v1 rolling out?
can anyone help me in java
read the docs
is it possible to make "on vote" in node.js
thanks
is that in the webhook section?
alright thank you
where i can find authorization for Topgg.Webhook()
You create that yourself
hi
1 wait pls
I made an Economy bot and it is uptime but how do I get it confirmed?
-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.
-faq 1
ok sorry
how can I tell when someone votes for my bot on TOP.GG and the bot responds not even a text channel that TAL users voted for it?
how do i send a message to my server when someone votes for the server
This/next week hopefully
Probably next week since I've got some college work piled up 
the docs explains it for bots, how would you do this for a server
how 2 top gg webhook
With the uh, autoPoster thing
What are you meant to put in place of "client"?
I can't figure out if you just leave it as client
dblapi.js was deprecated. Am i able to still use it or not?
Preferred that you use top-gg/sdk in case a breaking change happens
-help
-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.
Does someone know, how to make a "voting reward" thing in JS?
All the videos are deprecated
https://docs.top.gg is the best you could get, or wait for someone who may know in your programming language
c:
hi, i was coding something to send a message when someone vote for my bot and i was wondering how can i "try" my code
why the website url doesn't disappear after i refresh when i remove it
@ember swan test button in webhooks section
thanks you !
also, if i dont have a website to post the Webhook what can i put in the "Webhook URL" section ?
yes
yes thats what im talking about
so i do something like this ?
it should be only /dblwebhook
ok thanks
I sent you a DM
o
mine is /topgg-bot
/dblwebhook is for example
and is this correct ?
or the ip for their webhook
yup
How can I get DBL api?
ok its what i have done
Ohk thanks
after i should have an id in my console ?
yes
why have i nothing x)
maybe the port isnt forwarded?
forwarded ? (sorry im french) x)
What do I have to do after going to My Bot's webhook section for DBL api?
@willow spindle
Read it

talk english in here
what's up?
sorunu çözdm
-notr
İngilizceden başka dillerde sohbet etmek için #general-int kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
Hey does anyone know how to setup the how many servers your bot is in?
pretty confused.
I tried testing the webhook but i didnt receive a POST req, i tried 5 times in the past 30 mins and havent received anything. Can someone please help
nvm it worked now
idk how there was such a long delay
thanks tommyinit
how to show server count
show server count glitch ?
same problem ;-;
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
where can i get dbl api key for my bot ;-;
see last pin
okay, ty
i still not know how to show server count
Hi, good afternoon, I'm testing the webhooks but I don't receive any post request... I have been trying some hours, but I hasn't received anything; Can someone help me?
have you pressed save before using the test button?
make sure it isn't a discord webhook, as we don't support them
-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.
wtf was that
where do i do cmds
-starboard
-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.
change channels though, thanks
what exactly is the problem?
so i was looking at the documenttation and for the on_dbl_vote event, do i get user information. such as who voted? or do i only recieve vote counts
-help
hey, could i get some help setting up a webhook 🙂 my 2nd bot just got verified\
┬─┬ ノ( ゜-゜ノ)
I'm still having issues with the webhooks being sent multiple times. Here are the logs showing I am responding with 200
- - [02/Apr/2021:19:48:04 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
- - [02/Apr/2021:19:48:04 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
- - [02/Apr/2021:19:48:06 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
thing is, I been using the same code for the webhooks for the past year
and it just started doing it once they changed it
like 2 weeks ago
and it never did it once before up until after the 18th
hi webhook what should i write to url
Bruh are you kidding me I had to do http bruhhhhhhhhh
ı do not understand
how i post shard count to topgg?
Hello, does anyone know how to use POST REQUEST to make a vote checker on the site? I wanted to give prizes to those who vote for my bot here but I don't know how to do that.
how do i setup webhook??
javascript
i have tried to use the manual posting code for python for the server count and i have done it right but it has not worked can anyone help
i have used this exact code and i have put my token in and even tried re generating multiple times and have also waited over an hour just to make sure
there is no error
and the code is above lmfao
it dosent work
there is no error or i would be able to fix
its the exact code from the docs...

wtf isnt it working
i have loaded the cog
everything is fine
lmfao
i know
And you're sure the token matches? There's an issue where sometimes it won't save if you regen your token
i have waited hours
yes
i have tried waited an hour
regened the token
put the new one in
waited another hour
it dosent work
...
its not my first day coding i know what i am doing and this shouldnt be happining
I'm fairly certain the on_guild_post needs an event listener decorator, it's just not in the docs. But that shouldn't affect whether it actually posts it or not
does it need a decorator?
i dont think it does
acctually it does
but thats just to print it
it wont effect if its posting
I know someone else had a problem where their new, regenerated token didn't work, despite it showing the new one on their page
...
i have tried it multiple times
re generating
ok
can you send some example code
damn
its so easy
i know js
no
js and py are so easy
...
indentation
yeah
bru
spaxter can you send me some example code
for calling the api to check
I'll see if I can find something
ok
bc i dont know how to do it with topgg
everyone i know has problems with this api
¯_(ツ)_/¯
yes
but this api is weird
atleast in py it is
its not in js
but its still buggy in js
LOL
you havent had problems with it
your lucky lol
everyone i know has problems with it
js and py coders
¯_(ツ)_/¯
i mean i get it but its buggy
it just needs some work
¯_(ツ)_/¯
ye
thats wut i said lel
hopefully he comes back with something good to call the api and test the key
...
no.
this api is just confusing in py
ask anyone that codes in py
i do
the code is perfect
ive never had problems with any code from the official docs of anything LOL
¯_(ツ)_/¯
yes
ik i dont know how to with this async wrapper
and the docs dont explain
¯_(ツ)_/¯
no.
let me look again
-api
i have
but it shouldnt be this hard
ik
the library on GitHub
yup
where did spax go lol
Sorry that it took so long, you can try it with this
import requests
url = 'https://top.gg/api//bots/your-bot-id/votes'
auth = {"Authorization": 'your-token-here'}
response = requests.get(url=url, headers=auth)
print(response.status_code)
of course replacing your-bot-id with your ID, but I'm assuming you already know that 
yup
thx
ima try
so for the auth i put the token right
yeah @night ingot
Yeah
it says 200
Well, then you know the token is correct at least
but I have no idea why it wouldn't post
Yeah, 200 means OK
Which in this case, is a little troubling
should just be @commands.Cog.listener
lemme see if it posts but topgg
yep thats what i thought
ima do that and give it 30 more mins
and see if it prints
Yeah, if anything it might print an error if it fails
@night ingot
sorry, @commands.Cog.listener()*
lel
@sullen nymph sorry for the ping but I'm at a loss
Hello i use the python DBL API for the a VOTE Check on my bot site on TOP.GG...
I use the command : get_user_vote(user_id: int) to check the vote...
But if i test it, then i gives me every time FALSE back....and i voted. So...it is buggy ?
AFTER 5 MINUTES ???
I think it is realtime, when voted ?hmm... :/ okay...thx for the tip.
Sure ? The 5 Minutes are over.. 😂 And its False... 😦
absolutly not. My Code is running fine.
And it works without any errors or something. The only thing is the vote status.
The Top.GG page also does not load the values correctly.
I had 4 votes...of which I have voted 2 times with 2 accounts,...so I should then have 6 votes.
But suddenly have 8 VOTES at my bot although I have no Voter users....this is extremely strange the Internet page...
If I then reload the page, I have again 4 votes without my 2 new votes. I come on it just not clear...
i use this...
hook = dbl.DBLClient(token=token, bot=bot, webhook_path=path)
and ctrl+f5 dont work...
is use it... 😄 and it works. 😄 😄 😄
But the VOTES are not processed...
uh....wait a second i take a look. 😉
im on it... 😄
@restive otter you forgot the self parameter
where @sullen nymph
In your on_guild_post event
okay,...i give up for today. 😄
i use the same codes in 2 scripts....and one of them works, but not the other...strange strange strange...its late today. but thx for help, im sure that i will get it tomorrow.^^
can you show me an example
YES I HAVE IT ! 😄
The problem was, that i use 2 bots in one script....for testing and so on...
And in the test mode i use a OTHER Token...so the bot dont see whats going on on top.gg because the bot istn on the website.^^
Now all its running,... :>
Hey, what does this error means?
object Lock can't be used in 'await' expression
Yada yada an error that will be fixed in v1.0
Oh, I need to downgrade to python 3.8, right?
Yeah, unfortunately
Is there some kind of system to avoid users taking advantage of this?
Like, Instead of guild count my bot just posts "5000"
One message removed from a suspended account.
Like, when I post the server count
Instead of client.dblpy.guild_count
I just do "1000"
No real system other than... well, user reports

damn
how do I use the api
the bot has servers
right
to display the server
on top.gg
what do we do?
What library do you use?
djs
Feel free to use the @top-gg/sdk package
ok lemme look
can we later on fetch the guild count from top.gg to use it on the webiste
?
what
like, after i successfully adding the server count to top.gg website
cani fetch it again using top.gg api?
like can we get the server count of the bot from the top.gg api after we pushed it from @top-gg/sdk package
Yes, but why
Did you waited 30 mins?
it takes 30mins for the first push?
Yes
how do I make it when somebody votes it sends to the webhook
@restive otter
why 5 servers when i have 330?
const Topgg = require("@top-gg/sdk");
const api = new Topgg.Api(config.toptoken);
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size,
});
}, 1800000);```
I recommend using the top.gg autposter package btw
lol





