#topgg-api
1 messages · Page 141 of 1
I see the port forwarding, I just can't find the device on the list.
Does it not have a name prepended to the local IP?
Just the normal numbers.
Does just checking my hostname work?
Probably
I should be connected now.
Does it work?
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.
-help
thank you
Oooooo thanks a lot !!!
I'm looking for this... i don't know how long it was but thanks
if i made mistakes, sorry I'm french
i cant get my bots api-key
read pinned messages
there is NO webhook page..
there is
er
Then you don't seem to have proper access to that bot
do you own it?
it should say this
which bot are you referring to
my bot, shadow bot
ID?
you need to wait till it is approved
ok.
How do I get the authorization code for my webhook? I think I asked in the wrong channel before...
got this when trying to install the top.gg sdk
npm ERR! code ENOLOCAL
npm ERR! Could not install from "@top-gg/sdk" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/container/.npm/_logs/2021-03-17T14_31_42_322Z-debug.log
I'm running through Plox.Host so I have to install from a package.json
It doesn't let me use console commands to install directly basically.
nvm i figured out what I did wrong
if v1 is being worked on, will there still be a way to access v0 until EOL?
how can i setup the webhooks system?
Just google how to setup a webhook service regarding the language u wanna use, e.g. PHP, JS etc.
it always depends on how u wanna do it
if i post to dbl using autoposter, do i need to configure a webhook?
No.
how do i get sb is voted my bot? without the library? i tried this but dont work:
response = requests.get("https://top.gg/api/bot/mybotid/check", params={"userId":myBotId}, headers={"Authorization":myBotToken})```
-api @terse patrol
@terse patrol
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.
Pong!
I cant figure out how to get the Activation verification for webhook voting for bots
Can I have help?
use aiohttp
In the headers you send the bot's top.gg token
The rest seems fine
what error u geT?
k thanks
How do you get server count when sharding? Nvm found how
guys um..I get that error, Pls read stuff arrounf that message to studie the code and not ask me for what I have..
what do you pass to the api constructor
Make sure the client u pass is a valid...
discord.js or eris client (or djs ShardingManager)
the webhook is not working
how to use webhook properly
so it sends votes in a channel
"Is not working" isn't very descriptive, explain what doesn't work
is there an api documentation for this?
cause i don't really need all the things provided in the top.gg client
so im writting a handler
i just need it to get the vote info
and maybe the stats
hmm nvm i think i did the request wrong
const url = new URL(`https://top.gg/api/${endpoint}`)
if(userId) url.search = new URLSearchParams({ userId })
cause this is what i did
How come I'm getting top.gg API token not provided on post_guild_count when i already authenticated the dbl client with the token?
Also https://top.gg/api/docs#webhooks does not work. (it is linked as data def from on_dbl_vote data)
bot edit page > webhooks
oh wait
u have the token
h
on_dbl_votedoes not seem to being called at all
Dont know if i should ping a mod/dev
theres a few python? devs here anyway that could help
Yes that is python but its more of a library issue to me.
What about that
That's where the new docs are
https://docs.top.gg/libraries/python/ links me to https://dblpy.readthedocs.io/en/latest/api.html which contains https://dblpy.readthedocs.io/en/latest/api.html#dbl.on_dbl_vote where theres an invalid link for data
Wasn't changed yet
i guess youll forward to devs then
No need to yell at me, no worries
I just need to push some changes and update the docs
YOU'RE YELLING AT ME IN NON-CAPS BRO
OK NOW IM YELLING AT YOU DEAL WITH IT BRO
BESIDES YOU WRITE ALL THE CODE IN ONE FILE
!!
OK OK I'LL UPDATE THE DOCS SOON SHEESH
AND YOUR CODING STYLE
IT'S READABLE
OK DM ME WITH YOUR SUGGESTIONS I'M ALWAYS UP TO HEAR FEEDBACK AND THAT'S EXACTLY WHAT I SEEK ALL THE TIME HERE
how do you get the vote expiry date??
You can just send a request to top.gg API and cache the result for around 1-10 minutes though
i have an idea anyway
ill use redis
and update redis with the webhook
and ill get my vote status from redis
Sounds a bit extra to me but I'm not stopping you

