#topgg-api
1 messages · Page 1 of 1 (latest)
How can i get the url of vote count?
Error: Unsupported client
??
autoposter
nevermind
i put the code in the wrong bot
wait
no
its still error
the client is meant to be the bot client?
yes?
Try ):
The response will contain a JSON object that has two values interesting for you:
"monthlyPoints": Votes of your bot for the current month"points": Total votes of your bot
cc @magic canopy
Tysm i have do it
Our suggested method is storing vote data in a database. That data can be received from webhooks.
So How? Can you post code?
Is it for V12?
does the site take a while to update shard count?
cause mine said it posted just fine but isnt showing on the bot page lmao
Seems to have posted fine?
Ooh weird haven't updated on my end.
So server count will always be half of what it is because it's split up into two shards
you send a server count of each shard and it totals them
I am using java to develop, and i wanted to incorporate the top.gg API via gradle. Their examples indicate using
compile 'com.github.DiscordBotList:DBL-Java-Library:2.1.1'
but since "compile" is deprecated I used implementation. I resynced gradle, built the project without problems but I cannot use the api classes in my code (they appear as if I asked for an unknown class). ex. cant use the "DiscordBotListAPI" class.
deleting cache/restarting ide/resyncing gradle did not fix the issue
I don't think that code has anything to do with versions (That's supposed to be a placeholder not copy paste code)
is there a tutorial for vote locked commands?
-pins
@glass heron
No like is there a video tutorial?
Yeah that i see
shouldn't be hard to implement based on that 😄
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('auth') // add your Top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.listener(vote => {
// vote is your vote object
console.log(vote.user)
}))
app.listen(135) // your port
What did i do wrong?
💀
Bro
Is it not working?
Any error
Specify that
I can tell you several things that are wrong, but cant specify anything without you posting errors
I'm kinda confused on what url I put in the webhook url section
Wherever you want those http requests to end up
Your vps / pc, an url, some serverless stuff etc
normally it looks like https://YOUR_IP:YOUR_PORT/yourroute
example: http://10.10.10.10:5000/dbl
Aah alright so the full thing including the /dbl part
yea
Yeah that worked now ty!
when i tried using maven(java) to import I got a cannot resolve error. could someone clear up the problem? I tried putting a random string instead in dependecy and i get a different error, could not find, so it is finding the intended maven import but unable to resolve when trying to get the topgg api.
Full maven:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>untitled</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.discordbots</groupId>
<artifactId>DBL-Java-Library</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</project>
refer to the pinned messages
does anyone have any python example code on how to give users rewards after they voted?
i was having problems with the versions in both gradle and maven, but tried the snapshot version with gradle and it worked! Tysm for your help
CLIENT.topggpy = topgg.DBLClient(CLIENT, 'secretheh', autopost=True, post_shard_count=True)
``` how do i make it post my full count, cause its like splitting up my total servers by 2 because i got 2 shards, instead of s howing over 1600 it showing ontopgg i only have 800
How do I get API authorization to read votes?
I find! Thanks
how do you get your ip and your port?
Your ip is your servers ip, if you're running off a service with no provided ip your url will depend on your host
If you're hosting at home it'll be you're public ip.
Your port is something you set in code.
whats the api for votes?
ohh i see
what do i put in place of /dbl?
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dbl", "password")
do i just keep it as /dbl?
nvm
No just not working whhen someone votes my bot nothing happen
There's a test webhook button
try it
Make it with web process
connect to the port heroku gives you
If I remember correctly you can get it through env variable
i did try all of that
the link is : https://myherokuproject.herokuapp.com:port/vote
is there something wrong with it
remove the port
also the route is wrong
in the ss I see /dblwebhooks
but here /vote
dblwebhook or dblwebhooks
idk whatever you put in your code
same
but when i used the port in the url i didnt get this error + when i vote nothing happens
https://github.com/top-gg/python-sdk Where do I find the version for servers, since this just shows examples and stuff for bot votes?
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
top.gg/servers does not have an API
Hello
you require API access to do any API things, meaning you'll need an approved bot
Search it I guess
show code
I did solve it
use webhooks
Yeah, your best bet is storing that information
Alr
Bye

well if you just need to check it one time
just call the api for it
i use webhooks only for logging votes and storing it because its better for my usecase
hi, How can I solve this error? TopGGAPIError: 504 Gateway Time-out
The site will have been down when it tried to post stats
Nothing you can do on your end
Ty
https://top.gg/api/bots/12345/check?userId=67890
The example response was:{ "voted": 1 }Is that how many times the user has voted? or just 1 and 0 to show if the user voted in the last 12 hours?
nvm ig, found my answer
how could I get the number of votes? I tried this but it's not accurate.
await fetch(
`https://top.gg/api/bots/mybotid/votes`,
{
headers: {
Authorization:
"-",
},
}
)
.then((res) => res.json())
.then((r) => (r.length)); // here, this should be the result
1 if voted in the past 12 hours, 0 if haven't
ty
What do you mean with "not accurate"?
well, on the website
and on the server
let totalvotes = await fetch(
`https://top.gg/api/bots/mybotid/votes`,
{
headers: {
Authorization:
"-",
},
}
)
.then((res) => res.json())
.then((r) => (r.length));
await votesChannel.edit({name: "Votes: " + totalvotes});
uhh, I am trying to understand how are calculated otherwise
One user votes, so one entry is added - though in the frontend they're added
You could get them from https://top.gg/api/bots/905134681199104020
And get the monthlyPoints field, which is currently 101
so change the API request url to the one you provided me?
Yup, also no need of an Authorization header
and I should get a response like
{
{ monthlyPoints: 101 }
}
```?
Correct
thanks!
It will look like this: https://docs.top.gg/api/bot/#example-structure
Not an object inside an object
{
"defAvatar": "6debd47ed13483642cf09e832ed0bc1b",
"invite": "",
"website": "https://discordbots.org",
"support": "KYZsaFb",
"github": "https://github.com/DiscordBotList/Luca",
"longdesc": "Luca only works in the **Discord Bot List** server. \r\nPrepend commands with the prefix `-` or `@Luca#1375`. \r\n**Please refrain from using these commands in non testing channels.**\r\n- `botinfo @bot` Shows bot info, title redirects to site listing.\r\n- `bots @user`* Shows all bots of that user, includes bots in the queue.\r\n- `owner / -owners @bot`* Shows all owners of that bot.\r\n- `prefix @bot`* Shows the prefix of that bot.\r\n* Mobile friendly version exists. Just add `noembed` to the end of the command.\r\n",
"shortdesc": "Luca is a bot for managing and informing members of the server",
"prefix": "- or @Luca#1375",
"lib": "discord.js",
"clientid": "264811613708746752",
"avatar": "7edcc4c6fbb0b23762455ca139f0e1c9",
"id": "264811613708746752",
"discriminator": "1375",
"username": "Luca",
"date": "2017-04-26T18:08:17.125Z",
"server_count": 2,
"shard_count": 1,
"guilds": ["417723229721853963", "264445053596991498"],
"shards": [],
"monthlyPoints": 19,
"points": 397,
"certifiedBot": false,
"owners": ["129908908096487424"],
"tags": ["Moderation", "Role Management", "Logging"],
"donatebotguildid": ""
}
I think authorization is required 😅
Yep, all endpoints need auth
Interesting, works fine for me 
Can I be the dev of topggpy? 😌
Feel free to contribute to the project
Thank you guys 
It's open source
Ohk because i seen it discontinued
How can I contribute?
https://github.com/top-gg/python-sdk and make pull requests
Okh
what does certifiedBot mean?
You're logged in as user
I believe it's deprecated
They used to add custom url and stuff to good popular bots before
ah. alright
topgg backend open source when 
nevertm
😔
Documentation for @top-gg/sdk
Why vote so many times at the same moment?
https://prnt.sc/T4iNQLW25JSb
The webhook will be retried multiple times if your API does not respond quickly enough or does not respond with a 200 OK
I would highly recommend storing votes in a database and use that to dedupe votes to prevent duplicates
Okay thank you
how can i send a message after a user vote's?
Official Top.gg Node SDK. Latest version: 3.1.3, last published: 8 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 6 other projects in the npm registry using @top-gg/sdk.
how long does it take for the short desc to update?
Personally I recommend responding with 200 OK as soon as possible, to prevent the repeats
Oh yeah definitely.
The internet is known to be unstable, so even tho you may send a 200 OK instantly it may not reach Top.gg for any reasons
So the caching to dedupe is just to prevent retries from giving double rewards :)
Yeah that too ^
The same time your browser needs to clear cache
And for search even longer i guess
cuz they probably index things and they don't change often
Can I get my top.gg token before my bot is verified?
No
So I can post my bot stats to my page?
Why do you wanna show server count if no-one is able to see it yet
Also if you want to try out other api endpoints and features besides bot stats
You can just log in top.gg with your browser
And try them out then
The user token works pretty much same for other endpoints
Edit: They don't have tokens but use cookie header instead but it still works
I was looking to get the code working prior to the page going live so that when my next bot update goes to the main branch and pulled down to the production server the bot starts sending stats right away. But thanks for the advice.
JSON structure is pretty easy, you can already write the code quite easily
Yeah I was being on my game and wanted to get the top.gg link working right away. I guess I will work on getting he website and php portion of what I want to do sorted instead as that like said above uses user auth.
I see php
I leave chat
bro
gays deserver better than php
So I cant set up an integration to work through my website to give users a role and a credit for use on things in my website and server per vote via the server vote webhooks until after my bot is verified?
hey guys, how would i send a webhook after someone voted on my server? Is there any way i can track that as i right now have no clue
Users can't even see your bot unless it's verified
How do you expect them to vote it?
No, vote for the server...
servers don't have tokens
you have to set up webhooks and do that manually
servers have only webhooks
yes but to listen for webhooks I need a token according to the docs
That's auth token
not top.gg token
You set that
Under webhook section
of the server
I am, like surely that says I need the token for the api?
This one
ah ok, is the authorisation sent as post or get?
How do I view the result of my webhook
im getting 0 errors on my server that it sends to, I just dont know if its working like it should be
If I remember correctly the test button was broken for a while
Try voting for real
Fix that and try 12 hours to test it again
In this meantime
Think about your life problems
and question reality
Oof
the test button should be working fine
It’s not. I’m getting nothing. I even made my webhook reciever email me the result of getting $_POST
So that's a feature top.gg actually fixed
you're 100% sure you've configured your webhook correctly?
webhook url(not a discord webhook) is set correctly, and the authorization.
It’s just a post request to the php page so I shouldn’t need some fancy webhook handler should I?
its just a post request yes.
the webhook site I run requires users to use the test button, I have quite a few people using it daily fine.
I tested using that too btw
too lazy to create a server and test
eww php
I removed the emails and credentials... for obvious reasons... But it sends nothing when the test server runs
is it possible the mail server doesnt work?
thats prolly why it aint work
Nah the mail server 100% works because it’s sending payment receipts currently and working.
Can't you try doing console.log or something similar?
To make sure the server received the vote
Its showing $_POST as empty
this is one of those moments I wish I knew php at all.
these two seem conflicting dont they?
https://i.imgur.com/I02f0Ct.png
does $_GET refer to a get request? or getting something.
or, what does
if ($_GET['action'] == 'vote') {
actually do?
oh I have another thing going to that webhook page ?action differs the response
my url on the top.gg website sends ?action=vote to make sure I am eecuting this code
So yet $_GET is a get request
how about using another route
?
only got one IP for this server
/vote
its not a pure url yet as its testing
so wouldn't be false every time?
if ($_GET['action'] == 'vote') {
and then the next if statement would never run.
but its a post request, so $_GET would be empty.
no
get refers to anything after a ? in the url
so localhost/webhook.php?action=vote
the get pulls down action as a get variable called action with the value test
just to clarify, you're not using localhost in the webhook url you put on topgg right?
just making sure, a lot of people make that mistake
thats working, it passes the get check, but the post check fails as $_POST comes as empty
can you log $_SERVER[REQUEST_METHOD] ?
to check if the request is a post
$_POST is entirely empty?
post is checking what part of the request? headers? body?
probably body
looking at php docs, it seems to be only for
application/x-www-form-urlencoded or multipart/form-data
https://www.php.net/manual/en/reserved.variables.post.php
nope
topgg sends the data as json
i just have the issue of, what is the authorisation logged as
nope post is empty
$_POST refers to all post data as an array of key and value
for form data right?
yeah but all post requests work like that... give me a second
I think thats a known issue
it should be, but I'm not a site developer
i also opened a ticket requesting to remove me from the team manually but you guys said it's not possible
i mean, you have my perms and it's my data after all and I want to remove myself from a team
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
If you want help for support related issues you got #support :D
You can as you said, follow up on your support ticket to continue talking with the person who originally dealt with your ticket
Need more advanced support?
Open a support ticket
sorted it, yes thats for form data... i needed to make a payload as a json_decode into a php object
let me know if you need anything else.
Will do thanks
Hi
Hi
Hey guys, how do I get the authorization token for my server that I published on topgg? I need it for t he vote event
you don't get it
you set it
From your server page
Go to edit > webhooks
Fill the auth and webhook field and click save
done
copy / save the Authorization value to receive vote requests
how can I make my bot vote reward system?
Like it send rewards to the user when someone vote?
you can use topgg webhooks. https://docs.top.gg/resources/webhooks/
so... bro how will this work then?
when user vote > server webhook send message in channel > my bot have to detect the user ?
like this?
topgg webhooks do not work with discord webhooks if thats what you're asking
Hm... so how can I make it? can you please tell me bro? Cuz I thought you are talking about server channel webhooks
making the webhook will depend on your programming language and host.
heres the general documentation. https://docs.top.gg/resources/webhooks/
i made my bot with discord.py
the link shown there redirect us to our bot page?
I want to do a little bit different thing tho... i want that my bot give reward when our vote our server
I think that's against tos
oh
You can make that
But IDK anything else
Make webhook for server
Then giv reward in bot
But how it's against? welp..
if it is then i will drop this idea and continue on bot votes
still i have to know about how to make it... i am checking those above links
I once asked xiuh (maybe xetra dunno) if it's okay I I gave reward if user votes one bot in another bot they said no (Servers didn't exist then on top.gg)
idk anything else
@jaunty plank might help
it depends.
if the two entities are tied together its fine. for example a bot giving a role in the bots support server on vote.
oh
can I ask here again if I get any problem?
yep! I might not be able to help much though, I dont know python.
bro from your links i took one example and put in my bot to test how that even works but it printed nothing
import topgg
#This example uses topggpy's webhook system.
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
# The port must be a number between 1024 and 49151.
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}")```
exact same as example to understand how this work
did you fill in your webhook url and auth?
yes
the Webhook 'i entered in top.gg' and password 'authorise that I entered'
@jaunty plank bro can you tell me a thing? how I am supposed to enter webhook in this?
example: my webhook is https ://test
I enter it like:
bot.topgg_webhook = topgg.WebhookManager(bot)dbl_webhook("/dblhttps ://test", "testpass")```
or
```py
bot.topgg_webhook = topgg.WebhookManager(bot)dbl_webhook("https ://test", "testpass")```
no change in it?
the url also needs to be a real url.
for example
http://IP:port/path
it needs to contain your ip, the port you set in code, and the path you set in code.
in the example here your port is 5000 and path is /dblwebhook
so
http://IP:5000/dblwebhook
with the ip filled in.
means the number we use in webhook.run will be our IP that we have to use in webhook?
the number in webhook.run is the port
/dblwebhook is just a path
a little bit confusing.
can you tell me an example?
wait... maybe I got it
let me try
hello top gg devs, is there any api to search bots by owners id?
Hello Dev's, is there any api to get if a user has voted the server or not?
wait that's for bots only
nvm
use webhooks
I never used it so i don't actually know how to do it, can you like tell me a bit on this?
it's basically a webserver
top.gg sends vote data as post request to that url
read the docs for more info
Also if you just want vote notifications
use this
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
no coding knowledge required
TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)
at Api._request (C:\Users\k-van\Desktop\CoffeeBOT V2\node_modules\@top-gg\sdk\dist\structs\Api.js:76:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Api.postStats (C:\Users\k-van\Desktop\CoffeeBOT V2\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 is the error reason
You need to provide a API token for that endpoint
I did error persists
Would you be able to show the code you use? Just hide the API token
@dim kettle
Where do you define dbl?
for total vote data
Are you setting the token in the dbl client?
const dbl = new Topgg.Api('Your top.gg token')
const express = require("express")
const app = express()
const Topgg = require('@top-gg/sdk')
const DBL = require("dblapi.js");
const dbl = new DBL(`${settings.url.topgg}`, '893949713047519273')
Dont use https://www.npmjs.com/package/dblapi.js
it has a massive deprecation warning
Use the official lib instead https://docs.top.gg/libraries/javascript/ and provide the tokens as shown in the example
Thats fine, that has nothing to do with what NPM lib you use
i think i solved it i will test
hello i need help how to activate the bot?
Nivatus
and also i need a list of commands
With the api can I do vote rewards?
yea
I'm going to learn to use it
prolly add bodyparser and use the json method

its not even saying its triggered either.
works perfectly fine when I connect to the endpoint for a post curl or by using a web browser.
o
Nope, and its server, not bot.
Exactly. The URL was correct. I changed and saved 3 times lol.
can u show the url u put 
No...
eh
I cannot. As the testing one I used is pure ip
just hide the ip 
with http before it lol
did u add the port after ip?
yup
Known discord bug for a year or longer now
kekw
Probably longer
weird.
easiest way to write for discord is like this
cloudflare dont care
http://ip:port
Still have the issue of why topgg webhook isnt triggering a get or post request on the express app.
The link parser just has this bug but who cares
half tempted to change it to .on('post')
Press the save button any time before hitting the test button
three times...
lol
Well maybe not functional atm then
Happens from time to time people complaining about this
The site is.. just an ongoing nightmare
yeah but I tried yesterday as well. Just today I am trying it as pure express request and response data, excluding the topgg webhook element from the code.
Because you DONT need it for the vote webhooks.

unless I am completely wrong and I need it 100% to handle any request from topgg webhook on express lol
No firewall blocking your requests?
fresh webhosting server
0 firewall and 0 cloudflare rules
thats why I wont share the IP.
No it’s not required
Glitter asked earlier
for the sake of being an idiot I am half tempted to use azure endpoint option to test. Ensure it isnt me.
Also no proivder firewall?
Mate the server is sat next to me going straight out on fiber connection.
Oh
Its a microserver.
yup its the spare build server I use for work. on the same outgoing 10gb/s down and up fiber connection work installed, just this is wired into the non-firewall ports on the switch
...

But still there’s a router in front
If I set up webhook endpoints on this connection to use a self made api to handle my works app build requests using express, I am pretty sure this one that has the same configs minus the port and ip, should work.
U tried an external tester tool to figure the connections works?
So requests can be send ?
Yes
I made my website send a request to it. And I used he US serer that hosts my site, not the UK one.
it worke
Then try a different browser logging into topgg (again) and try sending the webhook again
So the endpoint worked. I just wanna know what topgg thing I am doing wrong to make their webhook request not work.
Always hitting save before test button
ive tried 4 different devices...
No there aren’t any requirements to receive the webhook
It either works or not which means the site might have some issues (again)
You just need to confirm the request and respond with a 2xx status code
FFS, and I am testing this to help 3 people that have had an issue using the javascript endpoint to handle bot/server vote requests...
const express = require("express");
const app = express();
let port = 3000;
const util = require("util");
app.post('/', async (req, res) => {
console.log("post");
console.log(util.inspect(req, false, null, true));
res.send("We see you");
});
app.get('/', async (req, res) => {
console.log("get");
console.log(util.inspect(req, false, null, true));
res.send("We see you");
});
app.listen(port, () => console.log(`Webook listener running on port: ${port}`));
```the .send(messsage) is a 200 response
Could also be an issue with your IP which cf might have blocked temporarily if the test requests also pass cf
Not sure about that
But you can easily find out
shouldnt it be res.write?
I know it is... cus I accessed via my web browsser.
it showed the message and dev tools showed 200 res in headers
Did you try changing the request path?
yeah
To some@other path
ive done full circle lol
Well yeah, then a site issue or CF
is it cf proxied
Nope
You aren’t able to figure out temporary blocks
you are if you made a CURL request to it from a server in another country and it worked.
im shuttng it down and returning my webhook to the actual vote handler endpoint I configured on my php server
This helped a few people in the past
Oh server webhooks
Ok
Didn’t you say vote webhooks?
yes server vote sends a webhook
Ahh thought we were talking about bot votes
But anyways
Yeah seems like it won’t do the job for you today

