#topgg-api
1 messages · Page 38 of 1
did you open the port. and did you edit the webhook port on ur bot pahe?
So getVotes does return the last 1000 votes of this month
Perhaps updating the documentation wouldn't be a bad idea
¯_(ツ)_/¯
I tried to run the sample python code and this happenedpy AttributeError: module 'dbl' has no attribute 'Client'
the line was ```py
self.dblpy = dbl.Client(self.bot, self.token)
is there a test button so i can code vote events,etc?
yes, on the edit page
yea
sorry for asking im new to coding, but how can i find the url that i have into that text field
or can i put any url in there?
oh okay thanks
the url must lead to your bot, which means you need a webserver
and how do i make a webserver
@sleek topaz don't call your folder or file dbl
Anything but already existing ones' names or dbl
Hello, is that normal that the webpage shows "2 upvotes" where
console.log(votes.length);
})```
shows 21 rows ?
Using javascript api
https://discordbots.org/bot/484127854326710300 on that bot
OH alright
but, something still weird
do u know the refresh time ?
if (votes.find(vote => vote.id == msg.author.id)) console.log(msg.author.name + " has voted;");
});``` does not log once I post, but I've voted 5mn ago
type +risibank test, then vote, then retype +risibank test 😃
every vote counts, the reason your vote is not showing up is dbl api hasnt updated/cached ur vote
tom pls
so instead, you should use a webhook to get every vote live and save it to ur own db, and stop relying on dbl
oi
that pfp
i dont liike it
Ummm, I'm trying to add bots but its using my old account instead of this one
Check #460037222331187200
Thank you
What if I get more than 1k votes a month and still use getVotes
What's gonna happen
🤔
It will just get most recent ones I'm guessing

@polar mirage the endpoint will return exactly what it says it will return
Doesn't say anything about it being the monthly votes
But okay
Wouldn't say "exactly"
Just use webhooks they are more efficient
yes yes
use the webhook
Yes
Setup a webserver that accepts POST requests and point DBL to the url where you want to receive the data.
I need help.. I need a bot for patch notes for an app on Google Play and the App Store
I figured as much lol. Where would I need to go?
@topaz wyvern ty 👋
np
What is an api and webhook?
const userID = message.author.id
const url = `https://discordbots.org/api/bots/${botid}/check?userId=${userID}`
const snek = require("snekfetch")
const voted = await (snek.get(url)).body``` Im trying to fetch the voted from the page
but the output is always undefined
isnt the page a json ?
okay thanks
exports.run = (client) => {
client.user.setActivity('Suggestions', {
type: 'WATCHING'
});
console.log("\n---=[Events & Commands has been loaded succesfully!]=---");
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
}
is this right?
for posting the stats for my bot?
yeah that should work
How can I check if someone has voted for my bot? I don't really understand this... /bots/{bot.id?}/check Like how to use it
@restive otter what language?
i dont believe it has support for thtat
Yeah I saw the example for updating server count. But I don't know, its a bit complicated
yes
just make a request to that url
My bot url right?
https://discordbots.org/api/bots/BOTID/check?userId=USERID
Oh alright
you'll need to set the Authorization header to your bot token
Whats that? If its in the post_server_count example I have it, because i use it to post server count
shoudltn the lib dot hat
Alright, thanks a lot
exports.run = (client) => {
client.user.setActivity('Suggestions on ${client.guilds.size} servers', {
type: 'WATCHING'
});
love when this dont work
xD
am dead
use ` not '
Well I get an error "Unauthorized" 🤔 Luca
U did not send auth header then
This is what I have
@commands.command(pass_context = True)
async def test(self, ctx, user: discord.Member):
url = "https://discordbots.org/api/bots/408439037771382794/check?userid={}".format(user.id)
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
asd = (await resp.json())
print(asd)```
How do I do that @sudden depot
I dont speak snake but where do u seend the auth header
did you send the Authorization header?
How
check the docs for the request lib you're using
So somthing like
requests.get(url, header='token')```
idk python or whatever request stuff ur using
Pfff get error 'header'
Anyone knows python here? lol
For example how do you do it in js?
I must use only token? or it needs bot id too?
well the id is in the url
Got it, but now I get other error. add userId = to your request
but i do have it
I think its because "i" is not capitalized
hold on
Yup
Works. Thanks a lot Luca
lol
how do i get a webhook url?
@ripe linden you need to set up a webserver to receive the post requests that DBL will send
what language are you using?
js
you can use the dbl js lib
or, if you already have an express webserver, use that
heres the js lib docs https://discordbots.org/api/docs#jslib
i have an OVH vps and dont know how to create a webhook url
use the dbl js lib i linked...
@plain timber authorization header is unnecessary to do when using dblpy :^)
Does GET request even require auth?
yeah
Oh, my bad
for my webhook port can i use ssh?
wwut
no
how to fix this?
@uneven hill looks like you didnt specify your token
https://discordbots.org/api/docs#mybots token from there?
hi
In how many minutes does it update when someone has voted?
For example i have a comment which Icheck if someone has voted or not
It respons with 0 if he didnt vote, but if he did it responds with 1
But when he votes it needs like some time to update
so you're using the endpoint, it should be pretty fast, I don't think it could be more than a minute but I haven't used the endpoint in a while so idk
meanwhile the webhook updates almost instantly
depends on what language
you can probably just look up "[language] webhook tutorial" and find something but idk
I use a super ghetto system that sends it to my website, which sends it to a discord channel for easier logging 
looking up "python webhook listener" seems to bring up quite a few things, I'm very unfamiliar with python though so I can't help you
ok ty
npnp
Are the webhooks working for you guys 🤔
@summer oracle @surreal junco Sorry, there was an issue with the queue, all the backlog of votes should process now

