#topgg-api
1 messages ยท Page 149 of 1
It does

Also
didn't expect that to work then
I suggest you rely on 2xx responses generally instead of just 200
import dbl
import discord
from discord.ext import commands, tasks
import os
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = "my_dbl_token"
self.dbl_auth = "my_dbl_auth"
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth=self.dbl_auth, webhook_port=8080)
self.update_stats.start()
@tasks.loop(minutes=30.0)
async def update_stats(self):
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))
finally:
print("guild post attempt done")
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
logger.info('Received test vote')
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
print("top.gg loaded")
200 <= response.code < 300:
success
have you attempted to make a test request to your webhook using postman or reqbin?
Yes
Where is your webhook hosted
what?
Ye I tried and it send me a json
Also keep your indents either at 4 or 2 spaces
How was my question unclear
{bot: user:
Yes it is supposed to
it isn't
How are you sending the request
It is sending me post request
so you are sending a post request to your webhook with json data?
To post the vote data when someone votes bot
No top.gg API is sending me
use reqbin to check if your webhook works correctly
So can we assume that it works properly..?
So it worked
Yep
Not works
What is that thing?
Reqbin lets you send custom HTTP requests
oh
Where do i get the webhook url?
and paste it where you want it
Discord Channel webhook?
yes
It appears that my bot page on top.gg does not show any of its most recent reviews, only the first 20 or so, although I can still see the review count going up. How can I fix this?
Pretty sure that's just a site issue right now, you're not able to view more than 20 reviews
I'm sure it'll be fixed with the upcoming updates
thanks ^^
what do i put into the authorization box @night ingot
Whatever you want
:D
ok
@night ingot i keep getting this error:
discord.ext.commands.errors.ExtensionFailed: Extension '__data__.dbl' raised an error: AttributeError: type object 'dbl' has no attribute 'DBLClient'```
Did you import the dblpy library?
yes
Show your code
ok
nvm i fixed it
@night ingot one last thing,
what would go in the
webhook_path='/dblwebhook'
this confuses me
So your webhook url is supposed to be
http://<public ip>:<port>/<webhook path>
that's the <webhook path> part, it can be whatever you want
i thought the webhook was supposed to be a discord webhook?
so in your case, your url is http://<public ip>:<port>/dblwebhook
No, Discord webhooks won't work
i see
In cases like this you want to make sure they are not using a variable or a locally imported file @night ingot
I have a problem with the webhook after vote, no send post
Before I had http but I added ssl & changed to https and now the top.gg webhook do not arrive
But if I test it on postman it works correctly
You want to send it on your server?
Express on vps linux.
if i use postman, return 200 ok https://prnt.sc/11q5meo
Hmm i think not ๐ค
But before putting the ssl it works for me without problem
I know, I just need to know all details
If you were using nginx/apache I'd say to check the logs
They'd have listed what's happening with the request
How can I check?
That's what I'm trying to find out
Check what proccess is listening to ports 80/443
Yep looks like you're raw
Hm
Lemme think
Do express have logs for requests?
Or a debug mode?
Let me check
From what I see, express () never receives the request
How to dm a user after they vote?
Sorry wrong channel couldnt see names proprly im so sleepy
guys, how do I check if someone voted my bot on top.gg?
nvm i found the /check endpoint
are you sure you're typing correctly the address?
alright so I am attempting to run a few lines of code after someone votes for my bot. I am trash at working with apis and http requests so any help would be much appreciated (discord.net library)
ps. tried myself without any luck
isnt d.net outdated?
but anyway, you'd need to use a webserver or @Top.gg/sdk
does @Top.gg/sdk include any methods related to checking if a user has voted my bot? something like a .hasVoted function?
i am not referring to the api itself
there was a function in the dblapi.js package which allowed me to check if the user has voted
but it seems like in the new package, I cannot find a function like that
thanks 
Is there any problem with dbl webhook?
I tried using the dbl webhook but no webhook path found 404
I tried the same path with a custom webhook it worked and prints
why dbl webhook not working
I am hosting my bot on replit and using flask to run the server
So what should I type as the IP?
localhost?
Anyway it doesn't work with dbl webhook
Please help
For custom webhook my webhook url I set was https://my_repl.repl.co/dblwebhook
Pls bal 825298180479909918
-botcommands
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.
Hey dude can you get me anyone who is good at py here
can't help with repl related things
@app.route('/dblhook',methods=['POST'])
def response():
data = request.json
print(data)
user_id = data['user']
check = str(request.headers['Authorization'])
token = "Bearer "+str(os.getenv('dbl_auth'))
if token == check:
return Response(status=200)
else:
return Response(status=410)
This is my custom webhook
It works fine
can't help with repl related things
But I need a async function which is not possible with this
but why?
because I never used repl in my life and never will
Hi, can you send me owo cash?
what?
just ask
I can't virfy my channel
of Discord
Nad I alos can't invite the bots
he tell me to virfy to my Discord Channel
please tell me
๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ
how to invite bots
what is the topgg documentation?
Thanks
Yup
Because ratelimiter package is ๐ฉ and doesn't work with Python 3.9
Downgrade
Between 3.6 and 3.8
What yells it's not?
Yeah reinstall the package via pip
What did you do
install not uninstall
dblpy

any1 got code for discord.py if i wanted a role to be given when ppl vote on the server?

How do I add this bot to the server
whats this bot?
like dsl?
Yes
server listing?
Yes
Ty
rtfd
data is a dict
You can't get keys as attrs
get_member isn't used on data
That code by far
Is the worst example I have ever seen
sahur ci
It was already fixed, thank u
import discord
import asyncio
import dbl
import logging
from discord.ext import commands, tasks
class Vote(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'MyRealToken'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_port=5555)
async def cog_command_error(self, ctx, error):
if isinstance(error, commands.CommandInvokeError):
await ctx.send(error.original)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("received an upvote")
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("Received a test upvote:", "\n", data, sep="")
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(Vote(bot))
Checked everything but still authorization is an error it says
https://cdn.discordapp.com/attachments/412006692125933568/833606944031899698/unknown.png
https://cdn.discordapp.com/attachments/412006692125933568/833607035072937984/unknown.png
https://cdn.discordapp.com/attachments/412006692125933568/833607528994439228/unknown.png
If you set your Authorization to "topgg" you need a webhook_auth="topgg" in your client parameters as well
you can use whatever you want to send vote received message
hi i want help idk if i am on right channel for help but yeah
i want to make a vote checker from which i mean
my bot will check who has voted it
then send a thank u dm to user
i can do the dm part but i need vote checking part
also i dont know anything about top.gg api
the language i have to code is js
thanks
@rain heart
if you've setup the webhook parameter in your constructor and the webhook in your bot page, yes that could work
@rain heart done all of that
@rain heart this is for discord server list
still applies
reqbin is more controlled to test it
{
"guild": "12345",
"user": "12345",
"type": "test",
"query": "?true&isTrue=1"
}
use this as test data in reqbin
@rain heart what would my url be?
http://yourip:portofyourwebhook/path
what do you get in response?
also can't really help with repl stuff, so you need to be 100% sure the url is correct
unauthorized
do i have to add some token or something
have you set a Authorization header?
not password and username
literally just a basic auth header
well not basic auth
in reqbin's case, custom
@rain heart it worked
How can i get the API key?
You can find your dbl token on your bot's edit page under webhooks, but you won't have access to the API until your bot is approved
1 question
There is any way to make that if somebody votes a server
the bot detect that?
it does
With the same dbl token key
Okay
I dont find the key ;-;
Ah
it needs to be approved
Well.
If i want to get the api key just for the server and i dont want upload the bot?
What could i do?
is dbl and dsl events under the same network?
More input please
post your code, what exactly isn't working
have you added it to your bot page settings under webhooks etc
i posted about it earlier
and yeah, i did add all the stuff i'm supposed to add
i have the auth did properly, the url is my public ip
set up like this
http://my.ip:6950/dblwebhook
additionally, i also tried making a new open port
have you tested it using reqbin for example?
Test it outside of top.gg to see if you're at least getting a valid request to your webhook
sure
alright it works
@rain heart what exactly does the query do?
uhuh
@rain heart can queries be empty?
yes
last thing
what does this mean?
the query there?
see what i just said above
A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML form.A web server can handle a Hypertext Transfer Protocol (HTTP) request either by reading a file from ...
bit more detailed
ahh icicic
for example you can have ?dmNotifications and check if the query is ?dmNotifications and know that for example this user voted through the dm notifications
Is there a on_dsl_vote event because I have a server private bot and I want it to listen to on_guild_vote if exists
That bot is not registered in dbl
Was the api being laggy for anyone else yesterday?
how? Use custom webhooks?
or is there a way to create dsl webhook
like
self.dsl = dsl.Client()
That port needs to be free and be opened
can someone please help?
a user just voted for my bot
and in data it shows this
but when i check if the user voted
it shows false
whats going wrong?
@rain heart
oh wait i dont think i should have pinged, in which case soz
npm ?
what id are you using to check
id? @rain heart
im 100% certain
instead of fetching all votes
@rain heart i did both
my noob temporary code
@client.command()
async def broskis(ctx):
if ctx.author.id == ownerdude:
print(await dblpy.get_bot_upvotes())
@client.command()
async def brud(ctx, userid):
if ctx.author.id == ownerdude:
print(await dblpy.get_user_vote(userid))
don't fetch the whole votes just for one vote
brud shows false
use the has_Voted or the check endpoint
not the whole list of votes
im certain it doesnt work @rain heart ive tried different methods
but whenever a user votes for me
it shows on my repl that it recieved it
but doesnt show on ur end
use reqbin and make a manual request to the api
using the users ID in the body
then see what it responds with
also you're doing it wrong, you're supposed to include the UserID in the query
not the body
see example response
append the correct params to your code above
see the example response in the screenshot, you're making your requests wrong
just use webhooks
@gritty needle i am using webhooks
then I don't think you need to check using the API
@gritty needle in the end of the day
it doesnt show that my bot got the vote
even though it did
py
repl
@gritty needle thatd mean a lot
@rain heart one question if you dont mind
can i use reqbin
cant rn
my question tho, can I use reqbin to make a post request to using a random id to get my bot think it got upvoted?
Yes
What's your code like in the first place
I wonder what I'm trying to do
Whatever that's even remotely related to your webhook
Windows asked me for access for the application and i allowed it. Is that what you mean?
You still need to open the port in firewall settings and forward it to your device via router settings
got it
ohhhhhh
Sounds like an issue on your end. I use repl just fine
ok thanks
dblpy = dbl.DBLClient(client,
gg_token,
webhook_path='/dblwebhook',
webhook_auth='pass',
webhook_port=6500,
autopost=False)
and then
@client.event
async def on_dbl_vote(data):
print(data)
k = int(data["user"])
user = client.get_user(k)
chanah = client.get_channel(834354286644428810)
embed = discord.Embed(
title="",
url=
"https://cdn.discordapp.com/avatars/823830590163255296/000ef89b04f9d1abe102b68aa7ae08ab.webp?size=1024",
colour=int('c72fa7', 16)
)
embed.set_author(
name="Fake TOG",
url=
"https://cdn.discordapp.com/avatars/823830590163255296/000ef89b04f9d1abe102b68aa7ae08ab.webp?size=1024",
icon_url=
"https://cdn.discordapp.com/avatars/823830590163255296/000ef89b04f9d1abe102b68aa7ae08ab.webp?size=1024"
)
embed.set_thumbnail(
url=
"https://cdn.discordapp.com/avatars/823830590163255296/000ef89b04f9d1abe102b68aa7ae08ab.webp?size=1024"
)
embed.add_field(
name="We Just Recieved Feedback!!!!",
value=
f"**{user.name}#{user.discriminator}** Was Kind Enough To Vote For Us, It Means So __MUCHHHHHHHHHH__ :heart:",
inline=True)
embed.set_footer(text=f"User: {user.name}")
await chanah.send(embed=embed)
it sends this
and all
but when i check if the user voted via
these 2 temp commands
@client.command()
async def broskis(ctx):
if ctx.author.id == ownerdude:
print(await dblpy.get_bot_upvotes())
@client.command()
async def brud(ctx, userid):
if ctx.author.id == ownerdude:
print(await dblpy.get_user_vote(userid))
doesnt work
it shows false
and the other doesnt have the name in the json list
API can be slow at updating the voters list
@sullen nymph same problem on the website
How can i check if it worked?
i cant see the add in the vote
What did you enter in webhook URL
Run your webhook and send a request to it
And does it work
@sullen nymph it sends the message in the channel
that someone voted
with the name and all
but it doesnt get added in the number of votes on the site
or when i check with the api
it shows false
Give it anywhere from few minutes to an hour
once again, have you tried doing a manual request instead of using your code??
so then i tried this
@rain heart thats where this question came
my question tho, can I use reqbin to make a post request to using a random id to get my bot think it got upvoted?
Do you realize that your webhook has nothing to do with the API requests you're sending
i understand that, but this was just a pure unrelated question
would that even work?
here's a simple code
that would do that
would this work?
It can work, yes. dblpy before v1.0 used to use on_dbl_test for test requests
import requests
from requests.structures import CaseInsensitiveDict
url = "https://ttbot.tog6.repl.co/dblwebhook"
headers = CaseInsensitiveDict()
headers["Authorization"] = "pass"
headers["Content-Type"] = "application/json"
data = """
{
"bot": "823830590163255296",
"user": "789435091960463370",
"type": "upvote",
"query": ""
}
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
Possible, yes
well that would be broken wouldnt it?
In what sense?
I am an idiot
I don't know how to request anything. I've never used webhooks before. All i have is a supposed listener on vote
When i console.log(app)
It says that events count is 1
wait so you're saying if i use this code with random user ids
id get a bunch of votes?
in which way it would be pretty broken
no
There's a reason test requests are distinct from upvote requests
that is not how it works
yeah that makes sense
if you're referring to other users using your url to get vote rewards, then that's why Authorization is a thing
to authorize top.gg
Auth
ahh icicic, but anyways, why wont it update tho?
different for each account
webhook_auth is the password for your webhook
uhuh
is _eventsCount the number of listeners that are active?
The webhook under the hood checks the auth header
and then adds the vote
Top.gg uses the password you enter on the website (the Authorization field) and sends it on each request
bot รผst sayfalara รงฤฑkฤฑyor
Essentially โ yes. After that, it emits the on_dbl_vote/test event with received data
i see
so where does it so go wrong that it emits the on_dbl_vote, but doesnt add the vote?
Internally on its own because API
Hence why it's been strongly recommended to use webhooks
is what you are talking about for the python version?
bruh
i saw him on github while going thru the docs
Yeah, you're using the dblpy webhook to process the votes in real time
sadly i'm using the js one
so where does it go wrong? sorry im so new to all of this
its like a whole new language ๐
so theres no fix?
None that you can implement to change it
i've made a new thing here for port forwarding but it still doesn't seem to work
(25565 is for a minecraft server)
What else am i doing wrong?
@sullen nymph last thing, who do i contact to fix?
also this shows status code 200 meaning it should have worked right?
import requests
from requests.structures import CaseInsensitiveDict
url = "https://ttbot.tog6.repl.co/dblwebhook"
headers = CaseInsensitiveDict()
headers["Authorization"] = "assda"
headers["Content-Type"] = "application/json"
data = """
{
"bot": "823830590163255296",
"user": "524918284269912064",
"type": "upvote",
"query": ""
}"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
Yup
Make sure your firewall isn't blocking requests to port 5000
Ok i added this inbound rule to allow everything both on tcp and udp
how about now?
there are still 0 listeners
@sullen nymph sorry if the ping annoys you i won't send again
How are you running the webhook
God help you
this is the output
oh no
i must have done a million things wrong
sorry i've never used webhooks before
Try to open the url to that route and port locally
Nah I just don't know what the fuck is happening
You do if your PC is connected to internet
Try to open localhost:5000/dblwebhook in your browser
The format is http://your.public.ipv4.address:5000/dblwebhook
You are probably seeing your local IP
yeah
If it starts with 192.168
What I meant is enter the URL on top.gg
Following this format
Not that
The one above that
You get the point
if they're hosting their bot locally they gotta do some port forwarding on their router first
to use their public ip
Done
i did
alr
So i'm not going to do ipconfig to get it?
Is it the one where i ask google what is my ip
and it gives me a number starting with 62?
this is what i typed
and it showed me this
that's a local ip
right
Yeah that's a local IP so
ok how do i get my public ip then
ah ok thanks
you need the public ip
it refused to connect
i just did this
and then put it here
is there something wrong with that
try visiting that url
if you don't get any response, then either port not opened or you have these kind of routers where it doesn't let you connect to it when you're on the same network
try using reqbin to make a request to it
see if that returns anything
what is that
and i type the same thing?
maybe i didn't port forward correctly
although i've already done this for my minecraft server
yeah then you probably didn't
If you don't get something like this on the right, very likely it isn't portforwarded correctly
i just added another thing here
right
ok
and then i allowed the port 5000 with an inbound rule
both on tcp and udp
I don't think there's anything else i have to do
i could be wrong though
inbound should be correct yeah
do i need to setup dynamic ddns?
that's exactly what happened
what else is there to do?
i'm going to check the inbound rules agai
is the local ip address you're using, valid aswell?
could you try using that local ip in your browser?
yeah it takes me to my router
you need the public ip
like my current local ip is 192.168.0.2
nobody can do anything with it
my messages are not sending
oh
they knows
i need to put the public ip in the port forwarding?
No no
look: try using your internal ip, the ip from your ipconfig, in your browser
do you get any response with that?
yes
it takes me to my modem
oh wait
that's not what you asked for
ok when i add the other
stuff
your pc-specific ip
you know what
this router is connected to another router
do i need to do port forwarding to that one as well?
unless it is a repeater
no it's another modem
the modem's configuration
is it on the back?
I can't really help you with that as I don't know what router you have, nor have extensively worked with port forwarding
should be
I know, my messages are taking long to send, that message was supposedd to be sent earlier
is it the wlan security?
no
the ds-n?
Product: Home gateway
Model: a bunch of letters?
There is nothing else
can't help then
Ok thank you for the help so far. I'll come again when i've port forwarded my other router
your other router's ip is most likely to be 192.168.1.1
siema
I wanted to know
how do you use the bookshop system @ top-gg/sdk from WEBHOOKS on bots with SHARDS
my bot uses 4 shards and can create shards automatically, but because of that the top-gg/sdk system doesn't work because it is giving an error because of the shards
what url do i send to?
Hello Friend
is your question about webhooks on multiple shards? or about posting stats with multiple shards?
ok
I just wanted my bot to know when to vote for him and who voted for him, how do I do that?
what do I do for this code ```js
app.post("/dblwebhook", webhook.listener(vote => {
console.log(vote.user)
}))
to work?
add your webhook url on your bot page settings
ok but my bot it is hosted on repl.it and from there comes a url is this url?
Can't help you with repl related things sorry
OK then
your url is like this:
https://replname.username.repl.co/dblwebhook
says: not found
I added my webhook from my support server and added a authorization thing to it and it said it couldn't save the webhook
Oh okay
I am getting an error 401 message when I use a valid request token, any idea why?
How are you passing the token?
(f'http://top.gg/api//bots/830771134177083393/check?userid={message.author.id}', headers={'Authorization': f'TOK:{os.getenv("TOPGGTOKEN")}'})```
The token is stored in a .env file
let your token print out before using it
Is the TOK: supposed to be there?
Because I'm pretty sure it's just {'Authorization' : 'your-dbl-token'}
yeah only the token should be there
what did you mean by this?
yeah, I am using replit, so...
wait should 'authorization' be there or should something else
Yes, that should be there
You don't need a webhook to access the api
Do like Aurel said and print the token to make sure it's the right one
It lets you post your bot's servercount, use webhooks to listen for votes, or just access Top.gg data about your bot such as who has voted etc.
You can read all about it here
Does it give examples on how to do something?
@night ingot is it possible for the bot itself to listen to votes?
Yes, that's possible. You still need to setup webhooks though
api/ not api//
why it doesn't work?
I did click to test button
it doesn't send anything
port 80 is open
I installed @top-gg/sdk and express
first of all
use http, as https automatically sets your port to 443, secure
second, define the port in the url by adding :port
http://yourip:port/dblwebhook
like http://site.xyz:3000/dblwebhook?
yes
Did you check if the port is open?
i just use these to open port 3000
firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --add-port=3000/udp --permanent
yea
it is open when i run node server.js
is it open on canyouseeme.org?
try making a test request or try to access it through your browser
if it doesn't respond at all, it is either your code being bad or ports not being open
I can't change your ip part
Port Checker is a simple tool to check for open ports and test port forwarding setup on your router.
Verify and diagnose connection errors on your computer.
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("authkey")
app.get('/test', async (req, res) => {
res.json("site acik galiba")
})
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(3000)
console.log("basladim")
I use this
I'm assuming you've hit "save" after changing your webhook url on the page?
yea
again try accessing the site using your browser
it isn't loading when i use http://test.xyz:3000/dblwebhook but it is loading when i use http://test.xyz/dblwebhook
because test.xyz is your website
it is trying to access port 80 when there's no port given
if 3000 doesn't work, then it is your code
lol
So... Do I need to create a website to receive votes?
I made a solution if you don't have a website or server, see here
https://comhad.github.io/webhook.html?page=serverless
Ooh thanks a lot!
Np :D
Kindof yes.
when will the reward role system be back?
when it gets fixed
With the API, can I know the time when the user voted for my bot? example: (req.time or req.vote.time)?
Ok, thanks
You can use top.gg's API for your bot when it is approved, but you cannot get realtime-vote events without using webhooks
why doesn't my bot appear to be online when it is online?
Because it isn't implemented atm, as @abstract moth cannot track presences at the moment
Approved meaning?
Wow OK
So when my bot is approved and on the topgg bot list , I can use the dbl event to reach votes with my bot right?
yes you could, but remember to also set your webhook url
Meaning
sorry I just started learning about this api today
We hook url?
Wait so I canโt use my bot?
??
So can i track votes , with my bot , without using a webhook?
no you can't
There is one already, using Webhooks
Again you're only able to use it once your bot is approved
I have a solution i made for using webhooks without a server, here it is
https://comhad.github.io/webhook.html?page=serverless
(mods i'm not sure if this counts as advertising or crosses a line, if it does just let me know)
Ah, that's good, ty :)
Oki guess I gotta wait a few days lol ๐
@spice helm thx a lot
Np :)
How to get how many times a user had voted?
okay
I am not able to vote
Please help
I tap on vote but it doesn't count it
What should i do?
Should i ask there
yes
would this work with a discord webhook
no
ok
but actually, do you mind trying something for me?
yeah sure what is it
Currently working on a new concept that might make using vote webhooks easier for people with no coding language and just want the vote messages than using rewards
one sec
Do the following:
- create a webhook in the channel you want vote logs on
- go to your top.gg page and use the url
https://api.discord.re/v1?url=YOURWEBHOOKURL - press save and send a test vote
ok
It should sent a voting message in your webhook url
wait is it the entire url i use or the but after discord.com/api/webhooks/...
the entire url
what do i put in authorization
leave it empty
Thank you, will continue working on it
but again you can't use raw discord webhook urls in there
yeah
Everyone can use top.gg-core npm, i am using it
Is too easy
(if this is ad just delete)
nah it's fine
though made that discord.re thing for people with either no coding language (referring to servers), who want a quick solution for logging or just want logging without much coding
It doesn't work for me...
Not the package. The package might work. I just can't get any ports open. Even with port forwarding enabled on my router, it still says they are closed when I check it on a port finder website
It doesn't matter as he assigned that as his constant name
hey, I am still getting error 401 no matter what I try ๐ฆ pls help me? I have tried everything. I am using python, and noting works
I already got a variable named webhook so I just changed it with one o.
how can I get total votes of a user?
How to dm a user after they vote?

post requests neva received help!
Details neva received
Is working if u dont use localhost...
So if you want vote log, you must use replit, glitch or vps
dont even use glitch
Repl it better option
I want to know how to setup server webhook .
read it but didn't work this.
In bot's webhook we have bot token but what about server?
top.gg/servers does not have an api like bots do
then how can i use server vote webhook.
servers does support webhooks
well servers get different data, but pretty much yeah

@rain heart what should I fill here for log votes .
read the docs for that, you need to make a webhook yourself
but pretty much the same way you did on bots
just with servers this time
any understandable doc for this :(
that the most understandable you could get
Will help u
What the fuck does it mean, "top.gg API"
It's not even official
You can literally use the official one just fine. Hell, express directly.
New to API, Is there a way for testing votes, Because you can only vote once in 12 hours?
ty
wha-
how do i trigger when a member vote
with top.gg/sdk
using webhooks
hey guys for some reason my code is not working
i am using python and using webhooks frm top.gg api
i am trying to reward my users for voting
have you tested your webhook using reqbin
It'll be hard to tell what's wrong without seeing your code
hmm
okay letme send
os.system("pip install dblpy")
import dbl
import discord
from discord.ext import commands
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = os.environ.get("dbltoken")
#self.dbl = dbl.DBLClient(self.bot, self.token, autopost=True)
url = os.environ.get("dblurl")
auth = os.environ.get("dblauth")
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path=url, webhook_auth=auth, webhook_port=5000)
async def on_guild_post():
print("Server count posted successfully")
#channel = bot.get_channel(825627974720159774)
#await channel.send("Server count posted successfully")
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Received an upvote:", "\n", data, sep="")
#print(data)
channel = self.bot.get_channel(825627974720159774)
await channel.send(data)
user = data['user']
embed = discord.Embed(description="New Vote! Voter: {}".format(user))
await channel.send(embed=embed)
@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."""
#
#try:
print("Received a test upvote:", "\n", data, sep="")
channel = self.bot.get_channel(825627974720159774)
await channel.send("Received a test upvote:", "\n", data, sep="")
#except:
#await channel.send("Received a test upvote:", "\n", data, sep="")
@commands.command()
async def dbl(self,ctx):#,data):
#C!exec import dbl
dbl = self.bot.get_bot_votes()
#dbl =data
print(dbl)
await ctx.send(dbl)
def setup(bot):
bot.add_cog(TopGG(bot))
this is my code
i was editing bro
thanks
ik how to use
lol no need to send this
what is dblurl in your env
So first of all, is port 5000 open on your network? And second of all, yes, what is dblurl
idk i thought its supposed to confidential
There's no reason to hide the path
okay is server channel i created a webhook
You can't use Discord webhooks for this
you cannot use discord webhooks
re-read the docs
hmm okay
@restive otter here's a basic guide on how to setup webhooks, with or without a server https://comhad.github.io/webhook.html
Though they seem to actually want to reward users using it
oh wait lol that's new
didn't see that landing page yet
hmm then wut is this
You cannot use discord webhooks
the webhook url is not the discord one?
The url would be
http://<your public ip>:<port>/<webhook path>
that is a discord webhook
You need a custom one i think
public ip?
Yes, the public IP of your network
i have heard of ip addresss
Hmm, do you have a static IP or dynamic?
but i dont rlly know
Well you should probably read into webhooks a bit more then
Or a server you can expose to the internet? Like a VPS?
i got a ip address
telling me its a current ip iddress
is it mine?
That would be your public IP, yes
i c
And then you need to open the port you want to use through port forwarding
okay for the webhook path
wut shld i put
this is wut i got
Don't share your public IP
oh


