#topgg-api
1 messages · Page 37 of 1
the test button sends a fake vote event with your id as the user ^^
oo ok ty sir
The only way to tell if its not a test is by checking the type field
if its a test, then the type field will be be test
hmm ok ty
I'm getting a 403 when trying to POST the server data with dbl.py.
future: <Task finished coro=<Main.startup() done, defined at F:/Python/DiscordFireBot/main.py:32> exception=Forbidden('Forbidden (status code: 403): {"error":"Forbidden"}',)>
Traceback (most recent call last):
File "F:/Python/DiscordFireBot/main.py", line 36, in startup
self.bot = await bot.initialise(self.config.discord, self.db)
File "F:\Python\DiscordFireBot\bot.py", line 23, in initialise
await update_status()
File "F:\Python\DiscordFireBot\bot.py", line 83, in update_status
await bot.dbl.post_server_count()
File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
I copied the DBL token from the mybots page
yes
The one from the mybots page
bot.dbl = dbl.Client(bot, config["dbl_token"])
await bot.dbl.post_server_count()
And from a quick look, the start and end of token are the same and I'm pretty sure I copied and pasted it right
are you posting the stats to the correct bot?
I would assume so - it's the same bot token I'm using in production
I'm assuming there's not a way to add a testing bot that can also work with it so I don't have to do all the dbl stuff on the same bot as all my servers all the time?
(Not what I'm doing now but would be nice to know)
question on the api for bots
owners: [ '131417543888863232', '412374698987487242' ], how do i list each owner and make them tag
i tried <@${body.owners.first}> but it did not work
tag me if you can help
@lunar tide Not really relevant to here, but why didnt it work
@thin gulch and no, there isnt sadly
umm idk it just showed as undefined and i tried this (img). the code for that was just <@${body.owners}> and it did that since their was 2 how do i make it to tag each owner?
js arrays dont have the property first
do you know what it is to list each? in a tag like this
first, iterate over the array to create mentions by using Array.map() and then put them together with Array.join()
ahh ok thanks
(I'm still not sure what I've done wrong with my thing)
did it thanks @arctic arch
Well I found my issue. It seems to think my bot id is None
It wanted me to do this for some reason
dbl.Client(bot, config["dbl_token"])
bot.dbl.bot_id = bot.user.id
await bot.dbl.post_server_count()
(Forbidden, 403)
New announcement:
a
?
sou brasileiro brow
Is there a chance to add 'points' field to answer of GET bot stats endpoint? The answer of bot <id> endpoint is huge and recently there is no need in other info except 'servers' and 'points'.
stats endpoint is for server and shard count
if you want you can limit the output of the bots (without id) endpoint
sa
@restive otter "ingilizceden başka diller için #memes-and-media kullanın" -tonkku
why are you quoting me on that
is it possible i can just show server count on my website using dbl api?
yes, its possible
how?
what language are you using?
html
what
and css
to code your bot in, friend
okay, so there is a python lib but its kinda dated
I think it should work for what youre doing, though
take a look here
not what i am looking for
why?
is it possible i can just show server count on my website using dbl api?
on my website
not on dbl page
Oh my bad, i misread
thats fine
There are the widgets you can use
or you can use the API to get the stats and manually insert it into your page whever
not the whole widget
It doesnt require a token to get the stats or anything
i am trynna look for an example
-bots @restive otter
@uncut lark
You're probably gonna have to use some client side JS to call that url and parse it
I'm not too familiar with it
but it doesnt seem all that difficult
not used to js
Cant really help ya there, man
its fine
@restive otter where you want the number to be put <span id="servers">Loading... </span> then use this js:
window.fetch('https://discordbots.org/api/bots/466007757183516703/stats').then(r => r.text().then(t => document.getElementById('servers').innerHTML = JSON.parse(t)['server_count']))```
lemme try
wait wot i thought fetch was localised to service workers thats so much nicer if its global
Why am I getting this error when using example webhook code from https://discordbots.org/api/docs#jslib
client.on('ready', () => {
^
TypeError: client.on is not a function```
what code did you copy from the site? I only see client.on in the postStats section
uhh
Its not really possible to tell without more code
@restive otter what is your client
are you using the latest version of dblapi.js?
that error makes no sense
It makes plenty sense
He's trying to use the webhook function on the discord.js object
it looks like its saying the client.on is in the dblapi code
but its not
and client.on works in d.js anyways
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'mypassword' });
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!`);
});```
this is my code
that is not the same code from your error, friend
Ohhh, I see
I'm gonna try reinstall it
It installed the same version and its now working

