#topgg-api
1 messages · Page 60 of 1
e.e
does the test button like send you data? doesnt work....
@app.route('/dbl', methods=['POST'])
def dbl():
user = request.form['user']
print(user)```
is this bad?
im trying to receive data with python flask
the data is sent as json, not form data
Flask script mainly to handle POST requests from discordbots.org - shivaco/DBL-python-webhook
ok who in here can help me with the python library
ok so your bot is on discordbots.org right
Correct
Yep
well mine just had ??? and ive spent a hell of a long time trying to get it to say the right status
and i cant
Ah, it's not related to any of DBL libraries. It's either your bot is still awaiting approval wasn't invited when approved or kicked
oh it has to be in this server?
For status yeah
oml ok, for some reason i took it out of this server
now i just need to get it back into here...
I can invite it back if you give me its ID
Yep
Nah
Know what ima just try Shiv's api reee
Hello, for the moment i don't have 100 votes. BUt is it better to star developing the vote command with the webhooks or not?
@little mason webhooks let u run code when the user votes
also /check can take a while to update
@plain timber Okey thanks I will use web hooks
Hello, for creating a wekhook I ned to provide an URL, where can I find this URL ? Do I need to create a webhook in my server ?
uh
on python you'll need to set up a webserver
and accept the post request from dbl
@plain timber Okey, but where I will look a tit
what
@plain timber I will setup my web server. But where do I create a webhook ? I need to create it first, on my server discord ?
Ho, I see. I just need to create web server. And allow DBL to do request. But do I ned to setup a php page or something ?
Okey, I just need to install apache2 and it's done?
no you dont need apache
you need to code something to accept the post request
you can do it in python
I see, but from wich ip or hostname do I need to accept the request
huh
dbl will send a post request to the url you provide
you can run code when you get the post request
Do I need to store the data from DBL send to my IP ?
Okey so I just need to accept post request
DBL ---> My Server ---> My bot
https://github.com/shivaco/DBL-python-async-webserver this might come in handy 👀
An aiohttp webserver made for usage in discord.py bot cogs to keep track of upvoters. - shivaco/DBL-python-async-webserver
@sullen nymph I'm keeping get this error: "error while attempting to bind on address ('0.0.0.0', 5000): address already in use")
@little mason use another port
@runic grove I already tryed with 25565, same error
I done a nmap scan. The port 5000 is not used by another service
It's working now, idk why
@runic grove If I want to use webhook for vote, what do I need to provide here ? http://prntscr.com/o7d0xd
But if I want to get who voted for my bot with web hook because upvote has a limit of 1000
Do I need to create a webhook in my discord channel and provide it?
discord webhooks and dbl webhooks are different. shivacos code allows you to run a dbl webhook and optionally hook it up to a discord webhook as well
I want to use the DBL webhook. When the connection is up, in myc ogs discordbotsorgapi what I need to do to get back the player who voted ?
Can anyone help me to setup webhook for the vote ? Please i'm here for like 2 hours omggg
I'm using python and @sullen nymph script
riks, have ur tried looking at the docs?
because
usually they're pretty helpful
Same
Tht literally explains everything
nothing against shiv, but why not just use the original?
@bot.event
async def on_dbl_vote(data):
print(data)
# Will output the following:
# {
# 'type': "upvote",
# 'user': "247741991310327810",
# 'bot': "264811613708746752",
# 'isWeekend': False
# }
it's just http now
pretty simple
no, no that's bit hard for python
I think I got it, but I'm looking a way to test it
postman
ok or do that
Put it print nothing
try postman then, see if its a problem with ur code
thanks lol
In shivaco code, it doesn't appear somewhere you can get back the info, like who voted etc..
user is the snowflake id of the user that voted
I'm using this https://github.com/shivaco/DBL-python-async-webserver
An aiohttp webserver made for usage in discord.py bot cogs to keep track of upvoters. - shivaco/DBL-python-async-webserver
well have you configured the site to have an open port
yes the connection is good
and have u set the the ip / url on dbl?
yeah but is it port forwarded
that port needs to be open for the whole internet
right now its just open on your machine (or local network)
by default all port are open
As in port forwarded?
How ?
^^ open like a /test, and go to it via your IP address not your local host
postman like i said
The reuqest URL test was not found in this server
wait
Not
It works
So it is working!
@lime gust
Through your local IP?
Yes
Or from the port forwarded up?
Ok
it say ""it work"
In the code I saw
that if I connect with /test it will say to me it work
so that's working
Why this is not working with vote?
What lib are u using? Or are you doing routing yourself
shivaco
An aiohttp webserver made for usage in discord.py bot cogs to keep track of upvoters. - shivaco/DBL-python-async-webserver
Py?
Oh ok
Nothing happend
But the server count still update
but it doesn't print something when someone wvote
sorry i’m really not quite sure what is wrong. might be worth asking a mod
How can I get notifications if some one upvote my bot (JS)
Webhooks
@little mason How are you using it
@sullen nymph I found the solution after 4 hours. You make a misstake, you forgot a TAB. I send you where in a sec
We're getting off-topic, let's move to DMs
This isn't related to the API, but rather the website. Could you please keep the bots previously submitted and add an option to resubmit?
@tropic hill throw it in another channel then 😃 will prolly get seen more if you either email them with a suggestion or post it in a channel not surrounding the APO
theres the issues repo which only gets looked at to add labels
Nothing really gets fixed there imo
The website says I dont have any bots when I do, what do I do?
you must wait for the bot to be accepted for it to show up publicly
@teal plaza great spelling http://prntscr.com/o7mzwu
@runic grove yeah lol
Hello, anyone here who made a python bot and use a vote system ?
what is your question
Are you trying to check if a user voted for your bot, or run a script upon someone voting?
Yes @buoyant sandal
But it doesnt work fine
I need someone who already do a vote system un python who can explain to me
what does not work fine @little mason?
I can help you if you specify what you want to do.
@buoyant sandal I’m actually prety tired. I will look at it tomorow
I @ you tomorrow is it ok ?
sure
Thanks !
@hoary blade never ping me again plz
@teal plaza sorry 🙃
@little mason something I do is make a aiohttp call (ima do this in a dm so the jerk named cry would shut up) to DBL and check if the userId is in the voting json
(Json, txt, whatever)
@worn quail Shivaco made a script in python who made those connections. I think that’s working good, be I need to review my code to see what’s wrong
Mk
I just haven't figured out how to get a webhook working
Since my pi died
I'm needing to order another
Hi okey
So in the meantime that's my only way of checking if a user has voted
I will see I’m home in 20 mins
Oke
https://discordapp.com/channels/264445053596991498/412006692125933568/592417581680427019 linking this cause it'd be nice to get an opinion from a web admin
Pong the tonk
@sullen nymph ? Could you help me please. When someone vote it says new upvote! But id oesn't go into my code in the cogs discordbotsorgapi.
Elaborate please?
One sec I show you my code
Here I init the client http://prntscr.com/o7y06o
It post the server count, but it doesn't print the data http://prntscr.com/o7y0bm
in the event on_dbl_vote
In my console I got this http://prntscr.com/o7y0ls
@sullen nymph
Are you using dblpy autopost or the webhook I sent before
tbh you could just make checks for the api and save the file as a json, pull from it when changes happen.
like if
current (web) != saved (file)
Ehh, use dblpy autopost
The message new upvote come from here http://prntscr.com/o7y1nj
@sullen nymph What's the difference with autopost ? Can I still get the user vote back ?
webhook - no events used
autopost - emits on_user_vote when someone votes for your bot
@sullen nymph But with autopost is there a restriction when you hit 1000 vote ?
@worn quail What are you using ?
@worn quail And is it working fine ?
async def user_voted(author_id=message.author.id):
voteurl="https://discordbots.org/api/bots/543966796944769044/votes"
async with aiohttp.ClientSession(headers=dblheaders).get(voteurl) as r:
json=await r.text()
if author_id in str(json):
return True
else:
return False```
Mhm
Has a delay, due to dbl, but it works
But when you reach 1000 votes what happend?
@worn quail Are you french?
okeyy
Ima brb for a bit srry
I think your method is good
But I will be fuc**d when you reach more than 1000 votes
For the moment I will use your method who is pretty good
But it send a request every time ?
@little mason https://discordapp.com/channels/264445053596991498/412006692125933568/594173492086308908
There's no vote limit on autpost
Ye
Wait, why am I mentioning autopost
@sullen nymph How I use it ? I remove your wholecode
lul
yes
thats not good
@sullen nymph Just help me to ue your method who you code in git
The connection is perfect
But why when i call dv_lon_vote
It's doesnt work?
Specify webhook_port in dblpy Client and it should work, though I also suggest using webhook_auth
But just those ? Not the path?
webhook_path is by default /dblwebhook, you can use that or edit it
@sullen nymph I will try rn
@sullen nymph Not working, I specified the port and the auth. But still nothing happend. The data is not printed
Are you opening the specified port as well as forwarding it?
Use on_dbl_test if you press "Test" on the pot's page, on_dbl_vote for votes
When I press the test utto I saw Nes upvote in the console
YTou script work
But not the event on_dbl_test
How are you using on_dbl_test
And are you sure your Authorization field is the same as webhook_auth
yes same
Huh
Your connection script is working, but I don’t know the connection to the cogs Discord bot api is not working
The cogs reload the guild count
But the cogs doesn’t work with event with connection
@sullen nymph If you find the solution you are a god. I’m looking for a solution since yesterday
Try restarting your bot fully and test your webhook again
Okey I’m going do this in a mins
@sullen nymph When I try to start my bot with the webhook_auth and webhook_port it say to me that he can't bind the adress or something but when I start my bot without webhook_auth and port it work perfectly but the test features still not work
So I tryed to start the bot without the webhook and after reload the cogs with the webhook but still not working
If you don't specify port, the webhook won't run
Slap me the full traceback ty
@sullen nymph here we are http://prntscr.com/o7yohq
Do you have anything else running on port 5000

