#topgg-api
1 messages · Page 158 of 1
np
Will port be a random number between 1024 and 49000 ? OR it should also be extracted like IP?
ValueError: path should be started with / or be empty
Its says ^
Should I just do /dblwebhook ?
port is probably this
as for this
show the line where you create the webhook
Hmm 👍
client.topggpy = topgg.DBLClient(client, dbl_token)
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "The Auth token I added from the webhooks page")
client.topgg_webhook.run(3000) # this method can be awaited as well
not sure whats wrong there
Same, trying again and again.
import topgg
import discord
from discord.ext import commands
# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.
bot = commands.Bot(command_prefix=">")
dbl_token = 'BOT TOP.GG TOKEN HERE' # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "AUTH PASSWORD HERE")
bot.topgg_webhook.run(3000) # this method can be awaited as well
@bot.event
async def on_ready():
print("Working.")
@bot.event
async def on_dbl_vote(data):
if data["type"] == "test":
return bot.dispatch('dbl_test', data)
print(f"Received a vote:\n{data}")
@bot.event
async def on_dbl_test(data):
print(f"Received a test vote:\n{data}")
bot.run("BOT TOKEN HERE")
Please check if there's an error or something!?
Btw are we supposted to run the bot as we usually do or go check at the webhook url for the printed statements?
👍
Can anyone tell me why the code isn't working?
Gods of webhooks do not like you
You probably put the wrong URL/authorization or the port is not open
Make sure to hit the save button 
How to check if the port is open or not?
Are you self-hosting it?
Yea on my computer
You can head to canyouseeme.org ig
Yeah its closed. How to open a port tho?
I tried opening a port through windows firewall, eventhough it was added.
The code is not responding to that port neither does the website canyouseeme.org!
Have you redirected your port to your device in your router settings
No, how should I do that?
I'd suggest asking Google and specifying your router model
Oof. Confused 😕 now! Are you talking about port forwarding or take change settings in router settings?
webhook.listener is not a function``` this is my error pls help
Port forwarding?
Mhm
I dont exactly understand from which port to which port i must forward 😖
``` This? (except changing the ports and ip)
um hello
What's your node SDK version
Idk
How can we setup vote rewards for my bot on discord.js
I have little problem with @top-gg/sdk npm module,
when I substract 1000 server, top.gg server count too
I need to set "2800" to have the good server count
fyi you will get banned if you're faking bot stats. This should be very obvious
that's illegal
Well not illegal to manually post your server count
Just illegal to wrongly post it in the sense of showing up as having more servers than the actual count
I have send the real bot server count
8143
¯_(ツ)_/¯
Are you getting any errors?
No
But in the top.gg server count it’s 13k
I don’t send 13k
And when i send 2,5k, this is 8k on top.gg
This is glitched
Remove your shard count posting
I never lied and I don't want to, I posted the exact number of servers and it added 7000
I have set shardCount to 1 and the real count are posted
Take a look at the docs which are pinned in the channel.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
?
One message removed from a suspended account.
One message removed from a suspended account.
o
One message removed from a suspended account.
I know x)
But I don't post top.gg stats with the bot but with another process
One message removed from a suspended account.
no, with an api
One message removed from a suspended account.
I using clusters
One message removed from a suspended account.
One message removed from a suspended account.
(All of my shards are not on the same vps, so I using my own api to post stats)
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.


