#topgg-api
1 messages · Page 65 of 1
Aren’t those archived/not good anymore?
Nah they are okay (most of them)
Ah mk
https://discordbots.org/api/docs @grave talon
I did. @narrow zenith where specifically?
You can do either given answers, I suggest the api docs from the website itself
How can I send shard information using snekfetch with this code:
snekfetch.post(`https://discordbots.org/api/bots/stats`)
.set('Authorization', `${config.tokens.dblAPI}`)
.send({ server_count: server_counts })
.then(() => console.log('Updated discordbots.org stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body}`));
Would a shard count be added automatically, or is that manually added?
@hybrid geyser #memes-and-media for offtopic stuff and other langs
@hybrid geyser don't be toxic, also no insult
@winter spade that's automatic i think
use the docs
your url isnt correct either
it should be an array of numbers as it says
so fetch the guilds per shard and push them into an array
ok
-bots @sterile dawn
if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
What is vote id ?
The id of the bot ?
ID of person who voted
ok
When my bot is offline and won't receive webhooks, will the webhooks which couldn't be delivered be sent again if the bot is back online?
Negative
how can i get the api ?
@cloud ferry you should probably have a separate server receiving requests for exactly that reason
If your bot crashes, your server (that will have like zero errors) will still receive them
@vague sequoia "Get the API"?
||client.getTheAPI()
||
api->get()
api()
Nah then I'm going to implement that the first 12hours the bot runs vote locks will be disabled
What is API?
const express = require('express');
const app = express();
const https = require('http')
app.get("/", (request, response) => {
process.stdout.write(Date.now() + " Ping Received\n");
response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
https.get(`http://too-scared-to-show-my-project-name-lmao.glitch.me/`);
}, 60000);
const server = https.createServer(app)
const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: 'AlsoThisIsMyPassword!', webhookServer: server });
dblw.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dblw.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
server.listen(5000, () => {
console.log('Listening');
});
I have a question, for some reason, while "Webhook running with path /dblwebhook" does log, whenever i vote, it does not trigger User with ID ${vote.user} just voted!...
i am using the example from the docs
and i set the Webhook URL on my bot page as http://too-scared-to-show-my-project-name-lmao.glitch.me/
ah man i guess this chat is mostly dead
¯_(ツ)_/¯
dont wanna be a beggar, but could you help me?
Doesn't Glitch only allow port 3000
oh
i guess i'll try port 3000 as well
const express = require('express');
const app = express();
const https = require('http')
const server = https.createServer(app)
app.get("/", (request, response) => {
process.stdout.write(Date.now() + " Ping Received\n");
response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
https.get(`http://my-project.glitch.me/`);
}, 60000);
const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: 'my password >:(', webhookServer: server });
dblw.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dblw.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
this is my updated code... whenever i hit the "test" button it doesnt seem to do anything...
this is also the url its going to
should i change it?
wdym by path
webhookPath
And are you using it
im not good with servers so idk how you would "use it"
The URL
I'm just poking fingers at random things at this point
That means your IPv4
0.0.0.0 means it's available on all ip addresses of the machine
ah
im still super confused tho
still not doing anything when i press the test button...
https://discordapp.com/channels/264445053596991498/412006692125933568/617819684405772290
here is the code again
How to make API look cooler?
this channel is starting to turn into a starfarm
(╯°□°)╯︵ ┻━┻
HoW tO MakE ApI WoRK
I get this error when I start my bot since I post servercount to dbl
{ Error: 429 Too Many Requests
Please ping if you can help me
that's just a ratelimit
Its fine.
Though unless you are getting 20+ servers at once, then you are fine.
You need a rate handler
just post your stats every 10 minutes instead of posting it on every guildCreate and remove
One POST request every 10 minutes is better than POST request per guild leave, join etc
Even better
how about not even posting guild count at all
How do I even setup the API for how many server's the bot is in.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/bot.py", line 580, in _load_from_module_spec
setup(self)
AttributeError: module 'dbl' has no attribute 'Client'``` I'm getting this error
Even though everything worked perfectly before
🤔
oh I see, dbl.Client is renamed to dbl.DBLClient
Oops
i don't understand what i did wrong client.user.setPresence({ game: { name: "I'm makeing a better MIDI than randoms", type: "STREAMING", url: "https://www.twitch.tv/hotbeatstv"}});
console.log('Your Bot is Online')
});
const prefix="!"
client.on("message", (message) => {
if (message.author.bot)return;
if(!message.content.startsWith(prefix))return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase(); // Replaces the Current Prefix with this
if (command=="ping") {
message.channel.send("pong!");
} else
if (command=="jeffy eat your green beans") {
message.channel.send("no!");
}
else if (message.content === {prefix}user-info) { message.channel.send(Your username: ${message.author.username}\nYour ID: ${message.author.id}); } else if (message.content === ${prefix}server) { message.channel.send(OOSM aka our own midi squad: ${message.guild.name}`);
}
});
i did not show the token
Use code blocks or a paste site
Like https://hatebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
"makeing"
there
you fucked it up
"
after the D
and use codeblocks
I've found 3 paces where you fucked it up
@somber spire please use codeboxes
hello
Is there a way to send a custom # of servers using dblpy? I run my bot across two servers, so the server count is inaccurate using post_guild_count.
you can use a rpi, connect the two computers (servers) and use a shared folder, or use a storage system, eg github
@mellow reef just send the request yourself
Using some http library that python has
yea good idea
I used to do that but I thought we were supposed to use the apis now
Thanks for the help guys
thanks
Hey how many times in an min i can make my bot to change role color
As it should not abuse discord api
This channel is for the dbl api.
But it's generally a bad idea to change role colours every X minutes
@nocturne quartz a rainbow role in any respect is usually considered api abuse
@nocturne quartz once every 24 hours
@restive otter dotpost
My stats won't post
like the bots server count
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
I put that but I nothing happened.
Is there something I'm supposed to do or?
Would posting the servercount in a command work, like this:
async run(msg) {
const DBL = require("dblapi.js");
const dbl = new DBL('No u.', this.client);
const embed = new MessageEmbed()
.setColor(this.client.embedColor)
.setDescription(`Posting...`)
const sent = await msg.channel.send(embed);
// Optional events
dbl.on('posted', () => {
const embed2 = new MessageEmbed()
.setColor(this.client.embedColor)
.setDescription(`Posted a servercount of ${this.client.guilds.size} to DBL**`)
sent.edit(embed2);
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
}
this would send a message everytime your bot posts
the interval is very high
would rather not enable autoposting.
meaning you do
const dbl = new DBL('token');
dbl.postStats(params...).then(
()=> channel.send('lol, done'),
()=>channel.send('lol dbl api is unstable and failed again')
);
sound like a lot of useless work
So it posts around every 15 minutes
yes
and losing all upcoming updates
Lmao
Upcoming updates
Nice joke
I havent updated my personal lib in months
And even then just update and change it 
@dense basalt just make your own request, not that hard
Or that
or force it to post stats once
I moved it to my ready event now
So, 15 minutes after the launch of my bot it should post
And how would you do that then
call postStats once
But you could eval that right
I guess
Yeah that works
You cant vote using the api
you can get the total votes, or if a user has voted, but not sending a vote
Hello
Does a bot really need to have a website or a github to be certified ?
Okay thx
One message removed from a suspended account.
GWovoRaphiXD
GWovoRaphiXD
GWcorbinMonkaGIGA
What
@spiral steeple
Why
@fierce grotto please dont randomly ping users
@restive otter
hmmm i got this error...
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dbl\client.py", line 432, in close
await self._webserver.stop()
AttributeError: 'DBLClient' object has no attribute '_webserver'
What's your code
Looks like I did a bad with dblpy's source code
Mind opening an issue about this on https://github.com/DiscordBotList/DBL-Python-Library ?
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
sure!
👍
What can I do to avoid http://prntscr.com/p2slph
Not make too many requests

there are only commands to vote
- Don't ghostping people
- As Steven said, it's better to use a webhook and store the vote data locally as well as grab it locally
one request per command is discouraged
And will comonly het you rate limited
Yes, you send an HTTP request on each command usage as it seems
dbalpi.js has built-in webhook
Is there an example for this
Yes
if only someone did read the docs...
The dbl docs
oke
-owner @restive otter
That's a user, not a bot...
dbl.webhook.on(message.author.id).then(voted => {
if(voted) {
So I'm gonna use it like that?
const DBL = require('dblapi.js');
const ayarlar = require('../ayarlar.json');
const dbl = new DBL(ayarlar.dbltoken, { webhookPort: 5000, webhookAuth: 'mypassword' });
dbl.webhook.on(message.author.id).then(voted => {
if(voted) return message.channel.send('test')
});
what is the problem
uhmm.. not trying to to rude(?) but.. is the close error gonna be fixed soonish?
how can i solve
@ornate abyss Somewhere around tomorrow. For now you can dig into dblpy source code and fix DBLClient.close method (I attempt to access self._webserver when it doesn't exist. You should be fine with a try-except for that)
How would you download the code for a discord bot?
g i t h u b
dbl.webhook.on('vote', message.author.id).then(voted => {
if(voted) return
@spiral steeple

hello how am i able to use the api to post my server count onto my bots page?
what do u mean
because in the certification it says post your server count to our api, how would i do that in the bot
It pretty much states everything in the api @restive otter
Why am I getting this?
(node:1382) UnhandledPromiseRejectionWarning: Error: [DDBL-MODULE][POST-STATS] An error has occured: Request failed with status code 429
@daring panther ik but where would i place the posted event in my code?
It is a loop so you should create it once anywhere you want as long as the loop is being created
so would i place it in my main app.js file where the bot is being created n everything
@Callum#6052 You're getting ratelimited
mmk
YOu could for example create it in on_ready.
so eg:
bot.on(`ready`, () => {
dbl.on(`posted`, () => {
console.log(`Posted!`);
})
})```
like that
Separate event
That was an example and no, you want to create the loop. As you can see by the command above it's just optional. You don't need that
ahh so i just put it in my app.js @sullen nymph and it would run anytime it posts?
Provide your client to dblapi.js client and it will automatically post
you're welcome ^^
const dbl = new DBL(token, { webhookPort: 5001, webhookAuth: the_auth, statsInterval: 2400000}, client);
shouldn't using something like this update the stats every 2400000 ms
Anything that you want as a password
webhookauth??
Yes, that's what you use
hmm not working
can you throw code to vote with webhook (discord.js)
I tried to do it but it didn't
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
@sullen nymph
what should we write
const DBL = require('dblapi.js')
const ayarlar = require('../ayarlar.json');
const dbl = new DBL(settings.dbltoken, { webhookPort: 5000, webhookAuth: 'mypassword'});
dbl.webhook.on('voted').then(voted => {
if(voted) {
message.channel.send('oke')}
})
what is the truth, can you correct and send?
dbl useful_js_debugging @restive otter
const express = require('express');
const app = express();
const https = require('http')
const server = https.createServer(app)
app.get("/", (request, response) => {
process.stdout.write(Date.now() + " Ping Received\n");
response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
https.get(`glitch url lol`);
}, 60000);
const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASS, webhookServer: server, webhookPort: process.env.PORT });
dblw.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);;
});
dblw.webhook.on('vote', vote => {
console.log(`User just voted!`);
});
hey guys, so i have this code here... and even after some experimentation , when i test it, nothing happens... i host on glitch so i can only use port 3000... any ideas on what to do?
im using both
you cant
imagine hosting to webservers at the same port

that never work
you need to remove the
app.get("/", (request, response) => {
process.stdout.write(Date.now() + " Ping Received\n");
response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
https.get(`glitch url lol`);
}, 60000);
in order for dbl webhook to work
or just rent a 5 dollar vps which will provide you superior results
if you can at least have nitro I doubt you cant have 5 dollars vps
then im afaik thats a problem
the test will fire via vote correct?
what is a vanity url of a bot?
vanity? String The vanity url of the bot
So like https://discordbots.org/bot/dankmemer iirc is a vanity url
Correct
only certified ones
Yea
And the question mark in vanity? String The vanity url of the bot means it’s an optional thing that you can use btw
ooh thx
Hewooo.... I was wondering.... Is it possible to setup your api and stuff before ur bot gets accepted ?
You have no access to the API unless you have at least ome bot approved
Ok!
I hope no one reviews me.... cos my server just rebooted randomly now my bots down
To show bot upvotes on an embedded I have to do .addField(`Total Upvotes`, `${points}`, true)?
Can someone please help me with that?
How
If you want to display upvotes, it uses api
Mk didn’t see that part
Show more code then just that along with errors
We can’t make guesses as to what is wrong
It says points is not defined
I even tried changing it to ${dbl.points} but then it shows undefined
Show error and code
I just told u, it says points is not defined
Showing code will help
I can’t do much with that
I did show the code
Show how you defined dbl
That's not the whole code
I can’t do anything with an addField
const infoEmbed = new Discord.RichEmbed()
.setColor('#FF69B4')
.setTitle('MegaPhone - BroadCast Messages')
.setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
.setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
.addField(`Total Guilds`, `${client.guilds.size}`, true)
.addField(`Total Members`, `${client.users.size}`, true)
.addField(`Total Channels`, `${client.channels.size}`, true)
.addField(`Total Upvotes`, `${dbl.points}`, true)
.setTimestamp()
.setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
That's what I currently have
What is dbl
Don’t think that gif will work in a footer btw
Gifs do work in footers
const infoEmbed = new Discord.RichEmbed()
.setColor('#FF69B4')
.setTitle('MegaPhone - BroadCast Messages')
.setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
.setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
.addField(`Total Guilds`, `${client.guilds.size}`, true)
.addField(`Total Members`, `${client.users.size}`, true)
.addField(`Total Channels`, `${client.channels.size}`, true)
.addField(`Total Upvotes`, `${points}`, true)
.setTimestamp()
.setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
That should work tho
1 sec
What is dbl
What is points
http://prntscr.com/p3dly4 what can I do to get this error less
Not send a request on each command invocation
what should I do
Have you ever read the docs, Eren
points is supposed to display upvotes, https://gyazo.com/afea8da2d5a6650e56d53321f40352e5
That's the code:
const infoEmbed = new Discord.RichEmbed()
.setColor('#FF69B4')
.setTitle('MegaPhone - BroadCast Messages')
.setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
.setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
.addField(`Total Guilds`, `${client.guilds.size}`, true)
.addField(`Total Members`, `${client.users.size}`, true)
.addField(`Total Channels`, `${client.channels.size}`, true)
.addField(`Total Upvotes`, `${points}`, true)
.setTimestamp()
.setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
That's how I defined dbl:
const DBL = require("dblapi.js");
const dbl = new DBL('my token', client);
I read but I couldn't :/
@restive otter That's not a property of DBL
Could webhook be the solution to use?
Yes
points
Don’t webhooks still have ratelimits or a, I just being dumb
Ok, how can I display total upvotes then?
Am*
Use getBot(id) that dblapi.js provides
Then the JSON returned will have the points key
ok, will try
@muted oar How are webhooks supposed to have ratelimits
You don't send any API requests. Your webhook will get a POST request from DBL when someone votes for your bot
@sullen nymph
So, basically if I use js dbl.getBot("264811613708746752").then(bot => { console.log(bot.username) // "Luca" });
for example, then "points" will be defined?
Ok, thanks, I will try it
@sullen nymph I am still getting error js ReferenceError: points is not defined
Code
const infoEmbed = new Discord.RichEmbed()
.setColor('#FF69B4')
.setTitle('MegaPhone - BroadCast Messages')
.setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
.setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
.addField(`Total Guilds`, `${client.guilds.size}`, true)
.addField(`Total Members`, `${client.users.size}`, true)
.addField(`Total Channels`, `${client.channels.size}`, true)
.addField(`Total Upvotes`, `${points}`, true)
.setTimestamp()
.setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
That's the embed
What's points
^
uhh, 1 moment
Wouldn’t they have to move the embed inside getBot?
Technically
How do I vote with webhook
i read docs but i don't understand
Can give an example
discord.js
You just vote
There's examples on dblapi.js GitHub repo
Even on the DBL docs
where i can give my bot @sullen nymph
You mean submit your bot on https://discordbots.org/ ?
I read but I couldn't D:
I couldn't make a vote with webhook
I mean I normally use hasVoted but how can I do it with webhook
I tried to do but did not
I can't tell because I use translation :/
dbl.hasVoted(message.author.id).then(voted => {
if(voted) {
webhook version ^
Translating in turkish what shivaco said in https://discordapp.com/channels/264445053596991498/412006692125933568/620258909051158529:
Sen hiçbir istek göndermiyorsun API'ye, DBL o verdiğin webhook adresine post isteği gönderiyor birisi bot'a oy verdiği an
What's the issue with it
(Correct TR: (doğru türkçe yazılış:) oy verildiği zaman webhook ile bir kanala atmasını nasıl sağlayabilirim?
it is not ^
(Turkish spelling: ( Demek İstediğim:) hasVoted kullanmak yerine webhook kullanmak istiyorum ama yapamadım, dbl.hasVoted(msg.author.id).then(voted => { if(voted) {
kodunu webhook ile çekilenden nasıl yapabilirim
You should use webhooks as stated before https://eri-is.online/VEHTcI.png
you are still requesting the api https://discordbots.org/api/docs#jslib
One message removed from a suspended account.
One message removed from a suspended account.
it's your bot client
are you supplying a client when your client variable is something else like bot for example
One message removed from a suspended account.
add it on the constructor when you verified how you called it
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
it depends how you called it
One message removed from a suspended account.
How long after a post to the api does it take for the site to update?
Almost immediately most of the time
However caching can take up to 30 minutes to update
const DBL = require("dblapi.js");
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const dbl = new DBL("token", {
webhookServer: server,
webhookAuth: "passwordok"
}, bot);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let votea = new Discord.RichEmbed()
.setColor("GREEN")
.setDescription(`📣 ${bot.users.get(vote.user).tag} just voted the bot! 📢`)
bot.channels.get('1234567890').send(votea)
});
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
anything wrong with my code? it's not working
]]moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
@old grail what isn’t working?
Provide errors
Also 1234567890 isn’t not a valid channel ID
Why though not like it’s a private thing or anything someone can do something with
Anyway
Provide errors
no errors there, it didn't repond anything but it responded
{ server_count: 485, shards: [] } Server count posted!
when i clicked the "test" button
anyone help?
just wait and be patient
Hey can we DM pls I have some questions @dawn fjord
If they're about the API, you should ask them here
They arent
ok
Could someone help me setting up a webhook server for votes?
..snipe
@Moderators - a few seconds ago
Aaaa
@coarse marten why?
ghost mod ping
why would you ghost ping the moderators?

@coarse marten ??????
eek
@worn quail if you're not here to help, stop filling the chat pointlessly
]]faq 10 -c
ok kyo-senpai
My bot doesn't want to send stats to dbl...
I use the postsStats method but the posted event is not triggered
// Post DBL stats
const DBL = require("dblapi.js");
const dbl = new DBL(this.client.config.dbl, this.client);
dbl.postStats(this.client.guilds.size, this.client.shard.id, this.client.shard.count);
dbl.on("posted", () => {
client.logger.log("Server count posted to DBL!");
});```
s
I've seen people use <iframe> for their description. How?
use it like you normally would
But it says there isnt enough content
when submitting a new bot you need 300 characters
I believe after that you can change it to an iframe without issue
@wet seal
vote.user returns an ID string right?
anyone? is this a good place to ask a question about coding or how to get to the coding screen
What?
me when im a coding screen
@restive otter I might be late but yes, anything that would say user should be a string ID. If we're talking webhook vote data, that would be correct
oh someone answered earlier, said that user returns an integer
so it’s a string for sure?
Last time I checked, DBL only returns string IDs :p
It's a string
same about Discord
ok
discord returns ids as numbers if they're smaller than ~2^53
Hello i want ask QAQ
@dense compass could you help me setting up a Voting Webhook server?
I've never set one up so probably not
ok... Who could help me with that?
¯_(ツ)_/¯
State the problem
The webhook server starts and runs but the vote event doesnt fire
Are you sure your specified port is open and that your firewall is not blocking anything
It shouldnt
I am able to access the page without being in the same internet as the bot
What about webhookAuth
does the api post to discord webhooks yet?
unfortunately nah but I made this https://github.com/Deivu/Haruna that can do that
Simple webhook vote handler for Discord Bot List https://discordbots.org/ - Deivu/Haruna
i think the biggest issue, is that sometimes people arent able to set up portfowarding and/or firewall rules to allow webhook servers.
AA portforwardnig!! Yes, that is a problem, many people (like me) suffer because of that (after years i worked it out lol)
just curious why dbl doesnt support it
i have my own system that works with dbl directly, ill probably write an api for it. but its only used by a few people
the more users you handle, the more load
the more load, the more expensive to maintain
it would be more cost effective to have them host their own webservers
Also putting it directly into a webhook would negate a lot of stuff people do with votes (vote locking, vote rewards, etc.), so I doubt you'll ever be able to put a discord webhook directly into the webhook url space
And have it work*
If i want to get when people vote do i just use a discord webhook or if not where do i get webhooks?
How would you check if someone has voted for my bot in the last 12 hours?
Is it something like: user.voted: true?
Discord.js
most likely as long as you have the right stuff done.
Well The bot can receive votes, give people roles in support server and send a message if they vote
What lang?
Discord.js
That's such a nice lang!
.js
If you cant tell the lang
Idk
He just gave more info
2 birds with 1 stone.
Hi neko
Wrong channel for chatting
-_-
@vernal quartz if you're told a channel is not for talking, don't keep talking
Are vote webhooks working currently? I’m having no success
works for me
how do I get the dblpy example to work?
https://discordbots.org/api/docs#pylib
dbl.DBLClient
?
Use dbl.DBLClient
I don't know what you mean
AttributeError: module 'dbl' has no attribute 'DBLclient'
oh ok I found this
classdbl.DBLClient(bot, token, **kwargs)
So
I'm not sure
Is any of your folders/files named "dbl"? No? Make sure your version is 0.3.2
Though, you were too vague by literally just saying "How to get the example to work?"
Well for an average user I'm fairly sure I don't need to explain what cogs are
fresh environment, fresh install, I copy pasted the example, added my token
That's code for a separate cog file
That you later load as an extension in your bot's main file
hmm ok
And it's not hard to rewrite it for single-file bot
my discord bot doesn't use extensions
I guess I'll be forced to
so I save this example as cogs.local.py ?
Pretty much
so then how do I load it from discord bot?
In example, what is the name of the cog?
https://discordbots.org/api/docs#pylib
discord.py server helped me figure it out
the example cog is failing tho
ror: AttributeError: module 'dbl' has no attribute 'Client'```
fixed, i was using dbl.bot instead of dbl.client
If you read #312614469819826177 it clearly says, "this is outdated"
It's the api example
from the docs @balmy hamlet
The #312614469819826177 use http requests
I think
alright then those are outdated too
Tru
how i get the wwbhookauth?
@restive otter I assume you'd find it here: https://discordbots.org/api/docs#mybots
I also assume you might have to add your bot to the discord bots list, if not added already
I want to say this password
@restive otter webhookauth is set by you
It's a value you provide
In the edit page of your bot
Hello I want to online my bot please?
no
@dreamy bay #development
const discordbotsorg = new DISCORDBOTSORG(config.discordbotsorg, bot);
This ain't sending my stats over?
dblapi.js
Can you add
discordbotsorg.on('posted', () => console.log("posted"))
See ya in 15 minutes ....
oki still nothing in the log
You added the on::error?
. play senorita
That works I guess.
hi, please, i need help to enter a valide webhook in the informations of my bot, when i put a discord channel webhook it's said This webhook does NOT post messages to Discord channels. It is designed for use with your bot only.
and i don't know how to create other webhook
@worn kiln you need to self host a webhook
A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with t...
@worn kiln ^
ok that right, i have now a webhook, and place it in my bot's information
No
now how do i grab request of the webhook in the bot code ?
You need to self host one using a static IP
i have
yis
k
now how connect it* to my bot code ?
🤔 i think that not what i'm searching
i actually test that
but that's not work
oh shit that work now xD
Hello
Ask the question
no problem
~~It's possible to execute function when user vote on discordbot ?
Because i want give a reward 🙂
(Mention me to respond plz)~~
Edit: okay i've read api's docs ^^"
Sorry i hadnt' seen the link
what
probably the same way you joined this server 
https://github.com/DiscordBotList/DBL-Python-Library/blob/master/docs/api.rst
This says to get on_dbl_test to use
async def on_dbl_test(data):
print(data)```
how does that work if it's in the cog?
does that go under the class
class DiscordBotsOrgAPI(commands.Cog):?
oooh do I see a s y n c
so the example is different from the docs says use
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)```
which is what ive been using
@ruby yarrow yep, that goes under the class preferably for easier management of your stuff
ok that's how i have it like the example
on_dbl_vote and on_dbl_test are different events
yes
https://discordapp.com/channels/264445053596991498/412006692125933568/622680529053024256
Not really following the question here, sorry
but i assume they're used the same way, since the example only shows one used
im just not getting anything from the test webhook on the edit bot page
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = '' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token)
@commands.Cog.listener()
async def on_dbl_test(self, data):
logger.info('Received an upvote')
print("dbl vote test")
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))```
and im reveiving the webhooks (even tho they say 404 in ngrok, not sure what's up)
I'm able to pull get_bot_upvotes() fine
is dbl on port 80?
It sends you a request to the URL you put in
Are you using the built-in webhook
ohhhhhhhhhhh finally see it
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
hmm well now it's error 401
woowwww finally got it
authorization str was required on both sides
@dense grail Could you help me setting up the DBL vote webhook for javascript?
@coarse marten use the api wrapper
@coarse marten leave your questions here and we'll try to help you
please avoid tagging random mods for help as not all mods know your language, and not only mods help out in this channel.
Yes I saw you have the Certified Developer role and thought you could be experienced with that
Well thats weird managed it to work
Are there some issues with the API right now?
Such as?
I tested the voting webhook and it took a few minutes for each vote to arrive at my bot.
I "voted" three or four times in a row and I just got dm'd about the third vote even though the first one is at least 5 minutes ago.
@sullen nymph any idea?
Looks like API is a bit drunk rn
aight
I'd say wait a few minutes
well
I already noticed it earlier today
like 8 hours ago I already voted
and it didn't arrive at all
Hm
just saying
alright
ow do i put this URL? Is it mandatory for the bot to send who voted for it?
hey, is there any way to get the timestamp of a user's last vote without webhooks? or can you only get the true/false boolean from the API?
Only the latter
alright thanks
why does the endpoint show if someone voted in the last 24 hours if people can vote once every 12 hours
heck
docs hasnt been updated
(Which is weird because it's been known for about a year)
Or feels that long now
Yeah it's been more than a year.
ohhh ok that makes a lot more sense
thanks y'all
wait so to be clear, the endpoint does return true if they've voted in the last 12 hours, not 24 hours
Can i get mee6 bot? Please
wrong channel and server buddy
@idle sable yep, it's 12 hours
thanks
What do you mean?
Does anyone speak Arabic?
I want the bank bot to go into my server and distribute salaries to customers.
What says this channel is for asking help with any bot?
One message removed from a suspended account.
@river verge for example take a look at the vote event for the js library
Or the hasVoted method
yeah i did..... thx
Np
Bonjour, j'ai un problème avec l'api. Une personne peut-elle m'aider svp ? (Je pense que c'est moi qui n'ai pas compris)
Mon code :
const Discord = require('discord.js');
const client = new Discord.Client();
client.commands = new Discord.Collection();
const fs = require('fs');
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
fs.readdir('./Commandes/', (error, f) => {
if (error) { return console.error(error); }
let commandes = f.filter(f => f.split('.').pop() === 'js');
if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }
commandes.forEach((f) => {
let commande = require(`./Commandes/${f}`);
console.log(`${f} commande chargée !`);
client.commands.set(commande.help.name, commande);
});
});
fs.readdir('./Events/', (error, f) => {
if (error) { return console.error(error); }
console.log(`${f.length} events chargés`);
f.forEach((f) => {
let events = require(`./Events/${f}`);
let event = f.split('.')[0];
client.on(event, events.bind(null, client));
});
});
const app = express();
const server = http.createServer(app);
const dbl = new DBL('tokenapidiscordbot', { webhookAuth: 'https://discordapp.com/api/webhooks/623042976259506176/P44Ffo53PK8aLmMOFWYqvmEiVU5V52nwtof17L8VKbyVJ9GD3ZWvlAlbuTDYVSmSloIS', 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');
});
client.login(process.env.TOKEN);
In English: Hello, I have a problem with the API. Can someone help me, please? (I think I'm the one who didn't understand)
My code:
⬆
webhookAuth is the password you set on the edit page of your bot
You'll see it at the bottom of the page
does the bots/<bot.id>/check endpoint (to check if a user has voted in the last 12h) usually take up to 10 mins to update?
Caching
oh ok
Best solution is to webhook rather than check
read the error
Ik
its self explanatory
did u make the bot
No
Could we please keep this channel on-topic https://zws.im/
k
where shall I ask about this then?
ok
Necesito ayuda, alguien habla español?
いいえ
I expect I will need to use this channel soon, because I'm implementing the API :)
Hm, I have it all set up, but it isn't changing the number of servers or its status.
Of course, all I am doing is creating a new instance of the class and giving it my client
How is this physically possible
This... This truly is big brain time.
Working on setting up webhooks for a djs bot. Trying to run some tests on a local machine but the requests arent coming through. Does the webhook system require a secure https connection or does standard http work?
If I create the query in postman and send it off to the same url it works but I'm not seeing any traffic using the test button in the api options on the website
@slate saddle are you using the lib or doing it in another fashion
using the library
Can you show the code?
well I was using the library. Now im just running an express server to catch all traffic on the port i'm using and still not seeing anything
My port forward was successful because I can successfully query my public IP at the right port and see the results in express but I'm not receiving anything from discordbots.org
Stuff from the library doesn't get caught normally
const express = require('express');
const app = express();
const port = 5000;
app.get('*', (req, res) => {
console.log('get');
res.send('hello world!');
});
app.post('*', (req, res) => {
console.log('post');
res.send('htmm');
});
app.listen(port, () => console.log('Listening'));
this should be catching everything on the port
POST /dblwebhook HTTP/1.1
Host: **.***.*.**:5000
authorization: *********
Content-Type: application/json
Cache-Control: no-cache
{
"foo": "bar"
}
I'm shooting off this http request and i catch it and this is basically the same request that the website should be sending
And the endpoint you have on the site is correct?
👍
@half sphinx dms!
need help with this
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Error
/home/dominik/ModBot/index.js:22
dbl.webhook.on('vote', vote => {
^
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (/home/dominik/ModBot/index.js:22:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
This means you haven’t provided correct options for webhook server or port etc
Well you don’t have to own a site but you do need to make the host accessible from the outside
Read the docs on how to do it then forward the server and add it in
i dont rly understand the dosc that why i come here
If you don’t understand the docs chances are you don’t understand how to get everything even working on the outside. Further knowledge is what you need, not walkthrough support
Ok then you need to figure out how things work
We’re not gonna drag you along and direct you to everything to do.
where could i find how to creake a webhook>
How do you make a bot? like Dyno
@restive otter no... #development if anything
but no
nani
@worn quail sry xd
wut
Hey guys, had a look through the API and I can't seem to find a field for when the user registered with discord?
Unsure if I'm looking at the wrong thing lmao
Do you mean the Discord API?
Yeah
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
I can't get the api to work for me... It keeps saying "Install Error" when I try to install dblpy...
Are you using 3.0 or whatever the 2.X version is
3.7.4
is there a difference between installing with pip for 2.X and 3.X?
if so, install the 3.X way
you're welcome!
What is the getaddrinfo error? Like why does it happen?
HI
hot api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
@untold canyon ^
Hi I get AttributeError: module 'dbl' has no attribute 'Client'
when trying to use the post server count in python
self.dblpy = Dbl.Client(self.bot, self.token)
NameError: name 'Dbl' is not defined
im just using this https://discordbots.org/api/docs#pylib
where are my spelling mistakes
in what line
oh yeah i changed that
and i just get AttributeError: module 'dbl' has no attribute 'Client'
@stiff orchid I think it wants you to pass in self and self.bot?
nope, read the wrong part
sorry
@stiff orchid dbl.DBLClient
I use this code to make it work when a user votes:
'use strict';
const DBL = require("dblapi.js");
module.exports = async (client) => {
let stats = new DBL(client.config.api_key.discord_bots, client);
setInterval(function () {
stats.postStats(client.guilds.size);
}, 60000 * 10); // every 10 minutes
let dbl = new DBL(client.config.api_key.discord_bots, { webhookPort: client.config.webhook_discordbots.port, webhookAuth: client.config.webhook_discordbots.password });
dbl.webhook.on("vote", async (vote) => {
let dUser = vote.user;
dUser.send("**📨 | Merci d'avoir voté pour __Novus__ sur __Discord Bots__ !**").catch((err) => { });
client.guilds.get('613327170298839061').channels.get("624675003266236427").send(`**:incoming_envelope: | Merci à ${dUser} d'avoir voté pour __Novus__ sur __Discord Bots__ ! > https://discordbots.org/bot/613339080658255895/**`)
});
}```
And when I test the system, no errors reach me in the system and it doesn't send to the text room concerned.
Port: 5001
Why ghost ping
-m @restive otter ghostpinging mods | 1 week
🤐 Muted Emmanuel#1411 (@bold herald)
Damn ghost ping ffs

Unless it was accidental, which I doubt
I was excited thinking someone @ me
Does the website go offline in the mornings
Looking back at my logs it says bad gateway assuming it went down
the website's having a 500 error
I mean is it everyday/constant
is there any reason automatic stats posting isn't working?
const dbl = new DBL(botAuth, { webhookPort: 4000, webhookAuth: whAuth, statsInterval: 2400000}, client);
Not sure statsInterval exists
the docs says it does
Does the guild post event get emitted?
how would I check that?
There should be an example where autopost would emit an event
oh this?
dbl.webhook.on('posted', () => {
console.log('Server count posted!');
});
cause that never gets emitted
unfortunately, my bot stops working after an hour. so i want someone to help me with some type of "restart code".
like you can restart using the console
but how can i do that in code
move to #development
ok
How to setup webhook?
@boreal bridge how to get auth for webhook?
you make it
What do you mean?
When I type this link
https://discordbots.org/bot/:ID/edit
It says 404 not found
replace it
Thanks
const dbl = new DBL("secretToken", { webhookPort: 5000, webhookAuth: 'secretPassword' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
client.db.query("INSERT INTO votes (user_ID, time) VALUES ('" + vote.user + "','" + new Date().valueOf() + "');");
console.log(`User with ID ${vote.user} just voted!`);
});```
I have added this to my code but it is not working. What am I doing wrong. Or better question what am I not doing for the vote endpoint to work correctly?
define not working
well its not sending anything to the database and I am not getting a console.log of the user voting
did you open the port
do you mean port forwarding?
yes
i think I did it right
@boreal bridge yes I know it is now and its still not working
@restive otter does the ready event get fired
@restive otter not really sure what to say then
if you have configured everything correctly both on the site and in your code
and opened the desired port
Im not either. I am very confused
what token did you use for the DBLToken
the token found in edit
I believe so.. I added my own password and in the url I added the console url that pops up when the ready event fires
So, basically... I used this:
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id === `${message.author.id}`)) message.channel.send(message.channel.send(factEmbed))
else message.channel.send(votelockEmbed)
But after voting it still sends the votelockEmbed. I have to restart in order for it to start sending the factEmbed... What should I do?
https://gyazo.com/669a27aa04e9af99f6f24a7d4e00b18d
message.channel.send(message.channel.send(factEmbed))```

If the command is for 24 hours... why not use hasVoted(id)
yeah, that method is ridiculously inefficient
yeah, I'm changing that
I will use that from now on js dbl.hasVoted(message.author.id).then(voted => { if (voted) message.channel.send(factEmbed) else message.channel.send(votelockEmbed) });
Now it's not working at all
/weekend
tfw client mods
ugh
discord.py needs an argument in the message Object to tell apart if the message has been sent on desktob, web or mobile
Uhh no?
FOR CHATTING ABOUT GENERAL TOPICS
WHAT CYBER SAID
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
How can I get an authorization for the webhooks ?
I think I just give a random password
@restive otter correct you create the autorization
😁
So uh, using dblpy, when doing await self.dblpy.post_guild_count() I get dbl.errors.Forbidden: Forbidden (status code: 403). Is my token fucky or what am I missing?










