#topgg-api
1 messages · Page 106 of 1
have u tried to regen ur token yet?
I remember having the same issue
can’t remember how I fixed it
I think it just went away
yeah ngl i think it will probably just go away after a bit
not entirely sure why this would be happening tho
lmao
if more people start reporting the same issue or if it keeps happening in a couple hours then ill report it to the team
Im trying to link my webhook url and i keep getting
There was a problem saving the webhook :Thonk:
Im using an ip currently because i dont have domain and the path is
http://ip:port/dblwebhook
still same error
voting doesnt work for my bot anymore either, nothing has changed on my end
getting a similar issue as the ppl above
Same here, tried regening token a couple times and it still returned a 403
@frozen canyon bots only work in #commands and #265156322012561408 also dank memer is muted
same, can't check votes, and it gave me a 403 and some kinda captcha
at the end of the error it said statustext: forbidden
Hi! So I wanted that when someone voted my bot on DBL, a message will be posted on a channel and then a role will be giving to that user 12h. All this automatic. I think I need to use the DBL api but not sure how to create this...
@narrow raft The role part can be done without the API but the message logging requires webhooks
Just a heads-up, we're not talking about Discord Channel Webhooks
So like I want a bot message not a webhook
You have to use the DBL Webhook
Api now works! nice
require('dotenv').config();
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(
process.env.TOKEN,
{
webhookAuth: process.env.WEBHOOKAUTH,
webhookServer: server,
},
);
dbl.webhook.on("ready", hook => console.log(`Webhook running with path http://${hook.hostname}:${hook.port}${hook.path}`));
dbl.webhook.on("vote", vote => console.log(vote.user));
app.get("/", (req, res) => {
console.log(req);
console.log(res);
});
server.listen(1234, () => console.log("listening"));
This didn't console log the vote
did you update the url on your bots page?
I did what?
also, im not sure it even works if your bots not approved yet
im doing this with a friend
also, if you're going to use express and http only for dbl, might as well not use them
his bot is approved
dbl doesnt need express nor http
do i need to use my own ip?
the ip of the server your webhook code is running on
is that the hook.hostname?
require("dotenv").config();
const pack = require("dblapi.js");
const dbl = new pack(
process.env.TOKEN,
{
webhookPort: process.env.WEBHOOKPORT,
webhookAuth: process.env.WEBHOOKAUTH,
},
);
dbl.webhook.on("ready", hook => console.log(hook));
dbl.webhook.on("vote", vote => console.log(vote));
right now we have this
looks correct
you dont get it from there
oh
im just using my pc right now to test it
ah
then you can google "whats my ip"
however you will likely be blocked by your modem/router's firewall
its better to test it in the server
ok!
it would show ur ip but the port forwarding would be messed up wouldnt it?
and then use the ip of my vps?
yes
if it works can u show me how to do it cuz im having issues
What issue are you having?
Where can i have a token?
i started the file
on my vps
i got
{ hostname: '0.0.0.0', port: '5050', path: '/dblwebhook' }
0.0.0.0 is ur vps ip bascially
but then i pressed the test button for the webhook and didnt get anything
it just outputted this
0.0.0.0 is just whats default logged for everyone
also, if you have a firewall youll need to let that port past
the url is the
http://ip:port/path
@jaunty plank i did this in the dbl settings
i dont think i have a firewall on myh vps
how do i check?
i would just add a index.html and then add a simple hello website
so when u type the ip adress and port it would show that
or postman
but idrk
or whatever its called
it lets you make requests to a server, in this case you could simulate a request to your webhook server to see what kind of error your getting back
ok
dont i just need to change the hostname somehow
K
https://www.postman.com/
@jaunty plank how do i use this??
make a post request, send it to the url you are using
with the auth header set to the password you chose
so
simulated request sent to my bots server
the url is the
http://ip:port/path
@jaunty plank this
How works the dbl webhooks
i cant click send
yeah, or you can use the app
Postman is supposed to be run remotely from the thing your trying to access
Otherwise it will bypass the firewalls since its local
😔
Then more than likly you have a firewall if it couldn't get a response and the webhook was running
CORS Error: The request has been blocked because of the CORS policy
No idea how to solve that, ngl
require("dotenv").config();
const pack = require("dblapi.js");
const dbl = new pack(
process.env.DBLTOKEN,
{
webhookPort: process.env.WEBHOOKPORT,
webhookAuth: process.env.WEBHOOKAUTH,
},
);
dbl.webhook.on("ready", hook => console.log(hook));
dbl.webhook.on("vote", vote => console.log(vote));
with:
webhookURL:https://ip:port/path
authorization: "password"
You are putting your ip port and path in those spots correct?
yes
Also http not https
Np
Hi! So I wanted that when someone voted my bot on DBL, a message will be posted on a channel and then a role will be giving to that user 12h. All this automatic. I think I need to use the DBL api but not sure how to create this...
I am not sure how to do this and I have tried this but idk how to make it work... https://www.npmjs.com/package/dblapi.js/v/2.4.0
You can also simulate the calls with postman, I found it more reliable than the websites webhook test @restive otter
@narrow raft
https://top.gg/api/docs#jslib
^ this explains how to use the lib
Your looking for the webhook stuff
What's not working? Are you running on a server or at home?
it doesnt send a console.log of the up-vote
Have you put the url for the webhook on the bots edit page?
what url
A webhook server receives requests from the webhook client.
The bot has the server and the client(top.gg) needs to know the url that the webhook server is at.
The url would just be
http://ip:port/path
what ip and path?
The public ip of the server your code is running on
And the path you set with the lib
Or the default one listed on the docs
0.0.0.0 is just a placeholder
what do I set webhook_path to in self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='my auth here', webhook_port=5000)?
what is JavaScript (ES5+BD.js)?
you can leave it default /dblwebhook or make it custom to anything you want. @violet spoke
its just the path the post requests go to
so where would I put /dblwebhook?
ok
on the edit page, in the url spot, would I put my channel webhook url /dblwebhook?
you need to put the entire url
http://ip:port/dblwebhook
obvs replacing port and ip
would port be 5000?
yep
k
so how does it know where to send the message if it doesn't have the channel webhook url?
yeah
yeah
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(f"Received a test upvote:\nData: {data[user]}")
``` @jaunty plank would `{data[user]}` work?
im not a py user sorry
oh ok
yeah
@jaunty plank we have hosted the bot on heroku and the webhook returns this ip
youll need to use your public heroku url iirc
iirc, heroku gives a url thats public
heroku doesnt provide public IP's
since its not a standard server
i dont understand
heroku doesnt provide IP's
so you need to use the url they give you
whre do I find that
whas that
I wouldnt know
non standard platforms are hard to give help for
it might be somewhere on this page
https://devcenter.heroku.com/articles/github-integration-review-apps#heroku_app_name-and-heroku_parent_app_name
idk what I am exactly looking for
the public url they provide with every project
that would be the public url for your program, youd replace the ip with that
potentially the port to, not sure
heroku doesnt do things how other providers do it, so im not exactly sure
if you have to, contact heroku support.
so where do we put this url then?
help me how I got ping command for discord bot
thanks
hi i need api help hi
so when i post my total server count to the dbl api, its just wrong
its like half of what it actually is
from discord.ext import commands
import dbl
class TopGG(commands.Cog):
"""
This example uses dblpy's webhook system.
In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
"""
def __init__(self, bot):
self.bot = bot
print(f'bot = {self.bot}')
self.token = 'Token duhh' # set this to your DBL token
print(f'token = {self.token}')
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='http://00.00.00.0/dblwebhook', webhook_auth='password', webhook_port=1337)
print(f'dblpy = {self.dblpy}')
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print(f"Received an upvote:\n{data}")
@commands.Cog.listener()
async def on_dbl_test(self, data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print(f"Received a test upvote:\n{data}")
def setup(bot):
print('Top.gg loop started')
bot.add_cog(TopGG(bot))
so im using the example for webhooks in python. and im failing to receive any votes
anyone got any pointers?
Either the documentation is vague af or you people generally don't get it
it is
Actually that does make sense so yeah, thanks for the feedback
im able to get by with most libraries by just reading the doc but im at a complete loss with dbl
That one hurt 
Will work on the docs, got it
In any case, webhook_path isn't the URL. It's the thingy after the IP and port in the URL
awesome, good to know! 😄
so if you want the URL to be ip:port/dblwebhook, you set webhook_path to /dblwebhook
but the default value is that by default so you can technically just scrap it
gotcha!
Yeah, I assume you also took care of port forwarding 
and the format in the web panel should be http//ip:port/dblwebhook
mhm
ok perfect, that narrows it down for us! thanks 😄

@sullen nymph we've tried everything, we've tried testing open ports after forwarding. and still not receiving any requests. i feel we're missing something obvious haha
I would recommend using postman to send requests.
Try using reqbin to send POST requests to your webhook with the following JSON as request body:
{
"user": "123456",
"type": "test"
}```
@commands.Cog.listener()
async def on_dbl_test(self, data):
channel = self.bot.get_channel(764951115262853120)
user_id = int(data['user'])
member = self.bot.get_user(user_id)
#await channel.send(f"{member}")
print(data)
print(f"user:-: {data['user']}")
embed = discord.Embed(
colour=discord.Colour.dark_gold(),
title=f"Tested Upvote | {member}",
description=f"{member} tested an upvote.",
)
await channel.send(embed=embed)
```Does anyone know why `member` returns `None`?
User's either not cached or can't be found
do you know how to make it return the user?
ok, i did a check with reqbin. its giving a 200 code. all seems good. nothing in console still
User's either not cached or can't be found
@sullen nymph when I doprint(data['user']), it gives me the ID. but why can't it fetch the user?
yeah still nothing coming through. i feel like the listener just isnt.. well.. listening
Convert to int, print both the value and its type
ok
if we send a json structure that it shouldn't receive we get a 500, so its definitely parsing it
What are your discord.py and Python versions?
are you talking to me?
Nah, Cal
ok, I printed it. It returns 511943071655526411 - test
@commands.Cog.listener()
async def on_dbl_test(self, data):
channel = self.bot.get_channel(764951115262853120)
user_id = int(data['user'])
print(f"{user_id} - {data['type']}")
Oh, yeah, wrong type
one second
I meant type(user_id) 
oh
discord.py: 1.3.4
python: 3.8
well.. this is the odd thing
Toss me the Auth key and URL you entered on the bot's top.gg page
Actually, question
Are you testing DBL or DSL webhooks
DBL
we've had DBL send data to a bin and it works. so we're a bit confused
i have no idea what DSL is btw
its Discord Server List
ohh i gotcha, no we're using the DBL and using test votes and real votes
It returns <class 'int'>
@commands.Cog.listener()
async def on_dbl_test(self, data):
channel = self.bot.get_channel(764951115262853120)
user_id = int(data['user'])
print(f"{type(user_id)}")
Alright, then...
Try doing user = self.bot.get_user(user_id) or await self.bot.fetch_user(user_id), I guess?
ok I’ll try that
Please if any developer here has experience with Heroku and the DBL api, I would appreciate a lot if you DM me. Thanks!
Thanks, Shivaco! It worked.
eh well hopefully your ratelimits won't go brrr
is it possible to transfer all code from vs code to glitch?
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
Wait where is your client.on(“ready”
put it before you define the client
it is
You need to have ready before hand
No
const client = bla bla
client.on(“ready”
dbl events here
client.login
okay one sec
yea it has to be under
const client = new Discord.Client();
wilding
Of your code
but you get mycode thne
?
is that ok if you get my code?
Yes...?
Just don't have your token
Just remove it
I don't need the token I just need the code
no one is gonna steal your code dude
thats inconfig
at least here
nice ❤️
So send me your code at https://hastebin.com
press new top right
dont steal it -_-
Bruh I don't need your code lmao
that is what you ased for
bro im too drunk to understand you
Alright so
Delete that link
NOW
Because you have your DBL token
Like I told you not to have
wait
just regen it
i will xx
kk
put the const dbl under the ready event
i mean if mee6 wanna use it
^
like outside it
oh
👍
❤️
love you xx
no homo
im not ga
gay
please dont think im gay
but thanks 🙂
xx
100%
naaaaa :jkejw

do you like my ha;loween logo
pfpf
pfp
i made it myself
you know, im pissed because i got bot dev
then my bot got unverified
so i lost it
and idl whu
idek
they cukked me
i was like bitch why you remove me vevifed badge
then sent me that
like BRO
WHY
My bot was verified a day after they removed the de 
the dev badge
hopefully
on terms of @gaunt steeple
becuase the bot team owner got abben
banned
i cant have ownership of bot
how?
ah
Racism
yea
but yea. that was cool. then it lost it
so brain told me to make a new application
and bro it got 35 servers in 1 day from dbl
yea. trouble is my API limit
its 10000 and its 2x per each song played, so you play a song, it used 1 to search and then 1 to play
but then some can use more
lemme check it atm
what do you use?
use lavalink
Idk how
change it
once that 7 days hits max, it fucking stops working
changing the code isn't hard right?
go to #development so we don't get muted
its all different code
how to i send an message every time when a user vote for my bot via webhook
how do u get the API?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
use it
ok
https://top.gg/api/docs is the documentation
ooook
does any of u know how to add clear command??
@sullen nymph can we get a list of users who votes our bot in the past 12hr?
sorry for tag
See the docs
how do i use the individual user this
https://top.gg/api/bots/botid/check
what all i have to add?
In your code via HTTP request libraries
@sullen nymph ok thx
https://top.gg/api/bots/check?userId=<user's ID here>
Make sure to send your bot's top.gg token in the request headers
yup
https://top.gg/api/botid/check?userId=694061528906727514
i have voted the bot
but still its showing me {"error":"Not Found"}
ah yeh
Hello
@sharp hollow your bot needs to be accepted first before you can test, as you need the token for auth
How can I make vote rewards for my bot?
Believe so, yes
how to do a action to vote a bot
Why did you mention two people and delete the messages
Accidentally
anyone has meme api?
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
```Please correct if im wrong
Authentication?
Authentication???
Authentication header
how
where am I going to put header?
{headers: {Authorization :"token here"}, server_count: "clientguildscachesize"}
???
dealing with JSON is hard...
axios.post('https://top.gg/api/bots/744405785714491503/stats', {headers: {Authorization :"mytokenhere"}, server_count: "client.guilds.cache.size"})
ah
Why is it error 401???
{
"headers": {
"Authorization": "token here"
},
"server_count": "client.guilds.cache.size"
}
did this,,,, error 401
Headers need to be closed
???
and this is why I don't do POST
i think i got it
so I splitted the header from the content
and .toString()
it all works perfectly
axios.post('https://top.gg/api/bots/744405785714491503/stats', {"server_count": client.guilds.cache.size.toString()}, {"headers": {"Authorization": process.env.TOPGG}})
So what will happen if I place in inaccurate data??? 
Then... How will the mods know if the data is inaccurate?? 
Magic!
Then... How will the mods know if the data is inaccurate?? :keklaugh:
@frosty basin the appropriate amount on the bots invite link
ooh. Thats cool
Its not in #rules-and-info tho
Maybe I should update it every bot join/leave so it can be accurate af
nahh.. That is API abooz
hmmm 
I update it every 30 minutes
So it says in the API docs that
type String The type of the vote (should always be "upvote" except when using the test button it's "test")
Where is the "test button" so that I can push a test vote?
--HTTP Request --DBL server
@merry zodiac your bots edit page on the webhook tab
ok this thing right?
Please if any developer here has experience with Heroku and the DBL api, I would appreciate a lot if you DM me. Thanks!
Yeah @merry zodiac, you do need the webhook info entered and webhook setup to use it.
How would you add the webhook integeration with the dblpy wrapper
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = os.getenv("TOPGGtoken") # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token,
autopost=True) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
This is what I'm doing right now but when I hit the test button it doesnt print data
ReAD thE DoCS
im using the example from the docs
The docs below show the webhook stuff too
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
# 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))
this is what the docs r doing
pqpowieeuurhrhnsmslpaow
?
A simple API wrapper for top.gg written in Python. Contribute to top-gg/DBL-Python-Library development by creating an account on GitHub.
@peak lodge https://top.gg/api/docs#jslib
where i can get the token of dbl? 
thanks
@restive otter https://top.gg/api/docs#mybots
thanks
what is this?
https://i.imgur.com/kPqKsSw.png
how i see the password
?
the vote webhook is in the second example on the docs @peak lodge
you set it
its not given to you
change 'password' to what you want it to be
then on your bots edit page, in the webhook section put the authorization to the exact same thing
thanks
np
yeah
you can put it in your code and test it with postman to make sure it works
but theres not a lot of point imo
I’m using an iOS app to code
gl
Its what I am using
Did you fill in the url and auth on the top.gg site?
With the proper ip, port, and path.
const DBL = require("dblapi.js");
const dbl = new DBL('your api key here', client);
exports.run = (client, message) => {
dbl.hasVoted(message.author.id).then(voted => {
if (!voted) {
message.reply("Bu komutu kullanabilmek için DBL üzerinden oy vermen gerekiyor. (Eğer oy verdiyseniz bi kaç dakika bekleyin .s) \nTo vote: https://discordbots.org/bot") /type your bot's dbl vote link
} else {
message.channel.send("Destekçi rolün verildi."); //Gives a member a special role when you vote if you want
message.member.addRole("632469420220088325")//role ID to add during voting
}
})
}```
Example for DBL Vote

I don't see an error, It works clean for me too
but I want when a user vote the bot send a message
1 min
const DBL = require('dblapi.js');
const dbl = new DBL('DBLTOKEN', { webhookPort: 5000, webhookAuth: 'DBLWEBHOOKPASSWORD' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.channels.get('CHANNELID').createWebhook(vote.user.username)
.then(webhook => webhook.edit(vote.user.username)
.then(wb => {
const hook = new Discord.WebhookClient('DBLTOKEN', wb.id, wb.token);
hook.send(`\`${vote.user}\` Voted!`);
hook.delete()
}))
});```
@restive otter
HTTP Request -->DBL server
@restive otter i need to set the password?
yea
webhookID = '',
webhookToken = '';//
const express = require('express'), //
app = express(), //
bodyParser = require('body-parser'), //
morgan = require('morgan'), //
{ RichEmbed } = require('discord.js'), //
{ WebhookClient } = require('discord.js'), //
hook = new WebhookClient(webhookID, webhookToken);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(morgan('combined'));
app.post('/vote', (req, res) => {
var authorization = req.headers.authorization;
var bot = req.body.bot;
var user = req.body.user;
var type = req.body.type;
if (!bot || !user || !type || !authorization) {
res.setHeader('Content-Type', 'text/plain');
res.statusCode = 403;
return res.end('MISSING_PARAMS');
};
if (authorization != authorizationKey) {
res.setHeader('Content-Type', 'text/plain');
res.statusCode = 403;
return res.end('WRONG_SECRET');
};
if (type === 'upvote') {
var embed = new RichEmbed({
color: 3447003,
title: `A new vote has been received!`,
description: `<@${user}> bot gave a vote on DBL!`,
timestamp: new Date()
});
hook.send({ embeds: [embed] });
res.statusCode = 200;
return res.end('OK');
} else if (type === 'test') {
var embed = new RichEmbed({
color: 3447003,
title: `Successful!`,
description: `DBL test successful Votehook is working properly!`,
timestamp: new Date()
});
hook.send({ embeds: [embed] });
res.statusCode = 200;
return res.end('OK');
}
})```
wtf

