const DBL = require('dblapi.js');
const dbl = new DBL(`my api key owo`, { 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 => {
let mainguild = client.guilds.get('561972898554970113')
let role = mainguild.roles.get('567302962888572958')
mainguild.vote.addRole(role)
vote.send(`Thanks for your upvote!`)
console.log(vote);
});
``` 🤔
#topgg-api
1 messages · Page 56 of 1
the server name for that service is literally the exact same
at the bottom
yes
/dblwebhook if you didn't change anything
but in code there is webhook/url
// catches a post request with the specified URL
app.post('/webhook/url', (req, res) => {
so i need change it?
the test webhook button doesn't actually seem to do anything
set up a quick ngrok and tried sending a request there and it didn't pick up anything
Then your webhook isnt set up correctly
Or it wont access the target because of any firewalls
I can send POST requests to the URL just fine using postman on another device connected to a different router
Well its either the webhook, the port on your device or any firewalls blocking the connection
well there isn't actually a webhook involved in this at all, the port is fine and there's no firewalls because other devices can send the same request through just fine
Did you save before using test !!
whef
saving worked
the idea was to test the link I put in before saving it to my bot 
alright awesome, I can see the request coming in from the test and I can view the request and response objects. I can see the headers in the request object, but I'm not sure where to find the user object it sends?
alright and what if I'm not using the dblapi module?
So i would like to use this with my bot, that is running on my local pc.
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});
});
Am i correct that all i would have to do is open port from router and firewall to my pc? am i missing something?
can someone explain to me how to use the webhooks for discord rewrite if you don't mind?
@tired elm even I want a tutorial or explanation on it
But from the information I've digged up by now
Ig we need to create a webserver with flask/django and recieve the post req
@calm zealot well yes but the url and auth also needs to be set in your bot's edit page
GitHub
An aiohttp webserver made for usage in discord.py bot cogs to keep track of upvoters. - shivaco/DBL-python-async-webserver
@tired elm @quartz pumice
Kind of
Thanks for the example @sullen nymph
You can check my Flask script out instead if you want
yea checking it out rn
Oh shit yeah that was really helpful thank you
Is there a way of posting server count in the website with python async version? Im totally unfamiliar to the example version they gave.
nvm i found a async example in #312614469819826177
hi
@runic grove it is sharded I said that- discord.js had an update its .totalShards now, ids are seperated so the docs don't add up rn
huh, i wasnt aware of that
if i want to create a bot to test my code with the dbl library should i make another listing on the site or is there a way to test it without it
What are you testing
If you want to test voting, you can use the test vote on the edit bot page.
The votes have a type parameter which will be "test" when using the test vote, so you can make your code only reply to that.
how i can get the Authorization r this is use my DBL token? @arctic arch
@gloomy cypress
- dont mention admins for stuff like that
- its not your token
- it can be anything, it just has to be the same in your code
Hum...
I've a problem
Here is my code :
// Gets vote webhook
const express = require('express');
const app = express();
var server = require('http').createServer(app);
server.listen(client.config.votes.port, () => console.log(`Atlanta listening on port ${client.config.votes.port}!`));
app.post('/votes', (req, res) => {
console.log('[VOTES] Receiving a request...')
if (req.headers.authorization !== client.config.votes.auth) {
console.log('[VOTES] Rejected Post Request, Details Below\n', req.headers)
res.status(401).send('Unauthorized');
} else {
console.log(`[VOTES] New vote post, user_id: ${req.body.user}, isWeekend: ${req.body.isWeekend}.`)
client.functions.vote({user:req.body.user, isWeekend:req.body.isWeekend}, client);
res.send('Sucess');
}
});```
When I use Postman, it works
But when I test with DBL it doesn't work...
is your server accessible from the outside internet
Yes it's not in local
Do you want the url ?
If you want I can send them (in dm)
@arctic arch Could it be due to a temporary dbl failure?
dbl's side is working fine
Why am I getting an error Error: 503 Backend fetch failed from dblapi.js module?
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ocean pike that website is down if you get that error
@limpid sorrel what website..... lol
..the discordbots.org website
it's an API library, it interacts with the website
if the website is down, the API library also will not work
Oki
How to check if the user has voted or not voted?
*Python
" tell them that we use the days argument and it changes nothing (setting it to 1 or 31 does the same thing while it shouldn't) "
?
That's my brother's question
i need more context
@restive otter That's intended
Checking votes through API call checks if the user has voted for the past 24 hours, as shown on the screenshot justin sent
@restive otter days argument was removed from the api, the library is out of date
at the same time, any reputable python programmers here willing to become the maintainer for the dbl python library?
If you need some really simple library that would work fine, count me in
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 60000);```
it doesn't update my bot stats :v
api token is correct
any errors?
nothing, but i now forgot that i don't installed dblapi.js on vps
xD
is it just not updating but not showing N/A?
I don't think you're allowed to post every minute, but that shouldn't be why it doesnt work
Wait I didn't read everything 
Typical
// Gets vote webhook
const express = require('express');
const app = express();
var server = require('http').createServer(app);
server.listen(client.config.votes.port, () => console.log(`Atlanta listening on port ${client.config.votes.port}!`));
app.post('/votes', (req, res) => {
console.log('[VOTES] Receiving a request...')
if (req.headers.authorization !== client.config.votes.auth) {
console.log('[VOTES] Rejected Post Request, Details Below\n', req.headers)
res.status(401).send('Unauthorized');
} else {
console.log(req);
console.log(`[VOTES] New vote post, user_id: ${req.body.user}, isWeekend: ${req.body.isWeekend}.`)
client.functions.vote({user:req.body.user, isWeekend:req.body.isWeekend}, client);
res.send('Sucess');
}
});```
I've that code
But the req.body is not defined (I got this error : )
Ok so I rely on dblapi for the server count on my website for the bot.
Should I do like, every like 30 minutes it pulls from dbl and then sets a local variable or do in the request to my endpoint so it's fetched from dbl every time?
@sullen nymph see the current lib, and send a pr with your changes to bring it up to date and everything and we'll see