Why
But when I reload the cogs it's working
I think becausethe cogs sever who start the web hasn't stared yet
I don't know, hel me lol xd
shrug then, I'm out of ideas
@sullen nymph And the URL that I need to provide on the dbl is http://myvpsip:theport/dblwebhook ?
http://ip:port/webhook_path
there is a /
ffs
Yep
But I don't know, It receive the data from you script, but I doesn't give me the data with event
It print new upvote
when I do a test
But it doesn't send me the data
with the event on_dbl_test
Can you just send me in the DMs the file you are currently using
Using the server.py won't work with events, as I stated before, as it doesn't use discord.py's event system
I removed the second .votes part
but owo
Ima make it check in a specific interval (60s by default)
But it doesn't delte the entry so if the user say the command twice
It will still say he has voted
?
nothing xd
@sullen nymph DUDE UDE
ITS WORKING
working
without ur server.py
just the webhook
perhaps
Yes
Nice
const http = require('http');
const express = require('express');
const app = express();
var server = require('http').createServer(app);
const listener = server.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBLTOKEN, { webhookServer: listener, webhookAuth: "PASSWORD"}, bot);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log("Tested")
let a = bot.channels.get("594168469310668830");
a.send(`User with ID ${vote.user} just voted!`)
});
bot.on('ready', () => {
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
});
NO error, no message(already set in dbl edit)
when i try test it
no message
but dbl.postStats working
Maybe bad port
We can know if anyone vote without weebhook?
No
what do you guys think, should the benefits of voting for the bot expire after some amount of time if the user doesnt vote again?
yes. encourage them to vote as often as possible
@buoyant sandal Yes, i want to know how i can know if anyone have voted without using weebhook
@runic grove i was thinking of like a week or month for the perks
What library are you using? @restive otter
discord.js
So DBL will send a POST data in the form of json to the webhook you provide
"the webhook" is my problem
If you have a website, you can have a page receive the data or just open a port to receive data on your computer
Do you have access to html editing?
Yes
Try making a page with the extension .php and have it receive data with method POST.
Let's configure the webhook on DBL. Make a file with the extension .php and go to https://discordbots.org and edit your bot. Scroll down and find the API section and provide the url to the php file. And then we can set up the php file
a php file won't just magically execute by existing
yes
if there's no php engine set up there's no way it'll run
I know, I'm trying to get the webhook set up on dbl and then program the file
We can use php input and use json_decode, I think🤔
{'type': "upvote", 'user': "247741991310327810", 'bot': "264811613708746752", 'isWeekend': False } DBL should send something like this
"type": "test" for test :p
Yeah
How to I get my discordbots.org token?
in discord.js, how do I check if a user voted for my bot?
You use a webhook
Its global
uh
There is no other way without a webhook
oh I thought webhooks were for a single server
On dbl vote, data is sent to a webhook to analyze and reward or whatever you want to do. This feature cannot be done with the dbl bot token because the client is the one requesting data. The point of on dbl vote is that the website sends a notification to the bot that someone voted with the userid and all the information.
By webhooks, you cannot use discord channel webhooks.
You need to have your own
This process is actually pretty hard
Try updating your server count on dbl using the dbl token. If you can get that done, you can probably work out the on dbl vote feature.
How to see how many votes my bot has got
your av disturbs me
what lib
Others
Golang
I am not gonna be able to help
Y
https://github.com/TurtleGamingFTW/dblgo-archive This might help
Can anyone tell me
You need to know how to use the lang to supply help
I dont know the lang.
So I can't help.
End of story
What is the use of bots API key
Ensures the people accessing the api aren't random
and allows dbl to identify bots that spam the api
its like a password to use the api
It's in the Authorization part in the header. You can have your program check the password to make sure its from DBL, and not from someone who replicated the data to reward themselves, etc.
Please do not use this channel for questions regarding your bots disappearance. @novel aspen
[Edit]: Issue resolved.
@elder tulip sexy lady ahh
@noble smelt plz don’t use this channel for stuff like this or randomly ping people with stuff like that
I made a discordbotlist.js file and pasted the code and my DBL token to show the server count but it still saying N/A
What code did you paste
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(token here', client);
exports.run = async (message, token, client, args) => {
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
new DBL(token, [client])
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
}```
thats it
new DBL(token, [client]) why is this there? 
client.shards.Id
If you are not sharding, why specify shards
Assuming this doens't work with JDA?
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
Shard is basically a separate connection of your bot for certain amount of guilds your bot is in
@sullen nymph
does anybody else experience problems with updating bot's info via api?
@restive otter it's a placeholder
its meant to be substituted with you retrieving your bots server count
ie like
jda.getGuildCache().size()
Can I not use the webhook config on dblapi ? Because I only want to post stats (Nodejs) 
Aprrently yes
I couldn't make it say servers size in DBL >.< anyone can help????
Read examples
@narrow geyser i did, didn't work that's why: >.<
Code and error
@restive otter what lib
discord.js
And are you trying to GET from the api or PUT your server to the api
Well then I'm of no help :p
uh k xd
It is possible to see who voted without using a webhook, not sure why you are being told that a webhook is needed.
You cant get it as they vote tho
you can see
yeah
you can check who has voted
but webhooks let you run code as soon as they vote
Yeah, but the user was being told that you can only use a webhook in order to see who voted, which is incorrect.
where?
webhooks are recommended because they work for all bots and dont have much delay, but the api works
Lol.
You probably meant to join the support server for whatever bot you're experiencing that issue with
this is the discord bot list server
That's sad.
what
https://discordbots.org/api/docs#jslib - JavaScript
https://github.com/DiscordBotList/DBL-Java-Library - Java
https://discordbots.org/api/docs#pylib - Python
https://discordbots.org/api/docs#dotnetlib - C#
https://github.com/TurtleGamingFTW/go-dbl - Go
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
@ionic field
im currently using the dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); }); method but voting can take anytime from instant to up to around 30 minutes. is tehre something that im doing wrong or is the api slow? (im quite new to dbl so idk how the api is like)
@ionic field that should be instant but you cant really do anything about it
maybe its just slow some times
ive seen bots where its always instant so i cant help but wonder if ive done something wrong with the api
maybe ur just unlucky 
sometimes its instant, sometimes it lags
but that code looks fine and you cant really make it faster
hmm
the way that i have it is on vote it stores it into a db with the timevoted and on each command it checks the db and then checks if the time is greater than a 12 hour period
should i be attempting someway else or is this method effective?
that's the best way to do it
hmm
One day have passed and still couldn't make the server count even with examples.. If someone can help me in DMs it'll be appreciated, my lib is discord.js
@restive otter code?
yes @plain timber i tried making a file for it it didnt work then i pasted it in events/ready.js and still N/A
@plain timber no there's no error, a min and i'll send the code
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('my dbl token here', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});```
@restive otter do you know how setInterval even works
Uh no i copy pasted this from the examples
and that was your first and biggest mistake
@runic grove @plain timber I did it, thanks for the help.
your bot doesn't have permission
@restive otter give the bot a role that has admin privileges
it just depends on the perms
does https://dblpy.readthedocs.io/en/latest/api.html#dbl.Client.get_bot_upvotes get the ones from the latest upvotes or just from all time?
iirc latest
oo ok thanks
You can compare points from the dict returned by get_bot_info
ok ty
z = await dbl.get_bot_upvotes() and x = await dbl.get_bot_info() return different numbers
_upvotes returns 3 while _info['points'] returns 6
Yep, then get_bot_upvotes returns votes for the past 12 hours
points is overall and there's monthlyPoints just in case :^)
yeah it works again
yayyyyyyyyyy wonderful
Error :
npm i dblapi.js
@runic grove
now this.
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'quick.db'
npm i quick.db
hello guys, I have a problem with the api in my bot, it does not show how many servers my bot is on, neither in the profile of my bot or in the widget.
Excuse my English, I speak Spanish.
stop crossposting
^
It's ok, they posted it in the correct channel
@candid mountain Read this https://discordbots.org/api/docs
It contains easy ways to upload your server count
you mean this: https://i.imgur.com/BqsTCVk.png
I already put it on my bot and I put the discordbots token
how long did you wait?
approximately 1 hour

any errors?
why do I get unauthorized if I fetch the /bots endpoint?
ah nvm
didnt know you need the token for every endpoint
It's incase we need to block troubling bots
btw I do not understand where the problem is, I can not get the Bot to show the server counter.
https://i.imgur.com/b1Zf2e5.png
https://i.imgur.com/f4eGqCl.png
does it return any errors?
@candid mountain make http request
That's something you can do
Though, I'm working on a very simple way of sending it. I'll put it here once its done
thanks dude waiting for this
k
Lemme just make sure it works for both rewrite and async
I may have it by tomorrow, on pip
yeah requests and aiohttp seems to be faster
https://discordapp.com/channels/264445053596991498/312614469819826177/390605562771013632
guys https://i.imgur.com/HQGIAlc.png
The Tokens that are in My Bots and in Reference are different, is it normal?
Which of the two do I need to use for the script with aiohttp?
@candid mountain the dbl api token is separate from your bot token
https://discordbots.org/api/docs#mybots
This is where you get your own api token
the one in reference is an example and invalid
I've got a question about the webhook and I'm using the dblpy library. I've setup the config on discordbots.org and I've followed the example to setup the listeners for on_dbl_vote and on_dbl_test but nothing happens?
I can see the traffic being allowed through my firewall on my router and I can open a telnet connection on the port my bot uses for the webhook...
Sadly I get no output or exception and I'm not sure what else to try, does anyone have any suggestions?
@sullen yoke you set the webhook settings in your bot edit page
yes, I've done the config on discordsbots.org and I'm use the test funciton to test this
and I can see the traffic on the firewall logs
Are you forwarding to the port you specified in dblpy Client?
yes, if the traffic come in on port 5000 then it gets forwarded to the local ip of my bot

you saved before testing right?

Hi, i want make a Indonesian Bot, But are the staff in DBL know that language?
This is why google translate exist
So are I'm can make a Indonesian Bot than apply in here?
Yes
Thank you for the information
Is there any way to get the API widget to show all owners or does it only just show the one?
@outer kettle it takes up to two weeks
@outer kettle It takes some time, just relaxxxxx 😃
Also please don't use this channel for non-API related stuff
On that note, I would like a ping if anyone knows about my question. Thanks in advance
if it doesnt work then prob not
@wet sequoia each shard will post their shard stats unless you lock it to only send stats of specific shards by id
thx
Does the vote webhook actually send data? I'm logging everything sent and it doesn't seem to send anything?
yop it does
How tho? I'm logging POST, GET and REQUEST data in PHP, and still nothing
its post, dbl posts to your endpoint
I don't know shit about php so, just make sure you parse it right, its application/json
Hmmm okay, ta
You can set up a PHP page to receive POST data in the form of json
Lol, I know. I'm not a script kiddie. Think it's my rewrites
can you show us your code for the PHP file?
$data = [
'POST' => $_POST,
'REQUEST' => $_REQUEST,
'GET' => $_GET
];
file_put_contents('/../api.log', json_encode($data) . "\n", FILE_APPEND);
try voting for the bot and check what happens
the test feature may not work
it was empty
did you click save on the edit bot page?
Yeah, I'm getting the posts, just the data is empty
$ cat api.log
[]
[]
[]
[]
[]
[]
[]
{"POST":[],"REQUEST":[],"GET":[]}
'type': "upvote",
'user': "247741991310327810",
'bot': "264811613708746752",
'isWeekend': False
}```
it should send something like this
take out the request and get
it only sends a POST data
They're not causing an issue, but yeah I'll remove. I'm gonna test it with curl and see if it's a me issue
So I posted with curl and the data came through
curl --data "param1=value1¶m2=value2" mywebsite.com/api/vote.php
Logs:
{"POST":{"param1":"value1","param2":"value2"},"REQUEST":{"param1":"value1","param2":"value2"},"GET":[]}
Any help? Both the test voting and actual voting does not post any data
probably not an api problem
I dont know what else it could be
||php||
Iirc it's in the body not url parameters like your curl request
dbl has the data in the body, not the params
Ooooohhh
I think I get you
YESS LADS
file_put_contents('../api.log', json_encode(file_get_contents('php://input')) . "\n", FILE_APPEND);
file_get_contents('php://input') was the trick

I learned basic php in school but this will never make sense to me
So you're that one downloader a month 
What do you mean lol
not much people code Discord bots with php
Ahh yeah
Well I use PHP on a daily basis for work, so I know it more than any other language
Afik only 1 lib for php discord
And like no one uses php for discord
Actually there's 2-3
yop just googled
Didn't think it was really meant to run websocket long term
Yasmin is what I use
back in my day we had one
I'm happy I didnt get that job for php
Any Langauge: string.split
php: explode 💥
We're getting kinda off-topic 👀
Lol, anyway, thanks guys
x!help
@hearty lintel Okay thanks
bots cannot text here. Please use bot commands in #commands, #265156322012561408, or your own server. We want to keep this channel purely for api.
Read examples
someone can explain how vote system work?
Votes reset monthly
the more votes you have, the higher you are on the bot leaderboard
@faint walrus https://discordbots.org/api/docs
does the npm package for the api update server count on its own?
as in i don't have to manually run it or put it in a timer
dblapi.js?
yes
if you pass your client, it should
hello ı want my api upload discordapp.com but this document say one probleam and "Invalid server format" I need help. Please help me.
one, simple fix. Just dont put your server in there yet.
Two why here.
Someone can help me with my discordbots.org Bot API please
?
I am using Discord.js
And I wanna make an UpVote Counter
@runic grove ?
bruh
How would I use the webhook part of the API? I don't understand it.
The webhook is for dbl to send vote info to your bot
I know, but how would I use it?
docs, Google, all those exist
I read the documentation. I don't understand it.
Create a webserver using your router. You will likely have to request a static IP from the provider, unless it doesnt change.
Forward the webserver to DBL in the webhook area of the bot edit page
And then idk what else mmllu
Hello, I'm hosting the BOT on Heroku, this code doesn't work.. Can someone help me please?
const http = require('http');
var port = process.env.PORT || 3000;
var static = require('node-static');
var file = new static.Server();
var options = {
host: 'discordbots.org',
Authorization: "secret"
};
var server = http.createServer(options, function(request, response) {
request.addListener('end', function() {
file.serve(request, response);
}).resume();
}).listen(port);
const DBL = require('dblapi.js');
const dbl = new DBL("secret", { webhookServer: server });
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!`);
});```
I'm new to webhooks tho
@river musk Do you have a specific error ?
Normal
You need to create a web server using your rooter
after forward the webserver to DBL in the webhook area of the bot edit page
@river musk
mhm, i still need to use my router even I host it on Heroku? 
Try with your rooter
okay
oh, I don't have static ip tho - I need to ask my internet provider to change it
Okay
when I test the webhook, it doesn't do anything
what did you put on the website for the webhook url
uhh, what website? I'm sorry, but I'm pretty new to these things :D
nvm, i'm just an idiot and forgot something :D thx for help btw
youre welcome(?)
It always says 0.0.0.0, also do it on heroku/whatever you are hosting in, not your router
why is the backed having so much server failures? its a bit annoying
It’s likely due to the whole cloudflare issue but I’m not getting many failures? Check your end
If I get 503 Errors its the prob the server failing, not me
Its not all the time, but every time look in the logs
DBL restarting probably
I see this in the logs since a few days 
DBL restarting probably
long restart
ypeError: Cannot read property 'on' of undefined
4|atlanta | at module.exports.run (/home/d/dbots/AtlantaBot/events/ready.js:26:25)```
let DBL = require("dblapi.js");
let dbl = new DBL(client.config.apiKeys.dbl, { port: client.config.votes.port, webhookAuth: client.config.votes.password });
dbl.webhook.on("vote", async (vote) => {
let dUser = client.users.fetch(vote.user);```
What's the matter ?
@rigid lichen it’s webhookPort not port
Yes ofc
Yes but don't forget to save
okok
how can i use webhook and stats in the same time ?
I must create two variable ?
You can use the same dbl object
salam ealaykum warahmat allah wabarakatuh
#memes-and-media please
#memes-and-media @restive otter please
ve aleykum esselam
does anyone know how to check if a user voted a bot
What lib
discord js
ty 😃
There are two endpoints: one that returns the bot's votes but will fail if your bot has more than 1k votes, and the other checks if a user has voted for your bot or not
no
Use this lib for js. It has a .hasVoted(id) method
Nope. It's because more than 1k results would be too much data to return
ooo
But I recommend setting up webhooks to get realtime updates when a user votes
Can I use api on my phone ?
I can only install package
And create text file
Like json or js or md all I want
wha..
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!`); });
in "yourDBLTokenHere" do I need to paste my DBL token or do I need to put the token in parentheses?
I'm kind of new at this and I'm confused
paste the dbl token as a string
in "password", I put what?
anything you want
What is a DBL Token ?
The token is obtainable at https://discordbots.org/api/docs#mybots . It's like a password to prove that requests are coming from you not anyone else to handle website stuff.
I put my token correctly and the password of my webhook, but when someone votes on my bot nothing appears ... I did the following thing:
but in the end nothing appears in my terminal. (note: token and password I configured correctly ... I think)
did you actually set up the webserver
unless youre adding the webhookServer right in it doesnt fire a Webhook::vote iirc
what do I put in "server" in the "webhookServer: server" line?