there is something like this i use
i need this? xd
😄
?
Don't you want something like that? xd
Why i didnt get vote updates?
did you put your webhook url and auth on your bots edit page?
i did
so i changed it to http?
should be
@jaunty plank But when i clicked "Test" 4 times i get the ping received in console
seperate code
you need to use the proper path then, default is /dblwebhook
also, channelforWebhooks seems to be null
p!help
only other thing then is to add the proper path to the url on the bots page
i changed it to /dblwebhook and i spammed Test and i get the "Ping received" is this mean it worked when someone vote the bot?
how to do the server counts pls help me
you need a verified bot first
i don't think so
afaik, the webhook event is still supposed to happen. when using a seperate http server app.
not sure why yours isnt going off @potent basalt
you dont get an api token until your bot is approved @hard knoll
my bot is approved
is your bot under a different account?
yeah
idk
wait let me login with my real acc
well what lib is your bot in?
@jaunty plank BD script
like discord bot designer?
yeah
honestly, zero idea how you post server count with that
😢
honestly, zero idea how you post server count with that
@jaunty plank i really need help
shiv might know
You can’t post with that
yeah i didnt think so
when it says get your DBL token, does it mean your profile or the bot token in the edit page?
on the auto guild count
i think i did it. i guess just wait and see
^CUnclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fe6ea8cbf10>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fe6dbf8d0d0>
Task exception was never retrieved
future: <Task finished name='Task-1510' coro=<DBLClient.webhook() done, defined at /usr/local/lib/python3.8/dist-packages/dbl/client.py:417> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 5000): address already in use")>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/dbl/client.py", line 436, in webhook
await self._webserver.start()
File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_runner.py", line 100, in start
self._server = await loop.create_server( # type: ignore
File "/usr/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fe6dbeadd30>
Task exception was never retrieved
future: <Task finished name='Task-1922' coro=<DBLClient.webhook() done, defined at /usr/local/lib/python3.8/dist-packages/dbl/client.py:417> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 5000): address already in use")>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/dbl/client.py", line 436, in webhook
await self._webserver.start()
File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_runner.py", line 100, in start
self._server = await loop.create_server( # type: ignore
File "/usr/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use```
so I sometimes get this error when I stop my bot with ctrl + c
its in python
so this are my settings ob top.gg
Idk if you want to share your IP but your IP is in there
Anyways, my knowledge of Python is zero to none but there seems to be a DBLClient.close() function which you can call
to close the WebServer that's being used for the webhooks
okay, ill use it in future
and another question
my webhook just stopped working
i changed nothing
import asyncio
import random
import traceback
from datetime import datetime
import dbl
import discord
from discord.ext import commands, tasks
from discord.ext.commands.cooldowns import BucketType
import info
import sql
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'my_token'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=1556)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("Vote Test!")
def setup(bot):
bot.add_cog(TopGG(bot))```
so this is my code
@radiant peak where are you hosting
0.0.0.0
Idk if you want to share your IP but your IP is in there
@west flax is not an ip
Also, @radiant peak this just means something is already using that ip
that looks like an ip
0.0.0.0 is kinda like saying 192.168.1.1
its not anything important
every computer has 0.0.0.0, as it has localhost
^
What you get by 192.168.x.x is your machine IP.
No one will ever be able to access to it unless he's on the same network (local network).
Using this to make external ppl to access to it won't work
This is how it works when u forward ports on your router. You define the ports you want to open and the destination (Your local PC ip, if you're hosting a webserver on it, per exemple) so people will be able to get access to it from your public ip to the destination PC
When an application runs twice on your ip per exemple, the second one wont work @radiant peak
If u get no error then its okay
How could i make a vote command in python?
No entiedo
Hello
Did you read the docs
oh
oki
Did you read the docs
@sullen nymph sorry for the ping but i don't know how to find it-
where i can find?
what's your bot language?
is made with dbd-
Yeah, no. Ain't posting server count with that
oh-
Unless there's some feature somehow that does it, which I highly doubt
@hollow forum he removed if after I said it
@west flax ?
is there a way to know whenever a user votes for a server? not a BOT
is there a way to know whenever a user votes for a server? not a BOT
@opaque rampart yes using webhooks
we don't have docs for DSL yet
read pins for now
the setup is mostly the same as DBL webhooks
only difference is the request body contains different stuff
It’s just a POST request
you can find the auth in the Authorization header
and the body looks a tad like this: json { "user":"USER ID", "guild":"GUILD ID", "type":"upvote or test" "query":"?a=5&b=6" }
@opaque rampart ^
What you could do is set up a repl on https://repl.it to listen for your votes
Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript, Scheme, APL, Lua, Pyt...
The easiest way is using express
you do need to add the json parser though.
I’ll give you a baseplate
const express = require('express');
const app = express();
app.use(express.json());
app.post(”/", (req, res) => {
/*req.body gives you the body I discussed above, and req.header("Authorization") gives you the auth so you can check the validity*/
});
app.get("/", (req, res) => {
res.send("I’m alive!");
)};
You might want to put this on to uptime robot
uhh
need help?
yes
i dont know how these webhooks work
on the docs
it says https://top.gg/api/widget/:ID.svg should work
It just sends a POST request
express?
Authorization
You can use this value to verify the requests are coming from us.
but how
like
what web server are you using to receive the POST
i thought you just put https://top.gg/api/widget/:ID.svg and it would work
what?
for the webhook
no?
You got the wrong idea
That's widgets, yeah
basically displaying a bot's info
Webhooks are reverse APIs, used for easier storage and receiving of votes
i'm a little new at this stuff
It's all good 
we all were at some point
another question
aye
how do i use it to display on the bots thing
how do you use what
the widget
you only get access to that once your bot gets approved
oh-
Use the img HTML tag and set the widget link as src attribute
Well, you can still set it up, it just won't work until your bot is approved 
aH-
use codeblock for once 
that works
Yeah, that's Markdown, which is supported
or the whole thing-
That’s the markdown equivalent basically
uH-
you take the whole thing
do i still need the <img thingy
no

hey is there a python thing that works with this?
@frigid thunder
ok
Hi, I'm new, I have a problem with nekotina my bot does not react to my commands and is offline is Nekotina
I don't get how to set up the cog, Im not getting any result from on_dbl_test, what do I pass to DBLClient?
is there an example somewhere?
using Python btw
Hi, I would like to know: as @Lyss#0001 told me, the incorrect number of shards and servers on top.gg site is coming from my side, so please can someone tell me what's wrong with my request ?
My discord bot has 36 shards for 36,800 servers but on the top.gg web page we can see only 24 shards for 26,400 servers (https://top.gg/bot/318312854816161792).
I have checked and all my requests are sent by the bot and the send interval is 3600000 (1 hour) to be sure to not overload the top.gg services.
Here the code i use to send my shards stats:
const fetch = require('node-fetch');
Client.setInterval(() => {
fetch(`https://top.gg/api/bots/${Client.user.id}/stats`, {
method: 'post',
body: JSON.stringify({
server_count: Client.guilds.cache.size,
shard_id: Client.shard.ids[0],
shard_count: Client.shard.count,
}),
headers: {
'Authorization': process.env.topgg_token,
'Content-Type': 'application/json',
},
});
}, 3600000);```
I cant find anything to set it up for tracking voting though?
or I could have the webhook url wrong
what do I pass to this? in analytics
DraftMan#0042 Use the npm dbl package (salut sinon)
anyone able to help?
show your code
oops
import dbl
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'mytok'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_auth='mypass', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print('abc')
logger.info('Received an upvote')
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print('test', data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
Make sure your port is open and properly forwarded
is your code on a server or home network?
server
then you wont need to port forward
if you have a firewall on your server youll need to let it past
yeah I checked all the firewalls and theyre all open for it
well checked iptables and another one, I've never set one up myself
nothing blocking it
do I need to pass anything differently into self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_auth='mypass', webhook_port=5000)?
I dont even know how to do that
I believe in you and your common sense
I dont lol
It's relatively simple
I'm just getting operation timeout, unless I'm doing something wrong
I just put in https://ip.my.address.here:5000/dblwebhook and hit post?
I'm still not sure if https:// will even work
someone said it does, someone said it didnt 🤷♂️
the lib uses HTTPClient
after removing https:// I got Status: 401 (Unauthorized) Time: 139 ms Size: 0.00 kb
did you put in your auth?
pretty sure everythings working if you got an unauthorized warning
oh shit I got something through
it errored but I got something
ty
Im getting Status: 500 (Internal Server Error) Time: 141 ms Size: 0.05 kb
use http:// not https://
yeah same deal
doesnt work at all on https, on http or on nothing specified it gives internal server error
and the unauth error went away when you put the correct auth in?
omg it worked
yeah it did
it was working just got the internal server error as it didnt know how to handle whatever reqbin was pushing it
but works now from dbl
ah
tysm for the help guys, really appreciate it
what changed 
http > https mostly
ah your url on page i see
yup
read the channel topic

every since adding the dblapi.js library my bot randomly crashes without error
actually
Error: 503 Backend fetch failed
at IncomingMessage.<anonymous> (/home/pi/Essentials/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
.catch() is genuinely your best friend most cases
rip nitro boost
@jaunty plank i don't think so.
dont think what 🤔
rip nitro boost
aye
One message removed from a suspended account.
were
One message removed from a suspended account.

Hello I need help
I am using python
and I want to chech if a person votes a server
but the docs only shows bots
channel ded
Why is this channel ded
I
Because people are scared to chat here. If you want to chat, please go #general or #general-int for the sake of being muted-ness.
Thank you,
- BabyGOAT
May I ask with what?
How to make the bot run a command when the server is voted @mild flume
I have not done that yet, but I do know who does, join the Prism Official server and ask the Bot Dev how to. He has taught me many things and you can learn from him.
(He entered the part of cod you were talking about. With the voting.)
How to make the bot run a command when the server is voted @mild flume
@restive otter
DM mods
m
do u know any mod cuz i see none there
why api is like this withot servers but bots?
DSL is in reworks but an API is possibly or most likely planned to be implemented
so its possible to do ths i have seen many bots do that\
Use webhooks for ddoingdomething when someone votes
Discord webhook?
ye

why is this api like this
Webhooks aren't that hard to set up
ik but its confusing discord and other webhooks
and i ahave never create a "top.gg" type webhook. or maybe i have never created a webhook
There are official libraries that can help you
also a discord webhook or a discord_bot webhook?
i am using this-
https://pipedream.com/sources/new
OH
so you mean http requent thingy
this one
where is the application page to create a bot?
sorry