I just voted for my server, and my php endpoint added the top.gg voter role you can see here.
So, what is the GD problem with the test button not triggering any requests lol
Just to clarify, it works when you vote just not test without changing anything?
Yes
Like I said that has been an issue for many people in the past
The PHP endpoint is reporting nohing when I send a test either.
so its not the express endpoint at fault.
When you've saved your settings are you refreshing the page then testing?
Try using a third party site to use the test button.
Full disclaimer this is my site, but it should work with the test button.
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
If this ^ works with the test button it's something on your end.
Charging $1 per IO
Did it work?
Because yet again connecting to my webhook listener pasted a get req to console and a curl post posted a post req to the console... the test button did nothing.
I mean he said earlier he tested external tools already, so it most likely is
Can’t you test it yourself?
I literally have a website hosted in america to test webhooks I make for me using get and post options lol
they make a request that I configure the sent items of.
Guess you won’t be lucky today anymore
res => 200; logged req to console.
Wut
Fixed it, nvm ^_^
Woo drunk?
Doubtful, woo is working.
Nah, I'm out of office
right so my listener is on http://<ip>:3000
i put that into the webhook url of topgg... saved, refreshed, pressed test and nothing triggered.
I go to my site that tests my webhook and sent one of get and one of post to the same url, it triggered no issue.
Sounds weird but do not reload the site , jut hit save then test
And, that's the documentation standard for handling get and post requests via express.
im doing nothing special or different to their docs other than logging the req instead of handling it.
Test votes using express work fine for me.
so I am 99.9999% certain its not my endpoint.
I can send you the url I used if you wanna try sending a vote for me...
You seem trustworthy lol
0 auth needed rn
You're using the js lib?
No
rn im just logging the req from express .post()
I am trying to make it handle without the topgg api rn, then use the API
For anyone searching this in the future, seems the issue was using a local ip not a public one.
Some issue with the port I put the server on at the switch...
It blocked all external connections...
Like it goes out and functions for a bot... and allows my sites to get through... Anyone else? nah.
yeah and I can give the code to people to use now lol.
Thats the only reason I did this. To make this listener code so people that fail following the topgg docs can just clone a repo an boom