Instagram pics in #memes-and-media pls
wait how do you know that's from ig
I dont
What do I put in "server"? I do not know how to use this API, so I'm confused of what to do
U can leave server blank iirc
so here it is already 100%? or is there anything left for me to do?
That looks right
Well you’ve gotten to listen with the server to port 5000 and also make sure the web server is open and then throw it in the edit board
Oh yes @restive otter ^
why are you using http.createServer and webhookServer
if you use webhookPort then you dont need any of that
you probably cant have both webhookPort and webhookServer
okay
@plain timber you can but webhookPort is pointless. adding the webhookServer actually enable the vote webhook cuz without it i believe atleast, that the vote event wont be fired without it youll just have to manage the post yourself
@hearty lintel webhookPort sets up the webhook, you dont need webhookServer
yes but then you need to set up the app.post()etc. yourself
you should use webhookServer if you want to connect it to another server, or webhookPort if you want dbl to set up the server
supplying webhookServer automatically creates the route
ooh
you dont need to use http at all
mk
could i get some help setting up webhooks?
@proper atlas always say what language + specifically what the issue is
Is it possible to use webhook voting if your bot is hosted on heroku?
yes
Hey, i got question, im voting for a bot but im not getting any points or rewards, one more thing, if i have 2 accounts voting is separate right?
@pale sable not all bots have rewards/points for voting
How long does it take for a vote to get deleted from the api ?

