#topgg-api
1 messages ยท Page 36 of 1
what if someone (the user) isnt in the server
it will show @austere blade
then it would fail to give them the role
wym edit page?
go to webhook
yes
bottom of the page
im there
so glitch
what is the port
that you set
is it listening on port 3000?
paste this as your url https://ladmasteradva.glitch.me:3000/dblwebhook
kk
done
check console
how to test
on glitch
no friends are online
Webhook running with path /dblwebhook
Listening
on glitch
yes send that url
so i can see your code
also
take off your token
b4 you do it
kk
or put it in .env xd
unless you dont care and gona reset it
ok lol
index.js
kk
k your server is on 5000
its listing on port 5000
change the url port to 3000
on the edit page
Should I remove that message from my bot's cache?
done
hit test now
test on?
tested
oh you reset token
put your new one
just reset it after i leave
also
delete this link
what console
restart the bot
restart
hit test
hum
still
upvote
loops
maybe its your code
hm
it should not loop like that
its not listing
though
hit save
nothing
๐ฆ
:(
how did u do it
i used same code
:(
i did
one more time
???
lol
restart again
it should be port 3000
why is it 5000
i changed it too 3000
nothing
@restive otter Do you understand POST requests?
no
Read up on it. That is basically what a webhook is.
:(
but @light crag why is the real vote not showing?
the test button works
it send the message
but if say my friend does it
it does not show
Show code.
k
dbl_web.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl_web.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get("/", (request, response) => {
response.sendStatus(200);
});
server.listen(5000, () => {
console.log('Listening');
});
Interesting. If the test button works then the real vote should.
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl_web = new DBL('', { webhookAuth: 'upvote', webhookServer: server });
yea no idea why the real one not working
test works perfect
@restive otter
use that
the owner build it
try to copy and paste it
and see if it helps
Error: listen EADDRINUSE :::3000
seems like that port is already in use
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get("/", (request, response) => {
response.sendStatus(200);
});
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
server.listen(5000, () => {
console.log('Listening');
});
@elfin solstice glitch is stupid though
i never said its good
oh what
because thats where the requests get sent to
it redirects incoming requests on port 80 to port 3000 on your server
events.js:182
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
then also on the edit page of the bot site
yea
nothing
nothing
how u restart ur bot
oof
yee
Probably
@arctic arch can you help
depends
@arctic arch my question is before, what are the ratelimits done by
its by ip
do you look for the forwarded for header
its done in cloudflare rn
ah
are you reaching the ratelimit?
i feel i will if it doesnt listen to x-forwarded-for
what do you mean ๐ค
im writing a centralised api for all bot lists
so im passing the source ip i get as x-forwarded-for
but obviously my ip will be then making far more requests than the average user
so kinda like a proxy thing
yes
bot dev makes a single post request to post stats to all bot lists
i'll email cf to ask
events.js:182
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
i got this error while using vote api
using glitch
something is using the port 3000 already
you likely have the thing that keeps glitch running forever?
yea
what does that look like
Im using uptime robot
whoops
Webhook running with path /dblwebhook
Listening
it gets the webhook
but when i hit test nothing comes up
i changed port to 5000
still does not work
glitch only allows port 3000
try without :3000
k
glitch forwards that to the correct port
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL('', { webhookAuth: 'test', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get("/", (request, response) => {
response.sendStatus(200);
});
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
server.listen(3000, () => {
console.log('Listening');
});```
i used that
still does not work
test
no errors
just does not vote
nvm
it worked
thank yyou
if(dbl.isWeekend) {
message.channel.send(`hi`)
} else {
message.channel.send(`bye`)
}
I tried that and it says hi even now in weekdays
i do not think that dbl.isWeekend is a property
u can try
console.log(dbl.isWeekend)
i am sure it will say [Function]
Yea it's function
Didn't think in that way
Saw this from docs
dbl.isWeekend(weekend => {
if (weekend) {
console.log("Woo! Multiplier time!")
} else {
console.log(`hi`)
}
});
That didn't work nothing was logged and in docs, it was with syntax error
dbl.isWeekend(.then(weekend => {
if (weekend) console.log("Woo! Multiplier time!")
});
oh my thats a bad mistake
dbl.isWeekend().then(weekend => {
if (weekend) console.log("Woo! Multiplier time!")
});
Ooofers
can i get some help with this, i am using discord.py async, no cogs
afaik, thats the only reason you would get a 403
is it the token for the right bot?
Yes it is
hmmm
I'm attempting to get information on my bot, but I keep getting this exception:
java.io.IOException: Server returned HTTP response code: 403 for URL: https://discordbots.org/bots/461938818627665940
Code:
public String getVotes() throws IOException{
URL url = new URL("https://discordbots.org/bots/461938818627665940");
URLConnection conn = url.openConnection();
conn.connect();
BufferedReader buff = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String out = "";
String line = null;
while ((line = buff.readLine()) != null) {
out = out + line;
}
System.out.println(out);
String votes = out.split("\"points\":")[1].split("\n")[0]; //Because I'm too lazy to get/use a JSON lib
if(votes.charAt(0) == ' ') {
votes = votes.substring(1);
}
System.out.println(votes);
return votes;
}
Isn't it bot/bot.id?
is it possible that I'll do the counting of my server counts and just send the total shards and the total server count?
iirc you can send shards count as well
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
since this code if ran, will send 12 requests since 12 shards will run the code so what I thought is
client.on('ready', () => {
setInterval(() => {
dbl.postStats(myServerCount, client.shards.total);
}, 1800000);
});
this
then just have a process that sends that instead of shards sending it one by one
almost it, but you need to pass undefined to the ID spot dbl.postStats(myServerCount, undefined, client.shards.total);
got it, thanks
@fast tapir it looks like you're trying to access the bot page for users instead of the api
For the api use discordbots.org**/api**/bots/id
DBL(token, [options], [client])
if I pass client from 'discord.io' library will it still work?
discord.io is not a supported library so it won't post stats automatically
so I can't use DBL basically?
okay I see
webhook is done in different way
so the amount of server is what I supposed to post myself, right?
yea
okay it all seems pretty clear
thank you
dblapi.js is very wired
so I need to set up a server to listen to incoming webhooks on certain port, right?
nvm figured out
What is https://discordbots.org/api/bots/votes meant to return when you provide no ID and an Authorization header?
Yeah but I got a response containing 700 users when my bot has 25/2 upvotes
Some of the users were duplicates so I assumed that it was just every upvote of every bot ๐ค
the endpoint is broken rn @crisp leaf @loud gulch
whats the reason of it being broken
also that means gonna have to use webhooks instead right?
I think the preferred one is
the individual vote check
Or you can just use the /bots/{bot.id}/votes endpoint
i dont think that one isb roken
or if theyre technically the same
but yeah, individual vote checking is still on the table
Any eta on when it will be fixed?
No idea
Rip
Do i need to use API key to GET Weekender True /False? Or is it Public?
public
you can check if it's Fri, sat or sun by UTC now
but what if we turn double voting off one weekend 
I get a different upvote count whether i'm on my profile or the bot's page
https://xd.lol-sa.me/i/4q5xaf0e.png https://xd.lol-sa.me/i/4c9kde13.png
there are 2 counts, total and monthly
oh right
you can access both through the API, with points and monthlyPoints
monthly shows everywhere in the website but the profile page is rly outdated
alright thanks for the info 
@smoky trench I chjecked https://github.com/DiscordBotList/DBL-Java-Library but - at least for me - is there no real explanation, how I would check for a "voteevent"
There's only one, that requires the ID of the user....
I haven't used the java library, nor am i great at java
i can take a look for you but i wont be of much help.
eh i dont think that library actually has webhooks premade.
obviously...
i was just about to do that
@hoary timber easiest one to use is Spark
Spark?
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
Here
@smoky trench Thank you. But remember, that google doesn't just show THE ONE result I need... It shows hundreds
eh it was the first result when i googled "spark java"
I googled "spark"
using common sense, you'd append the language to the end or you would of course end up with unrelated search results
the computer isnt smart enough to know what you're thinking
but anyway, it's there and theres a lot of tutorials so you should be able to setup webhooks pretty easily.
So... If I understand it correctly, do I need to setup a get on startup, that f.e. listens to /votes on the VPS (which also hosts the site) and then peform actions, if that happens.
But what would I have to use, to get the values from the POST in the spark-api?
The webhook for votes gets send as POST.
I want to listen to those votes with the Spark-API. My question is now: Do I need to use get and what do I have to use, to get the values from that POST?
I want to listen for votes
according to the API-page are they performed as POST request
if its a post request, why are you talking about get
Spark is overkill
๐คท
Use OkHttp
...
instead of get, use post
ez
post "creates" something, according to the page (I still look at spark)
@arctic arch but he needs to set up a server in Java
it's just this kind of standard what those would be used for on a website
You're not the only one @proud sphinx
we're sending a post request, listen to that
post("/votes", (req, res) -> {});
And I could put code there, to perform an action, right?
Just want to be sure...
yes
req.queryParams() will give you the parameters
I think you can just res.status(200) so it responds to the request with OK
just add a return
Doesn't work either
I hope return null; won't make issues
And I'm not 100% sure, how to get the different valiues.....
from the body... Never worked with such stuff
Wait. I did something like that before... with the API I use (it also returns JSON....)
I really lose my mind now on how annoying that is...
@hoary timber do you still need help?
@restive otter cool ur here :)
@inner venture Yes.... I'm so confused right now
How does one create a bot on mobile?
Wrong channel
xD
Either use the official library or POST the data yourself
is there any way we can get an event that fires every time someone votes or will we have to check periodically?
webhooks are a thing
@final vortex use the official js lib
1|mb | /home/ignis/node_modules/dblapi.js/src/index.js:138
1|mb | async postStats(serverCount, shardId, shardCount) {
1|mb | ^^^^^^^^^
1|mb | SyntaxError: Unexpected identifier
1|mb | at createScript (vm.js:56:10)
1|mb | at Object.runInThisContext (vm.js:97:10)
1|mb | at Module._compile (module.js:549:28)
1|mb | at Object.Module._extensions..js (module.js:586:10)
1|mb | at Module.load (module.js:494:32)
1|mb | at tryModuleLoad (module.js:453:12)
1|mb | at Function.Module._load (module.js:445:3)
1|mb | at Module.require (module.js:504:17)
1|mb | at require (internal/module.js:20:19)
1|mb | at Object.<anonymous> (/home/ignis/node_modules/dblapi.js/index.js:1:80)

Are you using an old version of node?
6.14.3
Update to 8 or higher, as far as i know the async/await syntax isn't supported below 8
I thought it was 7.6 and above?
hmm, perhaps, anyway you need to update node 
^
Node.js updated
and another error
1|mb | FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
1|mb | 1: 0x8b8210 node::Abort() [node /home/ignis/mb/index.js]
1|mb | 2: 0x8b825c [node /home/ignis/mb/index.js]
1|mb | 3: 0xac1afa v8::Utils::ReportApiFailure(char const*, char const*) [node /home/ignis/mb/index.js]
1|mb | 4: 0x7fe56cf64839 Require(v8::Local<v8::Object>, char const*) [/home/ignis/node_modules/better-sqlite3/build/Release/better_sqlite3.node]
1|mb | 5: 0x7fe56cf650de Integer::Init(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Object>) [/home/ignis/node_modules/better-sqlite3/build/Release/better_sqlite3.node]
1|mb | 6: 0x7fe56cf6cd37 RegisterModule(v8::Local<v8::Object>, v8::Local<v8::Object>) [/home/ignis/node_modules/better-sqlite3/build/Release/better_sqlite3.node]
1|mb | 7: 0x8b9729 [node /home/ignis/mb/index.js]
1|mb | 8: 0xb4ee49 [node /home/ignis/mb/index.js]
1|mb | 9: 0xb4f9b9 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node /home/ignis/mb/index.js]
1|mb | 10: 0xe47787841bd
Anyone fancy giving me a hand setting up the Webhook API so i can have a Webhook message Posted to X Channel when USER Votes
@tardy mauve just receive the post request at the url you set in the edit page
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(vote);
// Do what you need to do
});```
could you fill this in with EXAMPLEs so i know what goes where. Rubbish at webhooks
i never got webhooks working with dblapi.js so i just set up a route in express
ok cool but he's asking help about the webhook with the lib
See, I'm really annoyed of this http://prntscr.com/kfbqkp
It always to go 3 when it isn't
Like it says the real count sometimes and 3 many times
My code was ```js
dbl.on('posted', () => {
})
Can someone help?
have you been using it on a test bot?
.
@arctic arch honestly ive done that same thing an embarassingly large amount of times
using production api keys in development 
I have it using the bot.user.id property so I can't do it on accident
The only thing I forgot was that it would still set the count in DB
So my site would show that
i once forgot about my test bot, shut down my bot to apply an update and then restarted it. the test bot was the only bot on for about 10 or so hours because i went to bed after that
c
helo
@restive otter the client is when you do something like const client = new Discord.Client(), usually it would be client but some people name it bot. its just whatever is before = new Discord.Client()
@restive otter you can also use this library https://github.com/T0TProduction/BLAPI , which lets you post to every botlist there is for discord bots
nice thx @woeful grove
@woeful grove good job at self promotion there ๐ cool thing though
Haha
i think the self promotion was ok because he actually looked for smth like that 
it's fine, yeah
I don't thnk that's really relevant to thsi channel
Oh oops wrong channel ๐
Am I able to link my bot after its been approved? if it does
Wrong channel @restive otter

can you help? 
In computer programming, an application programming interface (API) is a set of subroutine definitions, communication protocols, and tools for building software. In general terms, it is a set of clearly defined methods of communication between various components. A good API m...
Fellas what do I enter for the webhook url on the dbl website
server ip or?
Im really struggling with making the webhook thing work
I assume since my hostname log is 0.0.0.0, I'd just need to enter the ip + port into the url
but that doesn't work
is the port open
by default you cant use port 80 so
I having a problem making the dblapi.js sending how many servers my bot is in my code:
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL, bot);
dbl.on("posted", () => {
console.log(`Posted ${bot.guilds.size} servers to the DBL api!`)
});
I've put the token in the env and it won't post and its displaying no error
Its been a whole day ๐ค

same
okay
Ok i did it there is not error and nothing being put in the console but ill wait 30mins to see ๐
Ahh never saw that on the docs ok i will
lel okay
Fixed Tysm
np ๐๐ป
is there any bots on here i can add
there is a lot of them but i don't think it the place where you ask
where do i find them
you can find a lot of bots in discordbots.org
This isn't the channel to be discussing this.
Is there an API for cleverbot
yes but that's not what this channel is for
Oh
you can just remove the parts that you already have in your bot's main file
and add others
wym?
I'm having problems trying to authorize my token
I got the format and the token but if I put in in the search bar on google it just searches up random stuff
Ping me if anybody responds I'm going to sleep
why are you trying to Google it?
which language are you using?
@wet crow
Error, code
whats the correct way then
is vote the vote object you get from a webhook
dbl.webhook.on('vote', vote => {
console.log(vote)
return vote.user.addRole('Voter [11]')
client.channels.get("476158627791634433").send(The text)
});
thats what i have
vote.user is only the id of the user
oh
@inner venture JavaScript
why are you googling your token 
Can someone help me?
Yes?
Starts 12am Friday and ends 12am Monday iirc
Where do we put Authorization: TOKEN
you mean your bot's dbl token?
As a header I believe
@wet crow just use the dblapi.js lib
OK
What is the best way to send a User a message when after he voted? Using Java
@jade cloak the java lib doesn't have support for webhooks atm, but I'd love to help you implement it if you'd like
Would be very nice since I've never done anything with webhooks :3
Let's move to dms so I get notifications ^^
Once i install dblapi.js where do i put Authorization: TOKEN?
In the Http header I don't even know where the Http header is
Hi
@wet crow you don't use a http header if ur using dblapi.js
Just read the docs please
You put it in the new DBL()
What is the best way to close dbl client connections? When interrupt py script with Ctrl-C connections stay unclosed.
Can I use raw requests to API base url instead of using library?
yes of course, just don't forget the Authorization part
Why specify the shardID and shardCount in .postStats?
What to do with the Auth Part
At they website
What?
If U edit Ur bot
What tf are you talking about?
Anyway
What's the point?
And does this mean I have to run the function on every shard connect?
Bruh
If you don't know how the API works, don't answer
Clearly you have 0 idea of what you're talking about
shard id is for multiple processes, shardcount is for single process sharding
Uhh
if your bot is split into multiple processes each instance cant see all servers so the site adds them up basically
so I think that you would have to run it on each shard
Ah
Also, someone knows how to listen webhook in java?
@brittle iron The lib doesnt support webhooks atm but its pretty easy to set one up
Have you worked with webservers before?
Not really, only once with sockets
Ok thx
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
this is the website
Perfect thank you
I was stuck on getting the Voting system working when I was running a bot on my PI. I have now upgraded to a Skysilk VPS. Already open ports. How would I configure this code to make it fit?
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(vote);
// Do what you need to do
});
Mine doesn't has port and password set, it just has dbl token
I have more than 1000 votes a month, and to check if a user has voted I do https://discordbots.org/api/bots/467944868963024896/check?userId={user.id}"
should I have any problems with that?
i don't do like that but maybe i'd work
In the "API Options" section on bot edit page, when you edit the webhook URL and click "test", it sends to the original URL. To test the new URL you have to enter the new URL, save, edit again and then click test. Is this intended behaviour?
I'm wondering if the API for posting stats have changed. This used to work however my bot stats stopped incrementing for the last few days https://github.com/TitanEmbeds/Titan/blob/master/discordbot/titanembeds/poststats.py#L12
Anyone got a code snippet for a webhook implementation in C#?
Anyone? ๐
@prime shard Have you ever read API docs?
Individual User Id Voting Check for the past 24 hours.
Requires authentication.
Use this endpoint to see who have upvoted your bot in the past 24 hours. It is safe to use this even if you have over 1k votes.
GET/bots/{bot.id?}/check
Query String Params
Field Type Description
userId Number User id of the discord user
returns{voted: 1} or {voted: 0}
Quick API-question about webhooks:
No API-token is required for a bot to listen to webhooks, right? Or is it?
Because I'm thinking about a VoteListener-bot that listens for DBL-votes, so that people can give vote-rewards on their discord without the headache of setting up a votelistener in their bot...
No token is required because you dont actually make any requests
However, DBL does allow you to provide a password/authorization token
separate from your normal one
that you can use to verify that the requests are coming from dbl and not some other sketchy person
kk
groovy, any feedback about my question above about webhook test button?
@restive otter Yeah, that seems pretty normal
let tde = bot.guilds.get("429995294542004225");
let ch = tde.channels.get("471779437164101652");
ch.send(`User <@${vote.user}> has just voted for Automator! Thanks for voting :smile:`)
})
Getting an error with that
._.
@arctic arch You helped me last time (sorry for ping) is there anyway you can help me with this?
whats the error
TypeError: Cannot read property 'on' of undefined
const data = new DBL('TOKEN', {webPort: 5000, webAuth: 'accesstobot'});
Port 5000 is port forwarded
dblapi.js is installed
it's webhookPort and webhookAuth
Oh
you forgot the hook ๐
๐
Thanks
When I press test on the webhook page it does nothing
._.
Idk if I did something wrong
Orrrrr
How I am meant to test it
and what test does
๐
@arctic arch Sorry for double ping, can you see anything wrong?
Got no errors now but test doesnt do anything
did you correctly set your webhook url on dbl
are you running the bot at your house
Nope Ubuntu
or some other place where you would need to port foward
Port Forwarded port 5000
hm
Yeah idk
have you saved
You need to add /dblwebhook on the end of it
Your URL
On DBL? I need to add that in
Yes
Yes
Ok
Then hopefully it will work
yea
What you hosting on?
Okay
I used UFW to port forward 5000/TCP
got http:// in there?
Where?
http:// ip:port/dblwebhook
ye
For URL I have
oh lord
๐
Uh
So
URL looks like this
!!.!!.!!.!!:5000/dblwebhook
Except !! is the IP
@restive otter Is that right?
Think so yeah
Idk lmfao, I used glitch for my vote thing anyway ๐
Then my main bot is run on Skysilk
that ip is definitely readable lmao
lmao
Is that right?
๐
Because I am really confused
๐
And "Test" still isnt working
mine has /vote at the end instead of that
it doesn't look like it has http:// on it to me
How can I check if a user can vote
Like, if its been 12 hours since their last vote?
Yes
You could just called individual vote checking endpoint and then see if it says they've voted
if says they havent, they can vote
Which lang are you using?
how to unban api ?
Could you elaborate?
elaborate what ?
your question
my VPS get ban on API and any bot here cant start bc have problem with connect to gateway
like get ban
but when i host it from my pc it work normal
now is elaborate ?
Maybe a problem of firewall
bot work half year without any error
one day stop respond and second one got down
and i cant run it
bc on start have gateway problem
Ok well
It worked
for about 2 votes
and now
It won't work when my friend voted
._.
Seems that cloudflare has banned your ip
That sounds like an issue with discord, no?
const Discord = require("discord.js");
const DBL = require("dblapi.js");
const bot = new Discord.Client({disableEveryone: true});
const dbl = new DBL(process.argv[2] || config.token);
bot.on("ready", async () => {
console.log(`${bot.user.username} is online on ${bot.guilds.size} servers!`);
bot.user.setActivity(`for ${bot.guilds.size} servers | ${config.prefix}help`);
bot.user.setStatus("online");
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
});
dbl.on("posted", () => {
console.log('Server count posted!');
})
dbl.on("error", err => {
console.log(err);
raven.captureException(err);
})
``` have I set it up correctly for posting my server count to DBL?
const dbl = new DBL(process.argv[2] || config.token); is that your bot token? It should be a DBL token
and those events are never going to do because you're posting manually, you'd get completion status using promises
how, as far as i know the gateway is protected by cloudflare. why idk
so only way is get new ip there ?
bc change host is not on my walet
i need wait 3 weeks 4 that
idk, but you should send a ticket to discord
and wait 2 days for bot respond
wait, how do I get my dbl token? @arctic arch
on the tbl website
clicking in the right corner on your name
then on your bot you click "edit"
mhm
which code? ๐
const Discord = require("discord.js");
const DBL = require("dblapi.js");
const bot = new Discord.Client({disableEveryone: true});
const dbl = new DBL(process.argv[2] || config.token);
bot.on("ready", async () => {
console.log(`${bot.user.username} is online on ${bot.guilds.size} servers!`);
bot.user.setActivity(`for ${bot.guilds.size} servers | ${config.prefix}help`);
bot.user.setStatus("online");
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
});
dbl.on("posted", () => {
console.log('Server count posted!');
})
dbl.on("error", err => {
console.log(err);
raven.captureException(err);
})
forget about the process.argv[2] || config.token
idk, i'm not a js guy ๐
Code looks fine to me
hi Sam, hi Jonas
Hey
right uh, everything looks fine?
Yeah
Awesome! Thanks man
Try it and if anything is wrong get back to me
I personnaly update the server count when the bot enter/leave a server ๐
You're right
I have yet to even get the server count up first,
So putting it inside the ready event would put it up
yeah, also I have a little command to put em up whenever I want
everything, you're a coder ๐
It updates after the setTimeout runs out
So it will wait the full time
Before doing it
right, figured
mhm
np
alright, I think I got it to work, lets just hope it updates once it finishes the timer
Thanks so much man!
No problem! ๐ I had the same issues with this API for days
haha
haha, rip
cute


hello new here ;p.. im looking in the website a robot for music, who dont leave the chat voice later the song finish... any can have suggestion?.. i use fredboat but sometimes that broken.. so i was looking for another.
Rhythm not bad @heavy owl
Why send votes to a webhook instead of just from DBL itself?
I'm guessing because for big bots the payload would be massive
/bots/{bot.id?}/check is there a NON 24 check method?
or are you supposed to save it locally
you would need a webhook iirc
What response am I supposed to get from POST /bots/{id}/stats?
That's What I am getting rnjson {"shards":[]}

Can I get help with JS?
if its not about the api it should be in #development
Would someone mind explaining to me how to call the member function within in the on command function?
Heres an example of what I am doing
@client.command(pass_context=True)
async def login(ctx, email="None", member: discord.Member = None):
author = ctx.message.author.id
print(discord.Member.roles)
#development ๐
yeah
Okay thank u
wrong channel, read the topic
does the response code matter, or does dbl absolutely not care about it?
as in, im thinking of just always returning a 403 or 404 (even when the request was legit) just to avoid of the endpoint/path getting crawled and indexed on some weird place
OR
is there a list of IPs / IP ranges that we can expect the dbl webhooks to come from so that we can whitelist the webhook endpoint for them?
and if the answer is no to both, are there any plans to change that? possible example: currently response codes are ignored, but there are plans for in the future to redeliver webhooks upon a non-2xx response.
I want to avoid breaking the api more than necessary for such cases ๐
I dont think it matters :|
rn the response code doesn't matter
but we might introduce redelivery and error logging later
you should use the authorization to verify the request
How do you shard a bot?
oops
Just a question I'm gonna look dumb but just wondering, I'm getting a 401 error Just like wondering how do I autorize it? I used the correct token and such for linking the bot to the api to show the bot list or whatever but what else do I need to do LOL
p.s. mention me if you reply I don't have this unmuted and I'm a little busy lul
@torpid iris How are you using the token? 401 is usually returned if there's no token iirc
the way the website tells me sorry for the late reply
I have the attention span of a 4 year old
Got distracted
js
sures
(other stuffs)
const DBL = require("dblapi.js");
const dbl = new DBL('-web token-', client);
(event handler but no need for this)
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
@inner venture ^ just in case if you're like me and get distracted easily
You're not doing something like using your discord token right @torpid iris hahah
????
@inner venture explain ๐
i was just making sure you werent using your discord bot token in place of your dbl token @torpid iris
Nope
that was helpful
@ThaBot
I am not able to use the votes API in my commands
on the webhook when the bot start and you go to the site ip thats showen in console from it would the site show anything or just this
this is whats in console: Webhook running at http://0.0.0.0:5657/dblwebhook but does not do anything on site or when you test it in the dbl edit
0.0.0.0 just means that it will accept any requests that reach it
You should replace it with your machines actual ip
Loading it in browser shouldnt show naything, either
hmm ok makes more sence
Because when you load it in browser, that would execute a GET request when the endpoint is only configured to receive POST requests
ahh yah i see it worked now!
one more question sir
sure