Help me, I don't understand how to use the api, I'm from aoi.js
What part of the API are you trying to use?
Register the id of the user who has voted to make a daily
So literally what I just made?
You don't need the API for that.
I'll show you when done for node.
I come from there
the documentation mentions how webhooks work. You'd need to wait for someone who can assist you in setting up then
of course not spoonfeeding
not official
so no
the node topgg-autoposter is meant to update my page with the stats of my bot, how often is this and how long does the page take to display the data? I want to know if its once a minute or once an hour or once a day etc to make sure if I log the event to console it wont spam...
The autoposter by default is 30 minutes, it can be longer but ideally not any less.
The site can take an hour to update.
Generally not any more than that
How do I modify this setting? Is it just an option I pass into the AutoPoster()?
I can’t really see any documentation to modify it.
It's documented in code.
https://github.com/jpbberry/topgg-autoposter/blob/master/src/index.ts#L20
https://github.com/jpbberry/topgg-autoposter/blob/master/src/typings.ts#L8
Ty
Hello, i recently got my bot accepted, and I'm trying to figure out how to get my voting systems working. I was looking around, and came across webhook-topgg.com, for the webhook conversion, but the problem is that the BOT doesnt detect anything on the listeners.
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("this is my auth :(")
app.post("/dblwebhook", webhook.listener(vote => {
console.log(`vote detected ${vote}`)
}))
app.listen(80)
the webhook does work, it shows the test requests in the discord, but not in my console.
(Feel free to mention me when replying)
Hey! Are you using a third party service to get those messages sent to discord on test vote?
Topgg doesn't send messages in discord on vote, so I would think you're using another service to do that.
Sadly topgg webhooks can be sent to your webhook listener or to one of those third parties but not both at the same time.
Could someone help me to make a message when someone votes my bot? I didn't understand from the docs.
What programming language?
Aoi.js (Java script)
im using discord webhooks, that are ran thru webhook-topgg.com, but im testing the test button on the webhooks tab on top.gg
You cannot use the code linked above and webhook-topgg.com at the same time
im just trying to get it to detect when a vote happens, am i just entirely doing it wrong?
So topgg only supports sending one webhook at a time.
Both your code above and webhook-topgg uses webhooks.
would a discord webhook work fine for what im trying to do?
Nope, topgg webhooks don't work with discord webhooks
hmm
im using the send test on topgg and its not logging anything
That means you did something wrong on your side
Most possible issues:
- Your pc/vps is behind a firewall
- You entered wrong url
- Your code is wrong
- You're behind a vpn
- Your hosting provider blocking the request
- You have the wrong port
I literally made an example...
Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: normal-api.ml. is not in the cert's altnames: DNS:*.parkingcrew.net, DNS:parkingcrew.net```
what is this error ?
@timber gale
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
You deleted my hamster
Ok but its still rude from you to do that
This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/
If you need help with other development, please use #development.
continuing to talk about unrelated topics will get you muted
You also dont talk about api so why should i
What Discord lib are you using?
Discord.js
Your best option is to install and use the auto poster https://docs.top.gg/libraries/javascript/#posting-bot-stats
Lemme check
just need to paste the code or need to add some attributes in it?
I did this
You would need to pass the DJS client and your top.gg token as shown in the example
that I did
Looks about right to me
Do you see the console log when you start your bot?
yes
Nice. The site may take an hour or two before it shows the stats
thank you so much
console
I am using the topgg sdk for nodejs, and trying to receive votes, though I am getting to response on the post request.
I have double checked the information and it is correct:
topgg page:
https://i-got-ur-ip.xyz/w00jfz63.png
code:
https://i-got-ur-ip.xyz/hyus6rta.png
Logs are empty except for the log when the script is started which states: listening:
https://i-got-ur-ip.xyz/4j1t0azc.png
Does a firewall block the incoming requests on port 80 (tcp)?
the firewall is disabled, though i will try a different port
something i also noticed
is that when I define the webhook and log it
it logs:
Webhook {
authorization: 'authorization token (hidden)',
options: { error: [Function: error] }
}
Make sure the provider has no firewall in place
Some providers put one in place being enabled by default with their ruleset
Just to make sure, it’s not a server you’re running at home?
no its not a home server
and the firewall is inactive
Damn my phone auto converts it wtf
lol all g
Ok still no response after changing the port?
Did you update the URL after changing the port on topgg?
Also please choose a port of a non-reserved range
Idk like 3000 or 5000 etc
I mean it would complain if the port is already in use but still…
tried 3000
still no response
ok I set it to 0 which is obviously reserved and still no log at all
URL updated, pressed save then test?
yep
Remove the authorization please
wdym
Completely both in your code and on topgg
Then regenerate the token a few times, hit save then test again