Ping me if anything else happens, shouldn't though, thanks guys
Will do

Is it working now?
If I use the webhook test it works
But when someone actually votes, nothing gets send
¯_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
nvm works now
So i am using discord.js and host on glitch.com, for letting my bot be always online, i use this script:
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://nitrodiscordbot.glitch.me/`);
}, 280000);
And now i want to use a webhook from dblapi.js to receive upvotes, so i have to use this:
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
But i can't use both(when i use 2nd script, first won't work -> my bot goes offline)
What can i do?
not use glitch
...
Is there a way to disable autostatsposter?
And are there some other free services, that run NodeJs ? (I don't understand Heroku)
best solution, get a vps
check the example of linking the webhook to an existing http server
Hey does anyone know if theres a way to get check which servers are using ur bot like exactly like with a discord invite and everything ?
using Js
i think fetchInvites needs a permission. but you can do:
client.guilds.forEach(guild => {
console.log(guild.name);
});
Btw, here you can see the properties of a guild (maybe you need it)
https://discord.js.org/#/docs/main/stable/class/Guild
wrong channel
Still
# 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)!```
[04:53:58:527] Updated Discord Bot List Stats! {} { 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) raw: '{"error":"Oops, I think a bad happened, I\'m trying again just hang in there"}', body: { error: 'Oops, I think a bad happened, I\'m trying again just hang in there' }, status: 500, headers: { date: 'Wed, 05 Sep 2018 05:03:58 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '77', connection: 'close', 'set-cookie': [ '__cfduid=d94a2e706daf21b9b2b23f1e3734650361536123838; expires=Thu, 05-Sep-19 05:03:58 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ], 'x-powered-by': 'Express', etag: 'W/"4d-bawlvXmIX77Lqj+rNFbli5+PTRI"', 'x-cacheable': 'NO', 'x-varnish': '92700718', 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': '45562704a85c6be6-SJC' }, ok: false, statusText: 'Internal Server Error' }
0|jb | { Error: 500 Internal Server Error
0|jb | at IncomingMessage.res.on (/home/pi/Desktop/jb2/node_modules/dblapi.js/src/index.js:115:25)
0|jb | at IncomingMessage.emit (events.js:185:15)
0|jb | at IncomingMessage.emit (domain.js:422:20)
0|jb | at endReadableNT (_stream_readable.js:1106:12)
0|jb | at process._tickCallback (internal/process/next_tick.js:178:19)
0|jb | raw: '{"error":"Oops, I think a bad happened, I\'m trying again just hang in there"}',
0|jb | body:
0|jb | { error: 'Oops, I think a bad happened, I\'m trying again just hang in there' },
0|jb | status: 500,
0|jb | headers:
0|jb | { date: 'Wed, 05 Sep 2018 05:10:40 GMT',
0|jb | 'content-type': 'application/json; charset=utf-8',
0|jb | 'content-length': '77',
0|jb | connection: 'close',
0|jb | 'set-cookie':
0|jb | [ '__cfduid=da68843e4d2ccb122d4e8932c0495c0d21536124240; expires=Thu, 05-Sep-19 05:10:40 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ],
0|jb | 'x-powered-by': 'Express',
0|jb | etag: 'W/"4d-bawlvXmIX77Lqj+rNFbli5+PTRI"',
0|jb | 'x-cacheable': 'NO',
0|jb | 'x-varnish': '80054117',
0|jb | age: '0',
0|jb | via: '1.1 varnish-v4',
0|jb | 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
0|jb | 'x-content-type-options': 'nosniff',
0|jb | 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
0|jb | server: 'cloudflare',
0|jb | 'cf-ray': '455630d55c009cf6-AMS' },
0|jb | ok: false,
0|jb | statusText: 'Internal Server Error' }
``` help
Site was down
I am just getting a white screen on the site so something is happening
Is it possible to post the shard count with the python api wrapper?
dblpy lib
how can I check if someone hasVoted ?
I want to do some commands to be vote-only
I tried using the library
but it doesn't work
lib?
javascript
@restive otter what was the issue with the dblapi.js lib?
let me try it again and I will send you the error
It tells me "Cannot read property 'hasVoted' of undefined"
can you send your code?
sure
const Discord = require("discord.js");
const superagent = require("superagent");
module.exports.run = async(bot, message, args) => {
let hasVoted = bot.dbl.hasVoted;
if (!hasVoted(message.author.id)) return message.channel.send("You need to up-vote the bot to use this command.")
let {body} = await superagent
.get(`https://nekos.life/api/v2/img/Random_hentai_gif`);
if (!message.channel.nsfw) return message.reply(":underage: NSFW Command. Please switch to NSFW channel in order to use this command.");
let hentaiEmbed = new Discord.RichEmbed()
.setColor("RANDOM")
.setImage(body.url);
message.channel.send(hentaiEmbed);
}
Sorry if I made any mistake it's 4 AM here so I'm kinda braindead.
you didnt put the const dbl blahblah code there
const DBL = require("dblapi.js")
const dbl = new DBL('Your discordbots.org token')```
add that before your module.exports.run line
uh
looks like there are some more issues
let hasVoted = bot.dbl.hasVoted; not needed
oh aight
here use this
let voted = await dbl.hasVoted(message.author.id)
if(!voted) return 'you have not voted stuff'
yw
Nope
I have another problem now.
It all works, but after people vote it still doesn't work
Like I mean , you get the message that you didn't voted, you go to vote and after you retry the command it still says that you didn't upvoted
lemme try
Ok, so after I voted and restarted the bot
it says true
let me try with another guy
yeah
It says false
@plain timber Sorry for pinging you, but did you find a solution to this?
anyone have an idea as to why this is just giving me the regular array, not just ids and not only in the past day?
upvotes = await self.dblpy.get_upvote_info(onlyids=True, days=1)
iirc onlyids was removed
rip
its still in the docs and the current version of the python library
oh well, I more care about the days
its easy to get past the id stuff
maybe the python lib wasnt updated
but its not in the actual api docs
however you may want to use this
Look at the above image and read it. Then use logic 
Does the js lib create its own webhook or do you have to handle all that yourself?
How do you expect getting information about who voted by sending a webhook message?
It's talking about you having a webserver that will accept POST requests, and then it's up to you to forward that request to your bot
Example link would be https://your.ip/port
Thanks
@tidal burrow let ur bot get the vote.user (e.g voter's ID) and thats it
i need help i cant really figure out how to use javascript library on weebhoks
i mean i dont know how to provide a weebhok password and stuff
weebhook
webhooks need passwords and stuff? 
it helps, but they aren't needed usually
can someone help me set up a webhook with python to get voter ids over the past day?
@high iris a webhook is basically DBL telling you "this person just voted", if you want to store the webhook data you'll have to use a database
For the Python api if I wanted to do https://discordbots.org/api/bots/<botid>/check?userId=<userid> how would I get the authorization
you can find your token in the edit page of your bot
not the question
i think they mean sending it
and check the docs for whatever http request library you're using @restive otter
it should have something for setting headers
How can I make a Vote command?
@torpid rivet a command that checks if someone has voted?
@plain timber ah I see should have been easy
@cobalt ruin Are the webhooks down?
Sorry I should post an update here as well
We are investigating downtime / increase latency in web hook POSTs - we believe this is being caused by a third party hosting provider.
I see, was this posted in like certified or something? 😂
Yea 😛
Haha
Can confirm to any of you still having issues, webhooks are 100% instant again 👌🏻

I'm gonna need a little walk through on how to get webhooks to work in python.
I just wanna check if a user has voted
Webhooks immediately notify you when a user has voted, you cant (unless you store the user ids) check if a user has voted through webhooks.
i have basically no knowledge of python myself, but there should be lots of tutorials online because you're basically just listening for a http request from dbl.
Does searching for tags not work? https://discordbots.org/api/bots?search=tags:music
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/root/wowsb-bot/cogs/wowsb.py", line 149, in update_stats
await self.dblpy.post_server_count()
File "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Incorrect DBL token
do we need our "token" as well on fetching a bot's stats

Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/root/wowsb-bot/cogs/wowsb.py", line 149, in update_stats
await self.dblpy.post_server_count()
File "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
I get an error even though I input the token correctly.
is it bad to post server count everytime a new guild is joined or should i do it on an interval?
The interval is better if your bot is somewhat big
yeah i have to shard aswell so
would an interval in the ready event update correctly tho? and if im sharding one shard is going to be ready before the other one so it would drop the server count then go back up
Guys how can i post my bot stats to DBL?
@restive otter what language?
i tried this but it posts wrongly
can you explain?
example: my bot's server count is 4100 but it posts 1300
i think it posts just one shard
try removing client from the new DBL and instead use dbl.postStats
what library?
Discord.js
@arctic arch d.js
it should auto-detect shards
so what code i will write
Just dbl.postStats(client.guilds.size, client.shard.id, client.shard.count)?
thats what the library should be doing, what do you get when you console.log those values
Lol
pls help me
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
do i put this in the discord js ready function
or outside of it
?
it's no't a work
what
const DBL = require("dblapi.js");
const http = require('http');
const dblApp = express();
const serverino = http.createServer(dblApp);
const dbl = new DBL(config.dblapi, { weebhookPort: 1337, weebhookAuth: "somerandomPASS", webhookServer: serverino }, bot)
//DBL API SETTINGS
dbl.on('error', e => {
console.log(`DBL API ERROR! ${e}`);
})
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!`);
});
/*dbl.on('posted', () => {
console.log('Server count posted!');
})*/
why is not logging the weebhook
it should log this
Webhook running at http://${hook.hostname}:${hook.port}${hook.path};
kool
bwhahahahhahah
i did but im having a hard time telling my bot.js file where it is. This is what I have:
const dbl = new DBL(config.dbl, client)
and it doesnt work?
no
i get this error:
C:\Users\Josh\Documents\GitHub\Skywarn>node .
(node:15260) UnhandledPromiseRejectionWarning: DiscordAPIError: 404: Not Found
at item.request.gen.end (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15260) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15260) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
that seems to be unrelated
(node:9188) UnhandledPromiseRejectionWarning: Error: This function requires a token to be set
at DBLAPI.postStats (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\dblapi.js\src\index.js:139:28)
at Client.DBLAPI.client.on (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\dblapi.js\src\index.js:54:14)
at Client.emit (events.js:187:15)
at WebSocketConnection.triggerReady (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:125:17)
at WebSocketConnection.checkIfReady (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:141:61)
at GuildCreateHandler.handle (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
at WebSocketPacketManager.handle (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\ws\lib\event-target.js:120:16)
(node:9188) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
^C
C:\Users\Josh\Documents\GitHub\Skywarn>
its not related to dbl @half acorn
what?
that console.log thing, i can't figure out where to put it
console.log is just to see what dbl.token is
(node:26206) UnhandledPromiseRejectionWarning: Error: 500 Internal Server Error
at IncomingMessage.res.on (/Aurora/node_modules/dblapi.js/src/index.js:115:25)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:26206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
yeah DBL is having issues
should i just disable the api part of my bot now until it is resolved
no need, it shouldnt cause problems
just .catch it
oh duh 🤦 ya i'll do that instead
sorry i have been coding all day my brain is slightly fried
lol
I am refactoring my bot and is going to take a while so since it is the weekend i thought i would spend the day working on it but is frying my brain
making me realize how bad i did the first time too 😂
Hi, i found this: https://www.npmjs.com/package/dbl-api. But idk how i can use it or if it is still useable. Info: I use discord.js and host on glitch.com
Does anyone understand why im getting this when i try to auth my bot...?
https://gyazo.com/232052366e6eeec27587191e49ea3e9d
idk why it stopped working 
Probaly Miki Rest updated but the Lib didnt
@restive otter https://discordbots.org/api/docs#jslib
why
It works fine for me when I use glitch
you use glitch?
Yes, I can't afford a vps currently
oof
@topaz wyvern use (Heroku)[https://www.heroku.com/]
no
why
What
What
Do you know how bad Heroku is?
-
Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
-
Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
-
Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
-
Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
-
Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
Half of their servers are banned from Discord, afaik
Type of the vote. Is always "upvote" except when using the test button it's "test".
Where can i find this test button?
Atleast glitch can write files without reverting back
Oops! Error: 403 Forbidden
did you replace it
@humble bison TYSM
np
i am stupid, now i found where i can set the link to the webhook 🤦
lol
Oops! Error: 403 Forbidden
did you set your token
iirc 403 means there is a token but its wrong @fringe bear
someone help me change token is did not work
oh
at IncomingMessage.res.on (/rbd/pnpm-volume/32032b92-43ab-4834-81ba-73835762a4c1/node_modules/.registry.npmjs.org/dblapi.js/2.2.0/node_modules/dblapi.js/src/index.js:115:25)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)
(node:15620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15620) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
you sure you have a token?
403 is wrong token
Isn't there an uptime limit per month?
Not really
Well, those hours kept expiring for me when I used Heroku. My bots never went offline because of that
lol...
heroku is never made for discord bots support
use glitch with uptime robot inside ur file
@arctic arch @cobalt ruin webhooks dead again
should be good now?
can confirm it works, thanks!
np
What is the channel for bot commands?
#commands and #265156322012561408 but here is not the place to ask
how comes that the webhook die all the time tho?
how can that even happen
shouldn't it just have a queue and if something is in the queue try to send if finished go to next one
thats literally what it is
things can break in various different ways
hmm
well thats easy to handle
just add this snippet to your code:
if (things.areBroken()) {
things.unbreak();
}

Uncaught ReferenceError: things is not defined
const things = include("things.js");
pretty sure I did that right
wrong
is include a thing?
no
sorry
wut
import { weeb } from 'life'```
const thonking = ("thonking.js"); tonking.thonkicide();
So what is this API for?
mostly for posting your bot's server count to your bot's page
api for reading the channel topic
How can i use dbl vote check ?
I tried this ;
dbl.hasVoted(msg.author.id).then(voted => {
if (voted) {
if has vote
} else {
if not
}
});
But doesn't work
.hasVoted checks within the last 24 hours
Code is not working

@alpine raven use google 
Fun
m
How can I know my port, password and token please in the code :
const dbl = new DBL (yourDBLTokenHere, {webhookPort: 5000, webhookAuth: 'password'});
DBL token is on the bot's edit page
Ok
Webhook port and password are specified by you when setting up a webhook :^)
Ok thanks ^^'
{"name": ..., "channel_id":..., "token": ... , "avatar": ..., "guild_id": ... "id": ...}
what is the port?
wdym
const dbl = new DBL (yourDBLTokenHere, {webhookPort: '5000', webhookAuth: 'password'});
where is the port in the code above in the page :
{"name": ..., "channel_id":..., "token": ... , "avatar": ..., "guild_id": ... "id": ...}
or in the setting of the webhook
you set the port, then in the webhook address put that :port
So if I put port: 1895 it will put 1895?
but now I have that :
dbl.webhook.on('ready', hook => {
^
TypeError: Cannot read property 'on' of undefined
dbl.webhook is undefined 
const dbl = new DBL(tokendbl, bot);
Anyone know why he does not find my vote when I did it?
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id == message.author.id)) {
}
})
owner votes don't count iirc
Even the players can not make the command ...
Would it be possible to know when will it be repaired?
The DBL webhook for votes is a bit buggy too, I can't get get it to work
how do I get the guild icon when it's the letters? (oauth)
like the default guild icon
what do you mean
oops meant to send in #development misclicked
await dblpy.get_upvote_info(days=1) just gives me the last 31 days instead of 1
was onlyids and days removed?
yes
may aswell remove that shit from the api imo, going to use webhooks then
its still useful
i
🅱️urst
how does the website know a bot is online
because somehow two of mine show as offline with a ???
its status in this server iirc
what about
profile images
Your cache
I even tried with another browser and they dont show
removed cache
still default greenies
submit an edit
Can you confirm the online status being based on this server while your here 🤠 ?
seeing as the bots are not here, we also can't detect avatar changes
status is based on this server

might not have been reinvited
Ok the Edit updates the profile image nice
How do I get them re-invited in here
or can I just manually join with them
mh #topgg-api might be wrong category by now
from flask import Flask, render_template, request
import requests
app = Flask(__name__)
@app.route('/hook')
def votes():
What do i type o.o
if __name__=='__main__':
app.run(debug=True, host='IP', port='5000')
ive got everything setup correctly, not sure how to exactly get the data. has anyone used flask b4?
i.e im getting requests from the site, but just dont know how to use it
json.loads(request.data) hahayes
can anyone help me how to code my bot on mobile pls
^
I can confirm what Arda#0061 reported in Saturday, DBL in d.js (dblapi.js) seems to be posting server count only from first shard unless we both did something wrong lol
(await client.shard.fetchClientValues("guilds.size")).reduce((prev, val) => prev + val, 0) gives 289 , await client.shard.fetchClientValues("guilds.size") gives [ 147, 142 ] (don't bother why 2 shards at such servers amount just testing forward xD)
site currently reports 150 servers - 2 shards, inconsistency could be due to some servers leaving since last post or am I doing something wrong?
the real question is why you're sharding at 300
irrelevant
just to test out how sharding works etc
much rather do it at 300 than be forced to do it when it hits the limit
or just do it at 1k
ok nvm I get it now, it works as intended, its just supposed to run from each shard and I was limiting it only to the first one for some reason because of webhook (I ended up limiting just the webhook in the first shard), I guess Arda is doing something similar 
Is webhook working rn?
^ yeah are webhooks dead?
yes
@arctic arch @cobalt ruin hi webhooks no work plz magic
I have same issue ^^^
is the vote thing down?
somehow i dont get any calls anymore if someone votes
yes its down
I Want My Robot Used After The Vote. How Do I Do That?
Why is @Discord Bot List Ofline?
- why is this a relevant channel for that?
- why did you just try to mention a server?
Not server... He mentioned the entire fucking app called Discord
This aint twitter buddy
it's obvious that @Discord Bot List was meant to be one whole thing, so yes, he tried to mention the server since that's the name of the server
He meant @wild lantern
..
🤔
I had an error for dlbposter: ```
0|main | RangeError: You need to provide a client to bind to, either in the constructor of dblposter or in the bind function!
0|main | at DBLPoster.bind (/root/bot/node_modules/dblposter/src/index.js:38:22)
0|main | at Object.<anonymous> (/root/bot/main.js:32:11)
0|main | at Module._compile (internal/modules/cjs/loader.js:689:30)
0|main | at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
0|main | at Module.load (internal/modules/cjs/loader.js:599:32)
0|main | at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
0|main | at Function.Module._load (internal/modules/cjs/loader.js:530:3)
0|main | at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:75:21)
0|main | at Module._compile (internal/modules/cjs/loader.js:689:30)
0|main | at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
0|main | RangeError: You need to provide a client to bind to, either in the constructor of dblposter or in the bind function!
const dbl = new DBL('token', <client>)
<client> is what you defined Discord.Client() as (ie. bot, client)
Oh wait
Are you using a third party api?
@wanton finch
https://discordbots.org/api/docs#jslib is the js lib
ARRIBA ESPAÑA
Hello, someone knows a bot that has custom commands and can do this: for example I create a command /lol and it executes the command %weather of another bot
OMG
non related questions yes
wht
@wet tapir you could have it send the activating command but if you don't own the other bots almost all bots block other bots from running commands
in the event that you own the bot yeah u could
(both)
@inner venture link to probably nsfw video
what
For d.js, is api the packages?
wut
How i can post my guild size? And my shard count? Im trying use it in ready events but its not working
they are deprecated 
nah
oof
what
how I do it is I have a while loop in ready event, and it posts server count every 10 minutes while bot is online
Idk how to get the token
@limber night what language?
Js
use the DBL js library
Are the dbl token in edit session?
to get your api key go to https://discordbots.org/api/docs#mybots and click on a bot
wot
Any method for posting the guild count?
I will try it
@loud gulch stop linking to #312614469819826177
didn't my fucking post mean anything
tony, they are called "examples" for a reason
no it didnt
devi, they are in the "other channels" area for a reason
TonkkuToday at 6:32 AM
This channel is an archive of old examples.
Please see https://discordbots.org/api/docs for new examples and libraries```
👏
you can still use it as example 
it's still useful for those that don't know what an API even is, and how it looks like in code, nor how to use it in their language
they can still use that channel as a reference
but like
they aren't even guaranteed to work
^
stop referencing to them