@arctic arch Do you know why "req.body" is undefined ?
you're missing the body parser
Oh okay that's true thanks
also don't ping people for help
Hey Tonkku can I ask you something?
just ask
So my bot was declined but my bot you need to be in our server to see what is does it was declined because it wasn’t developed. Although it is I was wondering if I could show you in my server what it does.
this is not a question about the api, move to #general and ask the mod who declined your bot
why are you even using dbl for that
Could post your server count to an api of your own
i mean i also retrieve the votes
so i may aswell grab server count as well
@spiral steeple @plain timber
so which should i do :p
I never used an API before.. How do i do it..
read the docs and get back to me
Docs are very confusing for someone that never used API's before...
What lang do you use?
For me personally, I just read the docs and use trial and error till I figure it out
Most of the time there's already a lib for an api that you want to work with, if you use js the dbl api lib is simple asf https://discordbots.org/api/docs#jslib
I copied the webhook example on the api and tested my webhook and it received it, when on ready it is supposed to show the "Webhook running at http://${hook.hostname}:${hook.port}${hook.path}" part, but it doesn't and it also doesn't recognize votes.
You have your endpoint open n everything?
Does api/bots/{bot_id}/check still check if a specified user has voted for 24 hours?
12 hours but yeah
Months ago
Docs out-of-date smh /s
Thanks for letting me know
anyone who uses discord.py for their discord bot, because I have no clue how to implement the trigger_typing() method and how to disable the help command, so help would be appreciated, btw i tried reading the docs but i am hopelessly lost
I do not understand, I completed my password and my url with this format http://mypublicip:5000/dblwebhook by following what could be sent above. And my program follows this example : js 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!`); }); But the logs are coming out http://0.0.0.0:5000/dblwebhook despite that. And I do not have an answer when I test. 
@warm cairn the log should say 0.0.0.0
you need to change that to the public ip when you put it in your bot page
and also u need to save before testing
yes
hm
can you try making the request with postman
make a POST request to the url with the data that DBL would send
but DBL is down now so you can't see the docs
yes ;-;
thx
It does not work, the software tells me that it had a connection error 
I missed a step?
My bot is on cloud.google.com, I have to do some manipulation to allow the connection?
Ah
C'est bon
euh
I think I found
yes !
@plain timber Thanks you