Just to get rid of known site bugs unfortunately
Ok regenerated token
thanks it's showing
Does it work now?
nope
get request to https://top.gg/api/bots/:bot_id/check
how often does this reset to saying the user has not voted? (ie. 12 hours, 24 hours, weekly, monthly)
0 not voted
1 voted
12 hours
brilliant thanks mate
np
Can you access your endpoint using external tools?
Or simply by sending a curl request to it?
sending a curl request gives the following:
https://i-got-ur-ip.xyz/n8yn23gf.png
only thing running on that port is the topgg script
firewall is disabled
idk what is wrong
Try from an external device
Outside the servers network
Either using curl or an external tool like https://reqbin.com for example
{"error":"Unauthorized"}
Hmm
well it has no headers with authorization so ofc it is unauthorized
@craggy sentinel Is this an actual bug or we doing something wrong here ?
its likely something related to the webhook, not top.gg
also no need to ping a community manager unrelated to it
check your ufw logs, your ports are very likely blocked by another default setting
Well since the endpoint is accessible externally it looks like a site issue
Wouldn’t be the first time unfortunately
they're locally making a request though??
Yes he then tried a request outside his network
was Auth provided
they should try providing Auth too
if that works, then top.gg would be able to send one too if the Auth matches there too
Im not gonna use any auth key too
Wouldn’t be a surprise if the test button isn’t working again
But to make sure it’s working just send a test webhook to another endpoint
Can you test em using reqbin?
Does it provide a test endpoint
Or can you send requests only?
thing is: depending on how they tested it on top.gg
it literally will not send anything in the logs if the webhook feature is used from the library
since it will not log anything
if no Auth is provided
thus, please test it with auth too
So… the lib requires an auth key?
That's what I'm assuming
since that would make the most sense, to throw away the request when no auth is provided
per github, it responds with "unauthorized" and doesn't do anything else
as far as I understand the code
likely if no authorization is provided in the constructor
unless the user posted their code too
He said he removed it from the code and site
Hmm
Might be worth to double check
@wide stream you wanna double check, please?
lol now realized we both posted the same code 
Using share X for editing images?
Okk !!
also guessing the last one had the authorization not set since I haven't saved it
Well your hostname actually has a record to your IP
You might wanna remove that image
nah idc really