i'm gonna get somebody to delete the channel
nou
for the love of god, how am I suppose to tell you that I'm not telling them to actually USE them in their own codes
linking them to it = telling them its ok to use it
omg
it's... fine be it your way, idfc anymore
linking them to use it as an example
learn from it
not saying to actually use the code itself
some of it still works
sam just leave it, it's impossible to talk to him
yes i see
smh
i agree with @humble bison
ok
Why am I getting 403 when I try to send my server count?
Incorrect token
403 is not found
Meaning the page you sending the post info is not valid
Or incorrect token
!çal senden daha güzel atatürk
Adaaam
Probably a simple one you get a million times a day - I got my API auth code and I'm supposed to put it in the authorization header, but I have no idea where that is.
f
@vale onyx what are you using to something involving your api token
I got it figured out - thanks 😃
It wasn’t an error with the API key, but with the service it was tied to
oh ok
s
Hi everyone, do you know how do I choose the webhook hostname please ?
What do you mean?
👌
For some reason I'm getting 400 errors trying to post my bot stats. It all works just fine in the Postman program but not in my code. I fail to see why 
This is the entire response I get back: https://p.nobooli.me/xacawifeto.js
I'm using node-fetch (https://www.npmjs.com/package/node-fetch) and I have temporarily hardcoded server count and ID while testing:
const test = await fetch('https://discordbots.org/api/bots/376520643862331396/stats', {
method: 'POST',
body: JSON.stringify({server_count: 75}),
headers: {
Authorization: process.env.discordbotskey,
'Content-Type': 'application/json-rpc'
}
});
// temporary code to log the response, normally the fetch is not assigned to a constant at all
console.log(inspect(test, {
showHidden: false,
depth: null,
color: true
}));
the method of posting should work as this works just fine for the strawpoll API and is also the documented method for node-fetch
await fetch('https://www.strawpoll.me/api/v2/polls', {
method: 'POST',
body: JSON.stringify({
title,
options,
multi: false,
dupcheck: 'normal',
captcha: true
}),
headers: {'Content-Type': 'application/json'}
})
Try setting content-type to application/json? I can send the request in postman if the content-type is application/json but not application/json-rpc @restive otter
just a thought
huh.. that's odd. I meant to put it as application/json but copied it incorrectly but when removing the Content-Type header altogether it doesn't work either. I thought it would default to application/json 
ohwell, problem solved I guess.
How do I make a server invite for another server ?
get that other server by ID or name, get a channel by ID or name on that server and then create the invite for that channel
I can’t I’m not in it but I have the server name
Someone keeps asking me does help and they won’t invite me to their server
if your bot is not on the server for which you need the invite you cant do it
so you are trying to break into their server instead?
They don’t know how to get a server invite to me
this isn't even #topgg-api related, move to #development
Thanks
this isn't even #topgg-api related, move to #development
@ripe linden you run the code on a specific port specified in the constructor/default is 5000 iirc
so get your vps's ip and add :5000
1.1.1.1:5000
https://discordbots.org/api/docs#votes
https://gyazo.com/f76c03b3a6d227a686407b9133bdd779
https://gyazo.com/e297de3c320499370f7d67567ba5f330