epic
lol
does anyone understand how I can use oauth2 to login on a website?
?
Search up OAuth2 on google for some explanations on how it works. Discord also documents it here: https://discordapp.com/developers/docs/topics/oauth2
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
ik im looking at it
it seems that its just scopes passing json fields
but does anyone know like
the proper procedure as a html link to get it to request the username n stuff
Make a request to https://discordapp.com/api/oauth2/token supplying GET parameters which will return an access token meaning you can access the https://discordapp.com/api/users/@me endpoint supplying an Authorization header using the bearer token.
and some other endpoints
wrong channel for this, use #development
wdym
Discord OAuth2 works directly on API parsing
in this case with a login request to sites
@hushed reef this channel is only for the DBL API as it says in the channel topic
#development is for random development stuff
k 👍🏼
How many times a day should I post the stats of my bot?
OK thanks
I mean
posting every 30 seconds is safe,t oo
the ratelimits on dbl are fairly generous, from what i remember
(60 a second? something like that?)
something like that
Either, way it doesnt really matter
I just suggested every hour because it probably wont have changed inbetween then
for most small bots
🤷 ok
Posting whenever your bot joins/leaves a server is fine until you start hitting ratelimits, then it's best to post every minute or so.
Would just start with the best practice.
yeah and that would mean discord outages would spam it
I need some help with the botlist.space api
yes
Hey
Is there some delay in the /stats?
I am sending the server count
when I check through the API it shows the correct count
but on the site itself it shows the outdated one
oh well it updated
¯_(ツ)_/¯
Browser cache issue
@tawdry pine Ctrl shift r
@inner venture yeah it updated
😊
then leave. and stop having a generalised conversation in here.
thats why he said #general
fuck you and bye
okay
I remember this guy
He was getting pissed because I told him to ask in rythms support server when he needed help with the bot
There seems to be a problem with DBL's host.
Ok nvm.
I came here too quickly my bad.
I might also need help with setting up a webhook in my bot.
What is meant with the URL? How do I set up a URL?
you need to set up a web server to accept a post request
So, for example, IFTTT?
IFTTT has the possibility of webhooks.
But then again, how would I be able to get the info from the webhook? I might want to check the d.js docs
What language are you using?
no, you need to setup a web server that can accept POST requests @past reef
Ah okie
How can I check if someone voted and give him a role?
Or for example if he didn't upvote the bot a command will not work.
@restive otter take a look at this
specifically, the has voted methdo
refresh
1 hour to make a code for my server to give member that voted a role but deleted all of it because tha api didn't answer my requests XD
i kept getting that it uses id as an argument
but i gave it a defined id that should work right?
When I try and run the code to update my bot's server count on the DBL site, I get this error (using discord.py)
https://hastebin.com/exefunetot.rb
How are you trying to update the server count?
What do you mean? I used the example code on the API page, and changed it to use my token
Okay, well if its a 403 your getting refused by the server
Huh, what could cause that
Not exactly sure as I haven't used the API myself but potentially something is not sending correctly?
Hmm
There are some other examples to use for the api
You using discord.py rewrite or discord.py?
On the server-count-examples there is this example:
dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
requests.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
requests.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
requests.post(url, data=payload, headers=headers)```
The channel or?
#312614469819826177 its somewhere in there
Ok
Error: Traceback (most recent call last): File "C:\Users\Admin\Desktop\ Bot\servercount.py", line 10, in <module> import requests ModuleNotFoundError: No module named 'requests' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x03E8FE10>
You need to import requests
That's just a bad idea
Use dblpy
The official library and the example on its GitHub page
403?
Yeah
Yeah
Try resetting your token
Ok
there is a lib for the dblapi in python
Also make sure you are putting the DBL token
I am xd
how do i make a discord bot
Wrong channel
Um, I'm getting an Not Authorized error
are you sending your token
^
Yep, on an Authorization header.
bot token or dbl token
headers: {
"Content-Type": "application/json",
"Authorization": "<oof>"
}
I got the token in reference
But
I'm dumb
Sorry 😂
ok
Still getting 403 @sullen nymph
Do you mind sending the code with your token in DMs? (you are free to reset it before sending)
Ok
hi
how do I get the guild count when I want to update the bot guild count using the api?
// Update stats guildCount
await me.UpdateStatsAsync(2133);
I'm using another project from the original bot
@restive otter I'm not sure what you mean -- like, how to get the actual guild count from your bot?
yes
eh
I'm using this only
Am I supposed to use Discord.NET as well?
Anyone know why I'm getting Error 401 when I try and run the code that updates the bots servers count?
I mean... how else are you supposed to know what your bots guidl count is.... @restive otter
403 now
Tim maybe send your code
sounds like wrong token
I have a question
What does a dbl webhook send when it is submitted?
req.body parameters, yeah?
I guess so, never done much with it.
Weird
yeah it does
Okay thanks ^^'
Please read the docs @gilded summit
I don't know the format of an "HTTP server"
const express = require("express"),
http = require("http"),
app = express(),
server = http.createServer(app),
DBL = require("dblapi.js"),
dbl = new DBL(TOKEN, {
"webhookPort": process.env.PORT,
"webhookServer": server
});
dbl.webhook.on("vote", (bot, user) => console.log(bot, user));
app.get("/");
server.listen(process.env.PORT, () => console.log("Listening"));
I have this, and I set my webhook URL to http://96.250.125.31:8080/, but it's not working

@gilded summit default path is /dblwebhook
I tried that and it still didn't work
how did you "try" it
I set the webhook URL to http://96.250.125.31:8080/dblwebhook
did you set the environment variable PORT to 8080
the site?
Not site, but server
Because it actually connects, is what I'm saying
Cannot GET /dblwebhook
What is the version of the API for Gradel
dependencies { compile 'com.discordbots:DBL-Java-Library:VERSION' } stuggling to find it
Could not find com.discordbots:DBL-Java-Library:2.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
https://jcenter.bintray.com/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
https://repo.maven.apache.org/maven2/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
https://repo.maven.apache.org/maven2/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
https://jitpack.io/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
https://jitpack.io/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
https://repo.noxal.net/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
https://repo.noxal.net/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
``` and error I get when doing 2.0.1
Oh shoot
I mistyped
it should be
org.discordbots
@hollow edge
let me fix that rn
Lol no worries thanks @inner venture
lmk if that works
awesome!
Is the Discord bot ID the Client ID to the bot or it unique to discordbots.org?
Because we believe we set it up correctly, but we haven't noticed any change with our bot on the website.
client id
👍
rip discords bandwidth
So we added our Client ID from https://discordapp.com/developers/ and our Token. And we still had N/A on Servers.
Does it take a bit to update or are we just dumb. 😅
https://hastebin.com/uxosezekud.php
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
what token are you using?
@sudden rampart The discord bot token
you need to use the dbl api token
Oh?
https://discordbots.org/api/docs#mybots not this token?
that token
That's what we're using yes.
Nope
@hoary timber I just updated it to the more concise version
This is our resault when using the code: https://gyazo.com/9f9410655f29b34f2d033067fdf41ae7
N/A
the original one should still work
can you try just api.setStats(serverCount)?
Sure.
DBL-Java-Library - An API wrapper for https://discordbots.org/api/docs that works in Java
Add a consumer and check if its throwing an error
gson isn't thread safe
Its not?
nope
Should I use jackson in place of it
an easy fix would be thread local
personally i'd just use org.json and manual deserialization
hmm
i had to do this for a couple fields https://i-was-scammed-by.dabbot.org/e92c06.png
i got some broken data (out of bounds) a few times which threw when parsing
wth
Well only using Servers worked @sudden rampart 🤔
can you print the other variables you were sending on the first attempt?
Bot.getAllGuilds().size(), 0, Settings.SHARDS
Didn't work
dblApi.setStats(Bot.getAllGuilds().size(), 0, Settings.SHARDS);
Server Count, Shard ID, Shard Count
Worked.
dblApi.setStats(0, Settings.SHARDS, getAllGuilds().size());
Shard ID, Shard Count, Server Count
The github documentation may be wrong.
The data for setStats in the current source, shows different data than what the documentation does.
Documentation, which is wrong:
https://i.imgur.com/SrMgSSS.png
While the code, shows something different:
https://i.imgur.com/ELv7G3u.png
my apologies -- ill rectify that
No worries. 😃
#gibfreecertificationfromistakes kappa.
We'll let you know if we find anything else. 👍 😃
🙏
is 401 a credentials error?
yes
ye i guess i accidentally regenerated the token somehow, thanks ;p
anyone know why its saying undefined variables for url, headers, and payloads, i am on rewrite python
https://hastebin.com/bomapepoha.py
ok then
um
I has issue with Java library
I put 'yes' in the bot file and it didn't work
help me
For some reason the code for posting server count isn't doing anything, using python
ok
Use DBLPY
and well, maybe report a bug if your token still doesn't work
Or you can always try posting it mnaually with aiohttp :^)
How do you do that?
@sullen nymph
Also, this is with another bot that doesn't work as well. The previous one I got a friend to do it using the .Net library which worked fine
I had the code somewhere, give me a minute
Ok
I'll post the code in #development
Ok
hello
I fixed mine by adding an additional line that I'm assuming is undocumented
# Unexpected error!
# Error caused by Error : Error: 500 Internal Server Error
at IncomingMessage.res.on (/opt/app-root/src/node_modules/dblapi.js/src/index.js:115:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)!```
I randomly get that
maybe the site went down
Anyone able to deeply help me with API, I need to make a API bot but im completely unfamilier with how to do so
@keen pagoda this channel is only for help with the DBL API
for general development go to #development, but remember people will only help with specific questions, not just stuff like "help me make a bot"
thats why i asked for deep help 😄
at org.json.JSONTokener.syntaxError(JSONTokener.java:451)
at org.json.JSONObject.<init>(JSONObject.java:196)
at org.json.JSONObject.<init>(JSONObject.java:320)
at org.discordbots.api.client.impl.DiscordBotListAPIImpl$1.onResponse(DiscordBotListAPIImpl.java:243)
... 5 more
Suppressed: java.lang.NullPointerException```
🤔
seems discordbots is down
what method did you call?
probably #hasVoted method, idk that came right now
I also get a 502 bad gateway error on my browser
yeah it's down
@inner venture might want to check the response status code and throw something like "http error xyz" instead of letting json parsing fail
it does ^^
and yes it's the hasVoted method
or...
it should 🤔
@sudden rampart oh i know what broke there. I added a little thing to parse the body if it fails
because DBL sends error messages in the body instead of the status message
JSONObject errorBody = null;
try {
errorBody = parse
} catch(JSONException e) {
throw ...(response.code());
}```maybe?
If you like it that much your should post it in #memes-and-media
i'm getting Module dbl has no Client member on python
Don't name your file (or class) dbl
@sullen nymph
#memes-and-media thanks
I need some help with the webhooks :/
What's up?
lol
I need some help with people having to react to a message to get a role
Wrong channel #development
oh sorry my bad
At what time does the voting multiplier get active?
on weekends
Be aware of time zones. There is also an endpoint to check.
get isWeekend from webhook so no need to check 
well I want to send a simple message if the multiplier is active, checking the endpoint every hour for that isnt really great
how do I get my guild count on js
what lib?
I noticed you provide an authorization token in the header. To check if the request comes from DBL.
However you don't encrypt it 
Wouldn't that be better to for instance create a hash (sha1) with the authorization secret/token. And we could just create an hash in our side using the same token. Both matching would be that the request comes from DBL.
yeah that was a quick and noob friendly approach to verifying that the request is from dbl
There will likely be a signature thing lin the future for those concerned
thanks that would be much better
um
um
?
after i added <meta name="keywords" content="Fortnite Bot">
in the html
also what is this?
you cant add keywords in the body iirc
and that means you allow dsicordbots to use your video you link
also this is for #development or #general 
this channels for the dbl api
so I'm using dblapi and wondering how to use their webhook feature. If I'm correct it actually builds it for you? But the path defaults to /dblwebhook but I don't have that filepath, so I'm wondering if I do index.js or what 🤔
Is it just asking for my ip:port where it's hosted at or what
ah
lol
is /dblwebhook based off of where the program is stored or is that something I need to configure
no
so can I just have it opened on my vps which is just ip:port and I change that attribute like so
new DBL(config.discordBots, {webhookPort: config.dblWebhookPort, webhookAuth: config.dblWebhookPass, webhookPath: config.dblWebhookHost+":"+config.dblWebhookPort});
Or am I thinking of this wrong
because I believe this uses the port and creates it for me right? At least when I was trying to host it on express it said there was a conflicting port every time
ah
so if I type in my ip:port into the web browser when running DBL I should at least be getting a blank screen right, like no connection errors?
are you typing it in your browser?
well the ip and the port yes
yeah blank screen sounds about right
just curious, is posting guild count every 10 seconds (only posts if diferent from last time) too fast?
Why would you care about a 10 sec interval?
I mean no harm in once a minute
Personally I post every 5
Also 10 sec is just asking for trouble if you do anything else
I think that if multiple people were to do it, it may be a problem as even big APIs have difficulties taking that many posts. boop
that's exactly what he is doing
Well, it is kinda spam tho, personally post every hour as you don't really need your guild count to be up to date that much, i don't see any point in posting that frequently
Yeah even with the check every 10 seconds its still spammy imo, if I was running the API I probably wouldn't appriciate it
well mine is listening to a db changefeed for my stats which is updated every 10 seconds. same interval for updating stats on my site. but I could increase it to 1 hour for posting my guild count
ya it's prob better to increase it

I use node-ipc
Set up an ipc server on the webpage
Connect to it on the bot
Then send
i would use a websocket to do that but i guess that's another way to do it 
@raven zinc I'm to lazy to set up a websocket
i don't think it would be any harder than using node-ipc tho
mainly I didn't understand websocket at that time also
yeah i cant do the updating every time it changes thing, since im using eris-sharders stats. i just save it in my db every time stats event fires, btu stats are likie all together
changing source to get stats from each cluster all realtime sounds like a pita
and also I just checked I put it in my ready event
since I'm sharded I just fetch all guilds after all shards are done spawning
well you could have each cluster listen to guildCreate and guildDelete and make them relay that
yeah tru
though i guess 10sec is pmuch as fast
Then set it on a loop to fetch all of them every one minute and send
yeah it is fast enough
its clsoe enough to live for my site so im happy
lol i cant program
cause idk how to
for me, only one shard posts the stats to api's. other shards just relay the data to the shard that does the work
I'm using dblapi.js for server count and voted events in discordjs. I'm using a webhook that says it's ready to use, and then I post the server stats after a 5 second delay. However, the posted event in dbl.webhook.on doesn't trigger. I can visit my url in a browser, but it doesn't seem that discordbots or dblapi.js is handling the events or receiving the data. The authentication is also the same on both ends. I'm just kind of confused.
@bronze arch are you using dbl.postStats to post your server count?
the events are for the "autoposter"
hm
you can use promises or async/await to get the completion of the post
even then, I don't think my vote event works, I'd have to wait a while to test it out again (unless you have another idea to test the webhook with discordbots)
are you testing by actuallu voting
yes
there's a test function on the edit page
god damnit lol
have you even filled in the url lol
yeah the webhook seems to be on 0.0.0.0:port/ and then I have the right ip:port on discordbots
do you have http:// at the front
I have a anwers
answer*
How i use the api of DBL to get info of another bots?
i look in the api page and i don't know
@left spear https://discordbots.org/api/docs#bots
well
just do a GET request to that endpoint
then you'll get the bot object https://magic.school-b.us/482681477050531840.png
i make get like thhis
var s = require('snekfetch')
s.get("url").then(r => {
r
})
bad?
or how
yeah thats ok
and how i put in url
var s = require('snekfetch')
s.get("https://discordbots.org/api/bots").then(r => {
r
})
?
you need to put the bot id after /api/bots/
but the bot id what will be selected by command, example *dblinfo @AngelicBot#7047 or another bot
yeah you need to get the id from that then put it in
No need to get aggressive
smh just learn javascript and whatever discord lib ur using
but how
its hard
if its too hard for you to learn the language you're using then you shouldn't make a bot tbh
Hey
spoonfeeding isnt allowed here
spoonfeding?
Python is more recommended for beginners to programming, then JS and so on, in Britain that's how the education system works anyway lmao
Oh aha
Python is taught Year 10+, Universities generally teach Java
For general CS
For more specific areas, different languages are taught
I.e. Data science = Python and R
.
yeah for some reason my uni is making first years do python now
hey are gonna be fucked in 2nd year
doing C
usually first year comsci is java
these kids gonna get fucked by nullpointers
uni's tend to do java or python as first year heck knows why youd do python
java so they underatand OOP and types
python doesnt seem that useful in industry imo unless your going into something like ai in which case get good with py
theyre gonna be screwed learming python first
if you know something like java then you can easily pickup things like c
exactly
and we should probably move out of api channel
Delete it then lol
plz kick me
no
Why
I want to give a role to my voters who have a code ready
I still don't really get, what query actually is in the webhook.
Can that be anything I add after the link in the webhook-section of the botpage?
For example: thedomain.com/vote?uniqueid=<id>
Or how is that mean with /bot/:ID/vote? Is there anything I can do at the vote-page?
It's so confusing...
I'm afk for now.
If someone has an answer to that (Specially on the question on if you can send a own param through webhook) mention me pls.
erhmm how can I see if the author of the message voted today so like if i have a command called vote and when you do it if you didn't vote it would say you didn't but if you did it would say you did. How could I do this? (using dblapi.js)
@hoary timber
@gloomy geyser I'm not sure about js, but there's hasVoted(id) that returns a boolean
@sudden rampart That doesn't really answer my question.
How do I set those querys in the first place, without having the user to change it themself?
but that is js 
@loud gulch read first
i did
@hoary timber you give the url to users with query params set
that doesn't help tbh.....
I actually want to make a sort of Votelistener-bot (if that's allowed).
Currently use Sparkjava for making the votelistener.
Would it be possible, to make a post("/vote/:ID", ...) and then get the param :ID?
Not sure how parameters work in sparkjava.... if they are defined, or if you can give a own name...
post("/vote/:id", (req, res) -> {
var id = req.params("id");
})```
without the : in req.params?
Because the example of spark shows it with the :
ok
Because that way I could get a identifier to check info with the database...
Makes stuff a lot easier for me now.
Yo , I’m in python , but idk if someone can help me with this , since I asked on a python support server , but they said I needed the api something , to make it possible to let ppl „unlock“ a command when they upvote the bot on discord Bot List
Yes as long as you have an api key to their server or if they have a server where you can view the analytics of a bot
and as long you can call it in js
I'm confused how do i get the Webhook thingy that says on the edit page for your bot?
@ocean pike some of the DBL API libs support it, if you're not using one of those languages you'll need to set up a webserver to receive the POST request
what language are you using?
Js
Ahh Thanks
Okay btw i already have
const DBL = require("dblapi.js");
So i just need the other stuff?
How do i authentify on the api how to enter the token?
@restive otter are you using an api lib or directly accessing it?
direct
set the Authorization header
its not part of the body
its a header
check the docs for whatever request lib ur using
@inner venture I was asked to ask you about my issue. So my issue is that my bot doesn't update it's guild count on the dbl website. It used to work but doesn't anymore, the token didn't change and I'm using the official DBL API for java.
My bots log: [08/26/2018 04:20PM][INFO] Sent 'on 51 guilds on shard 0/1' to DiscordBotList.org [08/26/2018 04:20PM][INFO] Playing status updated to: Watching 59616 members on 51 guilds!
My code for sending my stats:```java
Timer t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
long members = 0, guilds = 0;
for (JDA j : jda.getShards()) {
guilds += j.getGuilds().size();
api.setStats(j.getGuilds().size(), j.getShardInfo().getShardId(), jda.getShards().size());
Utils.logNoCmd("Sent 'on " + guilds + " guilds on shard " + j.getShardInfo().getShardId() + "/" + jda.getShards().size() + "' to DiscordBotList.org");
for (Guild g : j.getGuilds())
members += g.getMembers().size();
}
if(!cmdPlaying.customPlaying) {
jda.setGame(Game.of(Game.GameType.WATCHING, members + " members on " + guilds + " guilds!"));
Utils.logNoCmd("Playing status updated to: Watching " + members + " members on " + guilds + " guilds!");
}
}
}, 0, 500000);```
My code for the API:```java
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token(Secrets.DBLToken)
.botId(Static.botID)
.build();
@rustic coyote hey. Can you add a callback to check if there's an exception being thrown?
Sure
Let me just do that realy quick
Could you tell me how implement the callback since I'm not really familiar with Java as a normal language but rather only with the JDA DiscordAPI wrapper?
oh one second
the parameter order for the setStats methos
You've got them out of order 😊
Oh, probably happened when recoding the function
Would've never noticed
Thanks for helping ^^
🙏
btw, timers are kinda outdated in java.
I would suggest using a ScheduledExecutorService
oki
Thanks ^^
Got it working now (had to do a mvn clean install bc intellij doesnt like me), also using scheduledexecutorservice now
Thanks for that ^^
OMG I accidentally bombed the discordbots api
Forgot to put it on 5 minutes instead of ms xd
hahaha
I imagine that in the server log, like just 100 times my bot sending stats
.
Is it normal for the API to not have permission when updating?
[DB.ORG] Attempting to post server count...
[DB.ORG] Failed. - Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
This is what comes up for me, however it works perfectly fine as it displays on the website (I'm using the Python library btw)
looks like your token is wrong
if it successfully updates it shouldnt say forbidden
How can I look up the name of the game that a user is playing using Discord API?
I am trying to learn how to make a bot and this little feature is kinda the core of the functionality I am trying to build
@restive otter this channel is for the DBL API
for other stuff go to #development (also mention what library you're using)
Okay thanks for the heads up
yw
@last cedar this channel is only for the DBL API, as it says in the channel topic
If you want help with a different API then go to #development
channel oof
ye
go to #development if you need help with the heroku api or whatever it is
javascript api for this
oh
like when i tried it, it doesnt change the server count
Well using the DBL API should be the same on heroku or anywhere else
^
the only thing it showed for dbl is ```2018-08-27T07:18:12.076723+00:00 app[worker.1]: Webhook running at http://0.0.0.0:5000/dblwebhook
nothing else besides commands
🤔
Can you paste your code?
alright nvm then
how to add webhook for my bot in discordbots.org
Can you be more specific
@restive otter Webhooks are specific to each discord server, you need to manually add each hook to your bot and handle them separately. If you share the webhook publicely than the only thing you achieve is allowing everyone to spam the specific channel you made the hook for
I'm pretty sure he means the vote webhook
Yeah I knew that.... ej
https://discordbots.org/api/docs I think this is the link, a few examples on there
Ueah checked that but didnt understand
What language and library do you use?
Python
Lib?
Discord
.py?
yup
Well, I have never used python but some people that have used discord.py might be able to help you
I found an example
Alright
Can I post it here?
Sure
bot_id = kwargs.get('bot_id', self.bot_id)
onlyids = kwargs.get('onlyids', False)
days = kwargs.get('days', 31)
return await self.http.get_upvote_info(bot_id, onlyids, days)```
Is that fine?
I'm not sure, I've never used python
Np
How can i set a weebhook? For upvote feeds?
@royal fiber you'll need to accept the request
either use the DBL JS lib or set up a webserver
you can set the URL in your bot's edit page
@plain timber Is there another way to do a webhook for dbl?
what are the 2 ways
js
then you can use the js lib
thx
yw
The webhook port is a location/endpoint on your system which DBL might use. The password is simply authentication so you know if the request is coming from DBL. Webhook is simply a webserver which accepts POST requests to receive data and interpret it.
The webhook port can be any open port you like and the password is a string which should be strong.
Like a password to a website.
so anything?
The port can't be necessarily everything. Password can be.
Just try a port and if you get an error which if I remember correctly is EADDRINUSE then that port is taken by some other program or the os.
ok
you do not remember correctly
Hello, How can I bring you the obligation to use the DBL Vote command
I get this error when trying to post server count http://prntscr.com/ko9lme
I didn't change anything it just came
Hello, i wanted to use webhook-voting for my bot, i use discord.js and host on glitch.com but i don't get how i should do it?
express server
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
response.sendStatus(200);
});
app.listen(5050);
setInterval(() => {
http.get(`http://process.env.Name.glitch.me/`);
}, 280000);
I have
doesn't look like it
i changed that