can some one help i have done this but i wont work
can some one help its not working
@commands.Cog.listener()
async def on_dbl_test(self):
print("A vote test has ran succesfully!")
from inspect import currentframe
import dbl
import discord
import aiohttp
from config import config
from datetime import datetime, timedelta
from discord.ext import commands, tasks
from discord import Webhook, AsyncWebhookAdapter
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = config.dbl_token
self.auth = config.dbl_auth
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook',webhook_auth=self.auth, webhook_port=5000, autopost=True)
@commands.Cog.listener()
async def on_dbl_test(self):
print("A vote test has ran succesfully!")
@commands.Cog.listener()
async def on_guild_post(self):
c = self.bot.get_channel(853929631459573788)
await c.send(f"Posted guild count: {len(self.bot.guilds)}")
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("A vote test has ran succesfully!")
user = await self.bot.fetch_user(int(data['user']))
embed = discord.Embed(description=f"**{user} `[{data['user']}]`** just voted for **Alpha**", colour=config.colour)
async with aiohttp.ClientSession() as session:
url = "url"
webhook = Webhook.from_url(url, adapter=AsyncWebhookAdapter(session))
await webhook.send(embed= embed,avatar_url=self.bot.user.avatar_url)
def setup(bot):
bot.add_cog(TopGG(bot))
Any errors?
nope
How do i find total vote counts of my bot?? Im using @top-gg/sdk for posting and vote logging
Is it ok to make stats update every second?
@ me thanks
How can I setup vote rewards for my bot
@sacred shell ?
Just don’t wanna make another interval for redis
How about a check if the current tick/timestamp is % 10
(arithmetic operators -> modulo)
I mean 60/min requests is the API limit for /bots
it was my bad ok
what does "your webhook auth" means???
how do i setup webhooks for server with the api 
oh wait nvm checked pins
Go to your bots page. Click edit. Click on webhooks. And there will be auth. Copy that. Done
js
can anyone help?
Help
One message removed from a suspended account.
One message removed from a suspended account.
henlo, anyways if a lot ppl votes at the same time would i get ratelimited 
Nvm now
I found a temporary solution 😄
Its working now
is there a way for the api to check if the user's cd for voting is finished for server/bot if so how
can someone help me with this?
no error not working
Do you have any error handlers
yep
Show them
can anyone example guilds stat
@commands.Cog.listener()
async def on_command_error(self,ctx,error):
""" error-handeler for commands"""
if isinstance(error, commands.BotMissingPermissions):
permissions = '\n'.join(
[f'> {permission}' for permission in error.missing_perms])
message = f'{config.xmark} | I am missing **`{permissions}`** permissions to run the command `{ctx.command}`.\n'
try:
await ctx.send(message)
except discord.Forbidden:
try:
await ctx.author.send(f"Hey It looks like, I can't send messages in that channel.\nAlso I am misssing **`{permissions}`** permissions to run the command.")
except discord.Forbidden:
pass
return
elif isinstance(error, commands.DisabledCommand):
await ctx.send(f'{config.xmark}| This command has been disabled.')
return
elif isinstance(error, commands.MemberNotFound):
return await ctx.send(f"{config.xmark} | Mention user properly.")
elif isinstance(error, commands.ChannelNotFound):
return await ctx.send(f"{config.xmark} | Mention channel properly.")
elif isinstance(error, commands.MissingPermissions):
missing = [perm.replace('_', ' ').replace('guild', 'server').title() for perm in error.missing_perms]
if len(missing) > 2:
fmt = '{}, and {}'.format("`, `".join(missing[:-1]), missing[-1])
else:
fmt = ' and '.join(missing)
_message = f'{config.xmark}| You need the `{fmt}` permission(s) to use this command.'
await ctx.send(_message)
return
elif isinstance(error, exceptions.AlphaError):
return await ctx.send(error.__str__().format(ctx=ctx))
elif isinstance(error, errors.MissingRequiredArgument):
await ctx.send(f'{config.xmark} | You missed the `{error.param.name}` argument.')
helper = str(ctx.invoked_subcommand) if ctx.invoked_subcommand else str(ctx.command)
return await ctx.send_help(helper)
elif isinstance(error, commands.CommandNotFound):
return
else:
raise error
@sullen nymph
That's commands, not general errors
Hey! So I hit the test button on the webhook page, but I don't see anything
Am I looking in the wrong place?
I was trying to see if the webhook is working
same issue
Receiving votes
I did that
What's with code here?
I haven't set anything yet
I only clicked test
Should I put the code and then this?
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = config.dbl_token
self.auth = config.dbl_auth
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook',webhook_auth=self.auth, webhook_port=5000, autopost=True)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("A vote test has ran succesfully!")
user = await self.bot.fetch_user(int(data['user']))
embed = discord.Embed(description=f"**{user} `[{data['user']}]`** just voted", colour=config.colour)
async with aiohttp.ClientSession() as session:
url = "url"
webhook = Webhook.from_url(url, adapter=AsyncWebhookAdapter(session))
await webhook.send(embed= embed,avatar_url=self.bot.user.avatar_url)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("A vote test has ran succesfully!")
user = await self.bot.fetch_user(int(data['user']))
embed = discord.Embed(description=f"**{user} `[{data['user']}]`** just voted", colour=config.colour)
async with aiohttp.ClientSession() as session:
url = "url"
webhook = Webhook.from_url(url, adapter=AsyncWebhookAdapter(session))
await webhook.send(embed= embed,avatar_url=self.bot.user.avatar_url)
vps
url of webhook created in channel
HTTP push api?
That's one way of putting it
Now, why do you think dblpy wants you to use a port
Anyhow, you need your VPS' IP and the port you use
Where does the IP go?
In the URL
Wouldn't that be the webhook URL?
Top.gg requires you to have a webserver as a middleman for whatever you want to do with the votes
So where in the code are we defining it
Most popular Top.gg libraries handle that for you with abstracted webhook helpers, like Webhook the JS SDK and WebhookManager in Python SDK
Is there a documentation on this?
@sullen nymph i have done this.
on_guild_post is working
but on_dbl_test is not working
What URL did you enter on top.gg
If it's a Discord one you failed
http://yourip:yourport/yourpath
http://vps_ip:5000/dblwebhook
That makes more sense. Sorry I was just a bit too confused about this.
Port open? No firewall blocking requests to port 5000?
Wait so I'd be required to create dblwebhook (or whatever), and run that server?
Essentially, you would run a webserver on some port, where it would handle a specific route (/dblwebhook)
And then keep your virtual server on 24/7
yep as bot is also hosted there
I do have a vps, I have one path for my bot. I would require a separate path for the webhooks?
It's a specific route handled by your webserver, no folders or that kind of crap if that's what you mean
aka ip:port/oneroute and ip:port/anotherroute would be handled differently
Yeah okay, but I'm not required to create anything on my vps right?
I checked for an open port
I got one
Not anything too complex I'd say
Uh okay
make sure your webhook is running
That's what I'm still a bit confused about
The definition of a webhook?
Just a webserver that does whatever on a received request
How do I know if it's running
@sullen nymph
You have your browser and your INTERNET 