I send that, if one day someone encounters the same problem~
https://cloud.google.com/vpc/docs/using-firewalls
x)
Where can I see the documentation for the python lib for dbl
cuz the link on the site doesn't work
found it
bit silly that the wrong link is on the official site
is it possible to get the vote count of a bot? if so, how?
The example on the github page for the python lib contains (at least) 2 errors
logger.info('Posted server count ({})'.format(self.dblpy.guild_count())```
has 1 `)` too little
and in```py
while not bot.is_closed():
bot is unresolved. Should be self.bot
there you go, that one ACTUALLY works
and i did an oof, forgot to take the token out xD
there
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token'
self.dblpy = dbl.Client(self.bot, self.token, loop=bot.loop)
@commands.Cog.listener()
async def on_ready(self):
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while not self.bot.is_closed():
logger.info('Attempting to post server count')
try:
await self.dblpy.post_server_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))
await asyncio.sleep(1800)```
Hey,
I heard it is better to use webhooks if you want to know if user x has voted. Can someone explain to me how I can do that in Java? I have literally no experience regarding webhooks. Thanks!
set up a http server that listens for post requests with a json body
Uhm, okay. Are there any libraries you can recommend?
I don't use java so I wouldn't know what to recommend
Okay, thank you anyways!
you'll probably find something good on google
Yeah, I'll look around
Is ok if I set the dlb.postStats interval to 300 seconds? or I should keep the default value of 1800?
Hey guys, i think i need to authenticate my bot to use the api, but i am not experienced with http stuff. Can someone explain or link me how to do this? I have no idea how to use an authorization http header.
google how to add a header for your language / library
@wicked storm why would you do 300 seconds?
Just asking mate
Have the issues in the python example been corrected yet?
hmm im using the python library as well, I just realised that its doing everything already. Im still getting "Unauthorized (status code: 401): {"error":"Unauthorized"}" though. I am sure that my token is correct. What else could it be?
yeah im using the newest version of discord.py and the dblpy one to access the discordbots api
How are you passing the DBL token in dbl.Client?
self.dblpy = dbl.Client(self.bot, self.token, loop=self.bot.loop)
self.token being the string of the token
just like in the code example for dblpy
if not self.token:
raise UnauthorizedDetected('Unauthorized (status code: 401): No TOKEN provided')
Yeah, dblpy somehow can't see the token
i saw that one too, i am getting a different error though:
"Unauthorized (status code: 401): {"error":"Unauthorized"}"
hmm i tried regenerating the token for a 4th time and now it works haha
sorry for wasting your time
i was getting the same error, thats what i was talking about when i was going on about the errors in the example
so i rewrote the example
now it works
I code in discord.py and I got this error when I tried to get the servercount on DBL done with the api ....
iirc dblpy is broken, youre probably better off just making the http requests
ow ok
Huh
Oh
For now yeah, use aiohttp
Cool, I get 401 when using former token for requests
don't use the example and you'll be fine
dbl for python works fine
but you'll have to use the docs
Can anyone explain why DBL sends 401 error code when the token is wrong?
Because it is the error code for unauthorized :think:
Isn't it suppsoed to be 403
That's forbidden, different thing
I think I'm confusing myself at this point
did someone already tell that the link on the api site for python is non-functional
and is a link to version 0.1.4
(It's actually 0.1.3 but eh... since neither work, doesn't matter)
if someone wants a functional example for the python lib: https://discordapp.com/channels/264445053596991498/412006692125933568/568739242675535872
@tribal trout i think Therese a issue tracker somewhere
meh, it works now for me. I know where to find what I need so I don't really care about the rest
x
Use webhooks and store votes
0 - no
1 - yes
@tribal trout What does your on_ready in that code do
o_0
@restive otter put that in #memes-and-media please
What they tried to do with awaiting a bool
on https://bintray.com/dv8fromtheworld/maven/JDA/ I don"t see any bouton Download, someone can show me how to dowload it ?
A Java wrapper for the Discord REST and Websocket API.
https://github.com/DV8FromTheWorld/JDA
async function postToDBL() {
request.post({
url: `https://discordbots.org/api/bots/482855531220959242/stats`,
form: {
server_count: client.shard.fetchClientValues('guilds.size')
},
json: true,
headers: {
Authorization: dbltoken
}
})
client.logger.info(`Anlık bilgiler başarıyla discordbots.org'a gönderildi.`)
}
Shard doesn't send them all
ty
Anyone got the WEbhook Vote to work with heroku
@restive otter you need to await the fetchValues
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.vote.inc(vote.user, 'votes')
const voteChannel = client.guilds.get('554742955898961930').channels.find(channel => channel.name === 'votes' && c.type === 'text')
console.log(`${client.users.get(vote.user)} has voted for Aliquid!`);
voteChannel.send(`${cient.users.get(vote.user)} has voted for Aliquid!\nThis user has a total of ${client.vote.get(vote.user, 'votes')}`)
});```This does nothing when a user votes. Reason why?
@ me with answer
@short girder did you set the webhook settings in the boy edit page?
If you mean the authorization
Because if someone knows where your webhook is running they could send requests impersonating votes
And farm vote rewards on your bot I guess
Its not required but as Wesley said, if somebody knows the Webhook he can get unlimited fake Votes
ah
What language
JavaScript
How do you make bots?
Thanks!
'''
some said me that python wrapper for your api is broken. Is is true?
Until someone merges my PR, it is true
I can"t find a clear doc of JDA, someone have it ?
it isn't broken, but the example is
Kinda both
Why does it doesn't do anything when I vote 😢
const DBL = require('dblapi.js')
const dbl = new DBL('My Token', { webhookPort: 5000, webhookAuth: 'My 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!`);
Money.findOne(
{
userID: vote.user,
},
(err, money) => {
if (err) console.log(err);
let CoinsToAdd = 120;
if (!money) {
const newMoney = new Money({
userID: vote.user,
money: CoinsToAdd
});
newMoney.save().catch(err => console.log(err));
} else {
money.money = money.money + CoinsToAdd;
money.save().catch(err => console.log(err));
}
}
);
});
did you set the webhook url in the bots page
Why does
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBL_TOKEN, client);
dbl.getVotes()
return 1000 Random Users
My Bot has 6 Votes
um what
That’s all the bots that have upvotes I think
You needs to do dbl.getVotes(“id”)
@sudden depot
pls
@dreamy grove ?
How do I post my total server count to DBL? (across shards)
you can either post shard specific counts and we'll add them up, or you can sum them up yourself and post that
ah alright
@arctic arch sorry to ping, but it worked and then all of a sudden it stopped counting them up and posts at just 1 shard
what are you posting
The server count for each shard
Sorry for late reply
Same as before, but now it isnt counting them together
oh it just posts as soon as the shard starts
then the next shard starts, posts again
worked before
why don't you just use guildCreate and guildDelete events for that if u don't get 60 servers in a minute
no
Cause that could easily abuse the api
well i used to send it like that with a 50k bot and never get warned about it so
having 26 shards and using intervals r ew

