#topgg-api
1 messages Β· Page 45 of 1
thx
what's your error
I hate to basically ask to be spoonfed, but I really don't understand how to make the webhooks work, what do you use for the link?
your server url:port and the auth token you wanna use to confirm the post request comes from discordbots org
I have the auth token set up, I just don't understand the link
you put the url in there where you gonna accept POST requests from dbl like: http://yourServerURL.com:port/votes
I'm using the lib, I'm talking about the link that goes here:
same - you gotta decide where the requests from dbl should go to (where your bot is hosted)
Alright, thanks
your bot Pug already does it
I did it
thank you
I read the docs
@plain timber sorry for the ping, but does that mean 100+ in all or this month
for the upvotes
120 in the month
120??
yes
Ahh
I can't figure out how to lock my command for have to vote!!!
Ive read the docks but idk what to do with
if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
});```
Are you using dblapi.js?
Yes
And I can't figure out how to implement this into my code
@plain timber
ping if someone can help
you better off using webhooks
webhook to record votes?
I want to lock a command
such as?
what you mean such as
What webhook
π€¦πΎ
@plain timber this is urs
To use DBL webhooks to votelock commands you will need to store votes in a database
alright
Or you could just use dbl.hasVoted
Whatever is easiest
just note that the endpoint has rate limit
Webhooks are recommended but hasvoted is easier to implement tbh
1/60 up to 60 burst
what's an example of locking a command with .hasVoted
and hasVoted has a cache, iirc
There's a code example...
Just change console.log(blah) to whatever u want to do if they have voted
yeah, uhm, you should prob explain more on the rate limit
i can already see users getting his api token limited
hm?
1 rps / 60 s, or 60 burst
I heard the ratelimit was like 20/sec or smth
nah
60 req per minute
so you have 60 burst
but once exceeded, it's an hour ban block
nvm sorry ghost tag
@plain timber https://i.imgur.com/TQTxYic.png
dbl.getVotes is not a function
sh0w code
I told u to use hasvoted tho
both should be a func
const dbl = require('dblapi.js')
const ms = require('parse-ms')
const Discord = require('discord.js')
const db = require('quick.db')
exports.run = async (client, message, args, config) => {
let timeout = 86400000 // 24 hours in milliseconds, change if you'd like.
let amount = 500
// random amount: Math.floor(Math.random() * 1000) + 1;
let daily = await db.fetch(`daily_${message.author.id}`);
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id == "500844395092901888"))
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let embed = new Discord.RichEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`**You have already collected your daily reward**`)
.addField(`Collect again in`, `**${time.hours}h ${time.minutes}m ${time.seconds}s**`)
message.channel.send(embed)
} else {
let embed = new Discord.RichEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`**Daily Reward**`)
.addField(`Collected`, amount)
message.channel.send(embed)
db.add(`money_${message.author.id}`, amount)
db.set(`daily_${message.author.id}`, Date.now())
}});
}
idk

That's not how u use ut
so you didn't even construct a client
You can't do const dbl= require
I did the first one
webhook auth
I don't know what any of that means
why is this so hard to fetch a vote
seems easy to me
ok I did that step or whatever
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere)
and of course I changed the token
What's next?

..
whatever
do all api requests require tokens
read the docsβ’
yw
Hey guys.
I want to know how to see how many bot's my servers in, I assume it is something to do with the API.
I've installed the DBL api.
At the moment it says N/A.
You can see your bot's guild size normally by <client>.guilds.size
Assuming you use javascript
DBL Api will POST that
Okay
Aye
Has something changed with the /bots/ID endpoint? It no longer allows me to view points and monthlyPoints (I get KeyError). Please ping me with a response. Thank you!
@median cedar you need to send your API key now
Hey, what i put in URL? https://i.imgur.com/fRQ5KGG.png , like https:/0.0.0.0:5000/dblwebhook? i alredy read the docs but i did'nt understand
ideally it's your public ip
with port and path?
yeah
ok thanks
Guys why my brodcast is illegal for API
what
what's broadcast
probably sending a message to every server or member
hey, i have got problem "unauthorized"
at IncomingMessage.res.on (/home/ubuntu/bot/stable/node_modules/dblapi.js/src/index.js:115:25)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
raw: '{"error":"Unauthorized"}',
body: { error: 'Unauthorized' },
status: 401,
headers:
{ date: 'Sun, 09 Dec 2018 15:21:49 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '24',
connection: 'close',
'set-cookie':
[ '__cfduid=d7a1f6aa763544be0c6fb3efb864521a51544368909; expires=Mon, 09-Dec-19 15:21:49 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': '306676074',
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': '486876b53edbc1ae-IAD' },
ok: false,
statusText: 'Unauthorized' }
token is ok
update to v2.3.0
ok, thanks!
/bots/{bot.id} is giving me 401 Unauthorized even though authorization isn't required?
@arctic arch
ken u should know π©
@restive otter all endpoints require authorization now
authorization is required now
oh
Except widgets
i should know but i dont cos im a busy boi
but i was able to request it without a token just a few minutes ago?
and now its saying unauthorized?
can someone help me to do a votes number
with the api
@restive otter the authorization requirement was announced 2 months ago and implemented 4 days ago
ah just found the announcement
thanks
docs still need to be updated to reflect that
Yeah docs are really outdated
I still can't figure out ddblapi.js π
I just want to reward my users for upvoting, giving the 200 doughnuts
how do I do this?
So my api token is longer than my screen.. how do i copy it
triple click
oh it does ok thanks
could someone explain how to setup a webhook for voting? i havent really done anything like this before so i dont know what to do
@old river what language?
C#
i just dont know how to set one up
like i have a server i use to run my bot
could i use that or something
You need to post your server count using the API
How?
What language is your bot in?
.js
const DBL = require('dblapi.js');
const dbl = new DBL(DBLTOKEN);
client.on('ready', () => {
dbl.postStats(client.guilds.size)
.then(() => console.log("Posted Stats"))
.catch(error => console.log(error))
});```
Hmmmm
That should do it
That's all?
Yep
π
One more problem
Sure whats up
@obsidian parrot isn't running on dblapi.js
It's running on discord.js
So, will this code work?
What you do is run npm i dblapi.js
In the console and it will install the package so that should work
No worries tell me if there are any errors
Ok
Quick question regarding the rules, I am planning on letting people do a daily command only when they have voted. is this seen as vote locking?
alright, then I will try to just use the webhook stuff. I might go and ask some stuff if I need some help
huh
I'll just let the bot give the reward by checking if they have voted.
thats still votelocking the fuck
I think he wants to reward people that vote
thats rewarding
But claiming the reward with a command
That they can't use if they didn't vote
So it's vote locking but not rly
ok
shortly said, what pokecord does
lol
Theres no announcement so I dont think so
Because idk if it's the site, or something in my bot, because Votes do no longer get processed by my bot (it either doesn't receive any or something else happens)
Looks like a check is messing stuff up....
Even tho it shouldn't since it's a basic "If vote received and bot enabled, do stuff"
Need more information
Moved π
Discord.js
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
How would I make a voter-only command?
maybe....
;-;
link is in the channel's topic
Read the docs
boi
;-;
which part
everything @sand hazel
you speak English?
yes
I am new to this type of coding and have no fucking clue how I am going to do this
Learn coding
which lang ππΎ
I want to know how to have a command for only people who have voted for my bot
which lang 
Suggest, take the codecmady Js course before continuing working on your bot. This will, a.) Helps you learn Js, b.) Make it easier for you to understand the docs.
okay
@young cliff i have no fucking clue how to use webhooks, but everything else, fucking easy
That's why I suggested to take the course
do you even know what a webhook is
If you want to expanded your understanding of Js, then I would recommend sololearns Js course. This course is long, but will teach you everything about js
tbh
if you just work on this project
then google around
you prob learn more hands-on
Lol
who
You and me, lol

