#topgg-api
1 messages · Page 110 of 1
Does it give you any IP or sub domain for your project or whatever you call it as
no
Then it's not possible to use webhook afaik
If you can listen to a port, you probably should be able to get an IP for it tbh since if it's not public, it'd be allocated to you
Do you have access to terminal? @steel acorn
yes
Is it linux?
no
Windows
I'm asking about your heroku app, not your PC if you're talking about your PC
heroku is a website.
I know, I asked whether you have access to your app's terminal in your website, you said yes
I use github to place the bot files, and I use the visual studio code application.
This might help https://stackoverflow.com/questions/31932218/what-is-the-ip-address-of-my-heroku-application
I'm talking about your host tbh, not GitHub nor your editor
If you find a way to get IP or buy a domain and link to your heroku app, then you'll put it in your bot's edit page
As http://ip:port/dblwebhook
Or https://dom.ain:port/dblwebhook if it has SSL certificates
How can I make it to where someone votes for my bot it logs it in a channel
shame that API token is unavailable until the bot is accepted
Hello, how can I do so that I can put text in paragraphs in the same field for my embed messages?
thanks for that stack overflow link
i was also looking for that
sorry, i take my thanks back
didn't get what i was expecting
Hey, with dbl.py I don't understand what I need to write here :
def __init__(self, bot):
self.bot = bot
self.token = self.bot.config['dbl_token']
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path = '/dblwebhook', webhook_auth = 'password', webhook_port = 5000)
webhook_path, webhook_auth and webhook_port
(vote detection)
I've been having problems with dbl.js, It takes some time to identify a vote, and I know is the API beacuse I got a veryfier and it gives me false when I vote and in 5 more minutes i finally can get it true.
you should really be using the webhooks to get when someone votes
bç
is it possible to post the servercount without the library?
what for a url would I need to send data to and what data?
It is, yes
cool!
the url is top.gg/api/stats/:ID iirc
just post json there?
ok good! thanks matthew 😄
Yes
@west wave webhook_path - route to use for the webhook, comes after the URL. Default value is /dblwebhook
webhook_port - port to run the webhook (listener) on
webhook_auth - password to use when requests are sent so that you can confirm that it's top.gg sending requests
Is the DBL api going to get comments/reviews added?
by using DBL webhooks @restive otter
you can't really DM tho
you can
but you're likely to run into errors
just use a webhook
and use vote.user which is the ID
to fetch user
and then get ratelimited by discord kekw
Does DBL Webhook have an event for new reviews? Like this: dbl.webhook.on('review', review => {
no
Ok thanks
i mean at least i dont think so
Ok
im trying to post guild count in py ```py
import discord
import dbl
from discord.ext import commands
class TopGG(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = 'token' # The token is correct
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))``` But it doesn't work? How is bot defined?
is it bot = commands.Bot()?
or what
or is there anything else I'm doing wrong?
so bot = discord.Client()?
ok wait we need to add client.run('bot token') at the end?
why would we need to run it?
no?
oh
you need your main bot client
wdym
the one that logs in
wut?
no
password is the auth
its a password you make and put in the authorization section on the page
yeah
it can be anything
u make it up
@restive otter
and u put that password in the webhook auth section
in ur top.gg page
you need your main bot client
@rapid kettle i still dont get it
wdym
what main bot client
the one that you use in events
yes i guess?
are you running it already?
uh yeah
If you have an http server already you put it there
If not, the library will make it for you and you can just delete that part
import discord
import dbl
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'token' # The token is correct
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))``` but apperantly setup is never getting called? How is it called, and how is bot defined?
no you cant use a discord webhook, you code your own webhook
read that
bot is the id of the bot
user is the id of the user that voted
isWeekend is if it is a weekend (if u want to give extra stuff on weekend)
uh u are logged in when you vote?
and it knows the id of the person who voted
NOO DUDE TOP.GG is sending a request
and that is the reques
t
they just added that as an example
but irl, top.gg will send a request
read this https://top.gg/api/docs#webhooks
it explains everything
Get the vote webhook.
On the event get the user via its id
Then user.send()
The fetching the user would be in your bot libraries docs
What language is your bot on?
Okay, on the page I linked to click javascript library
The second example shows how to use the webhook
Fetch the user with your bots library
Thats sending a message
Not fetching
The code example on the top.gg js docs is how to make the webhook
Get that part working first then you can worry about sending a message
The url is just
http://ip:port/path
Ip is the public ip, port is whatever you set in the code, same as path
Wheres the code your running hosted?
Ip will be the glitch url iirc.
Port youll have to use the env port variable glitch gives you
Glitch url that glitch provided.
I'm not sure, your the glitch user here
Yes
The environment port variable glitch provides
You can just use the environment variable
Just a side-note: glitch doesn't allow bots on their service unless you're paying for it.
Well that's certainly reason more to learn to use environment variables like process.env.PORT 👍
where you want to use... the port
no...

const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, 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!`);
});
webhookPort is the port
def setup(bot):
bot.add_cog(TopGG(bot))``` HOW DO WE DEFINE `bot`????
nothing seems to work
bot as in the client?
no that doesnt work
bot = discord.Client() is what you are saying @jaunty plank
because that didn't work either
bot as in the client you are using here
https://discordpy.readthedocs.io/en/latest/api.html?highlight=client#discord.Client
well, the library depends on it being the bots actual client, it can be a separate process, but it needs to be an actual client.
but if not discord.Client(), then what else
it should be discord.Client() but the client needs to be a logged in instance of your bot
hows it work for you if you dont have a verified bot 🤔
alt 
def setup(bot):
bot.add_cog(TopGG(bot))``` HOW DO WE DEFINE `bot`????
@patent lintel that's a cog
Are you initializing it "on_ready"?
You would use load_extension("cogs/TopGG") assuming your py file is named TopGG.py
In your main bot file
Or you could put this in your main.py file
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
That would load it whenever you start up the bot, along with all the other cogs.
Is there a rating API?
rating api?
How would I make it log to the console when my bot gets a vote? I tried that example code on the documentation but it didn't work.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
You can't fetch a user from the client without guild member intent?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