ip:port/whateverpathyouhandle in your browser and you'll get some response if it works
Shrug

I just did that
Wait the port should be between 1024 and 49151?
Eh it can be below 1024 but not advised
HTTP takes 80
5000 and 3000 are most commonly used
That's what's open for me
No open 5000 or 3000?
Both closed
Are you able to open them?
Lemme try
Nope, not able
F
I host my idiotic webserver on port 80 since I shut down my Apache server so shrug
...
But this comes up
can someone help me???
That means some other server is running on it already
welp
@ruby grotto DM me what your entered Authorization and URL values are
Just turn it off 
How
Visit its main page, it should say something

what is topgg api?
the top.gg/api/bots/botID/check?userId= endpoint is being so slow
it almost takes 15 seconds when I do a get request from the bot or open it in my browser
can u check if its a problem on ur side
here's the url i was using https://top.gg/api/bots/751100444188737617/check?userId=558861606063308822
to be honest, kinda expecting that on 373 monthly votes
though shouldn't be that long
I would like to send a direct message to anyone who votes for my bot.
i declined the first time top gg asked to send voting notif. now i want to enable them. how do i do that? (redirected here)
it was so fast when i had 500 votes or smthing
it was just yesterday now its fixed
when my bot will aprove plz tell anyone
3+ weeks
you make it, are you using a top.gg module for webhooks?
toppy.models.webhooks
ok, then your webhook URL will probably be http://<ip>:<port>/dblwebhook, the dblwebhook part might change depending on which path you chose
ip like in my ip ?
the ip of the machine your running the code on
if its your own pc you might need to open a port on your router, and you should check if you have a static or dynamic IP
and that dblwebhook ?
yeah

"if its your own pc" lost me after this
i assume you're using a router at home?
yep
alright, well by default those routers don't allow connections from the internet directly to your computer, you'll have to open the port on the router in the router settings
and you need to check if you have a static or dynamic ip, because if its dynamic it will change and top.gg won't be able to send webhooks to you
?
the process is different if using a home computer or something like a vps
I know
oh
I'm asking bc they said "lost me after this"
ah right
how do i do that ?
tbh i don't know, but if you didn't configure it odds are its dynamic, which will make webhooks a bit more difficult
god dam it aint there a easy way to do it
i just need a way to make some commands only for voters
its a pain, how many votes are you getting per month? i have a server less solution that works provided you get less than 500 votes per month
500 per month that op man
i get 80 approx
may be 100 sometime and sometimes not
alright, then take a look at this, its a hacky workaround https://comhad.github.io/webhook.html?page=serverless
kk
i didint got anything in integromat but my vote tracker said a test vote was logged
am i doing it right ?
yes
that's odd, did you save it?
lemme do it all again
no you just need to click save on top.gg
yep after 3 save clicks its done
oh right, well i can't see why it doesn't work
um how do i make a http ?
I dont understand
Once a webhook has been delivered, you can perform actions with this data, just put your mouse over the right of the webhook icon so it highlights the little circle and click it, you'll see another question mark. Press add another module and search through to see what you would like to do, if it does not exist, you can use the HTTP module and use an API for the service.
http module ?
Oh, see if the pictures help ypu
which one ?
Im not sure, see if theres a picture for the step you are on
there's none
Hmm, let me find something
A huge thankyou to comhad for providing us with this method.
Important links mentioned in the video
- Integromato :- https://www.integromat.com/en
Comhad github tutorial with code snippet:-
https://gist.github.com/comhad/bd42b56a0399dbfa645aa83fe3cf4c8a
Support me by upvoting my bot here :- https://top.gg/bot/819838809318621184/vote
Joi...
oo ty ty
@spice helmwhat to fill in here?
either use top.gg modules if you have a server or follow the above tutorial if you dont
alright, thanks
btw, we want for a server voting, not bot
Ah, it should still work, i think
okay, do u know one here who did that and is 100% sure?
I dont know sorry
okay.
........................
who knows how to set up a bot to track voting for a server?
You gonna setup a webhook service and listen to the POSTs from topgg
You have to enter the public IP or DNS of your webhook service in topgg as well in order to receive webhooks
That’s pretty much all
Oh and make sure your firewall is setup properly.
The webhook service needs an open TCP port (you choose)