but essentially, webhooks work and is likely a setup problem with the user
ufw-allowing 1234 made it essentially work even if I have a bunch of forwarded ports for dockers, no issues at all
using iptables is complicated nonetheless
Must really be the auth key then or something I don’t think of yet
ufw is better for managing it
Tf iptables isn’t complicated
At the end it won’t matter as ufw is just an interface for iptables
Since it’s disabled and the policy for iptables are right nothing blocks incoming requests
they should start a netcat session using nc -lvnp port and see if they're even able to get any request from top.gg at all
then:
- iptables blocks it
- they haven't saved it before pressing "test" (had that so often)
- webhook isnt properly setup
- wrong port
- port is privileged when using on a non privileged user
but I can confirm, the top.gg-side of webhooks work
since I was able to get it to connect and we havent had reports of any issues yet
yes that should say ipv4
but would default ot ipv6 if no public ipv4 is configured for some goddamn reason
assigned*
Well there are providers don’t providing an IPv4 by default anymore
You can buy it as add on and assign it as primary ip
nice
But this somehow looks like an IPv4 provided as URL
but I’m not really sure of course
well once they're back
ask
lol
https://datatracker.ietf.org/doc/html/rfc2732 could take advantage of just using that ipv6
Format for Literal IPv6 Addresses in URL's (RFC 2732)
Not sure if topgg even sends requests to provided IPv6 addresses
could actually test brb
Alr

