#topgg-api
1 messages · Page 116 of 1
It's a password you create and enter both in your code and top.gg
dblapi.js will rely on it to confirm that requests are coming from top.gg
tried it nth happened!
when i tried to post the server count i got an error of Error: 401 Unauthorized
Are the api docs open source somewhere? I noticed a broken link and wanted to PR.
The docs are in a complete rework iirc.
dbl.get_user_vote(ctx.author.id) i get error that dbl has no attribute get_user_vote(), why?
im using python btw
how to post server count?
you can use the api https://top.gg/api/docs#intro
follow the api docs.
GUys,
in python,
this:
yeah = await dbl.get_user_vote(ctx.author.id)
gives me this:
AttributeError: module 'dbl' has no attribute 'get_user_vote'
can someone help
An instance of DBLClient has that method
and the dbl module itself has the DBLClient class
mhm
ty
hey so I code in python and I need help setting up webhooks for top.gg for voting
how would I get started?
https://top.gg/api/docs
read through the python library
why i'm getting error
your string isnt closed
@rapid kettle no the error is not there when i paste the token i get the error
i closed the string but didn't work
send a new screenshot? because the one you sent showed an unclosed string
@pine heart
where exactly is the error?
when i paste the token i get the error
i'm trying to show the server count on my bot page
yeh
i know
give me a sec
take your time
yeh i do
hmm
so do you get the error when you insert the token into the "new DBL()"?
or where exactly
the error is
const DBL = require("dblapi.js");
^
SyntaxError: Identifier 'DBL' has already been declared
ahhh
well that says everything
seems like it's already declared somewhere
maybe search for "DBL" in your file and check if you defined it twice
ah xD
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
okay then I dont really get it I'm sorry
def __init__(self, bot):
self.bot = bot
self.token = os.environ["dbltoken"]
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,
webhook_path="/dblwebhook", webhook_auth="password", webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
@commands.Cog.listener()
async def on_guild_post(self):
print("Posted to top.gg")
Nothing gets printed
well for voting
try to save your token in a json file and import that and put it that way maybe?
just to try something else I think
yeh i was thinking to do that
I also did that, like you can see in my screenshot
also it's better practise to do it like that
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = os.environ["dbltoken"]
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,
webhook_path=os.environ["dblweblink"], webhook_auth=os.environ["dblwebpass"], webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
webhook = discord.utils.get(await self.bot.get_guild(720871110266191954).webhooks(), id=781938786158247967)
await webhook.send(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
webhook = discord.utils.get(await self.bot.get_guild(720871110266191954).webhooks(), id=781938786158247967)
await webhook.send(data)
@commands.Cog.listener()
async def on_guild_post(self):
print("Posted to top.gg")
os.environ["dbltoken"] = "/dblwebhook"
os.environ["dblweblink"] = "Mochipass"
Nothing happens when someone votes help please
or even if I press the test button
well is this python... I dont know much python but I think you have made a password and provided the token and the link
right?
lik
e
/dblwebhook
you haven't just pasted "dbltoken" there in your real code right?
hmm
well if you have entered correct token, password and link then I can't help you since I barely know python
oh okey thanks for trying
I'm sorry I can't help more :c
its fine 👍
So for the webhook to work, what kind of port do I need to open in my servers firewall to receive them (TCP, UDP, HTTP, etc...) And what ip will it be coming from so I can allow it to access the port?
TCP for the port you selected, guessing requests come directly from top.gg
Just resolve the domain name to get the IP
Ok, cool, thanks. I didn't want to just open it up to any ip, lol
so im trying to make my bot give credits over the past 12 hours every time someone votes, problem is there is no visible way to sort by date/time voted
my bot is in d.net
all it returns is user, discrim, id, avatar url
It doesn’t mean the top.gg IP can’t change sometimes, dunno if they change the IP sometimes or use a service like Cloudflare etc.
You need to log and save the time the event happens yourself.
now how the hell would i do that, i cant make it run constantly
thats just highly inefficient
Well I wonder why you need the exact time and date but top.gg sends it’s requests to your webhook service for example at the time the event got triggered
so the webhook sends when the event is fired?
You can cache the time and date atm you receive this event
Yes
That’s the actual time the event happens - somebody votes for example
so how exactly do i use the webhook, im confused on that part
Hey
How Do I Do
Like
User Has Voted For Bot Thanks For Voting Turn On Notifications!
Take a look at https://top.gg/api/docs, particularly the webhooks part.
It would be like
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Oh Ok
How the hell do i even use the webhook im confused
Hey @agile quail
pong
Can You Try to Vote For My bot?
sure
ok
You can use test webhook lol
Oh XD
voted
but still how do i use the webhook in the first place
Which library
aww man
Dunno :D
It took me 7 months to fix this vote thing. Just imagine how complicated things are
yea
What's issue
and i need to make it check every 30 mins if the person still voted, ID is easy to get
dbl.webhook.on('ready') Doesn't send anything for me, even after voting
Why do you need to check that, You can instantly give rewards on vote?
Or just save the data inside a file when someone's votes.
On other side put a infinite task which runs every hour, check if the user is in the file and then send rewards?
so that people dont gamble everything away at once
well someone said check when the user voted fires
from the webhook
and i can start a timer from there
for 12 hours
every hour it gives a reward
every time it sees the user voted fired it resets the timer for that user
You don't have to do that, Just save the User ID in the file with the time stamp. Put some conditions in the loop, if time is bla bla then send rewards else pop the ID.
well i dont want to store unnecessary data
problem us current api sends the last number of users who voted, instead of when and how many times
the data is returned like this
thats all the data that the api gives
I mean the info should be enough to reward voters by a script requesting this list time by time from the API.
If you wanna react "live" if the event got triggered you will have to use the webhook service.
could you test my webhook to see if voting works on it?
May the info you can get by the API is limited due privacy concerns, who knows
You can test it yourself using the test button.
On your bots edit page at top.gg
yo wheres the api page?
havent messed with it in a while and i need to get pp god's token
aight thx
what does this api do
Can someone help me with the API and an error I get when trying to add the server count
@loud jewel https://top.gg/api/docs
I cant get that to work
read it carefully
There's an example on the api docs
all it says is
dbl.on('posted', () => {
console.log('Server count posted!');
});
i tried it already
@stuck loom https://cdn.hopefuls.de/eJ1t
hm
the dbl.on('posted') is just the event when it was posted successfully
scroll down to the methods part of the docs
it still wont work when i take it out
the shards part it says postStats requires 1 argument
that one requirement is your server count
dbl.postStats(client.guilds.size) says that the shard id is a requirement?
is what is says
what arguments do you pass to postStats
uH
that one argument should be your server count, im confused
client.guilds.size
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 180000);
That is, according to the arguments table on the docs, correct
unless I'm missing something
idk
Interesting
paniK
@stuck loom what is your djs version
uh
12.4.1 @willow spindle
it is client.guilds.cache.size
aH
bruh i was gonna put cache.size
but i thought it was part of the api
so i didn't change it lol
Hey How Do I Use API?
So I Used What It Said
And Nthin Happened
I Voted For It
And Nthin
Happened
did you add the url in your bot settings?
yes
it is not your public address
you should use your vps' ip
you need to enter your public ip-address of the bot inside the bot page settings
not 0.0.0.0
This Is What I Use To Do It Or smthin
localhost:3862
Like That?
Its nOt Rlly My IP
DanBot
?
hmm idk about danbot.host
Aww Man
Does it give you a public website address? Like glitch or heroku
yea idk
I can go to source
@willow spindle
Yes I do
So if your bot is offline but you have a feature so whenever someone votes for your bot they get something in return, is there anything you could do in case they vote for it while it's offline
i suggest logging your votes on an external program
then log them inside your database for example 
So having two seperate things online.
I want to do this by bot. That's why I asked
@worldly saddle
you can technically make a getBot request and see if you receive 404
if 403, then the bot is not approved yet
Hello, I'm posting the shard_count but it looks like it's not showing on my bot page, any idea why?
Okey, thanks!
Ghost ping ?
I find where the link of my webhook?
My bot's ip address?
https://top.gg/api/docs under your library
your server's
servers link ?
https://your server's ip adress:port/path
@rain heart It's still not showing the shards
My server's page is having issue on top.gg - some users are unable to vote due to the ad either refreshing or not starting. Is this the right area to ask for support?
My apologies.
Bro?
I'm not getting..
How to add server count on my bot page
Please tell
Is there a post request I can send instead of using the library?
What's the base URL?
And is bot ID your bot ID or Top.GG token?
your own bot id
Ty
Would this request work? Sorry, this is my first post request lol:
data = {'server_count' : len(client.guilds)}
requests.post(url = "https://top.gg/api/bots/757286567906770965/stats",data=data)
i'd say https://tryitands.ee
not sure if it does, no clue about js
though for posting it, you might need authorization
I'm pretty sure dblpy is broken with py 3.9
It worked fine, now I keep getting TypeError when trying to fetch vote after updating to py 3.9
i don't know how i can setup it,_,
Yup
I'm very aware of the issue and will release a fix for it in next version
Hello, i want to make a "vote" command for my bot but i dont understand how to check if an user voted...
discord.js in javascript
okay
but i dont understand how to use webhooks...
yes but i dont understand...
this, this doenst work https://i.imgur.com/VOvVYOx.png
yes 
yes
ohh
top.gg needs to send a request to your endpoint, which means you have to provide a public IP/DNS
oh ok
so where are you hosting your bot on?
and in the "autorisation" field i put my passworld ?
yeah exactly
i test one sec
okayy do that
(you can test with the "test" button at the bottom of the page where you have to enter your webhook url)
yes
hmm
well you shouldn't show me this
delete that message again
good :)
but it looked good
and what's the code in your editor?
const DBL = require('dblapi.js');
const dbl = new DBL("mytoken", { webhookPort: 5000, webhookAuth: 'mypassword' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
in the console he send this https://i.imgur.com/tFjZh07.png
Used your public IP? Opened the required port? Firewall configured?
?
webhookPort: 5000
yes
You created the webhook service at port 5000 already.
ow
But need to allow incoming connections to pass port 5000
yeah exactly
ok...
By default most firewalls will block requests for ports like these
But I don't know replit
Well I can tell you how to do on Unix system and Windows bot no clue how to do so for repl.it
they probably have some settings somewhere
yes
then search for firewall settings and "port forwarding"
Hey, I know this question has been asked probably like 1000 times but can I create a webhook endpoint for use with Top.gg using Heroku? Thx in advance
Heroku you'll need to enable a web thingy(its in the heroku docs)
I'll look for it
Called dynos
ok
You'll also need to use the PORT environment variable heroku provides
ok
I'm brand new to making any sort of APIs, and only really know Python. I want to make a POST API for my votes that would then run code in Python with the info. Could someone give me a guide or walk me through on how to do that?
Thanks so much!
Keep the update interval in mind
@restive otter You need to continuously post your server count
L
How do I make the server count for my bot 0.o
ok.
hope wdym submit it? i saved it if thats what you mean
i already did
do i have to have the /dblwebhook?
you need to have your full url of the webhook
with the port too?
yes
so for example if my servers ip is example.com, it would be
http://example.com:5000/dblwebhook
though changing 5000 with your port you set
if my servers ip is 192.22.22.2, then it would be
http://192.22.22.2:5000/dblwebhook
and so on
ok so also the other thing is at the bottom i have server.listen(5000) but when i do hook.port its saying 0
i tried having my port as 5000 and 0 on the site and neither worked
that's something you can ignore, 0.0.0.0 is just another word for being able to connect to it from anywhere
the port not the ip lol
dm me the webhook url, i'll test it
You host the webhook on port 8080 and don't specify it in the URL you use
Can someone help me with the webhook?
What exactly doesn't work?
I don't really understand how to set it up...
I got this and what should i do now?
Instead of 0.0.0.0, use your servers ip
So for example if your ip is 192.33.33.3, then http://192.33.33.3:5642/dblwebhook
where can i change it?
It is changed
0.0.0.0 means you can connect to it from anywhere
Use your public ip address of the server your bot is running on
does the domain work?
which token should i use? from the api page or the bot page
Token?
You mean the Authorization
That's something you can decide for youself, as long as they're the same on the Authorization field of your bot page and your webhook code
Nah you should be able to run it from the example on the documentation
yea it's not working .-.
Dm me the url you're using
Where do I get dbltoken
Hi, I was wondering how I could give a role to a user if they vote for the bot? Is it possible?
you can do that with webhooks
the webhook returns the voters user id, which you can use to assign that user a role
O thankyou is it possible in the website or do I add it to my bot?
Thankyou
hِttps://repl.it:port/path 
no it does not
it says MODULE_NOT_FOUND
const DBL = require('dblapi.js')
const dbl = new DBL('dbl token', client)
so this is the beginning of the code
which uses discord.js v11
i don't know
your sentence was too weird to answer bruh
does it work or nah
I don't have an idea
who already make a vote system for hes bot in javascript (PLEASE ping me)
Isn't the link below meant to take me to my bots webhooks because it doesn't work?
https://top.gg/bot/741343332147658833/webhooks
yes
just go to your bot settings, then webhooks
Oh ok lmao
Thanks
@rain heart Are there any examples on how to do it, as i do not really get it?
Oh yes i see now sorry i was being blind thanks
I am really confused again lol, How do i create a webhook?
scroll down all the way
On what?
on your library section of the api documentation
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
So i need that?
yes presumably
Ok thankyou for all your help
dbl.webhook.on
TypeError: Cannot read property 'on' of undefined
Does anyone know why that is
Wait so it is not a channel webhook?
No it's not a discord webhook
I can't tell you how it's done because i don't work in js, the documentation is the most accurate information about the api you can find
Ok np
The
still havin problems with webhooks?
this is my code https://i.imgur.com/H20Xbd5.png
Have you tried making a manual request to the webhook through postman for example
but when i click on "test " button he doenst respond
in the url field i put project-name.user-name.repl.co:5000/dblwebhook
Well you need to replace the things, you know that right?
the project-name and user-name
the url is just project-name.user-name.repl.co/dblwebhook and no project-name.user-name.repl.co:5000/dblwebhook
the port is useless
Hi, so i am trying to give a user a role for voting for my bot could anyone help how i could do that? and also i have it log who voted but it does not log it?
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`)
});
you have to update it yourself
its empty
completely
only shards coming
for my bot
but for my another bot
its coming
servers are showing
did you update it for that bot?
Pls Caps off
hmmm any idea why this never gets trigged even tho it posts the guild count? 
async def on_guild_post():
print("Server count posted successfully")```
what;s not triggered
Does anyone know why this is happening when I run my bot?
Your using the same port twice.
hello everybody.. I realised that dblpy's "user_get_vote" doesnt work on py3.9
according to the issue i should send requests manually
how do i do that
Go to https://top.gg/api/docs then click on My bots , and you should see something like this when you click on your bot: https://im-a-dev.xyz/nLdnKGUY.png
Now just simply copy the token!
i get it thank you
If someone voted, i want that the bot ssay directly in a channel that he vote, is there an event or something that helps me do it?
thank you
To be straightforward and clear
Nothing fucking works in dblpy with py3.9
Apply cog listener decorator to the on_guild_post event
jesus christ.
and most of the shit i wrote doesnt work on anything before 3.9

fuckin hell
I'll be pushing out a release with some stuff soon
fucking hell is a bit too hot
i mean i been suffering since the morning with this
playing around with everything
and turns out its just python being an asshole
All I can say is it will be in December/January
The only way around is to rewrite the system yourself that doesn't involve asyncio.Lock
well i just need get_user_vote
(Feel free to steal the dblpy code if you are lazy)
and im terrible at requests
you can refer to dblpy code still ¯\_(ツ)_/¯
honestly i might do that cz im just bad at anything that has to do with requests
so i'll just play around with that
Aye fair enough

Hi, I was wondering how I could give a user a role in my server for voting for my bot? Could anyone help?
Set up a webhook service, use top.gg to send webhooks to your endpoint and use the provided user ID (the voter) and assign a role on your server.
Easiest way is to integrate the dblapi into your bot or well run a second instance of it just listening to the webhooks and to assign roles.
@plucky lance any way without webhooks? my internet doesnt really allowe em :/
not really
http://yourip:port/dblwebhook
ah oki ty ty
hmmm
uhm i got this error
ValueError("path should be started with / or be empty")
okay idk what to do it doesnt work for me..
this is the code
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
from utils.db import db
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'mybottoken' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='http://myip/webhooks/', webhook_auth='myauth', 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))
and this on the webhook topgg site
I have been going at it for a while now, and still cannot seem to figure out how to send an automated message when someone votes
Can someone help?
const Discord = require('discord.js')
const DBL = require('dblapi.js')
const bot = new Discord.Client({fetchAllMembers: true})
bot.login('')
bot.on('ready', async () => {
console.log('ready')
})
const dbl = new DBL(
'',
{ webhookPort: 5000, webhookAuth: 'password' },
bot
);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Here is my code, and it does nothing when a vote happens
Of course. You can send requests to the top.gg API at any time you can want to collect the last X voters and assign them the roles. Not needed to receive the webhooks having a live environment.
Can be via. script or manually any time you’re online for example, however you want.
Ooh how would i do that @plucky lance ?
Sending requests to top.gg and receive the list of voters only has one disadvantage - you don’t know the time to voter has voted.
But that’s unimportant if you just wanna assign some roles.
Doesn’t need to be live.
Just take a look at the top.gg API docs.
It’s not complicated to send requests and receive the results.
(bots lists, voters etc.)
What code do i use for my bot to do something if it gets voted
Im using python
Hey are there any ratelimits on fetching user votes?
Ofc i have the cog listerner decorater
fetch the API values for your bot info directly and see if it posted properly
Read the documentation correctly
Hey guys what is api
An application programming interface is a computing interface that defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc.
you make one
if you are in the edit bot/server page
scroll down and you will see webhook password and url
k
i dont know how to create a voting log with discord webhook, does anyone know it?
Just listen for webhook requests, then send the Message on your preferred channel
Parse the User ID etc
What to do if nothing happens when you click the Test webhook button?
Same problem here...
If you're coding in js, read the documentation
i red, more confused
Can't help you then, come back to it once you understand documentations
help me
A P I
yes
hello
I want to do that when someone votes for my bot that they give my bot a gift
if you want your bot to do something when someone votes for it, best thing are webhooks
create a webserver and handle requests
read here about webhooks
How do I do that? is that I am new in programming
if you are new you shouldn't start with this honestly
but if you still want to try I suggest to read the section of your library on the top.gg api site (link I sent above)
okey
Guys
How dblpy autopost works?
Like
It posts every 30 minutes
But does it post exactly when the bot launches?