.nw egirl_pex
Someone pls send the docs for py ty on and ping me pls
@rain heart thx 🙏
Can I use this : ```import topgg
This example uses topggpy's webhook system.
The port must be a number between 1024 and 49151.
dbl_token = 'Top.gg token' # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) # this method can be awaited as well
@bot.event
async def on_dbl_vote(data):
"""An event that is called whenever someone votes for the bot on Top.gg."""
if data["type"] == "test":
# this is roughly equivalent to
# return await on_dbl_test(data) in this case
return bot.dispatch('dbl_test', data)
print(f"Received a vote:\n{data}")
@bot.event
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
print(f"Received a test vote:\n{data}")``` but instead of bot use it for the server?
can someone help me setup webhooks inside of my bot?
How to check the amount of votes of a server discord.js
Either scraping or webhooks
DSL doesn't have an API to retrieve information about servers
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password") what's "/dblwebhook", "password" values here?
yo , the reward role thing isn't working for me
it says the dsl cannot manager roles
hey uh
to test something should i just reboot my main bot(which is bad) or can i use another bot to test out the api and stuff
okay i guess i'll run the main bot on my pc with a new file
path and auth accordingly
route/path is first, auth is second
can the discord webhook url be provided in path?
I got heroku so won't work for me it seems
Since you host a webserver yourself and make it the middleman
heroku no constant IP
It will. Your port will be whatever os.environ['PORT'] returns.
As for the IPx you literally get a URL to your app, not an IP
can u help me set that up in the dm?
Error in voting?
How to get my server token?
servers do not have an api
Instead of your ip address use your link to the heroku web
You can use ${vote.user} to obtain the voter’s ID but are we able to obtain how many votes the user has(per month & lifetime)?
you have to keep track of that on your own with webhooks
Okay.
I need help from a pro bot dev please
@willow sphinxmaybe u, since it's about voting.
how to add a vote-tracking feature for a server using a bot?
@rain heartthat has nothing I could see to help me
it mentions server webhooks here https://docs.top.gg/resources/webhooks/#server-webhooks
When using the https://top.gg/api/bots/:bot_id/check endpoint, will I know if the user has voted in the last month or in the last 12 hours?
Will anyone help me to do this...
What's Shards?
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
Last 12 hours
Aka a full vote cycle, which is 12 hours
Thanks 👍
12 hours
Of course the only time I forget to scroll down
-servercount
read the message above
hi guys, can you give me a vote notification code for top.gg that will work in the virtual machine?
i'm not sure what you mean by vote notification code, and any code that works on a regular machine should work on a virtual machine, if you want to be notified when someone votes, you can set up a voting webhook and forward it to discord everytime using this : https://comhad.github.io/webhook.html?page=serverless
@spice helmdoes it need any special things? or any bot dev can do it?
Doesnt need anything special, its designed to work without that stuff
okay, thanks bro:)
And I was wondering, how does top.gg knows that the server count is real, as anyone could state that their bot is in 100M servers?
hi guys, so i was using top.gg, died for like 3 month, retured and everything changed. can someone tell me how to use the server count thing?
https://docs.top.gg/libraries/javascript/#posting-bot-stats for any reason doesn't change the servers
hello. i want to make a webhook that will give a vote role , any video guide or something (thank you 🙏 )
https://comhad.github.io/webhook.html?page=serverless take a look at this, the integration service has a discord module, maybe you can use that
is the event on_dbl_vote immediately called when someone votes? (python)
Every time I try and do
await ctx.send(f"I have {await self.bot.topggpy.get_bot_votes()} votes on top.gg!")
I get
Ignoring exception in command votes:
Traceback (most recent call last):
File "/home/the1calc/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot.py", line 122, in votes
await ctx.send(f"I have {await self.bot.topggpy.get_bot_votes()} votes on top.gg!",
File "/home/the1calc/.local/lib/python3.8/site-packages/topgg/client.py", line 250, in get_bot_votes
response = await self.http.get_bot_votes(self.bot_id)
File "/home/the1calc/.local/lib/python3.8/site-packages/topgg/http.py", line 191, in get_bot_votes
return await self.request("GET", f"/bots/{bot_id}/votes")
File "/home/the1calc/.local/lib/python3.8/site-packages/topgg/http.py", line 121, in request
data = await _json_or_text(resp)
File "/home/the1calc/.local/lib/python3.8/site-packages/topgg/http.py", line 59, in _json_or_text
return DataDict(**json.loads(text))
TypeError: type object argument after ** must be a mapping, not list```
Same for me
damn
@terse elbow I don't have the solution but you can maybe do a request to https://top.gg/api/bots/(bot ID)/votes/ and don't forget to put header "Authorization" with your dbl token
did that work for u?
it seems to work
?
is there a way to get the Ratings & Reviews of a bot from top,gg api ?
or will have to manually scrape it ?
what
nothing
how to create webhook for post vote
deno support when
actually duck it im doing it myself
Ik they will refuse to add support for deno
so im just doing it myself cya
lol
how can I create webhook?
create a WEBHOOK with the top.gg api for a server and the same thing as creating a WEBHOOK for a bot?
They're technically the same, just different data formats
Check the docs about the webhook schema
what is the base link to the API?
I got a question. Can anybody here teach me how to link a voting site to a bot? Like when you vote for dank memer, it gives you daily boxes.
How to check if someone actually voted for my bot?
u can use the top.gg api webhooks
How do i setup the webhook?
Thx a lot
np
What should my webhook url be?
if it's a VPS then
http://YOUR_IP_ADDRESS:PORT/
Example
http://69.69.69.69:3000/
If its not a vps? @smoky marten
where is the server hosted ?
Your PC ?
AWS Lambda ?
GCP ?
AZURE ?
REPL IT ?
HEROKU ?
Replit
İt should give an url
the url in the top bar in the browser preview window. it looks like
https://project_name.username.repl.co/dblwebhook
Are ipv6 VPS adresses supported?
Guess so
(didn't try it out myself)
Hey how can i get the server count thing?
like
its from server_count
bit how do i take into actions?
looks like im too dum to know how it works lamfo
(node:33248) UnhandledPromiseRejectionWarning: Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)
const Topgg = require("@top-gg/sdk") const api = new Topgg.Api("")
if (u) {
await api.hasVoted(u.id).then(voted => {
console.log(voted)
if (voted === false) rozets.push(`**[${lang.badge}](https://top.gg/bot/817473313793376266/vote)**`)
if (voted === true) rozets.push(`:dbl:`)
})
}```
delete it
now
before anyone gets the token
delete what
the fucking code
you put the token in it
You put your Top.gg token in the code snippet you sent above
It's strongly suggested that you reset it as soon as possible
i deleted
Reset it as well
ok
Regenerate*
"server_count": 10
}```
Where do i use this info on?
body?
Do you know how POST requests work?
i totally have no idea about that
HTTP Request Methods The internet boasts a vast array of resources hosted on different servers. For you to access these resources, your browser needs to be able to send a request to the servers and display the resources for you. HTTP (Hypertext Transfer Protocol), is the underlying format that is used to structure request and […]
@sullen nymph how can i solve this error
Try regenerating your bot's top.gg token
The error sometimes happens even with valid tokens
yep
it is valid but still returns the error
Regenerate again 
but it always wants 
How To Get The API Key??
Read The Channel Pins!!
Ok
it returns error every time 
sometimes it works but %96 returns error
-b @restive otter
Banned UltPOG#0001 (@drowsy willow)
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
<@&304313580025544704>
-b @restive otter
Banned BlackBoy#9393 (@steep escarp)
damn
pain
wtf
Children being childish. :(
cringe
lmao wtf
Still getting phone notifications ffs
I was too when off discord
F
hey sorry to disturb but do u have any video reference?
Where Is The Webhooks Button
YouTube probably has something
Available once your bot is approved
how use the api dblapi.js for webhook rewards?
Im using https://npmjs.com/@top-gg/sdk is there any example of the vote object specified here: https://ss.fc5570.ml/r7g5
like i wanna know what the vote object contains apart from the user who voted
please ping when replying
without the express
It would be really nice if you guys added support to the openAPI specification for top.gg API
Hey I been waiting over 3 weeks for my bot to be approved and I never applied for a bot before so I don’t know how it works so can someone help me out here please
here its a file out of my deno version of the node sdk
the node sdk should return the same object structured like this
here is also the link to the docs
the structure is also defined here
Hi, the site is for some reason sending two requests to my Webserver, which then gives the user instead of 500, 1000 Zeros (bot-economy), also sends them two DMs and adds two votes to their vote count
Ping me once you reply, please!
on weekends your bot when it gets a vote actually gets 2 votes instead of one
are you responding with a 2xx?
and this above
if you dont respond with 2xx the event will be requeued and resent
also no, its only one vote event even if it's weekend, its up to the dev to decide via the isWeekend property
I see
btw question
does it make sense to have a seperate event for the webhook class that I have
for when its an upvote for a server
or should I keep both in the same event
same event
export interface WebhookPayload {
/**
* If webhook is a bot: ID of the bot that received a vote
*/
bot?: Snowflake;
/**
* If webhook is a server: ID of the server that received a vote
*/
guild?: Snowflake;
/**
* ID of the user who voted
*/
user: Snowflake;
/**
* The type of the vote (should always be "upvote" except when using the test button it's "test")
*/
type: string;
/**
* Whether the weekend multiplier is in effect, meaning users votes count as two
*/
isWeekend?: boolean;
/**
* Query parameters in vote page in a key to value object
*/
query:
| {
[key: string]: string;
}
| string;
}```
its best to just leave it how it is and maybe add separate events in the future
especially because v1 is planning on adding many more events
reviews, announcements, etc
ok so it just has both as optional parameters I see
I will do it like this then
oh nice I can finally listen to reviews lol
ye
epic
announcements would also be a cool way to just make it post the announcement to discord channels
anyways cya thanks for the help
Thanks.
I was looking at the webhook part of https://docs.top.gg/libraries/javascript and I was confused
How do I create a webhook url?
Also please dm me because I am about to sleep and I don’t want to lose my replies
it takes long for your bot to be reviewed so just be patiant
oh, yes, makes sense.
thanks
can't find all the events
for example how do i reward an user for voting the bot?
because i don't see any example code
How do i get webhook url for this? Im using heroku to host my bot
How do you do that?
i know what is heroku
you don't need vps for hosting a webhook
kinda
@manic duneHey, so i got the webhook now and its a long code, what do i do now?
umm how ?
Do i have to create any file in the folder to paste the webhook code?
The webhook path is a imaginary path you choose the webhook service is listening to.
There are no folders/files needed in/to the root path.
It’s cloud usage not a VPS.
There’s a major difference between a VPS (virtual machine) or just cloud resources you can use in a non-os environment.
const { get } = require("request-promise-native");
let t = await get({
url: "https://top.gg/api/bots/830102447614853153/votes",
Json: true,
qs: {
access_token: 'censored key'
}
});
return t.length```
Getting Unauthorized...
Isnt this how we get votes using request-promise-native
whic can only be obtained after getting your bot approved
My bot is approved
I have api key
Tried using but still unauthorized
Cuz of Epic Games
Couldnt claim Nitro in that acc made new acc
weird
Hm
Can someone help me fix this? Getting unauthorized even with correct key
hi
I want a few of my commands to work with votes what can I do
I'm getting a bunch of spam for 401 unauthorized. Is there any way to turn that off? (I'm using the npm package @top-gg/sdk)
you can't turn off a http request, but you can change your code to hopefully get another different request
I'm not the one producing the console.error I think it's coming from the middleware for the webhook.listener
either file a issue on their github or start a pr
but mostly if it's the middleware, it might be your code that it's complaining about
first thing you should do is troubleshoot the action itself, then look at everything it interacts with for problems
don't be afraid to console.log regularly
Yeah this is the error:
TopGGAPIError [Top.GG API Error]: 401 Unauthorized (You need a token for this endpoint)
at Api._request (node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Api.postStats {
response: { error: 'Unauthorized' }
}
unless I'm using the wrong token
hi
I want a few of my commands to work with votes what can I do
nevermind I figured it out.
You can integrate with webhooks Every time someone votes it will send it to the webhook
okey
Error: 401 Unauthorized?
it is...
it isn't
i mean it worked once and when i restarted the bot it stopped working
so... any ideas?
@rain heart hi, is about me! I have a bot on your website and i have a problem with api, all the time eerror: 401 unauthorized
Work only 1 time and after, this error
And is not only for me, a friend have same problem
If you can verify the api or idk :-?
@paper crane is my second developer on my bot and this is why ask about that btw
after 35 min, no answer? 😕
seems you are not using the correct token
I use the correct token, like i click on "regen"
i use "relase token" and i copied it
After i put it where is needed, work for one time and after doesn;t work anymore
@paper crane can explain more, he work on api's for my bot 😕
yup
Work only one time
sheeesh
After that
its so hard to make a website D:
nope
Sooo what do you think, @jaunty plank?
so i made a test command
hmm, not seen that happen before.
double check you are sending the right token by logging it.
and this is the dbl.js
with the same token (verified) or other token (regen)
oh
We will try, thx ^^
@jaunty plank im waiting for a approval for my bot how long those it take??
whats the new code look like?
so it looks like your making a new dbl client each time you run the command. you dont need to do that.
oh
const Topgg = require(`@top-gg/sdk`) // this part can go above the command export
const api = new Topgg.Api('Your top.gg token') // this part can go above the command export
await api.hasVoted(dbwVars.CommandAuthor.id) // this can replace the require/token part
did you fill in Your top.gg token
yes
i don't have access to it but @knotty plover sent it to me
if i send you the token can you verify if it's correct?
@knotty plover is this how you got the token?
https://cdn.discordapp.com/attachments/412006692125933568/813891525708349440/z66BymzwTZ.gif
so...?
did you update your code to not make a new instance every time the command runs?
Yes
Work for one time and after BUM error
and it still works once then not again?
no it doesn't work at all
keeps saying the unauthorized thing
I have no idea then
So, @jaunty plank, new member with the same problem :))
Sometimes working sometimes not working
yes
Hey this is more related to the vote webhook, we use a UFW firewall on our VPS is there anyway we can whitelist the IP that sends posts to us?
How can I do that? Never done it before
It doesn’t filter the source IP but that shouldn’t matter for a random port
sudo ufw allow from 1.2.3.4/32 to any port 9999
If you wanna filter the source the request is coming from
the code is literally on their README.md what's there to help ?
😋
legends can understand 👀