members intent should only cover getting an entire guild list from the api, you can still get individual members from it
proof of that btw
first pic shows that getting individual members isn't related to privileges, second shows that users aren't related in general
does the dbl.on('posted') automatically update servers or should I put this within a guildCreate? Thanks
dbl.on('posted', () => {
});
is just an event for when the server count was posted, you shouldnt put events in other events.
the auto poster posts every 30 minutes.
{
success: boolean,
approved: boolean,
message: string,
}
🤔
Hello
there
See channel topic
Does anyone knows how to set this up? I want to upload the guilds count https://top.gg/api/docs?__cf_chl_jschl_tk__=472eedf4126e715aa1f1834b0a364acab7349624-1604495451-0-AVJMK2iAHoqgjKnbw81qILQjEdF4zTZyr7pRUW6tsXm-hFFJx2TtnKVsoK8TWUiXgv2ub6ovgY0saMyasHwf7OImGygoojCnZsvdhO1X0qKe-5YlpdE5Q36WY_ABX_OFtf1qb67w87_ZoPHzdpDWqyO1taOyiXfQTn646U73RkEslPeXqqiY-UYafSuOr9cenNhAzvELr7T9GR9dCfV_ISPEpkxqI9TUetwtrHCgyVdskZsophAbWumN2IT8si88xl231-OelTmT9jgR91plbO25xfUmUTlN38U-lgR2uOU9#dotnetlib
@willow sphinx any updates about the PR? I've signed the commit, just waiting for your approval and merge tbh, I don't think I have to do anything else
Can someone help me?
My bot server isn't isn't being sent to website
client.guilds.cache.size
@vital anvil why is this on the docs and not on api?
Ok i'm sorry to ask this since it's probably been asked before. Will there be a review webhook added to the api?
probably™️
whats the tm for lmao
i have the code ```import dbl
import discord
from discord.ext import commands, tasks
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token'
self.dblpy = dbl.DBLClient(self.bot, self.token)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
def setup(bot):
bot.add_cog(TopGG(bot))```
why doesnt this work?
whats not working
@quaint pendant use pipedream
whats that
hey, im trying to create a vote webhook thingy, but the code provided in the js docs isnt working, am i missing something or what? also i am not very good at js so that might be part of it.
is there an error?
i have filled in the webhook url, but i havent filled out the auth
the auth needs to be the same as the auth in your code
webhookAuth: 'password'
both need to be the same
so i get to choose the password or am i stupid and it is predefined
you choose it
alr
also, just a few things.
if your hosting off a home network or not from a proper server, youll need to port forward.
if you have a firewall on your server youll need to open the relevant port open
im using the discord.py library and trying to get some sort of voting notification system. I'm having lots of trouble with this and help would be aprechiated :)
curent code:
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
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)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
self.bot.console_webhook.send(f"Received a 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."""
self.bot.console_webhook.send(f"Received a test upvote:\n{data}")
def setup(bot):
bot.add_cog(TopGG(bot))
how does the dblapi.js webhook work
when a vote happens, top.gg sends a post request to an http server at the url set in the webhook section of the bot with the relevant info
you can think of it like requesting data from an api, but in reverse.
rather than sending an api request asking if theres any new votes, when a new vote happens top.gg sends the data to you.
.trade cancel
how do i set up the voting event?
i have troubles with setting up the webhook
because i dont know how to use webhook on the discordgg
how do i even find the webhook password or auth or authorization
this is so fucking complicated
ive been sitting on it for a hour and nothing is working
yeah ive already seen it its just that what i took from the example (```Python
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='auth', webhook_port=5000
needs path (which im not sure what is it, auth which i dont know what is it either and port
where they share just the ip and not the port
oh you use python
yup
hmm
port should be the port your bot uses
to host the webhook
and for example
if you hosted your webhook at 127.0.0.1/dbl/webhook then the path should be /dbl/webhook
if you understand what i mean
ehhh im not technically hosting the webhook, im using a site called pipedream to host it
and the url is https://(random code).m.pipedream.net
so does it means that the path is (random code).m.pipedream or did i miss anything?
also if we solve it theres still the auth parameter that i cant figure either >_<
I have problem (javascript)
I have code:
client.dbl.hasVoted(message.author.id).then(voted => {
if(!voted) return message.reply('vote on top.gg')
});
// command
why command is running?
wrong channel
The library is still working dblapi.js?
Yes
Still works fine
i need help
pls help me
.setImage("https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000") isnt sending image
I think you have to put this on sendmessage
@fluid siren heres my whole code const Discord = require("discord.js"); module.exports = { name: "dblinfo", execute(client, message, args) { const exampleEmbed = new Discord.MessageEmbed() .setDescription(`:teslabot: **[VOTE FOR TESLA BOT ON DBL](https://top.gg/bot/697348519295713302/vote)**`) .setImage("https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000") .setColor(0x0b0b0b); message.channel.send(exampleEmbed); } };
.attachFile('https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000')
.setImage('attachment://697348519295713302.png');
try this
because my good sir/ma'am
i know how the api works
no lmao
:)
@craggy sentinel ads
Why did u want my link then
Inb4 muted
I am just confused
That is why I wanted a moderator
I was confused to. This question has nothing to do with the api
Dsl isn't part of the api
sand he said voting so i thought it was about there api for getting votes.
Nope, just dsl for servers
my bad hhhh, that was my fault
(there is also a webhook option for DSL but yea - if someone is mentioning role rewards then its usually the option directly via DSL)
okay, thank's i will add that to my help folder when my pc starts up
Been here so long, never seen that once mentioned. I wonder what percentage of servers use the webhook.
Been here so long, never seen that once mentioned. I wonder what percentage of servers use the webhook.
@jaunty plank thats why i said aPi
Its never been used for roles before
🤔
Otherwise you'd be making a bot to give roles
Which would be a bot
Not like dev role means anything
no
i say dev senpai because
you like point out my errors and stuff
you would need a bot to interact with the dsl api to give the role
in my hea di imagined you could make a api and use http;s request to pull people who vote and use the api wrapper to give the wole
sorry if my spelling is aids i'm typing faster then i normally do
Coffee?
I've been buying preground beans since Rona started. Miss good coffee :(
can someone help me setup a webhook to know when someone votes?
depends on what lib you are using
depends on what lib you are using
@jaunty plank none-
BDFD
well JavaScript could be made
ima have to think x3
Mamamia
I think you cant do vote system on BDFD
The thing is that i dont know javascript, i barely learned like 20% :v
.token("asdasd")
.botId("dasdas")
.build();
top.setStats(api.getServers().size()); ```
I did this...But what did now change for the Bot on the Website?
someone there?
🤔
Should it show on the Website on how many Servers my Bot is?
yeah
ok...Mby it has to load a couple of minutes
it can take up to 30 minutes to an hour due to caching.
And how can I set the DND on the Website on Online?
it can take up to 30 minutes to an hour due to caching.
@jaunty plank ok
new bots are not added to this server anymore, so their online status isnt tracked from what I understand.
not sure why your bot would show up as dnd
my Bot is on this Server
ah nvm
or wait
api.getThreadPool().getScheduler().scheduleAtFixedRate(() -> top.setStats(api.getServers().size()), 1, 120, TimeUnit.SECONDS);
Is that too often?
It sends the Server size every 2 min
@jaunty plank ?
Does it need to send that often??
Check docs for any limits on how frequently you can send...
you should really be doing it once every 30 minutes
since your guild count shouldnt change often enough to need more than that
you should really be doing it once every 30 minutes
@jaunty plank ok
i may be making some stupid mistake but is it possible to get data from votes for a bot from a different bot? im trying to test a vote-for-currency feature (on my beta testing bot) but it uses the token of the real bot. is this a problem?
its just it doesnt seem to recognise votes
i.e. nothing happens when ppl vote
are you using a webhook?
hi
im using the python library:
#this line is in the init:
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=False)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
#some stuff
sorry im probably missing something big here
on your bots page, edit in the webhook section did you fill in the auth and url?
Does it need time to recieve my ServerCount information?
on your bots page, edit in the webhook section did you fill in the auth and url?
@jaunty plank oop no
but what url?
and what auth
Does it need time to recieve my ServerCount information?
@dreamy sky ?
the url to your webhook,
http://ip:port/path
but i thought you didnt need that if you use the on_dbl_vote?
i.e when theres a vote, it receives it
and i can do stuff with the data param
it should have shown up for you by now @dreamy sky
I dont know the language your bot is in, but can you log any errors that may be happening?
the on_dbl_vote is a webhook listener
it should have shown up for you by now @dreamy sky
I dont know the language your bot is in, but can you log any errors that may be happening?
@jaunty plank no errors and JAVA
the on_dbl_vote is a webhook listener
so whenever someone votes for the bot, it sends it to a webhook url. then the webhook listener hears that and knows theres a vote?
yeah
so do i need to declare something in the code
the self.dblpy needs to be filled in
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
and the
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
stuff needs to exist
ok so it needs to be the ip of the server im running my bot on
could it be localhost?
no, it cant be localhost
it has to be the actual ip, or domain
otherwise top.gg would be sending it to themselves
yeah
which, admittedly kinda funny.
you are filling in the token and bot id correctly right @dreamy sky ?
@jaunty plank yes
honestly, i am not sure then.
ok im really confused about this webhook thing
would http://my.ip.address work as the webhook url
i'm not quite sure
its
http://ip:port/path
wdym /path
why does it need a path
it doesnt have to have a path, you can make your path empty.
giving it a path may be useful, it may not be 🤷♂️
ok thx
it's one of those possibility things
possibility things?
it makes sense to have a path
if you wanted to have something else on the server, for example another webbook receiver you can put it on its own path.
ahhhh
theres no reason not to use one
so its for differentiating
yeah
Is the Number after bot the botid?
yeah
ok i really cant see what ive done wrong here:
#in init
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='http://my.ip.address:5000/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_test(self, data):
#some stuff
the webhook url and auth matches the one i put on the website
and i have pressed "test" a load of times
none of them work
also, if this is hosted on a home network, the port will need to be portforwarded.
If you have a firewall the port will need to be opened aswell.
ok that still doesnt work
oh yeah
portforwarding
oop
can i set the port to a different one?
one that i have already set up port forwarding on?
yeah any valid port
nice
if the port is in use already by another program it wont work
yeah
How does the authentication works in the DSL?
Gets sent in a header
Ok, thx
is there any guide on how to make a discord bot give players who vote for a discord server, a role for 24 hours after they vote?
or just give them a vote role in general
Ping me when you respond please./
The dsl bot will give a role for 13 hours if you configure it to.
One message removed from a suspended account.
One message removed from a suspended account.
just finished making it so you can see my bots server count on top.gg it was very easy!
ay, saddly its quite hard for some. glad it was easy for you however.
ay, saddly its quite hard for some. glad it was easy for you however.
@jaunty plank Thank You!
How do you make it like whenever the bot gets a vote the bot dms the user who voted
In python
when i use the API from the browser it lets me use it but when i use it from my code it returns {'error': 'Unauthorized'}
so i read that Authentication is performed with the Authorization HTTP header in the format Authorization: TOKEN but i am not sure how to use it
hello I added my bot to top.gg but it's still not accepted. Can you help me? <@&695153281105920070>
🤦♂️
@grizzled sundial https://top.gg/api/docs
I mean I've seen it but i don't quite understand how to use those classes with get_user_vote attribute
sg!vote
I need help.
How do I send a message to a channel via the dbl.webhook.on function?
is there a way to get the total vote count for a bot
like if a bot has 50 votes is there a way to get the total vote count (being 50) and post it and each time someone new votes (ex: 50 - 51) it auto update so instead of still saying 50 votes it says 51
@jaunty plank hhhh dev senpaii
places SEX DM
^nani
If you aren't logged in and try to vote
you are forced to watch an ad
then login
then watch an ad
then you can vote
I think they are trying to fix that
@jaunty plank halpp
What
So you want to get the vote count then get every vote aswell?
You can get the total votes of the bot here.
https://top.gg/api/docs#bots
Then get each vote from the webhook.
To count up
im constantly getting 503
i think its from website's side but no one else seems to be having this issue
so im worried that it might be related to me
Its the server.
You should try catching the 503 errors.
im catching it
im constantly getting 503
@sudden flare me too
Both have been up and down for awhile
They know. I think they are the ones taking them down fixing bugs tbh.
Is it possible to use get_user_vote in a regular command?
sure
How do I send a message to a channel via the dbl.webhook.on function?
inside that event, get the relevant channel via whatever method you like then channel.send
How do I send a message to a channel via the dbl.webhook.on function?
@random kindle you using eris or discord.js?
and are you running the bot on your local host or on a VPS?
you can test them here (if you're doing webhooks)
anytime
-p pergi hilang dan lupakan
There isn't one
hello, I need some help with setting up upvote webhook.
In webhook URL Do I put discord webhook url?
and my token in Authentication?
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000021927AD4C08>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000021927AF0978>, 623430.703)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000021927AD4D48>
what's this error about
Which event this Test button triggers?
https://prnt.sc/vf1rni
@thorny thicket it triggers the voting webhook
what does it do
But It doesn't log anything : @hidden wave ```js
dbl.webhook.on('vote', vote => {
console.log("Vote Triggered!");
console.log(vote);
// Do what you need to do
});
I used dbl.postStats and it worked perfectly
but i am having trouble with webhook
It also logged Webhook running at http://0.0.0.0:5000/dblwebhook on ready event
/////
const DBL = require('dblapi.js');
const dbl = new DBL('eyJhbGciOiJIUzI1NiIsIXXXXXXXXJ9.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.1UhYEc7K-lyIL-ph0ygx0m58q_sXXXXXXXXfv62jUw', { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.channels.get('742147798115418162').createWebhook(vote.user.username)
.then(webhook => webhook.edit(vote.user.username)
.then(wb => {
const hook = new Discord.WebhookClient('eyJhbGciOiJIUzI1NiIsIXXXXXXXXJ9.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.1UhYEc7K-lyIL-ph0ygx0m58q_sXXXXXXXXfv62jUw', wb.id, wb.token);
hook.send(`\`${vote.user}\` Oy verdi!`);
hook.delete()
}))
});```
//////
is it true
?
const authorizationKey = '',
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 MessageEmbed({
color: 3447003,
title: `Yeni bir oy alındı!`,
description: ` bota DBL üzerinde bir oy verdi!`,
timestamp: new Date()
});
hook.send({ embeds: });
res.statusCode = 200;
return res.end('OK');
} else if (type === 'test') {
var embed = new MessageEmbed({
color: 3447003,
title: `Başarılı!`,
description: `DBL test başarılı Votehook düzgün şekilde çalışıyor!`,
timestamp: new Date()
});
hook.send({ embeds: });
res.statusCode = 200;
return res.end('OK');
}
})```
tf
@thorny thicket
yes?
did you try adding this to the code?
if (client.uptime) {
client.users.fetch(vote.user).then(user => {
user.send("Thanks for voting!! your vote means so much to us!")
client.channels.fetch('Channel ID').then(channel => {
channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
})
})
}
});```
const authorizationKey = '',
webhookID = '',
webhookToken = '';```
What should I write in these parts?
if it says client is undefined then change client to bot @thorny thicket
Nothing
I click on test and this pops up
but nothing in console
code : https://prnt.sc/vf1xbt
then add this
console.log(`Oops! ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
if (client.uptime) {
client.users.fetch(vote.user).then(user => {
user.send("Thanks for voting!! your vote means so much to us!")
client.channels.fetch('Channel ID').then(channel => {
channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
})
})
}
});```
i'll just add the err event, I already have other one.
then add
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
if (client.uptime) {
client.users.fetch(vote.user).then(user => {
user.send("Thanks for voting!! your vote means so much to us!")
client.channels.fetch('Channel ID').then(channel => {
channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
})
})
}
});```
nothing.. no error
how about you replace client with bot since you use VSC
what's the difference?
i don't use VSC so idrk
that's not the problem
I have to use Discord Webhook URL in Webhook URL right?
wait brb i gotta do smth irl
dbl token is this?
Can you tell me what Webhook URL I have to put?
The one starting with
https://discord.com/api/webhooks/.....??
But it's not working, idk what am i doing wrong here
the wrong that you are doing is that you are putting a discord webhook as your Webhook URL @thorny thicket
you cant use a discord webhook as your webhook URL
what do I put there?
http://your.server.ip:port/dblwebhook
yea
ohkk
so did it work? @thorny thicket
no
i dont think http://0.0.0.0 will work
http://0.0.0.0 is your local host, you gotta replace 0.0.0.0 with your public IP
yes
@hidden wave will it always show http://0.0.0.0 in my console?
I entered http://<my IP v4>:5000/dblwebhook in url
I tested an online webhook tester and it's sending data to that one.
@hidden wave will it always show
http://0.0.0.0in my console?
@thorny thicket it should showhttp://0.0.0.0:5000/dblwebhookon your console
Then your webhook should be working
@thorny thicket is it working or...
nope @hidden wave
then add
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { if (client.uptime) { client.users.fetch(vote.user).then(user => { user.send("Thanks for voting!! your vote means so much to us!") client.channels.fetch('Channel ID').then(channel => { channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`) }) }) } });```
@hidden wave can this be used to add a role to it?
like ```js
client.guilds.fetch("guild id").then(role => {
client.guild.roles.find(r => r.name ("role
name").then(client.users.fetch(vote.user), role)
}
probally coded that full of errors lmao
is there any way to check id webhook is created successfully?
idk if i am putting URL wrong or there's some problem in my webhook
you could make it log the webhook on start
like ooh webhook was created sucessfully with id and ect
sa
@latent narwhal look at the code above the one i quoted
Guys my webhook is not working.. it's not getting data from api
do I have to change port number or make any other changes? any suggestions?
How can I send a message to a channel when the user has voted? for discord.js
Is there currently an error with the discord API, or discord itself or is it just me?
Is there currently an error with the discord API, or discord itself or is it just me?
@royal rampart discord was having issues it's fixed now dw
just seen it, thx
How can I send a message to a channel when the user has voted? for discord.js
@subtle wren get API from the vote page, create an event, in the event get the channel where you want to send it in by id, and send the message
I use 6565 i think or 6468 or something. I really haven't paid attention.
I just chose a port since I already had 5000 in use for something else
When I use any webhook tester website url it works fine and I get vote JSON on that website
But it's not working when i host website on my PC 😂
Are you port forwarding on your home pc?
URL sould be https://<ip v4>:<port>/<path>?
If you have a firewall are you opening that port.
Yeah
Http if your not configuring ssl
But yeah
I checked and that port is open and listening
And did you port forward.
Nope
Gotta do that
How?
I have my bot on vps, do I have to do same thing on vps?
It's also not working on vps.. what am I missing?
I didn't checked if port is open on vps
is the python library/api compatible with dpnp?
for the webhooks
cos the router where my bot is running cant do normal port forwarding
dblhook.webhook.on('ready', hook => {
console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
client.channels.cache.get('769725160118550558').createWebhook(`deneme`)
.then(webhook => webhook.edit(`deneme`)
.then(wb => {
const hook = new Discord.WebhookClient(dbltoken, wb.id, wb.token);
hook.send(`\`deneme\` Oy verdi!`);
hook.delete()
}))
})``` its true? @royal rampart
What is dpnp? @fast meteor
dblhook.webhook.on('ready', hook => { console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`); }) dblhook.webhook.on('vote', vote => { client.channels.cache.get('769725160118550558').createWebhook(`deneme`) .then(webhook => webhook.edit(`deneme`) .then(wb => { const hook = new Discord.WebhookClient(dbltoken, wb.id, wb.token); hook.send(`\`deneme\` Oy verdi!`); hook.delete() })) })``` its true? @royal rampart
@subtle wren I have not worked with the top.gg API yet, so I can't tell you if that is correct or not. As an alternative way, you could also just make your own bot send the notifications instead of a webhook.
@jaunty plank So I got this on searching port forwarding
https://prnt.sc/vf74f3
what should I put in Internal IP?
The internal ip of the system the codes running on
it's not accepting my ip 😂
The internal ip?
maybe cuz i'm connected to secondary router.
Also, port 21 is already registered to ftp officially.
Theres nothing wrong with using 21 if you dont need ftp, but just be aware its technically standard for 21 to be for ftp.
logged in 192.168.0.1 instead of ...0.0
Maybe that's why it's showing : Internal IP and LAN IP must be in the same segment network
i have an bot to now
@jaunty plank also, I need to forward only for TCP right? or both UDP & TCP?
Should be TCP
okk
are you sure that if I click on test it'll trigger dbl.webhook.on('vote' event? 😂
i tried everything.. NO LUCK
@jaunty plank I have to enter my "external IP" in webhook url right?
yes
wtf am I doing wrong?
do you have a console.log in your event?
How do I run the vote event on the webhook page?
If I just hit this button on the webhook page?
I click it... none of this triggers
dbl.webhook.on('vote', vote => {
console.log('Someone voted.')
console.log(`${vote.user} just voted!`)
});
it's likely not been properly setup
have you set the url correctly?
are the ports open?
const DBL = require("dblapi.js");
const dbl = new DBL("token", {
webhookPort: 5000,
webhookAuth: 'AuthCode'
});
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
have u set the url on ur bot's edit webhook page tho?
you'll have to do something like http://ip:port/dblwebhook
yeah in that box, you need to put this #topgg-api message

the ip is the ip of the host that the bot is on ofc
k did that
and the port is the option you set, which seems to be 5000
so my own ip
if it is hosted on your own computer, then yes
you'll just need to change the ip in that field
everything else should work the same
assuming the same port is still available
i have no idea what the ip would be (AWS ubuntu)
k i put the link in there, still nothin
no clue either, try this or something lol https://www.cyberciti.biz/faq/how-to-find-public-ip-address-aws-ec2-or-lightsail-vm/
ok u need to ensure ur port is open and forwarding correctly too
otherwise the webhook will be blocked by your router and not reach your computer
how do i do that
you can check to see if ur port is open with something like this https://www.yougetsignal.com/tools/open-ports/
The port forwarding tester is a utility used to identify your external IP address and detect open ports on your connection. This tool is useful for finding out if your port forwarding is setup correctly or if your server applications are being blocked by a firewall.
but you'll need to forward it first
which can vary from router to router
you need basically tell your router that any traffic received from the port you specified (5000), should be directed to your computer, so your computer can then do what it needs to do with it
yea it says its closed
yeah sorry, you need to forward it first
then check if it is open
as it may be blocked by your computer's firewall
How can i get vote update in Discord text channel ?
What is dpnp? @fast meteor
dynamic port forwarding
i think its dpnp
something like that
as long as the url listed on the site is pointing at whatever the right port is it should work
yeah
im getting a 403 forbidden when i do dblpy.get_upvotes(), might this be because im running it from my beta testing bot?
no i definitely have the right token
is there a vote test for the api?
so i can make sure when someone votes it works correctly
on your bots edit page, in the webhook section there is a test button.
anyone know how i can use the webhook to send a message into a channel?
like other webhooks
actually wait i have an idea
So i don't really get how to authorise, can anyone help?
(node:24) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.<anonymous> (/home/container/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:24) 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)
(node:24) [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.
You didn't provide a DBL token correctly
const DBL = require('dblapi.js');
const dbl = new DBL('i put the token on top.gg here', client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
Make sure the token you copied is correct or it will give that error
@restive otter ok so i regenerated a token, and i am going to try it
just wish the bot was in here so i can test it right here
🗿
YAY it actually worked, so you were right! I couldn't actually get the token right because of teh compact website
@restive otter what is the function so i can track votes.
<dblapi.js>.getVotes()
@restive otter i meant send the user a message when they vote for the bot
it can be message or whatever else.
You have to setup a webhook to receive on vote events so you can send them a message
is it ```
dbl.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
ok
i have a webhook
so what do you mean by setup a webhook?
ok
so im guessing this is where i test it. I don't really get the webhook URL and authorisation. @restive otter
A webhook example:
http://<your main IP>:<your port>/dblwebhook
Authorization can be anything you want, just remember it
what do i put in those two parts
Alright
what do i put in the port?
@restive otter can i put a discord webhook URL in the url section
A wot
i don't really get this 
what do i put in the ip and port section???
const DBL = require('dblapi.js');
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'password' });
now the posting function doesn't log anything.
@restive otter can you still help me?
Because you didn't provide the client
oh
new DBL(token, options, client)
so can you still help me getting votes
can u pls help with my bot
by webhooks and things
Im trying to post my guild count, but it just prints "online" and never says "Server count posted". And when I stop the code, it says:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1056b01c0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x1056bb820>, 6.557720309)]']
connector: <aiohttp.connector.TCPConnector object at 0x1056b2a00>```
My Code:
`index.py`:
```py
import discord
from discord.ext import commands
import os
client = commands.Bot(command_prefix="$")
@client.event
async def on_ready():
print('Online!')
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
client.run('bot token')```
`cogs/TopGG.py`:
```py
import discord
import dbl
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'dbl-token'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))``` Why is it giving me that error, and how can I fix it?
@restive otter so in the options part, it doesn't have a part to put the webhook-url
It doesn't need the webhook url
Anyone has idea about this?
https://prnt.sc/vffyuz
so i have setup and auth password , what next? @restive otter
You provide them in the DBL constructor in the options parameter
@patent lintel i don't think we are experts in python
It's not an error
You're just force-terminating all sessions instead of waiting until they're all closed
@sullen nymph do you have any idea about my issue?
You're just force-terminating all sessions instead of waiting until they're all closed
@sullen nymph ok but how long should i wait?
i have been waiting
and nothing happens
so something is stuck
From a few seconds to about a minute
Spam Ctrl-C until it shuts down then ig
how do i setup a webhook
hasnt Voltrex Master been explaining that for like 30 mins
Yes but i don't even get it
...
and port with ur port
so when i paste that in my browser @patent lintel it says refused to connect
and are you making a /webhook path?
so when i paste that in my browser @patent lintel it says refused to connect
@sharp hollow are you running it?
what do you mean running it.
like running the code
yes?
It's /dblwebhook
it should do a post request
so putting it in ur browser wont exactly like work
also delete that screenshit if you don't want anyone to spam it with requests
In the URL
lol
well im not an expert in node.js 😦
but like
it should work
idk why it isnt
but did it work?
@patent lintel
yeah
Make sure your port is open and forwarded
and that no firewall is blocking requests
Anyone has idea about this?
https://prnt.sc/vffyuz
hello, so i have my bot on top.gg i wanna make an upvote trigger in my bot what will i have to do to make it
so that whenever a person upvotes my bot they get the upvoters only command access
ping me if someone gets my ans
https://www.npmjs.com/package/top.gg/v/2.3.0 is it possible with this
You can use the api to check if a user has voted or use vote webhooks
I suggest you to read the docs
reviews still not showing ..
@meager garnet make sure you entered a valid top.gg api token, then you'll be able to publish stats
Hey, hello how can i disable autoposter? or can i?
lol
is there any example/tutorial for server count api setup for js ? 😦
try {
var Discord = require("discord.js");
var client = new Discord.Client();
var DBL = require("dblapi.js");
var dbl = new DBL('token', client);
}
is this correct ? i used npm install dblapi.js before
is top.gg webhooks compatible with dynamic port forwarding? the router my bot runs on can't do standard port forwarding, only dynamic port forwading (DPF)
Hmm I suppose that as long as you can receive http requests it should work
When sending the webhook URL what IP address are we supposed to use in place of the 0.0.0.0? I tried my IPV4 and IPV6 although none of them worked. Thanks in advanced.
either your public ipv4 or ipv6
Ok, I'll give it another try. Is there a way to find it in nodejs with a command or something?
not sure why you would need to.
if its on a home network, just google "whats my ip"
if its a vps, just use whatever ip you use to access the server.
https://www.npmjs.com/package/public-ip
there are modules that do this too, but I dont think its needed.
Thanks, I'll give them a look.
How to do java skript when you vote the bot on top.gg it will send a thank you message on discor
I tried my IPv4 address again(seems like websites can't find my ipv6). The link I used was http://0.0.0.0:5000/dblwebhook and I swopped out the 0.0.0.0 with my ipv4 address and it still doesn't seem to work.
Hello
My bot has been accepted, so I try to make sure that when someone votes for my bot, it sends them to a special channel on my discord server. So I looked at the documentation, and I found this:
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, 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!`);
});```
As indicated, I replaced the ``yourDBLTokenHere`' with the key api of my bot, and I restarted the bot. I then went to the webhooks category of my botn I put the webhook link I created, I saved and I then clicked on **Test** but nothing appeared in the salon in question.
Does anyone know why this isn’t working?
The webhook url you are using, what does it look like?
is it a discord webhook url? or the one pointing to http://${hook.hostname}:${hook.port}${hook.path}
It's a discord webhook url
top.gg webhooks dont work with discord webhooks
you have to use the webhook receiver you made in your code with the library.
How can I do that ?
just
http://ip:port/path
if your on a home network, youll need to port forward.
if you have a firewall you need to open the port aswell.
http://ip:port/path
I use a vps. So I have to put the vps ip, but the port, I put what? And the ``path`, is the path to what?
your defining your port in code
webhookPort: 5000
if you look at the api docs for this lib, the default path is set to dblwebhook
Where can I change the ip ? In the options ?
the ip is changed by what the url is pointed to.
as long as the url you fill in on the site is correct.
I'm going to go make lunch. if you need me, tag me please!
@jaunty plank, actually, I don’t understand how I can do...
just put in the url section
http://yourvpsIP:5000/dblwebhook
the auth section on the site needs to be the same as what you put here webhookAuth: 'password'
Thanks it works
ay
How i get my vps andress?
contact your vps provider
So I am currently upgrading Discordjs from 11 to 12, but now the DBL stuff is breaking.
Seems to break right off the bat, when I start the DBL service.
const dbl = new DBL('mykey', client);
I am guessing maybe I need to just upgrade that package or something?
I was looking over documentation and the top level stuff seems the same still. The require statement and then the dbl declaration
Yea looks like I just needed to force update my package.
Last Q, I don't think I am using shards. If those are null on my client is that fine?
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
This appears to be the same code I have, as in the documentation.
The only thing I have changed thus far is client.guilds.size -> client.guilds.cache.size
Im trying to post my guild count, but it just prints "online" and never says "Server count posted". And when I stop the code, it says:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1056b01c0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x1056bb820>, 6.557720309)]']
connector: <aiohttp.connector.TCPConnector object at 0x1056b2a00>```
My Code:
`index.py`:
```py
import discord
from discord.ext import commands
import os
client = commands.Bot(command_prefix="$")
@client.event
async def on_ready():
print('Online!')
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
client.run('bot token')```
`cogs/TopGG.py`:
```py
import discord
import dbl
from discord.ext import commands
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'dbl-token'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))``` Why is not working, and how can I fix it?
I add to my bot dblpy and when I start the bot I have this error. How can I solve?
File "/usr/local/lib/python3.5/dist-packages/dbl/__init__.py", line 18, in <module>
from .client import DBLClient
File "/usr/local/lib/python3.5/dist-packages/dbl/client.py", line 74
_webserver: Optional[TCPSite]
^
SyntaxError: invalid syntax```
the intents say that if you want to enable them, your bot has to be verified once it's in 100 servers. Does that mean that there is no longer a 100 server limit on unverified bots if they don't have intents enabled?
idk maybe
@proper narwhal not related to top.gg api, but no, the verification is system is not modified by the intents system.
Quick question for webhook which webhook is it asking discord channel webhook?
A webhook that you created with your bot. It's not a Discord webhook
This for server webhooking?
what does automatic server count do?
what does the yourDBLToken here in const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' })
what does that mean
isnt that just top.gg token?
Can someone help me with server count posting
fetch(`https://top.gg//bots/747076873359458370/stats`, {
method: "POST",
headers: {
Authorization: "------------------------------------------",
"Content-Type": "application/json"
},
body: JSON.stringify({"server_count": client.guilds.cache.size })
}).then(response => response.text())
.then(console.log).catch(console.error);```
its not working
states?
yea
idk what you mean
Can someone help me?:|
const dbl = new DBL(process.env.DBTOKEN, { webhookPort: 5000, webhookAuth: 'password' })
dbl.webhook.on('vote', vote => {
let embed = new Discord.MessageEmbed()
.setDescription(`Thanks ${vote.user.tag} for voted in me!`)
.setColor(config.color)
client.channels.cache.get('775321074975506472').send(`<@${vote.user}>`, embed)
})```
Alot of erros
Errors would definitely be helpful
hello guys. Can anyone help me how to use webhooks in python?
self.bot = bot
self.token = 'xxx' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@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("Received an upvote:", "\n", data, sep="")```
I am trying to write the voting command. I tried, but I didn't get any update in the output. (Didn't print anything)
Help