Yeah they changed it guess they forgot to update the docs
when i initialize the dbl client, pylint is saying that Module 'dbl' has no 'Client' member?
you know you have to define it after you define discord client and stuff
i mean i don't know python lmao
but i got an error similar to that with js
i had to define all of discord and client beforehand
yeah ik, i did that
@covert sun Don't call any file (that probably includes classes) dbl
Does it work to write who voted the bot?
With DBL API
@restive otter are you asking can you check who voted
yeah
this is invalid?
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
idk js
@noble iron I have one more question
I know I'm stupid
I do not know where I find my token
🤷
for my bot?
yes
@noble iron ```js
{ webhookAuth: 'password', webhookServer: server }
but where can I find them?
idk
oops
I have a discord.py rewrite quesition
where can I find it my token?
discordbots token?
okay
i send dm
According to his first messages he was asking how to get a token for his bot on dbl
then a few moments later he said:
no, I am trying to add my bot to the site(edited)
discordbots.org
bir Türk olsa ne hoş olurdu şimdi :unamused:
-GabrielSSQ#4863
@tidal burrow they just said "find it my token" I assumed they meant their discord bot token since they didnt have the bot developer role
but they did mention dbl though
I only said not API related after they said they were trying to add their bot to the site...
Hey I’m having some trouble figuring out how to check if a user has voted so they can use a command in python
Haven’t really used dbl at all so I’m pretty clueless
2 ways, make a request to the check endpoint or use webhooks and cache users
@topaz wyvern what category?
What lang you use?
for my bot?
Yes
English
...
or my lang?
No what programming language do you use for the Bot
aha :)) discord.js
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
yes and?
Use that section to find out how to post servers to dbl
like this
bot.on('ready', () => {
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
});
Yes
Did you restart the Bot
yea
It probably works. It's waiting 30 minutes to POST.
throw err;
^
Error: Cannot find module 'dblapi.js'
dont say to me do npm i dblapi.js because ive already done that, and the file it says the error in isnt even requesting anything to do with that, and it says the error is on a blank line, wtf could be the problem
what does --save even do
Or npm i -g dblapi.js
-g is for global
^
i dont think youll need it for global
🤷
wb dis error
C:\Users\User\Desktop\CatManiaBot FullRelease\index.js:278
const DBL = require("dblapi.js");
^
SyntaxError: Identifier 'DBL' has already been declared
there is nothing on that line even close to being related to dblapi
Yes
Your file already has a variable called that
correct
is DBL and dbl the same, even though they are not the same because caps
Pretty sure they are never had to deal with that
stoopid website shudnt have them the same then
the website example should be the same
yup, i figured that out, i used the find thing to find all lines that have dbl in it and its only declared once so why does it give error
no other file has this code
did you wait the 30 mins
also you know you can for loop instead of putting multiple fs.readdir
i dont care and yes
ill try again...
wait
no, i didnt wait because my bot doesnt turn on because of a non existent error
@shut ibex
https://media.turtle-bot.com/f/iXIDg.png you should put this about the message event
did that, then i removed anything that had the phrase dbl in the index.json, still getting error saying it is already declared
wait new prob
const dbl = new DBL('im hiding this part', client);
^
ReferenceError: client is not defined
@shut ibex
i meant like put put it right here https://media.turtle-bot.com/f/TbWkp.png
client still not defined
it should be
oh
https://media.turtle-bot.com/f/s83Dg.png move ```js
const dbl = new DBL('oof ignore this shit', client);
to where the red arrow is
@restive otter You showed your api key...
f
and your bots token is there...
fuck
screw thr yt api that doesnt really matter, and why tf would u say all that is there, then people will just go look
const server = http.createServer(app);
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.key, { webhookAuth: process.env.pass, 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!`);
});```
Can someone help me with Webhooks?
My console just says Webhook running with path /dblwebhook
is that right?
Sounds about right
hm
docs
You could try testing it with a Test button :^)
so this is the url that we can use to get info about whether or not a person has voted... how do you specify a user in Python? (I still don't quite get how this all works)
it literally says in the field: userId
but I don't recommend checking if a user voted after every command locked by upvotes
since you'll get banned from dbl api for 1 hour if you exceed 60/60 requests
I guess I would be better to check after a certain interval?
use a webhook, save the votes to the DB.
will be almost instant, best experience for your users and no api ratelimit problems
Test
hey, quick question. How do i know what webhook password i should use?
im trying to get a onVoted function
@restive otter Use a LONG password, of your choice
ok, thanks
i get the Webhook running message, but i dont get a webhook when someone upvotes?
Language: NodeJS
Code:
const DBL = require("dblapi.js");
const dbl = new DBL(*token*', { statsInterval: 900000, webhookPort: 5000, webhookAuth: '*password*!' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`new vote`);
console.log(vote)
console.log()
try {
*secret code, sorry*
} catch(err) {
console.log(err)
}
});
Console Output:
webhook running at http://0.0.0.0:5000/dblwebhook
even when i upvote using my friends account, i still dont get a new vote in the terminal
plz help ~w~
@restive otter what vps provider are you using
Hosting it locally, and yes all ports are forwarded to my computer
what url did you set on the website
Wdym
const DBL = require("dblapi.js");
const dbl = new DBL('{token}', { statsInterval: 900000, webhookPort: 5000, webhookAuth: '{authPassword}' }, client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted at: ' + client.guilds.size);
for(var i = 0; i < client.guilds.size; i++) {
console.log(client.guilds.array()[i].name + " : " + client.guilds.array()[i].id + " : " + client.guilds.array()[i].members.size)
}
})
dbl.on('error', e => {
console.log(`Oops! ${e}`)
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`new vote`);
console.log(vote)
console.log()
try {
*private code&*
} catch(err) {
console.log(err)
}
});
im gonna kill someone
@inner venture, you're a Library Developer right? Whats going on here????
sorry for ping, but im gonna go mad
what url did you put in the bot page?
you need to put your webhook url on your bot page
like, my ip?
it won't magically find where to send the webhook
is there something i need to do in order for the server count to show up on discord bots web page?
here?
isnt that public tho
cause my bot is in over 200 servers but it shows N/A for server count
remember to add http(s) before the ip
wait what? post server count?
yes
can someone try upvote, i've used my daily allowance. (i tried the test and it didnt work)
thanks
voted
nothing thanks anyway
how do i do post server count thing?
really though wats going on