oooooooooo
website updated?
ps thanks @rain heart ❤️
hey uhhhhh
whats my webhook_path?
http://serverip:port/thispart
dblpy = dbl.DBLClient(client, gg_token, webhook_path='myip?', webhook_auth='password', webhook_port=5000, autopost=True)
ahh ic
@rain heart
what exactly is meant to happen
when i click on test on the dashboard?
cuz i did this
and in my portal i added this
but when i press test, absolutely nothing happens
If an old error with the website still persists press save in the first place and test after.
hi baes
can some1 help me?
u must have public ip
and u can write it by yourself with flask
@stiff night ip is is public
Make sure to let your webserver pass your firewall for the port you choosed.
Protocol: TCP
Without that incoming connections for the port may be dropped by default
Hello; does the API allow multiple connections to the same auth token?
You’re requesting things only not opening socket connections. As long as you don’t reach the rate limits you can do as much requests as you want.
Ah okay, what's the rate limit btw?
Take at look at the docs
Alright, thanks!
https://docs.top.gg/api/bot/#individual-user-vote
Example show: json { "voted": 1 }
Will it show 1 if they have voted and 0 if not voted?
Thanks 🙂
did anything about the voting webhook change or any ideas how can this be happening?
for some reason people who vote once get the voting reward like 10 times until the app crashes with this erorr
see #site-status
ehm, so... how do I make it stop 😂
I just want people to be able to vote for one time reward while not crashing the whole bot with it and the old code doesn't do the job anymore ig?
respond to the webhook request with a 200