Wai
How do I make it
So
After the bot launches
It waits for example 15 minutes
Then the loop with 30 minute begins
class TopGG(commands.Cog):
#TopGG
def __init__(self, Bot):
self.Bot = Bot
self.token = ''
self.dblpy = dbl.DBLClient(self.Bot, self.token, autopost=True)
def setup(Bot):
Bot.add_cog(TopGG(Bot))

Hi, so i have a webhook and it does not work when someone votes for my bot it does not log it in my console could anyone help?
Test your webhook with something called Postman
to post my stats i tried using the following url https://top.gg/api/bots/707686027468472330/stats?server_count=69 But its just returning the server count instead of updating it, how do I get it to update?
2020-11-30T16:59:00.880959+00:00 app[Worker.1]: at IncomingMessage.<anonymous> (/app/node_modules/dblapi.js/src/index.js:118:25)
2020-11-30T16:59:00.880960+00:00 app[Worker.1]: at IncomingMessage.emit (events.js:326:22)
2020-11-30T16:59:00.880961+00:00 app[Worker.1]: at endReadableNT (_stream_readable.js:1241:12)
2020-11-30T16:59:00.880961+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
2020-11-30T16:59:00.881019+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2020-11-30T16:59:00.881100+00:00 app[Worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
is this a problem with the api or in my code?
Read the api do s
docs
"Json params"
oh, wait
alright, thanks
Hello
bot.dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Here i want that the webhook send the message and not to send in my console
How can i do it?
Ok
@rain heart Would you mind sending the link please
I think this is it? https://documenter.getpostman.com/view/6740351/S17oxppy
The Digitaleo REST APIs use webhooks for event notification. Webhooks are HTTP callbacks that contains notification messages for events. After you configure a webhook listener for your app, you can create a webhook, which subscribes the webhook listener for your app to specific events. The notifications namespace contains resource collections fo...
https://postman.com i think was it
Yup
Ok thankyou
any meme api?
const DBL = require("dblapi.js");
const dbl = new DBL('process.env.tokenDBL', client);
dbl.on('posted', () => {
console.log('Server count updated!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
gives this error: `Oops! Error: 401 Unauthorized`
You're sending "process.env.tokenDBL" as a string
Remove the ' from process.env.tokenDBL
@stray quail
thanks
If I have my webhook running off my computer's terminal, what should I put in the Webhook URL in top.gg to send my votes through?
You need to portforward the port of your webhook then
and then use your router's public address you can get from https://whatsmyip.org
Your IP Address plus Port Scanners, Traceroute, HTTP Compression Test, Ping, Whois, DNS, IP Geo Location, Password Generator and many more tools and how-to's
in voting what is the type if someone acutally votes?
the type is "upvote" when an actual vote comes through
ok thanks
"test" when it's a test vote done through the "test" button on your bot page
is there any other type?
Nope, these are the only two
ok thank you
Yup
What if it didn't work?
remember to press "save" and then test
because top.gg tests your currently saved webhook
I did hit save
not the one you entered inside the webhook field without testing
dm me the url
I'll see if it's valid
How do I see how many votes the person gave to my bot? Using the dbl.js api 
track them with webhooks
i suggest using a seperate node js program for tracking then
instead of implementing it into your bot
In js dbl api, can I put it in the main file thing, or should it be in ready event?

const DBL = require('dblapi.js')
const dbl = new DBL('', { webhookPort: 5050, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Can someone help me figure out what is wrong with this code? The code doesn't give any errors but it will not run the webhook
when i do ipconfig my ip starts with 192 but when i search on internet my ip is says it starts with 82??? and the webhook wont start on 82 only on the 192ip
i get this error with the public ip
OSError: [WinError 10049] The requested address is not valid in the context of the address
anyidea how to fix?
192 is most likely your local ip
if you're running your bot on linux, you should be able to do curl icanhazip.com to get your ip
windows
local pc? or on a windows server somewhere?
local pc
you need to portforward in order to get your port to be accessible from external connections
what's your code you used for creating the webhook?
import asyncio
import random
import os, re, aiohttp
from utils.db import db
from utils.defaults import guilddata, userdata
from discord.ext import commands
from random import choice as randchoice
from utils.dataIO import fileIO
import time
import dbl
import sys
import json
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/', methods=['POST','GET'])
def webhook():
if request.method == 'GET':
print("Solyx GET request?!")
return '<h1>This is for top.gg only, what are you doing here?!</h1>'
elif request.method == 'POST':
print("Yessir")
if not request.headers.get('authorization') == "myauth":
return
data = request.json
print("SOLYX VOTE: {}".format(request.json["user"]))
print(data)
userinfo = db.users.find_one({"_id": data['user']})
# Account check
if userinfo["class"] == "None" and userinfo["race"] == "None":
return
if request.json["isWeekend"] == "True":
userinfo["voted"] = "weekend"
else:
userinfo["voted"] = "True"
db.users.replace_one({"_id": data['user']}, userinfo, upsert=True)
return '', 200
else:
abort(400)
if __name__ == "__main__":
app.run(host='mylocal 192 ip', port=8080, threaded=True, debug=True) # will listen on port
yeah can't help you
adn when i chance my local ip to the one google gives me it saus that error
;-;
no worries
thanks for trying anyway

This hurts to read as I'm not used to big codeblocks
@sharp vigil run the webhook on 0.0.0.0
nope :)
Okay let's see how many prayers this will take
i have to do it with the webhook right?
cuz the uuh server post thingy works
although it sends the same amount as shards
;/
You need a webhook only in order to receive a live event not if a user has voted or not
ye
Specifically, are you .running the application on 0.0.0.0?
OS?
OSError: [WinError 10013] An attempt was made to access a socket in a manner prohibited by the access permissions
windows
Make sure to allow the app to pass the firewall and open/forward the port to your device the app is running on
Are you high
That’s a problem for u 
Oh you’re speaking about the error, thought you don’t receive the webhook
lmao
it gives me ✨ Distrust ✨
Is your Windows user (running the app) an administrator or just a user?
Admin
I think its cuz i have a router on a router
So www -> router -> router -> my pc
The webserver is running and is accessible and no anti-virus shit is blocking your app?
Tried a different port already? May some other webserver uses port 8080 already.
the uuh GET function works
just the post doesnt
if i try the post from topgg
O_O
tried port 8081
You can’t actually just run a webserver to receive a POST request on your endpoint.
It has to be a webhook service in order to work.
uuh me confused

anyway
how would i get the list of voted users?
or like check if a certain user has voted?
without the webhok?
Python?
yup
will do
Hi i added the api cog to update how many servers the bot is in to top.gg anyone know why the status stopped working after i did this
3
trying to test a webhook for bot running locally on my pc. It doesn't arrive, anything I am missing? Did the port forwarding, password is the same
(solved it)
One message removed from a suspended account.
Votes reset on first day of each month at 00:00 UTC
The number is there because no one has voted after the reset yet
Oh it could explain it then
anyone know how to fix the issue that heroku cant find module dblapi.js? it works on self host but not on heroku/github
is possible to .hasVoted() return also the left time to vote again? I am trying to avoid storage each vote in the db
which worker are you using?
It's an API call so no
top.gg doesn't provide that
I see, thanks turtles
You could technically track that yourself using webhooks
whr do i include this xD, i dont rly understand api hahaha
in your main file it seems like
i dont think you define the client inside other files
How can I fix this?
post your servercount https://top.gg/api/docs
hii
is there a way to test if on_dbl_vote works without waiting for 12hrs ?
in the python lib
?
Can someone help me how can i setup vote weebhook?
@tribal sky use the test webhook with on_dbl test
Read the docs
How to fix "servers"? is that it appears that it is at 1 when in reality it is at more than 50
You need to frequently post it yourself
Topgg doesn't do that for you
can i use https://www.npmjs.com/package/dblapi.js with eris?
ok
Should i add some password in py self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
Anyone
cmon atleast someone
;-;
in the password field yeah
you can define it yourself
it should match the one on your bot page settings
What ?
Like hmm password?
Ok u mean i can make my own password and insert it in there
@rain heart ?
any password
Ohk
Ohk thanks
In webhook URL, which URL do I have to write?
server?
Where are you hosting your bot?
the ip of where your bot is running on
can't help you then, google how to get the repl.it ip
I searched in google and got the result as some number in form 00.000.000.000
than?
look closely, if you dont know it, look through the knowledgebase of replit, otherwise ask their support
ok
will that ip will be in normal form like https://abcd.com/
ok but what will happen when a write the url and click oon test?
That's up to your code you used
it sends a request to it
a request to your webhook
and then you can make your webhook use the data from the request for for example rewarding the user
but how? what actually is a webhook?
@tiny heart repl.it webhook is reached via the project URL
The repl.me thingy specifically
That's exactly what I just explained
I'm generally amazed how you people manage to make bots without reading comprehension
repl.it should/does give you URLs to use for repls
yes it does
is this my url?
I sincerely hope you are simply fucking with me and actually seeing the URL to the fucking right of the code editor
ohh i wrote that url in webhook url and clicked test but nothing happened
Did you handle the incoming request in any way?
no incoming request was there
Send me the URL in DMs
ok
No request coming in my webhook URL
My Code :-
const express = require('express');
var bodyParser = require('body-parser');
const server = express();
server.use(bodyParser.json())
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
module.exports = keepAlive;```
dm me the url, i'll test it through a request maker
ok
Dbl Webhook nasıl oluşturabilirim
what to do of the information which i got when i clicked on test in webhook?
Could you tell me how to fix that? or pass me a "reply" code to do it...
Im having too much high latency on my bot and keep getting this error
any help?
i just required the api