Just posted the stats, got 400 error code but it posted the full amount. Did it with client.shard.id instead of shards.Id
@arctic arch apology for the ping, but I've tried asking a mod and been waiting for a bit;
When I launch the vote reward part of the bot (with 2 shards), it launches bot.js through index.js before the shards load, so the webhook already loads,
but then it tries to re-run the webhook and it says port already in use
So it just goes into an "exited before its client became ready" loop
Read the error
I did
The address is "in use" but I have no idea how to make it connect when all shards finish loading
Only run it one one shard or run it in a seprate file that doesnt get sharded
load the webhook in one shard or a master process
You're connecting twice, load the webhook on the final shard
Cause you're trying to run the webhook for each shard
its doing anything ```const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const httpserver = http.createServer(app);
const dbl = new DBL('token', { webhookAuth: 'password', webhookServer: httpserver });
dbl.webhook.on('ready', hook => {
console.log(Webhook running with path ${hook.path});
});
dbl.webhook.on('vote', vote => {
bot.channels.get('569500292815519756').send(User with ID ${vote.user} just voted!);
});
app.get('/', (req, res) => {
// ...
});
httpserver.listen(5000, () => {
console.log('Listening');
});```
How do I load it on the final shard?
just load it once in index?
tonkku you know why its doing anything ? ^
lemaaa
yes
nbr
?
stop speak chinese
bb
ok and what are you doing after that
uh nothing 
Any ETA on that dblpy fix? 
@arctic arch what website ?
I put http://'ipwebserver':5000/dblwebhook on the website and when i 'm going to this url its sending "OK" But when i'm clicking on test webhook button, nothing hapenned
Did you click save
Yes
for the webhook on js. What would be a valid webhookServer?
this: http://domain.com:port?
http://127.0.0.1:port
remplace ip by your web server ip, and if you are in localhost remplace ip by your ipv4
yes
ok ty
np
webhookServer is an existing http server you want to link the module to
yeah
make sure you've got ports forwarded so the outside internet has access to send requests
okay
i just copypasted the code needed to display the server into my .py lib
and inserted the token
and nothing happens
What happens when I use the test button? Does the dbl.webook.on('voted') function run?
yes, it sends a test vote
tonkku you boffin know your queue 
what
ok
i aquire assistance
What's up
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(config.apiToken, { webhookAuth: 'password', webhookServer: 'http://IP:PORT' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.vote.inc(vote.user, 'votes')
const voteChannel = client.guilds.get('554742955898961930').channels.find(channel => channel.name === 'votes' && c.type === 'text')
console.log(`ID ${vote.user} has voted for Aliquid!\nTag ${client.users.get(vote.user).tag}`);
voteChannel.send(`${cient.users.get(vote.user)} has voted for Aliquid!\nThis user has a total of ${client.vote.get(vote.user, 'votes')}`)
});
app.get('/', (req, res) => {
// ...
});
server.listen(4500, () => {
console.log('Listening');
});```This does nothing on test. This is what's on the bot webhook edit page: `http://IP:PORT/dblwebooj`
Reason why not work?
@ me with answer
Never even sends listening msg.
hmm i also have my own side of errors, but its on the Python side :c
or more like
@arctic arch the website is broken?
so dblpy sucks?
Sort of
idk when my PR will be merged, but until then you are better off using aiohttp
alrighty, thanks for the info