heyo
-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.
@hearty lintel since you maintain the js library, see #site-status 
ye already implemented
how would i go about updating it?
what version are you currently on?
3.0.6
What's this about?
the 200 response causing loops was only implemented recently causing multiple requests for the same vote on older versions
Ah
error: 'Required parameter server_count or shards missing'
I get this but I alredy put server_count
let me show you
method: 'post',
server_count: client.guilds.cache.size,
headers: { "Authorization": "my token" }
})```
I saw it, but I don't understand whats wrong
JSON is the format you need to post it in
What you're sending is not json
did you stringify it like in the docs?
now yes
Thanks
let me see if now it works
same
server count or shard required parameter missing
fetch('https://top.gg/api//bots/myid/stats', {
method: 'post',
server_count: JSON.stringify(servers),
headers: { "Authorization": "token" }
})```
oh ok
thanks for your time
SyntaxError: missing ) after argument list
body: JSON.stringify("server_count": servers),
I don't see any problem on that
just do the basic json format then:
{
"key1": value,
}
{ error: 'Required parameter server_count or shards missing' }
bruh
it can't be that hard
Fetch("https://top.gg/api/bots/" + <bot_id> + "/stats", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": <dbl_token> }, body: JSON.stringify({ "server_count": <guild_count> }) })
it can't be that hard
yeah it isn't
reading the docs carefully will tell you to specify the content-type
method: 'POST',
headers: { "Content-Type": "application/json", "Authorization": "tpken" },
body: JSON.stringify({ "server_count": servers }),
})```
server count or shards required
;-;
yes, and I get servers using client.guilds.cache.size
why creating an extra var?
?
fetch("https://top.gg/api/bots/xxx/stats", {
method:"POST",
headers: { "Content-Type": "application/json", "Authorization": "token" },
body: JSON.stringify({ "server_count": client.guilds.cache.size })
});
server count or shards required
is this the response you got?
which http code?
I get this on the console
Well did a manual test real quick.
The endpoint works as it should.
Did you post the stats with shards before?
I dont use sharding
Which lib do you use?
fetch or node-fetch?
node-fetch
As I said the endpoint is working fine for me.
I’m not sure what you’re doing wrong.
Make sure the bot id is correct but I guess it would cause a different error if not anyway.
You’re practically not doing anything wrong.
the id is correct
Try to send the server count as array
Hold on!
Did you probably use the guilds.cache.size before the client got initialized - before he’s ready?
Posting 0 shouldn’t work
console.log your guild cache size
bruh
Im not that dumb xd
Is it > than 0?
Did you try to send it as array?
when I log it I get 64
Alright and question 2?
no**
Oof...
{"server_count": [64]}
Send this manually without using the cache size var
Exactly like wrote
But is thatpossible?
I mean
if that's possible, anyone could send like 20000000 servers
Correct
so I think that wouldn't work
And what would be the benefit?
I don't know, just askin if the api permits that
Now I got the fucking error
Discord is showing you the correct count anyways.
0 servers
Before I got 64, now 0
So we can say its the client.guild... problem
Nope it’s not
{"server_count": 99}
Send this to see the result
Won’t take long until rate limitation anyway I guess
If you’ve logged the cache size and it really shows 64 it can’t be the issue
I console.log the client.guilds.cache.size and I got 0
Aye there we go
Found your issue
Probably because you used it if the client isn’t even ready
Yes, but what I don't understand, why I use that on the status and I get 64, and when using it on that I get 0
Where do you call your fetch function?
Told you already what could be issue and you told me you know what you’re doing
also incredible while we trying to solve this, the bot joined 11 servers ^^
But I tried what you tole me and I got a right number
oh sorry
Where do you call your fetch function?
You used it before/outside the ready event hmm?
lets see if it works
I used it on the index.js, there I have the event loader, not the events
That won’t work since there’s no cached data before the ready event sends it
Use it in the ready event like I wrote and it will work
Yes thats what I'm doing now
The bot is starting
You will later need to create an interval to repeatedly sending the requests to topgg within the rate limitation
For example every 30 min
Working now since the cache is loaded?
Wait is loading
Wow that’s taking long
it takes a little bit
Don’t forget to refresh the topgg site using the “refresh data” button since the site is cached in your browser
it took long because I forgot a fucking )
how canI be that dumb bro
Happens
It works
Thanks
Bro you need to be staff in here just for your patiente
Alright now consider to create an interval since the ready event being fired only if the bot starts
setInterval(() => { fetch... }, 1800 * 1000);
Alredy did it
Ok
15mins?
Sure but not needed I guess
1800 * 1000); I directly put the ms
Yeah anybody does how he likes to 
have a good night
Thanks, you too
u sleeping ppl
ohh sorry
I think you have a problem
I voted for my bot
Instead of the vote message coming once, it comes to me 10 times
See #topgg-api message and messages below
Dm me guys if you want to see my nudes for free
proceeds to receive 0 dms
i keep getting this after providing a token
UnhandledPromiseRejectionWarning: Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)
Did you provide your topgg API token?
yes
Do you use the autoposter lib?
Show the line you’re providing the header
Hmm don’t know that lib, maybe it’s outdated idk
const Topgg = require(`@top-gg/sdk`)
const api = new Topgg.Api('my API key')```
no
its on te latest
There aren’t much possibilities causing this.
Maybe your token is wrong for real due a typo for example or the header being sent is wrong.
idk, maybe coding a website and a entire api isnt as easy as it looks
i need help
my code doesnt work
import dbl
import discord
from discord.ext import commands, tasks
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'token here'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password here', webhook_port=5000)
@tasks.loop(minutes=30.0)
async def update_stats(self):
print('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
print('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
@commands.Cog.listener()
async def on_dbl_vote(self, data):
channel = self.bot.get_channel(783598824685436970)
channel.send('Received an upvote')
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))
print("TopGG Loaded!")```
it being easy isn't the case, this problem has been going on for weeks now. top.gg is too big and has way too much of a following to be pulling stuff like this. I saw on #site-status i believe they are working on a fix, i just feel like it has been way to long
?
yea they are fixing the webhooks
Well I'm kinda late, but you need to start the update_stats loop for it to start autoposting. Also, consider cancelling the loop on cog unload so it won't stack (in case you often reload cogs)
Have you entered the correct webhook URL on the site?
There are many possibilities why it doesn't work though, idk if it's on DBL or on you. But I just tested it and it worked (though it took a few seconds)
oh
what webhook url do i enter
just create a new one on discord?
i mean
i just want to print the result
do i need a webhook url
the format would be http://{ip}:{port}{path}. Which in your case it's http://{ip}:5000/dblwebhook
Make sure port 5000 is forwarded and you put password here on the site. Because if the auth don't match, it will never get dispatched.
webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000
what to fill here?????????
Those fields are fully up to you
what is webhook_path?
and webhook_auth?
and webhook_port?
??????????????????????
The auth checking is done internally, so what you're supposed to do is just put the same auth on both the site and your code.
what should be in the webhook_path then?
As I've mentioned, it's fully up to you
i have no idea
If you have this webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000, then what's on the site should be
api bana pava ver
just ask
okay im about to pull my hair out, i got the webhook all setup, i got everything the same code as the npm page, and i confirmed that the page is working, even double checked that the token was right, but i will not get sent a stupid test thing, and i have no idea what to do
and also how do i send back a success message? because the new api says it needs that
yep
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
heres my code incase im a dumbass
this happens when i open in browser, so its for sure allowed through the firewall
(this is on a vps btw)
you need to make a post request
isnt that what the test button on the site is meant to do
Post is what the test button does to your webhook, it posts data
Get is when you're not posting data, but just getting it
Could you DM me the url if you're comfortable with it, I'll see if i can make a test request from my end
👍
ok sec
aight
Authorization code?
i donno how to set one cause the docs didnt say :/
const webhook = new Topgg.Webhook(config.db0Token) // add your top.gg webhook authorization (not bot token)
No, not the top.gg token
config.db0Token replace it with whatever you want
use WebhookPass123 for example now
hmm aight, i swear i tried that but im probably stupid
are there any characters i cant use?
ok but
do i need webhook
all i want is to get notified when someone votes
didn't actually test it yet
but glad that it works now 
x3 i tested it again on the site
oh, while im here how do i send back the 200 code?
oop nvm
it auto does it
thats all i needed then, thanks again!
For some reason, it seems like my bot's webhook is getting POST request many times for 1 vote, is this a problem with top.gg? Cuz I haven't changed anything in my code and it randomly started receiving many requests for a single vote, happens for every votes
read #site-status
Didn't read that, sorry for not asking before reading that and thanks for letting me know about it
I'm currently trying to setup the api thing for my bot, but it doesn't seem to be working...
I've tried this and it doesn't update the server count widget
It's in Java, any help would be appreciated
no, everything works as intended, except for the api...
also my webhook doesn't give any output
that's jda stuff, that can be ignored
probably just forgot to recompile it
I put it into my ReadyEvent class and restarted the instance, now it works 🙂
But the webhook still doesn't give any output 😦
I'm making a leaderboard with a db showing all the votes a user has.
How would I say, the second a user votes, (do my db stuff)?
I can do the db stuff but idk how to say if a user votes, then blah blah blah. I have a votecheck command but I don't want them to run that command before receiving their points.
What is that
You dont really need any of those for a webhook..
I mean you could
But I used repl
its free
i dont want to host on repl
it asks me to pick at least one
-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.
Mb
Hope do you have any idea of doing this
Not really
Like with a webhook, can we do smth
Like there is the code in the webhook part
where once the user votes,
it sends the message
So how can I combine that
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
dwebhook.send(`<@${req.vote.user}> has voted for News Agent on top.gg!`)
});```
This part
Changed to this part:
(req, res => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
});```
hi there
i couldnt make a webhook
its not working
i made it
but not working
i made eveything correct i guess
Yes
@sullen nymph i have it setted up but nope. doesnt send anything
i used webhooks before
Show your code
hmm just copied from the site lmao
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='Test123', webhook_port=5000)
Then rely on the PORT environment variable as webhook_port to run the webhook
Max, was there any firewall that prevented you from receiving incoming requests on port 5000?
or do i just keep it
If you change webhook_path to anything else, yes
i didnt set it
i use repl.it so idrk
wait
i didnt set webhook_port
There you go
Don't set the port in the URL, Max
/:port?
@sullen nymph Any idea how I could do this
please give example
Which part of this was unclear
then where
?
i dont get this
without, yes
on the webhooks part
Correct, Max
where do i put it
Though I was not talking to you just now, but you got it
On the bot's Edit page in the Webhooks section
Deal with the Authorization field too and you should be good
P.S. it's a password you create
ik i made that part
how do i make sure that it works
port 8080 right?
This is quite literally a route handler for POST requests to /dblwebhook, so do whatever you need to do in there
You don't specifically "combine" anything. You set the webhook in a scope where you have access to your client object
Visit the URL
Run on port 8080, do not specify it in the URL, correct
Ok but I have my webhook on a repl, and my bot hosted on my device
Make the webhook send a request to your device then
How?
Be it via websockets or HTTP requests
404
but i see it on the console
Idk how to do that tho
Google ✨
how is this an api when i have to setup a webhook for it lol
Well less headache for me with you 3 constantly pinging me
const express = require('express')
const app = express() // Your express app
const webhook = new Topgg.Webhook(config.topggwebhookauth)
const dwebhook = new Discord.WebhookClient("id of webhook", "random stuff of webhook")
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
dwebhook.send(`<@${req.vote.user}> has voted for [BOT NAME] on top.gg!`)
});
app.listen(3000)```
Are you sure the webhook is actually running?
So basically
yes
Then all you need to do
ehm discod.py
Cool assumptions
Actually it doesnt matte the lkanguage
Is this on the same code aas youe discord bot?
as*
If not then it matters
you told me to use heroku url
Like I habve webhook on one repl, and my bot on another
import discord
from discord.ext import commands, tasks
import asyncio
import logging
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, webhook_path='/dblwebhook', webhook_auth='pass', webhook_port=8080)
# The decorator below will work only on discord.py 1.1.0+
# In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())
@tasks.loop(minutes=30.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
# if you are not using the tasks extension, put the line below
await asyncio.sleep(1800)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
Ok dms
Did you connect that as a cog to your bot, Max
max
except i use print
elite are you sure you're qualified to provide assistance with this
Same question goes for you Kero
To be specific, load as an extension
ofc
the problem is with the webhook
which honestly
i still dont get why its required
What do you mean by "required" exactly
You can use the API to receive recent votes but using webhooks is optimal
Make sure you are loading the cog, probably with a print in the cog's init method
How is it gonna be called without a webhook, using magic?
ok
what do i do for webhook
thats what im asking
i was trying to create a heroku webhook
Initialize DBLClient with webhook args
and asked what i should pick
That's pretty much the bare minimum
I thought you used it prior to this point
no
i was trying to set one up
because i dont have a vps
i use heroku
heroku doesnt have ip
so i couldn't figure out what to do
Heroku has a URL which you asked me about
This?
yes
i asked you
how do i check it works
you said
visit the url
why did it get deleted
Don't use dots
oh
Just use - or ^
ok
dots get automatically deleted
oh wait i made a typo
now i get this
2021-03-19T13:52:40.588524+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=appname.herokuapp.com request_id=4130beea-2f6a-4e77-afc1-1c574da024b3 fwd="159.203.105.187" dyno= connect= service= status=503 bytes= protocol=https
@sullen nymph
does this mean its working?
there's no web processes running on that path
ask @barren kestrel he/she is very helpful
if your bot is discord.js
py
@vital wolf i cna still do
..
hello, whenever a guy votes, i receive the same webhook 10 times, so when someone votes onec, he gets total 10 votes.. why?
read #site-status
how do i fix this
then how do i make vote checker at py
how can i test vote to check if the vote checker thing is working
nvm i got it
where can i get my bot token in topgg?
Hit the Edit Button on your bot page
Press the Webhooks button on the sidebar
Hit Show Token
Copy
log out and log back in
did you transfer the bot to a team, or transfer ownership?
Hi, I'm using express.js to handle post requests and when I sendStatus(200) to make sure that top.gg doesn't spam me with 9 more requests it skips the whole function body... Basically if i put console.log('some text') at the first line and then sendStatus under it, it doesn't log anything except 200 OK in the console, any idea why?
wdym, inside discord developers?
most likely related to the team issue too
ah ty anyways
have you tried moving sendstatus to the end of the function?
from discord.ext import commands
import dbl
from funct import func
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'proper token is here' # set this to your DBL token
self.dblpy = self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='kurwa', webhook_port=5000) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully")
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Vote recived")
@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(f"Received a test upvote: {data}")
def setup(bot):
bot.add_cog(TopGG(bot))
can someone tell me if this is right or am i dumb?
i tried with and without / and neither is working
Dm me the url, i'll tell you if it is correct
Yeah that should work, do you not get anything when you make a request?
i mean bot console shows nothing, should i look somewhere else?
where are you hosting? home, a vps, dedi machine?
the api doesnt care, webhooks will need portforwarding and ip yes.
😭 okie 🙏
i'm testing it on my pc
youll need to port forward then
and use your public ip
https://portforward.com/
^ has guides for portforwarding on most routers.
The issue is my dad doesn’t want me to port forward
I have my own server and everything but my dad doesn’t like the idea of anyone of having potential access to it
Do you use JS?
Yes
Then setup localhost express server and make it public using ngrok
Ngrok? I’ll google it
quite similar for me, i just dont have acces to router, although i can try to use vps, what should i do then?
Looking at it Ngrok looks decent but how can I trust it?
Everything has it's vulnerabilities
Fair point, is it open sourced
if you don't want to use ngrok, consider getting a proper vps
Yeah that'd be best
nvm, i just tried and it worked like a charm
I bought a server because it’s cheaper in the long A good VPS can be very expensive and with Covid I can’t find a job
But I’ll try ngrok
I use VPS that's about 2$/month for my discord bot, it's the best option if you don't want to port forward or use tools like ngrok
Yeah, I would use a vps but my dad gave my money and I spend it too quick
But thanks I’ll try it
If your father is okay with using his credit/debit card, google and amazon have free trials for a year for some of their hardware.
he can have full control over the money/account part, while giving you full access to the servers.
The issue with that is I have my own debit card and he only uses it on things like my anime subscription while he knows I wish to be a programmer he doesn’t like the idea of him paying for one
It’s just the type of person my dad is 
well, its free for the first year, google also has free small VPS's forever as long as a card is attached.
yeah
I’ve already used digital ocean back when I was a idiot programmer
you can easily get away with a 2 years of free VPS's currently
In my dads words
You have your own card deal with it yourself
Can you link me some of them that are offering free trails
^not this one please I already used up my trail
Thank you 🙏
oh heck vultr has free stuff too
psh, at this point 4-5 years of free servers 👀
I wonder if any of these could host a MC server reasonably well 👀
did i miss something? yesterday i see some api changes but idk what i need do
after someone vote to my bot, they get 1-5-10 times reward
yes i see but i didnt understand :(
You need to respond to the webhook with a 200 OK
As it says there
Otherwise i can't explain it
ty sm fixed
I'm making a leaderboard with a db showing all the votes a user has.
How would I say, the second a user votes, (do my db stuff)?
I can do the db stuff but idk how to say if a user votes, then blah blah blah. I have a votecheck command but I don't want them to run that command before receiving their points
Ping me if you know
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'my token is here'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='dbl_password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Received an upvote:", data) ```
so i have this code but when my friend votes nothing happens, is there something I am doing wrong
Would that be my webhook url if this is my code:
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
dwebhook.send(`<@${req.vote.user}> has voted for News Agent on top.gg!`)
});
app.listen(5000)```
App is express btw
yes
ok ty
but not 127.0.0.1
your server ip
how do I find that
which OS?
is that your pc
yes
do you host it on your pc
then just open browser and search what is my ip
and then put that :5050/dblwebhook
yep
yes
You need to portforward
Look it up, can't really help with that
The port you want to use
ok but like where do I find available ports
@rain heart
I hagve no idea what to port forwrd
Like what type do I forward?@willow spindle do you know?
I don't know much about the ports in windows
Ok
I’m getting this error:
ServerDisconnectedError: server disconnected
From a upvote.get_user_upvote(id)
Na
What is it for
Check if the user has upvoted or not
This has worked for about a month and in only suddenly getting the errror now
Py
hm, what are you using to host it
Digital ocean
oof idk
Rip
Hmmmm
Alright
you're such an... READ THE MF CHANNEL DESCRIPTION
how do you implement a vote command that can check if a user has voted or not?
using the api https://docs.top.gg
I tried
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print('Vote recieved!')
print(data)
but it isn't doing anything
if you want to receive realtime votes, you have to use webhooks with that
1xbet
because no one cares
you are not the first one, who made a bot
Hello, I have just changed my bot to a different VPS, and have noticed that the webhook for my voting system doesn't work. I changed the IP on my bot page, and when I use the "test" button on the page, the bot successfully sends a DM, but when users try to vote for the bot they don't get the DM. I am using the "dblapi.js wrapper". What could be the issue?
Maybe the users did disable direct messaging like a lot of people are doing
I don't think this is the issue, it only became a problem as soon as I changed VPS
Well if you’re receiving the test webhook at least your firewall is allowing incoming connections on the port you choosed
I’m not aware of any other issues with webhooks
yeah I think it's working now ^^ thanks anyway
Hello
@elfin solstice - Wouldn't the correct response to the vote webhook be 204 rather than 200? We're not returning data, just that the request was successful.
as i said in the announcement already any 2xx (200-299) status code is fine because they are all in the Success HTTP Status Code Range
204 will work (and makes the most sense) the same as 200 does

I'm responding with 204 and getting the retries
make sure that you close the connection and don't take longer then 5 seconds because we timeout after that
i tested it heavily and it works as expected
can you show me the code you are using?
I'll try and grab a screenshot on my break. The requests aren't taking 2s to process on my end
i just tested it again, we only retry on network issues, timeouts & 5xx status code
its either of that
204 is accepted like any other 2xx status code
Are we able to use the api before getting approved or thats not possible?
Nope it’s not possible
Okay thank you!
Success - No Content
Thx
Just checked - it's a MySQL insert followed by a reply.code( 204 ).send( ) (Fastify). I'll debug a bit when when I can get back into my office - am still at work.
Better if you send the status before doing anything else
Just in case it's taking longer than expected
that won't really work that way in nodejs
Really? Meh
try debugging it with a HTTP client like Insomnia or postman
looking at the logs ~95% of all requests are successful and the one's which aren't are either timeouts or 5xx status codes
i would check if the insert takes too long maybe or if you actually don't close the response (a lot of people had that issue with express before, they set the status code but the connection was never closed and so we timeout after 5 seconds and retry)
cause they forgot to call .end() and only called .status() and not .sendStatus() or .stats().end()
@rain heart
Your bot needs to be approved first in order to use webhooks
yeah you won't be able to with dbd, i'd suggest using a vote tracker bot instead
do u know any? @rain heart
Vote Tracker is one i can recommend

how to impelement vote, If someone vote my bot, it will be give users a rewards or dm it?
const express = require("express");
const app = express();
const webhook = new Topgg.Webhook("your webhook auth");
app.post("/dblwebhook", webhook.middleware(), (req, res) => {
// req.vote will be your vote object, e.g
console.log(req.vote.user); // 395526710101278721 < user who voted
});
app.listen(80);
?
where should I put my webhook url?
at your bots edit page > webhooks
is there something i have to change, except authorize?
just it?
will it response if someone vote on the bot?
you also need to answer the request with a 200 or it keeps retrying
and add it to your top.gg webhook settings under your bot page settings -> webhooks
I know there is a way to check if a user has upvoted a bot using the top.gg API, but is there a way to check if they upvoted a server?
Yönetici lazım bana
unfortunately not, you would need to do that yourself using webhooks
@rain heart
Alright, thanks
Yönetici lazım bana @rain heart
#support or #general-int, i also don't understand you language unfortunately
webhook tests aren't working
when i use auto server count with python top.gg api i get this error:
method has no arugment
https://gyazo.com/ddd098ab2a73a61c36dcd44164cfa3a4
i am using it in a cog
from discord.ext import commands, tasks
import discord
import dbl
class TopGG(commands.Cog):
"""
This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
"""
def __init__(self, bot):
self.bot = bot
self.token = 'Yout token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
def cog_unload(self):
self.update_stats.cancel()
@tasks.loop(minutes=30)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count."""
await self.bot.wait_until_ready()
try:
server_count = len(list(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))```
@short isle full code for that
When the topgg servers performs a post request when a webhook is tested it sends wrong user id
And I'm sure requests are from topgg
A min
for me on my bot's page it still shows N/A
you need to post it yourself: https://docs.top.gg
wdym?
you need to post the server count yourself
where?
read the docs
But doesn't it shows user id instead of topgg id?
Also when i actually vote a server it returns correct id
i think it was reported before to the team, they will possibly add both variants of it: the discord id and the top.gg id
couldn't find it
This started to recently happen, i remember few weeks before it was working well even with test
when the new ID system was introduced, yes
dude i did it's not there for me
So is there a way to fetch user id from topgg id?
i did
all it shows is this: https://gyazo.com/ca630748869e7876def70886458738d3
and i used that but the server count still don't show up
maybe check for error? 
Hey can you please reply to this
there are none
Ok how can I say, once a user has voted, do this (in discord.js).....
Please ping me if you know. I'm making a lb, where everytime a user votes, they get a point
owos