const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
response.sendStatus(200);
});
app.listen(5050);
setInterval(() => {
http.get(`http://nitrobot.glitch.me/`);
}, 280000);
you know
This is my real code, but i don't wanted to advertise
now add the dbl vote code
....
setup a post event
no u
it works as a string tony
but it's a integer by default
yes
Im having a bit of trouble with the API, not sure if its your api or the randomPuppy API, any idea what that would be?
(node:36658) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 38): TypeError: this.request.getHeaders is not a function
Im getting that when running a 4k command to do with NSFW
Thats all im getting, no line that the error is coming from neither
But it works on my test bot
well for one, uh, might want to delete that message because it has your IP in it
Rip him
wait it does?
Yep ^
lmao it does
is there currently a voting issue?
no?
some people are getting their dailys and others arent is why i am asking.. its been happening since yesterday was just wondering
Hi, I'm unable to get my token from https://discordbots.org/api/docs#mybots. I assume it requires having a bot application created, but I have no interest to do so. I'm looking to fetch data from GET /bots/
Screenshot: https://get.banned.today/119c3f.png (while being logged in, obviously.)
you don't need a token to read data from bots
^
you only need one to post stats/check votes
The only endpoint that says "Requires authentication" is the "Post Bot's Stats" one
well
and the vote checking ones too
but my point stands
the only ones that require auth are the ones that explicitly say so
to anyone that'll check LynxBot, it is offline until I can setup a heroku app for it
just ignore it and move onto another bot please
Speak spanish?
@uncut crystal no it's not my ip. It's someone else's ip and it says that the owner of discordbots.org has banned it
Idk whose ip it is and why they banned it
So I can't update server counts anymore?
depends on what they got banned for, if it's a ratelimiting ban it only lasts an hour
Then who got banned here really
Idk
@uncut crystal sorry for this ping but can you help me?
@formal sparrow whats the IP address
How is the Authorization thing done? Im reading the docs but im still lost
Use an API wrapper 😃
@formal sparrow found the screenshot
the IP was banned for heavy spam
@arctic arch but whose ip it is
And why I can't use
Kindly ping and tell me please
Not Tonkku but, Glitch probably recycles IP's from instances that go down, if someone abuses on an instance that IP gets banned
It's like receiving a lot of spam calls from a phone booth
You don't know who's calling you but you can block the booths number
Ik but how it happened automatically?
You can count how often someone hits your ratelimit and if it's above a threshold, IP banne
So it is cuz somoene spammed a command that uses ip?
So what is the solution to make it work again? Changing project will work?
nice
Its a very important white paper.
whats wrong with glitch
read the whitepaper 
:)))
Yeh
Don't fully trust the docs considering they also say voting has 24h cooldown
Seems outdated
@summer oracle so in your way, why some other bots running in glitch still can use dbl api
I think you did not read the white paper.
Just read it, things will be very clear.
I use glitch because I'm poor
Same goes here but still many bots can use api while I can't in glitch
I call bullshit. Maybe "poor" as in "poor life choices". The time spent to make a Discod bot work on such mutilated free services like Glitch or Heroku could be spent working a real job and earning enough money to run on some cheap af vps for years. The only legit reason anyone would ever choose to run on such a free tier is because it is a challenge to make things work on such a small, restricted, shared space, and some ppl enjoy that kind of challenge - in which case I'm the last person on earth that will ruin their fun by helping them solve it.
It works for me^^
😄
But yeh
I set up like 3 apps now
And even for the third app it still took me over an hour to get stuff running properly lol
@summer oracle im 13
i dont have 10$/month to spend
Where i live you cant legally get a real job until you are 15
damn
also bs i dont have a job and still make enough money to pay for a vps
its only $10 a month???
When you do @Luca botinfo @botname it shows "No server Count" How can I make it show the amount of servers its in?
@trail shadow sometimes cheaper
DBL api
by sending a post request to the api with your server count
https://goo.gl/bFsQ8p
Discord Bots | API
Poststats (assuming node)
Which language are you using?
I need help posting my server count to DBL
I've tried many methods but none of them have been working so far
lang?
discord.js
Here is what I'm doing ```js
dbl.on('posted', () => {
return console.log('All server counts posted successfully!')
})
dbl.on('error', (err) => {
return console.error(err)
})```
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
thats how u use the dblapi.js lib
Thats exactly what I have
@restive otter what kind of vps is that, ive heard there is many
const DBL = require('dblapi.js')
const dbl = new DBL(config.dblToken, client)
module.exports = async (client, guild) => {
dbl.on('posted', () => {
return console.log('All server counts posted successfully!')
})
dbl.on('error', (err) => {
return console.error(err)
})```
he's not even posting the stats
he is
Then how do you post the stats..
wait
what is client defined as in new DBL()
@topaz wyvern if u pass client into new DBL() it auto posts
oh
@shut ibex it didn't work
@steel hawk any errors logged?
nope
before dbl.on('posted' can you try adding this on a new line? dbl.postStats(client.guilds.size).catch(e => console.error(e))
at IncomingMessage.res.on (/root/ear-tensifier/node_modules/dblapi.js/src/index.js:115:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
raw: '{"error":"Unauthorized"}',
body: { error: 'Unauthorized' },
status: 401,
headers:
{ date: 'Fri, 31 Aug 2018 23:25:46 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '24',
connection: 'close',
'set-cookie':
[ '__cfduid=dcaf1c5c4e6b6f9edaf975a2383c83da91535757945; expires=Sat, 31-Aug-19 23:25:45 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ],
'x-powered-by': 'Express',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization',
etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
'x-cacheable': 'NO',
'x-varnish': '396133495',
age: '0',
via: '1.1 varnish-v4',
'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '4533421a3c262180-EWR' },
ok: false,
statusText: 'Unauthorized' }
Getting this error @plain timber
your token is wrong
401 usually means no auth was provided at all
can you double check its correct?
and that its for the right bot
k, if the token's fixed you can remove the dbl.postStats line
Does anyone know why this doesn’t work?
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!); });