So wasn’t totally wrong with my assumption

Well I guess let’s wait if he responds anyways to what we suggested
there's already official ones for mostly every programming language, the only ones that could be made standard are the ones that don't exist yet and are entirely open source
I doubt the team would add another library though, best to have it noted down as a third party library
Yeah I just realised there is already a wrapper for Rust, but it seems that it's no longer maintained, I'm looking forward to find the contributing rules then try to PR to complete the existing project
thanks
Yup that would be cool to contribute to, yes!
i cant update the server count on top.gg
after using api.setStats()
it still doesnt update
It can take an hour to update on the site
Why i vote the bot once and i 2-3 webhook requests?
Seems like you're not properly responding. Check the docs about "retrial"
i have responed 200
post your code here
You Must Vote To Use This Command. How will I do?
@fluid venture
const { QuickDB } = require('quick.db')
const db = QuickDB({ filePath: "./db/vote.sqlite" })
?
Version quick.db 7.1.3
Cane were hel me with the api? I don't know what to do...
const db = require('quick.db')
db.add(....
ig this
for v7
@fluid venture
I Voted But It Didn't Show Up On Console
45.131.3.74:3000 This Way
as the text says
cannot GET
it is only available through a post request and on the endpoint you set
which will top.gg make a request to
I'm Trying To Do This
probably ask the maker of that then
Is There Another Method?
How can I get the number of votes of my bot on the site?
Pls any help? I have no idea
Are you getting any errors?
I got no python experience, so won’t really know. Just wondering that the issue you are seeing
nothing, but
Yeah so in that URL field you would put the IP or domain name and path of where your hosting your webhook api
from my server?
It’s a API call going from Top.gg to your bot
So it would be your server IP or domain
Okay
Here is the python docs if you don’t have them already https://docs.top.gg/libraries/python/
And here is all correct?
so?
http://ip:port/route
As glitter said the top.gg site needs to match that route you added there, and also password needs to match
Error: path should be started with / or be empty
Code:
so use /dblwebhook in your code as you had it before, then on the site have: http://YourIpHere/dblwebhook
oh ok
same error
Did you update your code to just have /dblwebhook as the first argument?
I have in topgg: http://IP:2048/dblwebhook
And in code: self.client.topgg_webhook = topgg.WebhookManager(self.client).dbl_webhook("/dblwebhook"
where are you hosting?
Miete risikofrei Rechenleistung bei Host-Unlimited.de, einem der beliebtesten Serveranbieter Deutschlands mit mehr als 10 Jahren Erfahrung und eigener Serverfarm.
So btw i cant cklick Send Test its not working
refresh the page
Not working
But its not working
did u click the save button after making changes?
for sure
Is here an error?
is it possible your host limits you to specific ports?
I don't speak german so its hard for me to find it.
if you're testing on your home ip youll need additional setup
such as port forwarding
hmm ok
i use everytime the port:22 but this is dont working
In this image above it's still set to 5000
Thats my code
JavaScript Version ?
python 3.9.13 
:/
Can we write the password we want to Webhook Auth?
Yep
What reasons are there for it not to work?
öhm, OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 22): address already in use
Port 22 is already in use for ssh. Use another port
which for example?
It works?
You said no errors…
jes but not working
Thats correct?
And this is being tested on your server rented from host-unlimited?
no errors. And here all installed lib
are you maybe using some sort of ufw
ufw?
await fetch("https://top.gg/api/bots/stats", {
method: "POST",
headers: {
Authorization: env.TOPGG_API_TOKEN,
},
body: JSON.stringify({
server_count: stats.guilds,
shard_count: stats.shards,
}),
}).then(() => console.log("Posted to top.gg"));
is there any reason this wouldn't be posting to top.gg?
I think you need to set the content type
i dont no... How i cane check it? i use debian10 and i dont installed one
I think that's also not a valid url
https://docs.top.gg/api/bot/#post-stats
you could try making a netcat session using netcat -lvnp porthere and see if your server is reachable
retrying local 0.0.0.0:3000 : Address already in use
retrying local 0.0.0.0:3000 : Address already in use
retrying local 0.0.0.0:3000 : Address already in use
retrying local 0.0.0.0:3000 : Address already in use
Can't grab 0.0.0.0:3000 with bind
Should i use an another port?
is your bot already running?
jes
stop it
ok
listening on [any] 3000 ...
now directly go to http://serverip:3000
I was referring to Knoxxi
this is not related to your issue
Are you angry with me, my friend, you are acting very strange :/
The site is unavailable
is the page showing Cannot GET /dblwebhook?
that essentially means your port isn't open yet
Can't Get
could you do ufw status? maybe ufw is installed
Ports Open Firewalls Off
command?
for the javascript library thats normal.
If you paste that url into this field on your bots page.
https://i.imgur.com/hyTaAkF.png
and fill in the authorization correctly, save, then refresh the page it should work.
ufw status
command not found
did you get anything from netcat when going to the website?