I remember seeing something like dont name your file dbl and that fixes it
very weird
That's if they get module 'dbl' has no attribute 'Client'
dw ill just skip the existance of dblpy and try with aiohttp
well its something with forbidden error
i cant fix that, it's a connectivity issue between user and server
What's weird is that the lib is supposed to wait until bot user is ready to use, but it doesn't
So it sends a request to None instead of bot ID in the endpoint
pass an additional argument containing the bot_id ?
It doesn't accept that
the bot id is optional in the rest api now tho
Could honestly just use self.dblpy.http.post_server_count at this point 
At that point you are sure your bot_id is fine and you can just slap len(bot.guilds) in there
But that doesn't seem user-friendly
You know where to get the params or should I post them?
that would be useful
Just one sec
bot_id, guild_count, shard_count, shard_no
Just make shard_count and shard_no None
alrighty, thanks for the info!

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(config.apiToken, { webhookAuth: 'password', webhookServer: 'http://IP:PORT' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.vote.inc(vote.user, 'votes')
const voteChannel = client.guilds.get('554742955898961930').channels.find(channel => channel.name === 'votes' && c.type === 'text')
console.log(`ID ${vote.user} has voted for Aliquid!\nTag ${client.users.get(vote.user).tag}`);
voteChannel.send(`${cient.users.get(vote.user)} has voted for Aliquid!\nThis user has a total of ${client.vote.get(vote.user, 'votes')}`)
});
app.get('/', (req, res) => {
// ...
});
server.listen(4500, () => {
console.log('Listening');
});```This does nothing on test. This is what's on the bot webhook edit page: `http://IP:PORT/dblwebook`
Reason why not work?
@ me with answer
Also never sends listening log
@wraith flax may I ask you for your code when you were getting error 403?
I don't seem to get it now no matter what I do
@short girder the webhookServer is supposed to be the server you set up on the line above
?
webhookServer: server
bruh why! so simple
is there a reason you're setting up a custom web server?
both of you are using the example code with nothing in the / route
the module is able to host its own server as shown in this example
I am going to be making a website.
@arctic arch, Is this correct? JS Webhook running at http://0.0.0.0:0/dblwebhook Listening
This is what I get in console on boot
:0 port doesn't seem to be quite legit
and nothing happens on test
the port is 0 when you use server linking
TIL
wdym?
didn't find a way to get the port from a http server object
anyway
as I told leemaa
make sure you've got ports forwarded so the outside internet has access to send requests
You mean my port open?
so in your case 4500
Yes
make sure the port is open in your router and/or firewall so requests can go through
it is open
one sec lemme check
What should be on the bot webhook page?
http://IP:PORT/dblwebhook
then the auth be the same as webhookAuth: password?
Also if I were to go to http://IP:PORT/dblwebook, should anything happen?
...
no, it listens to POST requests
Ok.
Is this correct:
// Webhook URL
http://IP:PORT/dblwebhook
// Auth
password```
@arctic arch, Sorry for pinging you so much
yes
mmmm
// This is logging variable ${server}
Server {
_events:
[Object: null prototype] {
connection: [Function: connectionListener],
request: [Function: bound _handleRequest],
listening: [Function: bound _emitListening] },
_eventsCount: 3,
_maxListeners: undefined,
_connections: 0,
_handle: null,
_usingWorkers: false,
_workers: [],
_unref: false,
allowHalfOpen: true,
pauseOnConnect: false,
httpAllowHalfOpen: false,
timeout: 120000,
keepAliveTimeout: 5000,
_pendingResponseData: 0,
maxHeadersCount: null,
headersTimeout: 40000,
[Symbol(IncomingMessage)]:
{ [Function: IncomingMessage]
super_:
{ [Function: Readable]
ReadableState: [Function: ReadableState],
super_: [Function],
_fromList: [Function: fromList] } },
[Symbol(ServerResponse)]:
{ [Function: ServerResponse] super_: { [Function: OutgoingMessage] super_: [Function] } },
[Symbol(asyncId)]: -1 }
// Ready messages
Webhook running at http://0.0.0.0:0/dblwebhook
// Listening on port 4500
Listening
```This is what I get.
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(config.apiToken, { webhookAuth: 'password', webhookServer: server }, client);
console.log(server)
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.vote.inc(vote.user, 'votes')
const voteChannel = client.guilds.get('554742955898961930').channels.find(channel => channel.name === 'votes' && c.type === 'text')
console.log(`ID ${vote.user} has voted for Aliquid!\nTag ${client.users.get(vote.user).tag}`);
voteChannel.send(`${cient.users.get(vote.user)} has voted for Aliquid!\nThis user has a total of ${client.vote.get(vote.user, 'votes')}`)
});
app.get('./website/index.html', (req, res) => {
// ...
});
server.listen(4500, () => {
console.log('Listening');
});```
@arctic arch, Sorry for pinging so much. Just say if your too busy rn. I hate having to ping ppl.
so what's the issue right now?
Whenever I go to test nothing happens
Like how long does it take for the test to actually take action?
@arctic arch......
For me it worked in about 1 to 5 seconds
Port open in your router?
Yup
IPs are correct
Idk what's wrong.
Ya know what I'm going to not have the voting inside the server
make sure you've saved before testing
and that webhookAuth and the auth on the website match and aren't just password
ok
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(config.apiToken, { webhookAuth: 'aBotMaster', webhookServer: server }, client);
console.log(server)
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
client.vote.inc(vote.user, 'votes')
const voteChannel = client.guilds.get('554742955898961930').channels.find(channel => channel.name === 'votes' && c.type === 'text')
console.log(`ID ${vote.user} has voted for Aliquid!\nTag ${client.users.get(vote.user).tag}`);
voteChannel.send(`${cient.users.get(vote.user)} has voted for Aliquid!\nThis user has a total of ${client.vote.get(vote.user, 'votes')}`)
});
app.get('/', (req, res) => {
res.redirect('./website/index.html')
});
server.listen(4500, () => {
console.log('Listening');
});```Still nothing happens.
@arctic arch
Sure
if I'm not able to do it, you either have the wrong IP or the port isn't open
are you hosting this from a VPS?
Yes
did anything happen
Let me check console
wdym?
So when I have the correct auth it will crash?
Maybe try incorrect one?
to see
incorrect auth gives me 403 as intended
I only included the user in my request tho
wdym?
0|index | Oops! Error: 401 Unauthorized```
This is in console
@arctic arch
irrelevant
wdym?
I think it worked one sec
Cause it finally gave an error for sending a msg in the vote event
yup it works now
0|index | ID 95579865788456960 has voted for Aliquid!
0|index | Tag Tonkku#0107```
Let me add the message sending real quick
then try it one sec
@arctic arch try
??
@arctic arch, Sorry for ping again..... Could you try it
you can use the test on the website now
Tried nothing happened
Does DBL.js automatically handle ratelimits?
(To set guilds on join)
?tag tias
No it doesn't.
does anyone have thee documentation for discord.py 16.12
i cant find it anywhere anymore
https://discordpy.readthedocs.io/en/v0.16.12/api.html, wrong channel
i am getting a access forbidden error when i attempt post my bots server count, is this putting in the token wrong?
Dblpy?
i got it nvm
if you're using dblpy, don't use the examples
sorry, i was trying to post without the bot loading first
i got it straight off the api: https://discordbots.org/api/docs#pylib
because to be honest, it makes no sense to me
Docs and examples are outdated for now
"For now"
Been like that for like 6 months
That I know of
Idk about before then
iirc shivaco fixed it but PR not merged
^
spam
👌
this man left so my ban button wouldn't show, now I gotta delete these all
Have fun with deleting those
thanks mobile
Constantly
Constantly errors with the dblapi npm package
Backend fetch failed
Connection times out
Etc etc..
Anyone has a reason for it?
Or like why it even happends?
@restive otter what is your host?
One that doesnt disconnect from nowhere
Is it a stable vps? Because it can be that
Look, even when i use my own damn phone i sometimes get the same backend fetch on the site
So its not even just the vps
Ofc its a stable vps
I haven't noticed any issues with the api
Its Digital ocean for gods sakes
Dude even my own phone on multiple networks not just my home one, my 4g etc get this error like 1 time per month
So yeah the api might be a little bugged
"Sometimes"
and it'll go away
Happends on multiple vpses more than 2 times per month
It crashes my bot
Constantly
How the fuck can i catch the error on my bot
sounds like you need to implement error handling
My bot already listens to every error thing i know of
Unhandled rejection, error, the other rejection thing..
Well idfk
shoves try catches everywhere
Nah not gonna be that stupid lol
can anyone tell me how I can have that webhook (the dlpapi.js thingy) be behind a reverse proxy like nginx
server {
listen 80;
listen [::]:80;
server_name subdomain.example.com;
location / {
proxy_pass http://localhost:5000/dblwebhook;
}
}
oke
didnt know its the same for webhooks (dont know shit about webhooks)
should I have ssl or is it useless?
Useless
uhhh not sure, but I already have it like that, soooo can I just leave it as it is?
(its not for me, just somebody hosting on my server)
can someone help me set up the webhook thing
i don't know exactly what to do
nvm
actually
i do
@runic grove how do setup the webhook then?
@rugged sierra change server_name to whatever, and the proxy_pass to have the correct port. You need to configure the domains DNS or whatever its called as well with either cloudflare or the domain provider, to have an A record with the correct subdomain set, pointing to the servers IP
hey, can someone help me with this? My bot page says that the bot's status is "???" (I supposed it's not able to define it), but my bot is online. I'm even regularly posting the stats with the npm library. What can I do to make it appear online on the website too?
Your bot is not in this server
How do I add it?
It was probably kicked, search #mod-logs for your bot and see why it was kicked, fix the issue and ask a mod to invite it back
thanks