Doesn't seem to be after 12 hours
Minirem got points if you vote
Individual user votes
Yup
Thanks 
Could I get help with webhooks? I’m using js and I have no clue how webhooks work but I wanna detect when someone votes
Then someone should get on that, no?
Yell at Tonkku probably
Who uses discord.py
Me
do you use the dbl lib
Yep
How do you get the list of people who upvoted? I keep getting: <classname> has no attribute _ensure_bot_user()
no, One of a cogs is Moderation, which is a class.

Ah
i'll have to regen token later
@polar mirage How would one get votes working if bot is hosted on heroku, I have the code part fine it's just the URL and port that I'm having trouble with.
Get a pi and make http requests to your heroku project
Idk
@bold edge if you're on the heroku dashboard there's an "open app" button
That brings you the link you'll need
aka your project
idk the structure anymore, haven't used heroku for a long time
Language?
d.js
are you using dblapi.js
no
Ok well
You could either post your server count yourself
That
Or use dblapi.js
^
I just make raw api requests
dblapi.js doesn't rly support my way of sharding so I'll have to do that too 
installed, what's next?
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);```
^
And it should start posting
replace client with whatever client is called
You may have called it bot or something else
@polar mirage Yeah I can get the link but no matter what port I try it does not work.
Ahh so in the code I can remove the port part?, didn't know that
Yep
e is not defined means you've not declared what e is
^