π€
Lol
Why was I pinged, I thought fishy was taking care of this ;-;
It's ok
quick question in the line const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server }); would i put a " around the DBLtoken?
i assume i do, but my code doesn't work so im checking to make sure
it would be better to store your token in a different file such as a .env or a config.json
but yes its a string so you will need ", ', or ` around it
@plain timber thanks, and good idea about the .env part (sorry for the ping)
yw
ok, so i just might be a dummy but im currently trying to run this in my bot
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', 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('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});``` Yet when someone votes it doesn't get console logged
if im right the way i should have it setup is
https://Name.glitch.me/dblwebhook for url
and password for Authorization
uh u cant use express and http.createServer
gimme a sec
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
app.get('/', (req, res) => {
// ...
});
const server = app.listen(process.env.PORT, () => {
console.log('Listening');
});
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', 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!`);
});
@plain timber you can
I mean the one i had was straight from docs
plus the code advaith just gave gives the error Error: listen EADDRINUSE :::3000
That means you have another webserver using port 3000
E: error
ADDR: address
INUSE: you figure this one out
@scarlet copper wrong token
i realized that shortly after you said it lol thanks
im pretty sure im not using the wrong token now but i still get the same error
You might have to update the dblapi module
2.3.0 is the latest
if you get 403 when posting stats with dblapi.js it seems like it's because of an ip block
you can't get 403 from us when using dblapi
Using dblpy I'm getting a constant 403 as well when trying to post server count. Am I using a wrong token? Isn't the right token found at https://discordbots.org/api/docs#mybots ? I've tried regenerating a token but still no change.
(s)he uses dblpy
I was just asking to see if anyone was experiencing the same problem.
403 happens when
- The ID doesn't match the token
- Cloudflare blocks you (IP ban)
I will check both. Thanks for the info
@tawny oxide the upgrade only helps with 401, stat posting is unaffected
ooh okay
I fixed the problem. I found out that apparently the script was trying to send the server_count as 0 because it couldn't retrieve it since it wasn't waiting for the bot to get ready.
How can I test my HasVoted without a webhook
Cause I only see a test button on the webhook section
Yw
The reason you can test the webhook is the webhook runs right when you vote and you can only vote once every 12h
@urban vigil what language?
use dblapi.js
what
dont add vote number
?
see
220 vote
just vote
what bug
i just vote but dont + vote number
was it successful
Sometimes, numbers on sites like YouTube and Twitter jump up and down; subscriber counts lag, like-counts bounce all over the place. Why is it so hard for co...
oh :))
but why would i be ip blocked on cloudflare
Oof.
banned
Spam requests
ok
why does my bot's wont count sometimes say 2
and sometimes say 16
and not go up when i vote
Watch the video above ^^
π€
how long does it take for a vote to register?
like a minute or two?
cause it took a few minutes for the api to recognize that i had voted
What do you guys recommend building for a system to manage folks who have voted when enabling rewards?
Not currently using a webhook
I figure I could keep track of it myself however if someone votes, then waits an hour before claiming their reward then my internal time tracking will be off.
As far as I can see the API doesn't provide a date&time for votes.
Is the webhook method the only way to accurately keep track of this?
no, you can use one of their api packages
if your bot gets more than 1k votes in a month however then yes you HAVE to use a webhook
Okay, but how does that solve my issue with times?
so you want to be able to check when they voted?
Aye
hmm
that might be something you can only do with a webhook
cause you could check for when it got the POST
and save that as the time
easier too
Thought so
Honestly it's about time I set up a site, just work and effort I don't really want to put forth.
Β―_(γ)_/Β―
Guess my time delayed issue will have to do.
Actually nevermind, I'm stupid
My problem is non existent
yeah like for me im being lazy right now and just using the HasVoted check in the api
which takes some time to register
If my internal time is accurate and the HasVoted returns false then they should be fine.
from my experience itll still return false a few minutes after someone votes
Which should work fine-ish
while it updates or whatever
It's annoying they don't provide a date or a timestamp
They keep track of it, since its used for the sites internal timer
Never hurts to provide it, but its fine.
like i said most people just use a webhook
so its easy to get a date and time with that
possibly
unsure of how i should go about that
Could just package my bot into a singular class and run it in the background of an ASP.NET project
i havent started making a webhook yet but from my miniscule knowlege you could just create a webserver and host it locally
and have the api send posts there
you use C# right?
Yes.
you can use a weblistener
to look for POST requests on your server
and read them
I've used them in the past, made a small web server I never got around to finishing
wanted an easy system but ran into some issues because my failure to design
Not a bad idea actually
Grapevine(https://github.com/sukona/Grapevine) looks promising
Easier than having to build my own modifications for it
ooo nice
Sure, HttpListener would work fine for a generic listener for the webhook
But while I'm at it I might as well try to do something useful
web dashboard maybe
GrapeVine hasn't been committed to in over a year but it looks promising
Could you add on the website in the "not waiting approval .." Add like how many not are in line before you so that you can know if things are moving and to get a rough estimate on when you'll be checked
Bot
Stupid autocorrect
Thanks
sorry
Why is the api not working with me. .points returns undefined
So does the server count.
I have a bot, else I wouldn't be certified.
Wait do I have to supply and API token in my headers now?
It worked fine without the token for over a month though
They said it would start on the 5th of november. It worked fine for me even a few days ago.
Yeah the change wasn't actually enforced until like a week ago
They delayed the original date
Btw are votes updated faster using a webhook?
I assume yes cause you get the post right away
Instead of using just the api where it takes a bit to update
Yes
So since i get the 403 Forbidden it might be because heroku is banned
im going to get my own vps shortly so that should fix that issue
You could send the ip to DBL and ask them to unblock it
the prob. blocked it for agood reason, ill just stick with a vps
I can check if it's still a problem
@scarlet copper read above me if u didnt yet
Yes it is, thanks
@cobalt ruin can you help me here?
This is wthat I see in documentation
But there are no webhook attribute or and on doest not allow vote
I see DBLWebhook has that on options
But doest not new DBL returns DBLApi?
cause of
@sand hazel its even do not have on('vote')
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
@sand hazel yea, but types do not have that
yeah pretty sure the types are auto gen
not hand typed
and I doubt it's smart enough yet to include declaration in runtimes
@sand hazel i do not include them in runtime π
Does anyone needs help with c# library? Noticed that not that many people uses cs ._.
@honest root I think most associate C# with Windows hosting and those kinda servers always tend to be more expensive than Linux ones :/
@granite marten .core works perfectly on Linux
yea I know, that's why I wrote I think most associate it with windows by default and just leave it there as is
anyways, if anyone needs help with c# - you can ping me
What is the webhook of the dblapi?
it lets you do something when a user votes
I still need to set that up kek
Any news Tonkku??
news on what
How can I make the webhook od Dbots send a message in my server that says User has voted for my bot ?
What language?
Use dblapi.js @restive otter
API down??
Probably not
How do you make the number of servers or the bot there?
Thank you for answering me π
I do not find how we do?
@hollow lily you want to show on the DBL website? Or somewhere else
elsewhere
Then go to #development and say what lib you're using and what specifically you're trying to do
Hello!
const Discord = require('discord.js');
const db = require('quick.db');
module.exports = function(req, res, bot){
console.log(req.headers.authorization)
let amount = 200
let user = req.body.user
if(bot.users.get(user)){
db.add(`money_${user}`, amount)
let embed = new Discord.RichEmbed()
.setColor('BLURPLE')
.setThumbnail('https://i.imgur.com/qzuztfO.png')
.setTitle('Merry Christmas! Thank you so much for voting, ' + bot.users.get(user).tag + '!')
.setDescription('You upvoting our bot means so much! We will be giving rewards for voting soon! Come back tomorrow!')
bot.users.get(user).send(embed).catch((err)=>{});
}
}
I know this is an incorrect way to give the user 200 dollars after upvoting, so how can I do so?
how i can know if someone voted me
console.log(`User with ID ${vote.user.tag} just voted!`);``` ?
vote.user.tag?
what language
Discord.js
with name and discrim
DBL only stores IDs, you should always identify users with IDs
never store tags because they can change
can anyone show me how can I get the id for my bot?
I just copy the id
of my bot
the number is my bot id
and yes, I give me that
you dont have any approved bots so thats probably why
?
So
I have DBL setup
It posts server stats and all that
Bot beside the bots online status
It says ???
Any reason why? It has server count live updating and all that working fine
bot got kicked
Rlly?
let me check
Why would it have been kicked?
Wut
@inner venture You got any idea why my bot would've been kicked?
Well what did it get kciekd for
Must've been early beta
Because it works now
:/
Only released like 3 months ago
Sure, just link me the dbl page for it
Okay
@inner venture Tysm
const Discord = require('discord.js');
const db = require('quick.db');
module.exports = function(req, res, bot){
console.log(req.headers.authorization)
let amount = 200
let user = req.body.user
if(bot.users.get(user)){
db.add(`money_${user}`, amount)
let embed = new Discord.RichEmbed()
.setColor('BLURPLE')
.setThumbnail('https://i.imgur.com/qzuztfO.png')
.setTitle('Merry Christmas! Thank you so much for voting, ' + bot.users.get(user).tag + '!')
.setDescription('You upvoting our bot means so much! We will be giving rewards for voting soon! Come back tomorrow!')
bot.users.get(user).send(embed).catch((err)=>{});
}
}
I know this is the incorrect way to give the user money after voting
but what is?
first google result https://github.com/discordjs/discord.js/issues/1762
huh?
someone asked something else, but deleted the message
after I put a login with discord, the page ignores style.css and my other pages dont work
what vps does most people use for bots?
@swift shore #development pins
@median flicker that code doesn't seem to have anything to do with voting π€
it does
Where
nvm i fixed it
i keep my bots up using a combo of stuff
and none of them are paid services at all like vps
how does that relate to the dbl api
@median flicker what is the right code for that
Or does anyone have the code for when someone votes you can thank them in a message on your server
No but I think you can DM them
@restive otter you need to use webhooks
I can do that
what language?
for node u can use dblapi.js https://discordbots.org/api/docs#jslib
for python you would need to figure out how to set up a webserver
{ Error: 401 Unauthorized
at IncomingMessage.res.on (/home/pi/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
at process._tickCallback (internal/process/next_tick.js:63:19)
raw: '{"error":"Unauthorized"}',
body: { error: 'Unauthorized' },
status: 401,
headers:
{ date: 'Sun, 16 Dec 2018 00:46:49 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '24',
connection: 'close',
'set-cookie':
[ '__cfduid=dd35b3761bfefb409e95f06b7b03526ec1544921209; expires=Mon, 16-Dec-19 00:46:49 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': '61376635',
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': '489d22971a2ab765-CDG' },
ok: false,
statusText: 'Unauthorized' }```
Can someone explains to me
whats does it means ?
ur either ip banned or need to update
^
or i am completely wrong
No i think you're right
but its something about a website
with cloudflare
yeah when i'm trying to update guilds count
hm
tbh it just looks like you don't have access to it
@arctic arch whats this issue about again
ip banned is 403
π© how do people keep mixing up 401 and 403 learn ur response codes
well on DBots It shows the number of guild so i guess it's not the api key
make sure the module is at version 2.3.0
how i do that ?
just reinstall the module
kk
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.
+ dblapi.js@2.3.0
updated 1 package and audited 84 packages in 4.379s
found 0 vulnerabilities
k now its updated
still the error
Is it normal that the vote's webhook triggers it only 50% the time?
No
Where do I find the upvote oauth?
Hey guys im an idiot who doesnt know how to use APIs. Can help?
Im trying to get memes from r/dankmemes
@restive otter what upvote oauth
This is for dbl api?
yeah
what you trying to do?
make a bot that gives people Upvoters rank for voting
My developer is asleep now
So im kinda left here like
It's best you use webhook to record votes, and give ranks that way
wtf do i do with it
from aiohttp import web, ClientSession
import os
import json
import asyncio
import discord
from sites import errors, votes, index
import config
startup_sites = [errors, index, votes]
port = 8082
async def prepare(app):
app["http_session"] = ClientSession()
for file in os.listdir("./contents/data"):
if not file.endswith(".json"):
continue
with open("./contents/data/" + file) as f:
app[file.split(".")[0]] = json.load(f)
for site in startup_sites:
await site.setup(app)
async def start():
app = web.Application()
app["bot"] = discord.Client()
app.on_startup.append(prepare)
runner = web.AppRunner(app)
await runner.setup()
site = web.TCPSite(runner, '0.0.0.0', port)
await site.start()
print("Listening to localhost:" + str(port))
await app["bot"].start(config.bot_token)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(start())
alright
Or learn to code yourself
Hi hi hi
So
We're having some problems with the API
Does it use any sort of caching?
Cause it seems to take some time to realize that the user has voted
I believe there's cache
Yea
My command works like this: it checks if the user has voted, if they haven't, it gives them the link and tells them to run the command again after voting to receive their reward
Problem is that due to cache, the API takes some time to realize that the user has voted
Is there a way to circumvent this issue?
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\aiohttp\web_protocol.py", line 378, in start
resp = await self._request_handler(request)
File "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\aiohttp\web_app.py", line 341, in _handle
resp = await handler(request)
File "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\aiohttp\web_middlewares.py", line 88, in impl
return await handler(request)
File "C:\Users\Administrator\Desktop\ThankBot\sites\errors.py", line 7, in error_middleware
response = await handler(request)
File "C:\Users\Administrator\Desktop\ThankBot\sites\votes.py", line 14, in index
data = await request.json()
File "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\aiohttp\web_request.py", line 543, in json
return loads(body)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
Could somebody give me a link to some sought of docs where I can see the api to detect upvotes
it's literally in the channel topic 
But this is useless to a newbie
I have never handled api usage before
I dont even know where to start
https://perfectly-balanced.as-all-things-should.be/i/7d4t.png well this exist also
assuming you use javascript
np
is the api down? im getting a 520 with dblapi.js
what's .ks
its keyscript (kinda like typescript)
No it's a typo of js
ik, I was jk
dblapi.js?
because you didn't authorize /s
make sure it's v2.3.0
how do i check if its 2.3.0?
in your package.json, otherwise just type npm install dblapi.js again
ooo
npm list dblapi.js
oh shit no wait
can show you current version
smart tonkku is smart
yes
so add the authorization header
o lol
okok
but one thing is that when i put https://discordbots.org/api/bots/{botID} to my URL it works
you're logged in
Okay
If it returns {}
And code 200
Inlcuding auth
{
"server_count": 400
}
What did I do wrong?
Ok nvm it was just taking a bit of time
how to make it like this https://cdn.discordapp.com/attachments/264445053596991498/524418517399765003/unknown.png
Photo by: bobthemoose
Use css and that goes in #development since it's not related to the api
how do i implement voting to my commands
Explain please
like someone votes and that person gets like a vote crate
python
@plain timber are you selfbotted?
w h at
@atomic canopy no, selfbots are not allowed
The picture doesn't update
Oh wait
it does
But in embeds it is showing an old image
give the api time to update
When I click the pictures link it is correct
Just the discord version isnt
You see when you click the link?
it shows 611
cache
^
So just my discord isnt correct?
Ah okay thank you π
you might be able to add a random parm to it so you trick the cache ?
https://discordbots.org/api/widget/448845486515027970.png?random=kjeie
Now it works π±
Thank you very much Xavinlol
So just something random behind the question mark?
?random=something
^
just randomly generate a string or something
but not too long (it broke the image) 
Yes works now thx
i meant logic
i needed it before so i thought might work for that aswell ^^
7 digits is the limit btw just tested it
Btw if anyone using NodeJS wanna skid:
let charset = ['e', 'r', 'o', '2', '5', '0', '7', 'm', 'b', 'c', 'u', 'n', 't'];
let random = '';
for (d = 0; d < 6; d++) {
random = random + charset[Math.floor(Math.random() * charset.length)];
}```
interesting charset
Yes its error2507 and MemberCounter
Tonkku is this worth a pin? xD
Or for #312614469819826177
membercunt
neither
also, this is better
function randomSelection(choices) {
return choices[Math.floor(Math.random() * choices.length)];
};```
No o is second index
Okay Tonkku π’
Hi. I need some help with the javascript lib api. I'm trying to log everytime someone votes, but I don't seem to be able to get it to work. Can someone help me? perhaps by providing an example of how you got it working.
you need to use webhooks
so you'll need to add the code in your bot and add the webhook info in your bot's edit page
there is an example in the docs
i dont know how to create a commands Vote for Bot In DBL π¦ sad
sad indeed
quite
Is it possible to make a bot using Python?
I am new to the Discord API and have not yet looked into it.
yeah...
Cool
@tight sparrow yes, using discord py or discord py rewrite
I am not familiar with the libraries, which one should I use?
I recommend going to discord API server for help with that
@tight sparrow discord py rewrite
@plain timber you mean I need to add the webhook URL in the dev portal of the bot?
I've never used webhooks before, sorry if I need more details.
what is api
application programming interface
Apple pie ingestion
apply penguin intelligence
alliance of the pretty intelligent
audio penetration interface
API:
A - Move
P - To
I - #memes-and-media
!play
https://i.imgur.com/XvSG6s5.png where can i find this token?
is this the normal discord bot token?
@rancid kiln your bot will need to be approved
You can get it from API docs or your bots edit page
okay
Is it possible to use dblapi.js without discord.js/eris (without a discord bot client)
Yes
It tells me: unauthorized when i do:
const dbl = new DBL('SENSORED_TOKEN');
dbl.getBots().then(bots => {...}).catch(console.error);
maan i have to wait and have luck so that i can impliment my dbl command :(
@restive otter youre on an old version of dblapi.js
Oh sorry
@LΓΌck#8946 buy a new computer
yea i need some help with the webhook an api s h i t
Understandable
how to get the amount of servers my bot is in onto the website, ik webhooks and stuff but i am c o n f u s i o n plz h e l p
Read the d o c
i have but im still c o n f u s i o n
@sharp elm wot language
discord.js
i want the server count on the bots page and i already have code for when someone votes it sends a message i just need help with the api s t u f f
@plain timber
So you have the const dbl = new DBL(...) code?
K so can u paste that line
what line you need
That should post serve count to the website 
In your code do you use client.on or bot.on
bot.on
K so in the const dbl line change client to bot
Wait what
You have const client bot you're using bot.on???
Looks like your code isn't right
Did you just copy and paste it 
Cuz if you used const client that would mean that bot.on wouldn't work
Unless you did const bot too
i wrote it but wrote it from the docs
fixed it
i thought i was using client but im using bot y e e t
fixed
read the error
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(token, client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
}) ```
this is from the example
on the docs
idk
Lol
.
suicide is against tos
that's a wrong way to put it
oh ok
Suicide is illegal
Oof
creepy
.
Hi
what can i do with getVotes?
my bot has 6 votes
after dbl.getVotes().then(votes => { message.channel.send(votes.length)
returned 383
is it array?
getVotes is currently returning wrong cached responses
I recommend trying out webhooks for now
idk work with it :/
https://discordbots.org/api/bots/524254377830121483/votes this also returns only 3 when i have 6 votes
on weekends votes are doubled
where will i use it?
on the receiving side for verification
oh i dont understand this π
i used code on website, created another variable
got -Webhook running at http://0.0.0.0:5000/dblwebhook
it took like 20 secs from bot start
now you need to add information on the edit page of your bot
replace 0.0.0.0 with your server's public IP for webhook url
and password is what you set in the code
im not hosting my bot in my pc
will it still work?
can someone vote to test it? π
did you mean to say you are hosting it on your pc
im not
oh
on glitch you have to use port 3000 for it to work
your URL will then be http://project-name.glitch.me/dblwebhook
my project is not running webpage π
its just server side + packages
i deleted everything else
maybe it did something
so, where can i find my token for the api now 
it sends a test webhook
that should be correct with the defaults
what can i expect now to happen?
you should receive a vote event
oh
make sure to save before testing btw
oh
ty
works
omg im still having problems with JSON files in glitch, they are being deleted...
idk why
you should just use heroku to host it it's way easier
heroku doesn't have storage
now the glitch deleted customcommands of 2 servers π¦ π
i saved prefixes
btw this server is blocked from my bot π
we wont read any commands from here
ok
you could always use a real host
@arctic arch, I'm getting a 401 Unauthorized for retrieving bot info, should I gen a new API token or is it something else?
Every endpoint requires auth
i know, but i already have a token
if you're using dblapi.js, update to v2.3.0