HOW THE STARBOARD WORK
WHO KNOWS, ITS A MYSTERY
ummm ????
i just submitted my bot and it just redirected me to this
i have no clue what happened
backend issues, as you can read the error message
the website is being very slow for me right now
yeah, trying to log in just errors
ok so when i tried this on my phone it gave me a 403 error
is it not possible to retrieve a bot's status via dbl's api?
there is an undocumented endpoint /api/bots/id/status
oh, cool. thanks
is it possible to return the status via just /bots or is /bots/id/status the only way?
the status endpoint is the only way
damn, okay. could i suggest possibly adding it to /bots so i’m not flooding the api with requests?
or will i just have to work around it myself
status will likely stay as exlusive to that endpoint
okay then. thanks for the help
@sullen nymph you're maintaining dblpy now?
Kind of
@sullen nymph @golden wind that is not a dbl api related discussion. Please move to #development or #memes-and-media
We are in DMs, all good and sorry
@dawn fjord lmao it was dbl api related
anyone here can lend me a hand with the DBL api c#?
No, I could probably answer a Question abuat it but you are not asking one and i would like to keep both of my hands to myself
wot
how is someone supposed to answer a question if we dont know what the question is
One message removed from a suspended account.
I've not seen any c# around so I supposed no one would answer it just like when I posted it in #development
I'm greatly confused on why you all sound so triggered
Because we want to help people, but you dont want to be helped
If you wanted to help why not simply mention you may help and ask for my question? why make such a big deal out of this?
okay, so, what options do I have to pass if I want to have it running behind a reverse proxy?
for the webhook
Hi @restive otter
Gist on a vote webhook & auto-posting stats
<link deleted> dm me 
Looks like that's for an unofficial lib? This channel is for official libs and direct usage, see the channel topic
0|index | Oops! Error: 401 Unauthorized```My bot is on 21 guilds, but says 20 and gives this in logs.
Code coming
const DBL = require("dblapi.js");
const dbl = new DBL(config.apiToken, { webhookAuth: 'aBotMaster', webhookServer: server }, client);
// This is in client.on('ready', () => {
// event
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
@short girder are you on the latest version of dblapi.js?
and is config.apiToken set correctly
My api not updating
const DBL = require("dblapi.js");
const dbl = new DBL('token', bot);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
bot.on('ready', () => {
setInterval(() => {
dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
}, 1800000);
});```
@woven igloo the token in the new DBL() is the token from https://discordbots.org/api/docs#mybots right
i know...the token is in the docs
im dont sent it here... @weary ember
did 1800000 ms past?
WDYM @weary ember
you are posting every 1800000ms which means it will only post after that long
try to do js bot.on('ready', () => { dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total); setInterval(() => { dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total); }, 1800000);
nope
const DBL = require("dblapi.js");
let dbl = new DBL('ur token', bot);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
}) ```
can share my own Application Programming Interface here (via link)
note: written from translation
actually no, you cant. read #rules-and-info
thanks.
@restive otter thersE soemwhere an email to suggest it to be an offical lib
yeah i highly doubt its for dbl
Can I connect to the dbl using the same token on two instances?
Trying to test smth
yeah
good,
Can somebody help me with messaging the user on vote? (discord.js)
Tried the example
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
but it come as `TypeError: Cannot read property 'on' of undefined`
You have to actually set up the dbl webhook
const dbl = new DBL(config.bot.dblToken, bot, { webhookPort: 5000, webhookAuth: 'pass' });``` is this good?
The client goes at the end
ah
So your bot should be the last thing
Now for got sake, why does it error with smth that isn't even on bot.js ...
D:\path\test.js:22
let msg = await message.channel.send(`⏱ | The command is in cooldown.`);
^^^^^
SyntaxError: await is only valid in async function```
Because await is only valid in an async function
it worked PERFECT a moment ago ..
Just make whatever function that is in (something in test.js) async
} else if (cooldowns.has(message.author.id)) {
let msg = await message.channel.send(`⏱ | The command is in cooldown.`);
message.delete();
msg.delete(10 * 1000);
return;
}```
As I said, it worked perfect
and it does for the other commands
That doesnt tell me if the function is async
?
I mean, it worked before, and after trying to setup the webhook part it broke
Because it never got to loading the commands
It errored before it required the file with the error