yea i understood that I'm not a legend



TopGGAPIError [Top.GG API Error]: 401 Unauthorized (You need a token for this endpoint)
at Api._request (/home/ubuntu/real/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Api.postStats (/home/ubuntu/real/node_modules/@top-gg/sdk/dist/structs/Api.js:96:9) {
response: { error: 'Unauthorized' }
}
please help fast
i need to host my bot again
its crash by this error
its valid
you can dm me i can explain to you
also am making tutorial for this
You must be forgetting to use headers since the response was clearly an unauthorized error
Is there any way of checking how many votes someone has in total for your bot & how many for that month?
Hi, how to get voter username python?
module.exports = {
name: `grab`,
category: `🎶 Music`,
aliases: [`save`, `yoink`],
description: `Saves the current playing song to your Direct Messages`,
usage: `grab`,
parameters: {"type":"music", "activeplayer": true, "previoussong": false},
run: async (client, message, args, cmduser, text, prefix, player) => {
if(!voted) {
return message.channel.send(new MessageEmbed()
.setColor(ee.wrongcolor)
.setDescription(`This is Command is Vote Required Please [vote me](https://top.gg/bot/802812378558889994/vote) First `)
)
} else {
return message.author.send(new MessageEmbed()
.setAuthor(`Saved Song:`, message.author.displayAvatarURL({dynamic: true}))
.setThumbnail(`https://img.youtube.com/vi/${player.queue.current.identifier}/mqdefault.jpg`)
.setURL(player.queue.current.uri)
.setColor(ee.color)
.setFooter(ee.footertext, ee.footericon)
.setTitle(`${player.playing ? `${emoji.msg.resume}` : `${emoji.msg.pause}`} **${player.queue.current.title}**`)
.addField(`${emoji.msg.time} Duration: `, `\`${format(player.queue.current.duration)}\``, true)
.addField(`${emoji.msg.song_by} Song By: `, `\`${player.queue.current.author}\``, true)
.addField(`${emoji.msg.repeat_mode} Queue length: `, `\`${player.queue.length} Songs\``, true)
.addField(`${emoji.msg.playing} Play it:`, `\`${prefix}play ${player.queue.current.uri}\``)
.addField(`${emoji.msg.search} Saved in:`, `<#${message.channel.id}>`)
.setFooter(`Requested by: ${player.queue.current.requester.tag} | in: ${message.guild.name}`, player.queue.current.requester.displayAvatarURL({dynamic: true}))
).catch(e=>{
return message.channel.send("**Your Dm's are disabled**")
})
message.react(emoji.react.SUCCESS).catch(e=>console.log("Could not react"))
}
}
syntax error
but i cant find
i am looking 4 time but i cant get it
anyone can help me
you didn't define voted
solved
good then
Guys npm is showing 404 not found for @waxen widget-gg/sdk
Whats the reason?
how do i use the topgg api to show the guild count of my bot on the website
will this one work to show the guild count on the website
const { AutoPoster } = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
Try
Hey how can I get the vote.user tag?
if vote.user gives you the user id then fetch it from cache
client.users.cache.get(id)
something like that
Ok thanks
poor top always gwts pinged
lol
Also I want to vote reminders, Like subscribe and unsubscribe. How can I do that?
I mean, The bot needs to send a dm to user after 12 hours reminding them about the vote
Like dank memer sends a dm right
you gotta do that on your end
when an user votes, save that somewhere and then 12 hours later send that message
as easy as that
how you save it and how u send the message after 12 hrs have passed is not my problem
how to save?
Hy
You need a tutorial you can see this https://youtu.be/ydJbPG_dyHc
#discord #discord.js #realcoder
Hey am official member of realbot
Source Code - https://github.com/RealPukhraj/Stats-Count-For-topgg
Github - https://github.com/RealPukhraj
If you need any help join
Discord Server - https://discord.gg/k9zFcucTKp
Thank You
Regarding Real e-Sports
Always We are waiting for your joining.
Social Links :
✔ We...
This video can help you how to use top.gg api
Also you can read npm package for top.gg api
😂
Thanks
omg
tysm man
it helped me

Does top.gg api work with python
So no?
welp
oh
I just been seeing a lot of js so i thought it didn’t
ok
just use this
#discord #discord.js #realcoder
Hey am official member of realbot
Source Code - https://github.com/RealPukhraj/Stats-Count-For-topgg
Github - https://github.com/RealPukhraj
If you need any help join
Discord Server - https://discord.gg/k9zFcucTKp
Thank You
Regarding Real e-Sports
Always We are waiting for your joining.
Social Links :
✔ We...
it will help you
ALOT
description mentions d.js
LMFAO
Token not added via secrets
Yeah no chief
And what the fuck does "instantly" even mean in that case
As if top.gg delays requests coming from users
Thanks
Hint: it won't if you're not using JS
And since you're using discord.py, https://github.com/top-gg/python-sdk/
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you are
👍
thanks
One message removed from a suspended account.
One message removed from a suspended account.
Oh right I should release a new version with the deserialization patch
One message removed from a suspended account.
Imagine encouraging people to leak their token
One message removed from a suspended account.
It's a low-effort tutorial
One message removed from a suspended account.
I'm fine with it since you can post stats with just the token
Thing is, it's a Discord token
Yup
Oh well, did I misunderstand that
I read it as "You can only post stats with the token" 😩

Is there any way of checking how many votes someone has in total for your bot & how many for that month?
Only via storing all votes locally
So there’s an event for when someone votes for ur bot right?
And there an arguments that’s passed thought it called “data”
Correct. The WebhookManager class provides those events if you use the helper methods
ah ok
Hey, After how much time will topgg-autoposter will post server count?
Should run instantly after bot start, don't know
Yeah, My console is showing error
TypeError: Token is not a legal HTTP Header value
Why my console is showing this^^?
🤔
idk why it is showing that
I gave the correct webhook token
🤷 I'm not proficient in JS
How often does GET bots/:bot_id/votes take to update - For example if I want to add up everyones votes could I check for a change then get the latest bit in the list? What if 2 people vote in the same proximity of one another?
There's a possibility that you might find days-old votes due to the fact that that endpoint returns last 1000 votes for the current month
Oh sorry
worked bro no need
One message removed from a suspended account.
@old kernel no ads
but isnt it in order of recent votes?
It is. I don't remember if it goes first-to-last or vice versa
It's the 5th time seeing this weird video on the server today 
So what would be the best way of storing votes per user then?
How do i check if someone has voted for my bot?
Please give detailed answers
And examples
Read docs
I alr did
And be creative 
The docs literally only shows how to setup the webhook
What next?
What do i do?
Atleast provide some examples
Thats up to you
What if i dont know what do to?
Then read docs
Instead of asking others for it
Really.
Never done an endpoint too
ty
Okay these docs are useful thanks!
yeah because this is py lib's docs
Which event is invoked when an upvote occurs? (I using javascript API)
vote iirc
How can you make a vote Tracking system?
@tight osprey do u use js ? ||Sorry for the ping||
Can u dm me pls
Hey, How can I save a user who voted for my bot in last 12 hrs in discord.js?
I want add vote reminders so yeah
@jaunty plank Do you know about this?
if you want to save that information youll need a database.
I have a db. How can I save?
depends on the database
It's quick.db tho
Like it will save to the database and after 12hrs it will send a vote reminder to the user who enabled it.
you may want to use a more proper database, or youll want to build your own ttl system(as quickdb doesnt have ttl)
I am trying for mongoose. But idk how to setup it.
saving the info is quite easy with quickdb, but using it in this way is a bit harder since quickdb doesnt have a lot of features.
what OS is your bot hosted on?
Windows 10
https://www.mongodb.com/try/download/community
platform windows, package msi
Ohk thanks
https://mongoosejs.com/docs/index.html has a getting started page
i dont see why it wouldnt. vsc is just a text editor
Oh Ok
This has some kittens, I don't understand what are they but should I add that in my code?
kittens is just an example
you can call it kittens if you want, or whatever you want.
Alright, So I can just ignore them?
How can I save a user who voted for my bot in last 12 hrs in discord.py
How would I set authorization header in my code with my API token?
how can i fix this? it only happens if i try to reply to a user and like the comment
i think you should go to #support for this, but it looks like it might be your browser extension if you have any enabled
oh, it must be something on top.ggs part then, best to go to support and ask what to do now
they dont answer me tho
oh right
O
I am sorry I am kind of a noob and idk why this is not working I am useing python I am trying to make it is my bot can tell if someone has voted
@client.command()
async def vote(ctx):
if client.topggpy.get_user_vote(ctx.author.id) == True:
await ctx.send("thanks for voteing!")
else:
await ctx.send("plz vote")
I can not find any examples for of get_user_vote online
the command works but it allways returns false
can someone plz help
what do you mean?
can I await a if statement?
No, the coroutine
oh ok thanks
so like this?
if await client.topggpy.get_user_vote(ctx.author.id):
You first need to await the coroutine or otherwise, it'll always return True as coroutine is truthy
Try it!
yay it worked thanks now I just need to wait 12 hours to see if it will return false
Could've used an alt account to test 
hi
Hey any one can tell me how can i set a reminder for vote in dm
Someone help me, because that comes out when I use the vote command, I know little English
You are sending too many requests to the api.
And how do I solve it?
The size of the code can also be the problem?
Probably not
I already regenerated the token and I still get the same
Can I see your code?
one moment
print(b)```
I am trying to print the last 1000 votes list but it's not printing.. Can someone help
Did you get the same error as #topgg-api message ?
i used ``` except Exception as e:
print(f"Failed!\n{e.class.name}: {e}")```
which gave TypeError: type object argument after ** must be a mapping, not list
It's fixed in the master branch, you can install it instead until it rolls out to PyPI
does this include topgg.on_guild_post() , topgg.on_dbl_vote(data)??
on_guild_post is dblpy thing
How can I update the server counter on my bot?
when trying to get my bots server count using https://sourceb.in/x3xwkrtIBi i get { error: 'Required parameter server_count or shards missing' }
you're posting