oke then
Um @spiral steeple if you don't mind me, how do I proper setup a voting system?
I got http://0.0.0.0:5000/dblwebhook as webhook, sent a test but nothing happened.
oohsothatshowyoudoit
@wicked storm
- you need to paste that in to your bot's edit page as the webhook url
- change 0.0.0.0 to the public ip or domain of the server
- set the webhook authorization to the one set in your code
- save webhook
- test webhook
k so if I was to set it as my PI's external IP would it work like that?
if i'm on pc for testing, I should use my IP?
is here a different way than using webhooks?
All I need, is to send a message to the user on vote.
no, you need to use webhooks
but it isn't hard
and if you are using it on your computer, you will probably need to change your firewall/settings to make sure its exposed
ok, I will give it a try.
Has the python library been updated yet?
Woooo ima go have a look!
Hmm, I'm having trouble since today with the Webhook 🤔
My website doesn't seem to read the http authorization sent by discordbots.org when someone votes
I try to read it with $header = $_SERVER['HTTP_AUTHORIZATION']; but it's always blank
How do I make a discord bot?
read #502193464054644737 and this isn't generally the channel to ask it in
Ok, @narrow zenith Sorry.
https://dblpy.readthedocs.io/en/latest @shut sun
thanks

Guys, how can I get the total votes count of my bot? Tried
dbl.getVotes().then(v => {
console.log(v.length)
});```
But it's pretty behind comparative to the website value.
Isn't there a getPoints
Total all time votes
If that's what you're looking for
dbl.getBot(botid)*
Returns an object with a points property
Ty @polar mirage
.
lol
it isn't meant for discord webhook. its meant to send post request to ur server
Lmao
Well I have a problem too with the webhook. I clicked the test button and it gave me that, but a lot of ppl upvoted but it actually doesn’t sends it in the chat from the webhook ...
Well yes ... and that doesnt works but would it be possible with the api then ? ... somehow want to let a webhook send the votes in a chat ...
you need a webserver that listens to the webhook requests and converts it to a discord webhook or send it via your bot
Mmm ok ! Ty
How I can ask api to give me an User HypeSquad house ? It’s possible to get it ?
(Ping for answer please)
- this is a question for #development
- No, it is not possible to get information about user profiles as a bot account
However, I think it is now possible with oauth
Thanks
Hey all, using the .NET API, I have the following lines in my code for when my client is Ready. I am trying to update my guild count that displays on the DBL website. The issue I am encountering is the code can't get past IDblSelfBot me = await dblAPI.GetMeAsync();
Is this an operation that normally takes a very long time? If not, what might be going wrong?
Code:
var botID = ulong.TryParse(Config.bot.botUserID, out ulong ID);
var mutualGuilds = _client.GetUser(ID).MutualGuilds;
AuthDiscordBotListApi dblAPI = new AuthDiscordBotListApi(ID, Config.bot.token);
var dblBot = dblAPI.GetBotAsync(ID); //Gets bot through DBL API.
IDblSelfBot me = await dblAPI.GetMeAsync();
await me.UpdateStatsAsync(mutualGuilds.Count());
Any help is appreciated, thanks.
As a webhook could I use a webpage I have (my bot's webpage)
Never mind to the above I just noticed there's an api endpoint I can send the data to instead c:
const dblw = new DBL(process.env.dtoken, {
webhookPort: 5000,
webhookAuth: process.env.wtoken
});
Webhook running at https://0.0.0.0:5000/dblwebhook
I feel like 0.0.0.0 is unhealthy... any thoughts on what the problem could be?
@short mesa that simply means it is listening over ip rather than only at your home network
Ok, but I'm hosting it, how would that work?
Or will I just have to host the webhook locally
And so now I'm doing a local host and not getting any results from the testing, let me guess, port forwarding.
Well yes port 5000 needs to be open
http://prntscr.com/nhmb1u hello all why do i get this error when adding the api to the same bot ??
Wrong token
well @proud sphinx i have even regen the token also for it but since i have change the whole bot now i get this error 😦
I hope you don't have any new lines, spaces etc
basically @sullen nymph the whole bot have been change all commands are working its only the api key that i get the error from 😦
Do you mind regenerating once again and showing me how your token looks in your code
what i did was adding the token on the config.json file and in the main file grabing it like i would with the token stating DBL
"DBL": "TOKEN HERE"
``` @sullen nymph thats in the config file and in the main file i have this
const DiscordBotListAPI = require('dbl-api');
const DBL = require("dblapi.js");
const dbl = new DBL('config.DBL',client);
not sure xD the token was first in there but decided to move it to the config file 😦
so any other way that i can put that ?? please @sullen nymph
I don't know js, but I would say you need to require your config.json file and then get DBL key from that
Google will be your friend on this one
ok will have alook on the docs for it ty for the help @sullen nymph
can someone direct me to customize my bot page? like edit the background and the buttons outside the html field of the bot description
You need to have your bot certified before you can do that.
oh ok
false
@severe crypt @young cliff you don't need to be certified
just use css
<style>
put css here
</style>
Is there any documentation on this?
css is a commonly used language, google it
But where does it go
Just use the chrome devtools
Ok
you can use any html including <style> in the long description
but not js, thats cert only
I know that, I was talking about outside the long description like the full background behind the long description field.
Thank you
yes you put the code in the long description section
@plain timber so I could use css on my bot's page.
Thanks
(C#/.NET)
I'm trying to get the api response that gives a 1 or 0 based on if the user has upvoted my bot within the last day. I'm using https://discordbots.org/api/bots/{Config.bot.dblapikey}/check?userId={Context.User.Id} but I'm getting a 401 Unauthorized response. Do I have the correct URI?
bots/{Config.bot.dblapikey}/check is wrong
it's /bots/BOTID/check, or just /bots/check
Thanks
So when I hardcode the values (bot ID and my ID) I get the normal {voted:1} response, but when I try to use
HttpClient client = new HttpClient();
...
var dblResponse = await client.GetStringAsync($"https://discordbots.org/api/bots/538910393918160916/check?userId=146092837723832320");
I get a 401
Like if I copy and paste that link into my browser, it works, but in the code, I get a 401
Hey so for dblapi, is it required to use the webhookPort: for the webhook? And if yes, any other way to do it?
@ me with answer
@jagged escarp 401 means you didn't put the API key in the authorization header properly
@short girder if you want to use the webhooks, then yeah you do need webhookport unless you use webhookserver
Which I would still need a port either way.
My VPS Doesn't like too many ports open. Since I'm trying to have my website separate from my bot.
@plain timber I get a 401 with both my api key and the bot ID on its own, according to Natan it's just the bot's ID that goes into the URI I believe
oooh got you
Is there any basic tutorial for the voting api?
The references on the docs aren't helping much....
What language? And what are you trying to do?
The docs are more useful if you've used apis before
Ohhh
Now I am thinking whether should I completely drop support of async dpy or push an update tomorrow
I have a problem with dblapi.js!
dbl.webhook.on('ready', hook => {
^
TypeError: Cannot read property 'on' of undefined
at...
you haven't properly configured your webhook
Yes thanks you
@sullen nymph just drop support
Poor async fellas
A2OA sure I do
Yeah, that goes to off topic
It's not rewrite, it's latest now. Also, I doubt that's possible but good luck
@plain timber
What language? And what are you trying to do?
Python. Vote based Rewards basically
New... async is dead
awh
oh wait, you were talking to other person XD
Nah I was talking to you
oh 😮
I mainly use async cause I could never get rewrite to properly work
Async is discontinued afaik
Cause, if you do pip install discord, it'll install rewrite
ye, you could do that but you'll be missing out a whole lot of stuff i guess
True.
Are webhooks only for 1K+ votes or can they be used for single votes too?
you use them above 1k
like, take this use case into consideration:
- User used vote command which displayed the vote link.
- User didn't vote immediately but did so after like an hour.
Now, I don't think it's a good idea to keep polling the votes/check endpoint till a vote from that user is detected.
Or is it the only way?
GitHub
Flask script mainly to handle POST requests from discordbots.org - shivaco/DBL-python-webhook
thankyou
Pin the repo or the post server count example >.<

How do i set up a webhook for receiving upvotes
What language @ebon dragon
I mean, how do i set up a webhook, not how to use it
Well the code "sets up" the webhook
It will log a URL to the console
Use that as the webhook URL in your bot page
If it says 0.0.0.0 change that to the public IP or domain of the server
And set webhook authorization to the webhookAuth in your code (it's like a password)
Okay, thanks, you helped me a lot
Yw
Thanks
do you need port forwarding too for a webhook
On discord.js, what would be the best way for a check for a command that require the user to vote in order to use it?
Rn I use dbl.hasVoted(message.author.id).then(async (vote) => {} but it take a few minutes in order the user to be able to use itt.
the only other way would be to use webhooks and store votes in a db
I wouldnt use that anyway, that will get you ratelimited real quick, you should do what advaith said
Another option that I've experimented with is giving the user a role that allows them to use certain commands.
Ught, why does everything vote based has to use webhooks p.p
What's the issue? It's not that difficult to setup a solution that allows you to receive web hooks
Well, does anybody have an example on how do to it on glitch.com?
I use this https://paste.helpch.at/dicohojija.js and keep getting this error https://paste.helpch.at/zubuhutime.http
Even tried https://glitch.com/edit/#!/plum-town and get Error: listen EADDRINUSE: address already in use :::3000
dontuseglitch
For moment is ok.
@wicked storm you already have a webserver running, you will need to connect to that using webhookServer
The existing one is probably created by express
Hmm that code should be right 
Looks like you also have a express code somewhere else
So it's running twice
s!serverinfo
@plain timber I think the express code is to make the bot stay online.
Also, when you guys say "save the votes to a database" you literally mean to save the vote to a mysel db or so? Like ID: 123456789012344
I also want to make some commands for voters only, but how could i do that without using a db? Because my bot sometimes is offline.
File creation
@wicked storm well you'll need to export the listener there and use that one in dblapi.js, you can only run one express server
Can you send an example, please?
@ebon dragon the only way without using a DB is by using .hasVoted which may update late and/or get ratelimited
The /check is the same thing as .hasVoted but directly using the http api
when your bot receives a vote does the webhook fire immediately or is there a delay like the other voting endpoints?
It's usually instant, when I test vote it's in the console before I can alt tab
ok
so my code isn't working then.
which is a problem, because i just voted with my alt account to test, and now i can't vote again
It has a test vote
Right in the options
When you're setting the webhook settings
i know
but that doesn't allow me to test if voting unlocks the votelocked commands
basically, it was annoying me that it took like 2 minutes to unlock the command
so now, it uses webhook instead of /check
Well vote.user for a test will get your id
You could add your alt as an owner
So you can test with it too
eh it's fine


