#topgg-api
1 messages ยท Page 44 of 1
i am completely confused
im sorry but
what
Gets the guild count from the bot object
where the heck does the bot object come from???
at no point do i pass the bot object to the client
good god, im annoyed at this
you do when you init the client?
eh, i just went into the HTTP part and did the request myself
Tonkku can u fix the docs link for the python lib
@quiet egret Just in case, your Bot object is what you declare commands.Bot or discord.Client as
You usually declare that as bot or client
may i quote the zen of python
"Beautiful is better than ugly.
Explicit is better than implicit."
"at no point do i pass the bot object to the client"
Do I see trust issues
i'm struggling a little bit trying to get a webhook created to process when a new vote comes in and send the user a dm saying thank you, is there anyone willing to help me out
(using discord.js)
Have you looked at the dblapi.js docs?
yeah i have, and ive done what i think is correct (and i had someone else help me with it as well who is familiar) and i thought i had it set up right, but when i test it, it should output a vote received! in console but i get nothing
yeah i have, and ive done what i think is correct (and i had someone else help me with it as well who is familiar) and i thought i had it set up right, but when i test it, it should output a vote received! in console but i get nothing
let me try again and follow the docs
so its recommended to use the webhook for votes right
no matter how many you plan on getting
const DBL_TOKEN = botconfig.dbltoken
const webhookAuth = botconfig.dblauth
const dbl = new DBL(botconfig.dbltoken, { webhookPort: 5000, webhookAuth: botconfig.dblauth });```
is this not right?
Did you set the webhook settings in your bot edit page?
yeah, i have it as (publicip):5000/dblwebhook
thats what the person who helped me before told me to put, is that not correct?
i think i figured out why it isn't working, im pretty sure my vps isn't set to accept incoming requests from ports
i need to set that up first
ufw command not found >.>
i'm really new to all of this so im sorry if i come off as dumb or i dont know something simple
I got it to tell me that the webhook is running with a path of /dblwebhook
but when i test it, it doesn't console.log(user with id ${vote.user} just voted)
and after like 30-40 seconds it gave me this error:
0|jobsbot | at item.request.gen.end (/home/ec2-user/environment/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)
0|jobsbot | at then (/home/ec2-user/environment/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)
0|jobsbot | at <anonymous>
0|jobsbot | at process._tickCallback (internal/process/next_tick.js:182:7)
0|jobsbot | name: 'DiscordAPIError',
0|jobsbot | message: 'Missing Permissions',
0|jobsbot | path: '/api/v7/channels/265156286406983680/messages',
0|jobsbot | code: 50013,
0|jobsbot | method: 'POST' }```
it says
Missing Permissions to POST in a channel
๐ค
also why does d.js still use snekfetch smh
im not trying to have it post in a channel which is why im really confused
let server = http.createServer(app).listen(5000)
bot.dbl = new DBL(DBL_TOKEN, {webhookAuth: webhookAuth, webhookServer: server})
bot.dbl.webhook.on("ready", hook => console.log(`Webhook running with path ${hook.path}`))
bot.dbl.webhook.on("vote", async vote => {
console.log('New Vote!', vote)
if (vote.bot !== bot.user.id) return
//if (vote.type !== "upvote") return
let user = await bot.users.fetch(vote.user)
//Do stuff here...
//db.add(`briefcases_${user.id}`, 1)
//user.send(`Thank you for voting! You have receieved a briefcase.`)
}) ```
this is what i have
with this above:
const express = require("express")
const app = express()
const DBL = require("dblapi.js")
const DBL_TOKEN = botconfig.dbltoken
const webhookAuth = botconfig.dblauth```
@chrome canyon d.js uses node-fetch now
his version apparently doesn't.
also superagent > node-fetch
in speed as well as syntax
so why the heck
and also in promise support
i was under the impression i had the newest version of d.js
@signal hawk then that error's unrelated to your webhook
@signal hawk did you install discord.js or discordjs/discord.js?
discord.js
if the error isn't related to my webhook, then what is causing it, and why isnt my webhook working >.<
oh i know whats causing the error message
more important is why isnt my webhook working lol
@signal hawk you're trying to preform an action but your not doesn't have permission
@chrome canyon master uses node fetch I believe
nono the perm error is unrelated
Hello
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);```
i'm confused on how this works
@median flicker you can use dbl.hasVoted(user ID) to check if they have voted
use webhooks
Yeah you could also use webhooks and store votes in a db
dbl.hasVoted(message.author.id).then(async voted => {
if (voted) {
//your code
}else {
//Error code
}
@plain timber ?
Yeah
wut ๐
yo when i do .getVotes() on the js lib i get an object that contains over 900 votes, however my bot only has <100 lifetime votes, does anyone know why that happens? do i need to pass an id to it?
what bot
337959793106878464 bigshaq
Hello, I got the following error:
<Name redacted>:~ <Name redacted>$ pip install dbl
You are using pip version 6.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting dbl
Could not find a version that satisfies the requirement dbl (from versions: )
No matching distribution found for dbl
<Name redacted>:~ <Name redacted>$ pip install dblpy
You are using pip version 6.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting dblpy
Using cached https://files.pythonhosted.org/packages/aa/2e/d136bd593a1fe545d6e82c9317169beef2729ecb2878352c58cd8f7b374f/dblpy-0.1.6.tar.gz
Collecting aiohttp>=2.3.9 (from dblpy)
Using cached https://files.pythonhosted.org/packages/70/27/6098b4b60a3302a97f8ec97eb85d42f55a2fa904da4a369235a8e3b84352/aiohttp-3.4.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/sd/gjs1t8tx7hg3t1h6wmfr_9k00000gn/T/pip-build-xRnDcv/aiohttp
@topaz wyvern
???
Hello I have a problem with webhooks. While I set webhookAuth (js library) on my password and clicking "Test" without fill password field, my webhook receiving message, but shouldn't.
@soft talon did you save before hitting test
@arctic arch ok, my bad. ๐ I've testing without saving
btw. it could be useful to set querystring while test :/
@sullen nymph I'm getting these errors whilst downloading the API...
You are using pip version 6.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.```
Either your cache trolling you or your status update is just dead 
@sacred maple Nothing helpful. Did it show anything else
And I already tried upgrading:
pip install --upgrade pip
You are using pip version 6.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 6.1.1
Uninstalling pip-6.1.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 687, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 292, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-6.1.1.dist-info/DESCRIPTION.rst'
Yay! It works!
any idea why ? does it take time ?
I got another error:
dblpy 0.1.6 has requirement aiohttp>=2.3.9, but you'll have aiohttp 1.0.5 which is incompatible.
pip3 show aiohttp
Flip$ pip3 show aiohttp
Name: aiohttp
Version: 1.0.5
Summary: http client/server for asyncio
Home-page: https://github.com/KeepSafe/aiohttp/
Author: Nikolay Kim
Author-email: fafhrd91@gmail.com
License: Apache 2
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: chardet, multidict, async-timeout
Required-by: discord.py, dblpy
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So update it
Yep, you should be good if you update aiohttp
How can I get the normal pip
Got it now...
Thanks @sullen nymph and @plain timber

AAAAAAARGH!!!
========= RESTART: /Users/gebruiker/Documents/Python/Flipp3rrrBot.py =========
Traceback (most recent call last):
File "/Users/gebruiker/Documents/Python/Flipp3rrrBot.py", line 1, in <module>
import dbl
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbl/__init__.py", line 19, in <module>
from .client import Client
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbl/client.py", line 33, in <module>
from .http import HTTPClient
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbl/http.py", line 36, in <module>
import aiohttp
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/__init__.py", line 10, in <module>
from .protocol import * # noqa
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/protocol.py", line 18, in <module>
from .helpers import reify
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/helpers.py", line 25
ensure_future = asyncio.async
^
SyntaxError: invalid syntax
Do I see Python3.7 with discord.py async branch 
Or wait
pip3 show discord.py please
pip3 show discord.py
Name: discord.py
Version: 0.16.12
Summary: A python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email: None
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: aiohttp, websockets
Required-by: discord
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Oh
Yep, that's the freaking async branch
You might wanna use discord.py rewrite instead to get access to more features etc.
pip3 install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]
Need docs? There you go! https://discordpy.readthedocs.io/en/rewrite/api.html Now let's move away from this channel
@sullen nymph I got everything working, thanks!
is the .getVotes() sorted by when a person voted?
test
@amber dune a bot responds when you type anything into a channel it cant talk in
it was taken care of
k
who's have discord api invite pls ?
/discord-api
i hope this is the right channel.
Trying to test a webhook from the dbl website.
However i do not receive the post request.
If i try it from another source i get the request.
(same url checked multiple times :D)
is there a step i am missing for the test on the dbl website?
Thank you in advance
You need to press save then test
i was wrong sry didnt work after save + test still nothing (i dont get a error on the site though)
Does it say request sent?
yep i get the alert box with request sent .. may take a few seconds
or am i forced to receive the request through the dblapi itself with the vote event from dbl.webhook --> meaning i can't receive it with a normal express app.post... event?
Are you behind a firewall?
not that i am aware of 
all i do is creating a express server and listening for post requests for /dbl like this:
app.post("/dbl", function (req, res) {
console.log("post from dbl incoming")
// other stuff...
})
and if i send a post request from a local program on my computer i receive it on my VPS if i try to send one from the dbl website i dont get any.
have you saved
yep
are you sure
yap
oof thank you tonkku the protocol did the trick... didnt need it in the external program and copied the url from there thank you very much 
Exposed
is there a reason that my server count on the website would be different than the server count bot.guilds.size gives me from my bot? >.>
Are you sharding?
@signal hawk Can you show the code where you post the stats?
bot.dbl = new DBL(dBL_TOKEN, {webhookAuth: webhookAuth, webhookServer: server})
bot.dbl.postStats(bot.guilds.size)
setInterval(() => {
bot.dbl.postStats(bot.guilds.size);
}, 1800000);```
app is express
like new DBL(dBL_TOKEN, {webhookAuth: webhookAuth, webhookServer: server}, bot) ?
yes
will try, thank you!
@restive otter this channel is only for help with the DBL api
That didn't work, the website still says 57 :/
i have it set to update every 30 minutes
i dont have an eval in my bot >.> yet
and yes im sure im using the right token because votes are coming through
i didnt change anything but now its updating correctly so thanks for your help xD
lol yw
...it went back down to what it was before
it showed 94 (which is correct) and now went back to 57 xD
i use a php script that sends it to a discord webhook in a channel that my bot reads, and then it handles that and sends a message in another channel that everyone sees
it's php because that's the only backend scripting namecheap has and I hate nodejs
Is there a way to get a list of everyone that has voted for your bot (JS)
@copper stag why do you hate Node.js?
@frail lance you can only get the last 1000 voters in this month
Unless you saved all of them
hi
But...Node.js exists
So?
But why would you
Javascript was invented for the browser
Would you run SQL as a web server
the internet wasnt invented to chat with people so dont chat with people on the internet
discord wasnt invented for bots so dont use bots on discord
@copper stag Ok...what
SQL is a query language
Not even comparable in this scenario
JavaScript is a scripting language.
Node.js is so awesome because it takes that same JavaScript code, and utilizes V8 to compile this code into machine code,. With that being said, this helps web applications greatly, because it executes JavaScript very efficiently.
Why do you think that popular companies such as Microsoft PayPal and Netflix use Node.js?
not right channel mate
it started with a convo about the dbl api
I have a really important question about dblapi.js
I am having trouble finding out where to incude
if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
});```
in my if / else statement ( This is my music command I am talking about )

Ping me if you can help
discord bot list api, it's basically so you can know when someone upvotes your bot (at least that's what most people use it for)
Are you talking about the es6 syntax there?
the single line bracketless if?
ok
so you have a dbl api, with an async getter for seeing if you've been upvoted
what do you mean "where should I include this?"
if there's no event listener, you have no choice but to put it in a time interval
Im just confused on how this dblapi.js thing works
I want users to vote before using music
why would this be with your message parsing logic, if you dont mind me asking?
honestly idk
oh
I thought you were talking about the upvotes on the DBL website
yes!
are you?
yes!
so this would have absolutely nothing to do with parsing commands from users
you want to log the upvotes you get from the dbl website
on your bot's page
I want users to upvote the bot before using the music commands
aah
Is that possible?
ofc
yay
you could wrap all of your message parsing inside of that promise and just do a simple check for the parameter
i would modularize it though
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
else {
....
}
});
hmm..
I will try
woah wha?
dbl.getVotes().then(votes => {
if ( !votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
else {
....
}
});
check if it's false (not found)
otherwise, continue on with whatever
are you using a wrapper like commando
if you're just using the discord.js API then just encapsulate your logic inside of it
sure
I don't think I use commando
Would you like to see my code..?
I'm not very good at this
if you don't have time, I understand
client.on("message", function(message) {
dbl.getVotes().then(votes => {
if ( !votes.find(vote => vote.id == message.author.id)) message.reply("Sorry, upvote the bot first!")//not found
else {
//call your normal logic here
}
})
in else statement
did you write this code?
for the most part, no
in whatever you referenced
there should be event listeners for messages, reactions, etc.
you want to make users upvote the bot before they use commands
so yes
you encapsulate your message parsing logic inside of the db.getVotes().then() promise
search up MDN promises and async if you want to get a grasp of basic NodeJS server arch
okay
I can get this



That's exactly what I was expecting to hear
something on the lines of "learn js"
so close
๐ญ
Hello.
hi?
How are you.
good, how are you.?
Im alright.
Basically ive been around for a little and i was wondering if you could help me out.
๐ญ
Are you ok?
Oh.
I'm sorry
Feels bad lol.
Yeah idk im just looking for some help but I just get "learn js"
or some weird whatever
anyway..
ask away
Well i was wondering if someone could help me with making a bot that does this https://gyazo.com/6016c33bb1da5876ea3b69a6519e1bce ?
What is it doing
Ive tried learning multiple ways of making js and lua etc, but my mind works different and its hard for me to process.
Its basically a reacting/tally bot.
So basically you have a sertain amount of time like 5 mins, to goto a channel called "3 letters", You type the last three letters and then you get put in the sections, so basically if 2 people said " 200" they would get put under the Id of "200" and 3 others said " 313 " they would get put under the Id of "313".
@restive otter go to #development
Ok, thank you.
this is for help with the dbl api, see the channel topic
If you've been told on other occasions to first learn JS, maybe there is merit to the advice
Do you have experience with programming at all?
what about it do you not understand??
if you've coded multiple bots you should know what a promise and a callback is
literally just wrap your logic inside of the callback
mfw
Sorry to waist your time
no, im using free time
but you could save a lot of your own time by investing in learning a bit of basics first
and stuff like this will be a breeze
ok
this is stupid
what is
what else what
client.on("message", function(message) {
dbl.getVotes().then(votes => {
if ( !votes.find(vote => vote.id == message.author.id)) message.reply("Sorry, upvote the bot first!")//not found
else {
};
I can't figure out my else statement
first of all
why is there a semicolon there
secondly
you forgot to enclose the callback
thirdly, you didn't enclose the outer method
wew
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id == "message.author.id")) console.log("Tonkku has voted!!!")
});
client.on("message", function(message) {
dbl.getVotes().then(votes => {
if ( !votes.find(vote => vote.id == "message.author.id")) message.reply("vote for bot")
});
there?
client.on("message", function(message) {
dbl.getVotes().then(votes => {
if ( !votes.find(vote => vote.id == message.author.id)) message.reply("vote for bot")
else {
}
});
there.
Alright, I get that
Since all of my music commands are together in server.js, it is making it hard for me to find out what goes where
its just the classical music bot commands
nothing special
perhaps if you wrote it you would have a clear sense of your own code
I understand it
that's just me tho
Am I trying to put all of it in 1 callback? or do I put multiple...
Yes.
i'm not sure you understand what a callback is
if I don't then I get an error
a callback is a function, typically anonymous, passed into a method as a parameter
so that you know when an operation is finished. asynchronously
it has nothing to do with if/else
function sayHello(myCallback) {
setTimeout(function() {
myCallback("hello!")
}, 1000)
}
funcion run() {
sayHello( function(str) {
console.log(str)
})
}
this is the easiest way i could think of to explain a callback
if you don't know how async works you shouldn't even be using await
well
that's why callbacks are so powerful for servers
because nothing is instantaneous, and a lot of things you have to wait until you are ready to complete the operation
that's why db.getVotes takes a callback function as a parameter, because it is sending a request to the DBL website and waiting for a response
Ok I'm don here
good luck on your project fam

I appreciate your enthusiasm, but you really need to understand the basics
You may have gotten by on luck randomly copy and pasting features from other people's code, but it won't do anything for you in the long run
I don't say this to discourage you, but because I hope you will try to write your own programs
It will feel great, trust me
How to get dblapi ?
@ripe fjord https://discordbots.org/api/docs
I don't know how.
discord.js
Use the dblapi.js package
Look at "example of using webhooks to receive vote updates"
?
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
^
ReferenceError: yourDBLTokenHere is not defined
at Object.<anonymous> (/app/bot.js:752:21)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
You can't just copy paste an example exactly and expect it to work smh
is that not how it works 
Lmfaoooo
encode 
would it be possible to have webhooks as sockets instead?
for translate
encode what, and why do you need a pc to do that?
the token is right there, in plain text, on the page. You don't need to encode anything
unless js needs that but i don't think so?
and click on your bot
and copy the key
webhooks are kind of tricky to do
last time i asked how to do it you need a very large library
what
for java
java doesn't have in built http server?
that's all it need
it's just simple method check + credential check
generate the image by the discord bot?
@onyx sky this is not about the #topgg-api, move to #development
ok
For some reason my server count stopped being send to DBL, Any changes on DBL's side?
I dont think so...
It works for me
make sure your code is in the proper event
@restive otter aka the event that runs your bot
the server count code must look like this
const DBL = require("dblapi.js");
const dbl = new DBL('YOUR DBL TOKEN HERE !', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
//Error Event (To not trigger errors that will end your process, you must handle this event)
client.on('error', console.error);
is he even using js
Ye
@restive otter dose it work now?
Didn't check yet
K
The following message was sent to everyone in my discord server before kick/banning them and deleting all my channels and information. I am very patiently trying to figure out two things. Is there any possible way to retrieve any of my data from the channels from discord? How can I prevent this from happening again? Can someon please direct me to the correct channel or server to discuss such matters. I was using a Python Pot and I used Redis (NoSQL) to store my discord key so the key was not visable in the code. The code was available on github. I need to find out what I did wrong with storing information in Redis. The message is quite large I will on ly post what I see as being important.
Helo! im wiktor#9004 and i just ddosed this bot and your server! :) Subscribe to my YouTube channel :D "then it has a youtube address" and come to my house "then it has a google maps address location"
@plucky field yup, definitely leaked token, the guy did this to another bot before
@runic grove Oh really? Yea, I'm going through and double/triple checking everything. Already reset my token. Redoing my Roles. Not gonna bring my Bot up for awhile.
Discord will prob know more if you email them
It had to be something I pushed to github because I just did a push last night after making a few changes. Don't know how but the only thing I can think is I pushed my Redis db file.
IP origin
Ok
I found the leak. I had a "test" version of my bot when I first started working on it and really didn't know too much about it. I ended up starting over at some point and I created another repository but didn't delete the first "test" version. I had my token secure on the new version but the original had the token right there in the damn code.
And I never reset the token in between. Live and learn I guess.
!coins
@plucky field I know the feeling also happened to me when I just started making bots
@plucky field same!
Exact same thing happened to me
Except the person who first got the leak invited me to a whitehat server and didnโt give it away
Epic
Well I feel a little better. Thanks. Plus we've got the Discord Server almost fully functional again and I've removed any posibilities that anyone would have access to my token by deleting all the old files and adding extra security on my Redis server which is where I keep my token. Bots back up and running. Yikes though. What a nightmare. I learned a lot though. So there is that!
I just got kicked from a big server by the big man himself
I was trying to get to be one of the mods
Not even related to api
Now for the id is it the bots id or person id?
dbl.hasVoted("95579865788456960").then(voted => {
if (voted) console.log("Tonkku has voted!!!")
});```
alright im an idiot i didnt look well
user
How do I make it so that my bot will send a message in a certain channel that someone has upvoted or invited the bot?
For upvoted, just use dbl's webhooks
You can't for invited since there's no way to know who added it
Well, MrAugu did the invite for his bot
?
whats long winded?
long story
lol
You'd probably need to mess with oauth on your site and stuff
no
a simple glitch site would do
basically you use it as your invite, the user goes there, it detects the invite source via url param and redirects
i gotta look into oauth invite for v2
i guess you can use it for basic analytics anyways
@stray sierra You'll have to proxy this throught a server endpoint, is my thought
Then you can send a message to the channel
so you will need an http server to receive the webhook
Oh ok
const data = new Date();
if (db.get(message.author.id + "adwe" + data.getDate()) > 0) return message.channel.send("Odebraลeล juลผ nagrode na dziล!");
SyntaxError: Illegal return statement
why?
is it in a function?
(node:4302) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized why am i getting this?
probably a bad token
Either:
โข Bad token used for authorization.
โข No token used for authorization at all.
.-. i have good token, it wasnt reading it xD

@crimson geode em, you have db in file or module?
When I create a new dbl object and I set up client and statsInterval using dblapi.js, does it instantly push server count?
yes
got it thank u!
How do i get monthly votes since when i used points structure on the bot obj, it gives me the total votes
@restive otter monthlyPoints
bot.points.monthlyPoints or just bot.monthlyPoints
bot.monthlyPoints
Question: is there a way to get the API to send a simple text line to a discord channel via webhook when someone donates? I read through docs and all I saw was the example using express. I don't personally use it and would love an alternate option.
If you're using js, you can use dblapi.js
Something is wrong with this?
https://equalizerbot.xyz/screenshot/khflk.png
client.shard.fetchClientValues('guilds.size')
.then(results => {
var totalGuilds = results.reduce((prev, val) => prev + val, 0);
const snekfetch = require('snekfetch')
snekfetch.post(`https://discordbots.org/api/bots/405349279331254282/stats`)
.set('Authorization', 'token')
.send({
server_count: totalGuilds,
shard_count: client.shard.count
})
.then(() => console.log('Updated discordbots.org stats.'))
})```
What am I doing wrong
@plain timber
@restive otter totalGuilds is the amount on all shards?
Ye
client.shard.fetchClientValues('guilds.size')
.then(results => {
var output = results.reduce(function(accumulator, currentValue){
return accumulator + currentValue;
});
}).catch(console.error);```
I don't know
I think it is client.shards.size ๐ค @restive otter
Nvm
It is client.shard.count
Oh wait
the website seems kida broken
the server count always changes when i refresh my bots page
thats the caching from different clusters
post to the api
pls bal
I have been having a lot of trouble with people not able to claim their daily claim after voting.. It's like dbl and my bot aren't communicating.. Is there any known issues at the moment? Or honestly i don't even know where to start with this.. It worked just fine before.. I'm on js if that makes a difference
@royal vigil haha wanted to ask the same thing ๐
looks to me like it seems to be activated at a certain time/amount/whatever
how did you get this info
I did dbl.getVotes XD probably wrong
ah, your bots code ?
im trying to use the websites API to get the number of votes my bot has and instead it responded with that
getVotes is a function...
I know ๐ I had a stupid moment
I forgot the ()
now I'm getting object promise ๐ค hmm
await it
what
what
learn js
@royal vigil https://discordbots.org/api/docs
K
ahhhh so we need to update it our selves! thanks etcroot
What to do after generating API key?
Whatever 
@crisp river just look in the doc for your language
My language is python
np dammi
Hey, is API up to date about 12Hours voting ? because I see 24 hours on the docs
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
here is api
with this you can show ur bot like this
if u dont do , you will see this:
Is there a way to just get the number of votes a bot has instead of who's voted?
Thats what I'm asking if its possible. BC getVotes lists everyone who has voted. Not the NUMBER of votes
@uneven furnace what language
@humble bison js
i'm pretty sure it's an object anyways, try Object.keys(your vote thing).length
Hello sir ?
uh hi
reee someone help me with the weebhook for bot bot's server count, I have no experience at all
No to get the server count to the discord bot list website
post to the api
learn about API and how you can use it with your programming language
application programming interface
I'd suggest you to learn about API first, but generally how to post your server count is listed in https://discordbots.org/api/docs
Lmfao I have already finished it
nvm
you are hard to understand; first you said what an api is, then you said you already finished it, and now asking for a token 
Yes because there was literally code to copy paste on the api page
how ever
I didnt see that
unrelated, but are you using better discord?
Your discordbots.or token
Where tf do I find that

yw
what
Hey
I'm trying to generate an API key, but the generate button doesn't work

Anyone know why?
Microsoft Edge
pls dont use edge, many sites wont work properly on it (they're working on a newer version tho)
oh okay, thanks!
is there a way to test the voting system for a bot
there is a test button, if you are on the edit page all the way at the bottom underneath the webhook setup
oh thanks
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});
Can someone tell me why this code does not work with me ?
no
I have replace the token
but what's the 'password' and where I can find this ?
Perhaps read the doc
You are supposed to choose a password that corresponds to the authentication password on the bot page
a random password?
you decide what it is
ok
How Can i login to webhook?
{ webhookPort: 5000, webhookAuth: "" });
?
what is error
@limpid swallow you mean discordbots.org token?
really idk
Bot prob
@limpid swallow your bot id obviously
It gives you the correct code in your bots edit page
i get
Oops! Error: 403 Forbidden
in console, when the bot tries to post stats
and i checked api key
i have this
const DBL = require("dblapi.js");
const dbl = new DBL("api key is here", client);
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 800000)
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
403 means wrong API key @restive otter
Make sure you're using your dbl key and not bot token
Do I have to use an API key now
401 Unauthorized
I believe i has regen the token
help me ๐ง
401 means you didn't send a token @restive otter
send?
In your API request
i do
const DBL = require('dblapi.js')
const dbl = new DBL(process.env.DBL_TOKEN, client);
dbl.getStats(id).then(stats =>
console.log(stats))
its wrong? ๐ง
What if you try logging process.env.DBL_TOKEN
Try logging it to make sure it works
its work to post stats
but to get the stats etc
the error always happen
Also make sure you're using the latest version of dblapi.js
Does "get bot api" require authentication? If yes, how long?
It will need authentication soon iirc
I got 'unauthorized' now
Oh yeah it already does need it
Thanks for info
no permission
sh0w c0de
if (args[0] === "info") {
let user;
if (message.mentions.users.first()) {
user = message.mentions.users.first();
}
if (!user) return message.reply("Please input a valid DBL Bot")
let dblpage = `https://discordbots.org/bot/${user.id}`;
dbl.getBot(user.id).then(bot => {
let supports = `[Support Server](https://discord.gg/${bot.support})`;
if (!bot.support) {supports = "No Support Server"}
let web = `[Website](${bot.website})`
if (!bot.website) {web = "No Website"}
let githubs = `[GitHub Repository](${bot.github})`
if (!bot.github) {githubs = "No GitHub Repository"}
if(bot.server_count === undefined) {bot._count = 0}
if(bot.shards === undefined) {bot.shards = 0}
let embed = new Discord.RichEmbed()
.setAuthor(`${bot.username} DBL Information`, "https://images-ext-2.discordapp.net/external/8BBeTTZachdfvV_pRM7BuN7B8Xa7oH-wyk8j7PLyFhA/https/cdn.discordapp.com/icons/264445053596991498/f98ebaaa7f46cca0d412c26b3da4a286.jpg")
.setDescription(bot.shortdesc)
.addField("General Info", `-> **Bot Username**: ${bot.username} \n-> **Bot Discrim**: ${bot.discriminator} \n-> **Lib Used**: ${bot.lib} \n-> **Bot Prefix**: ${bot.prefix}`, true)
.addField("Bot Stats", `-> **Server Count**: ${bot.server_count} servers \n-> **Shard Count**: ${bot.shards.length} Shard(s) \n-> **Upvotes**: ${bot.monthlyPoints} upvotes (This Month) | ${bot.points} upvotes (Total Upvotes)`, true)
.addField("Links", `[DBL Page](${dblpage}) | [Bot Invite](${bot.invite}) | ${supports} | ${web} | ${githubs}`)
.setThumbnail(user.displayAvatarURL)
.setFooter(`This Command using DBL API. Requested by: ${message.author.tag}`, message.author.displayAvatarURL)
.setColor("AQUA")
message.channel.send(embed)
});
}```
the post stats func also 403 forbidden
i just want to check my bot / my friend bot at DBL without open the page
can you show where dbl is defined
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBL_TOKEN);
const Discord = require('discord.js')
exports.run = async (client, message, args) => {
if (!args[0]) return message.channel.send(`
\`\`\`Use my!dbl [option] [Tag @ Bot]
- info
- widget
\`\`\`
`)
if (args[0] === "info") {
from the edit bot page
alright, can you dump it to check the value
@sand hazel my post_stats also 403 forbidden
i already post the stats more than 4 month, but nothing happen like this
so, dump the value?
when i delete the token
so, can you dump the value (for the 4th time)
what the meaning of "dump the value" ?
dump process.env.DBL_TOKEN, make sure it's not truncated and it's the expected value
in addition, you can add a line to dump the dblapi options, in src/index.js, L104
@sand hazel btw my dbl webhook is working well
webhook does not use the API token generated by DBL
ok? but webhook doesn't use that?
i cant run the webhook if i delete the token
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
I honestly don't see anything regarding that DBL token
The DBL token constructor parameter is purely for payloads to DBL API
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
nor does the dblwebhook constructor takes the dbl token
nor does my lib: https://github.com/DiscordBotList/go-dbl/blob/master/webhook.go#L53
how it changed the background and color of letters where the bot appears on the discord bots page
Vote api broken
ah
I cant get votes
when vote api will be fixed will votes get issued again? My users want their voting bonus and I'd like to have those votes I got this morning
new one is already released?
idk then :/
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const DBL = require('dblapi.js');
const dbl = new DBL(`Token that I wont share`, { webhookAuth: 'no' ,webhookServer: server, webhookPort: 5000});
dbl.webhook.on('ready', hook => {
console.log(`Succes, webhook running on http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
dbl.getUser(vote.user).then(user => {```
Ok
that's my code
It is discordbots.org api code
yes
So thats not your code
and it used to work fine until this morning
User with ID 150590205437411329 just voted!
(node:31316) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.res.on (/root/overseerbot/node_modules/dblapi.js/src/index.js:115:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:31316) 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)
that's the error
if someone can help I would be grateful
which function are you using
update the module
ok
to 2.3.0
votes issued in that time are lost, right?
and I recommend using client.users.get() instead of the DBL api to get a user
okk
is the discordbots api built to allow plugin customization when managing bots in your server?
or is it a way to display it in the website?
I've made a couple of bots using the discord API so I'm trying to figure out what the discordbot API is for
our api is mainly for posting your server count to our site so it displays on your bot page and on the lists and for checking who has voted for your bot
ah cool
so publishing my bot in the website and using the API are not dependent on one another?
using the api is optional
ok, thank you
updating api fixed problem, thanks tonkku
I'll come back with some other questions eventually ๐
How do i open a port for discordbots using ubuntu vps on ovh?
Like, what are the IPs of discordbots.org so i can make only that site allow to send requests to my vps
or does it do that automaticly
@arctic arch ?
wouldnt that be the ip to your server
idk..
hmm
I dont use OVH, but those options look similiar to something else
0.0.0.0 might allow all
Bruh
and set protocol to tcp
BRUH
I just wanted to set it up for Vyan but I remembered he's not on DBL
is Vyan your bot
I want HQ trivia lives bot
@arctic arch why u askin
@light pollen you need to set up a webserver to accept the POST request sent by DBL
if you use js then you can use the dblapi.js package, or set up a post route in express
Discord.js-commando ?
um, lemme do it in #memes-and-media 
api saying error 403
token is 100% definetly correct
even tried new one
and have set the thing up correctly, because it used to work
ping me*
@restive otter 403 means wrong token 
Did the API changed again?
https://cdn.discordapp.com/attachments/448189613433946122/520348663315169280/204232208049766400.png
It should show the monthly and total votes and not ?
I got that right now on starting the bot:
Accumulating suspicious amounts of cached events during guild setup, something might be wrong. Cached: 2000 GuildId: 264445053596991498
The ID is this guild
Something doesn't seem right, because no matter what I do, it returns ? which means, that the returned JSON is wrong somehow
And I get the json from https://discordbots.org/api/bots/:id
Like I thought.... Page changed
Any way to receive the info now?
api requests require a token now
Even through the page mentioned above?
I remember asking that (if those requests would require a token now) and the response was No.
How should it be send?
auth header
What key? "auth"?
Authorization
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); on the site, it says password (webhookAuth), where exactly do you get this password (or do you just set it to a random thing?)
@distant ibex you can set it to anything but it needs to be the same in your code and your bot edit page
hey @arctic arch does dblapi.js have something for the Get Bot Stats endpoint
i dont see it in docs
maybe maybe not

!server
hmm....
Why does the counter run like this
lol x3
Are you intentionally refreshing the page? Cause I can't even tell what's happening or what you are trying to show
he try to show that the vote counter is changing every refresh
but that is basicaly because of multiple servers cache right ?
it is explained here
Sometimes, numbers on sites like YouTube and Twitter jump up and down; subscriber counts lag, like-counts bounce all over the place. Why is it so hard for co...
@restive otter
Yes @tidal burrow
It's caching
reminds me of the cloudbleed
how do I get the discord bot list webhook server pass and port?
weird that you asked that, considering you don't have a bot listed here
dbl.getBot("478202666355523585").then(bot => {
points = bot.points;
});```
Unauthorized
While it wasn't before
My token is right, I've checked
Also I'm pretty sure posting my server count wouldn't work if my token was wrong.
Do we not have access to .getBot() anymore?
update to v2.3.0
For some reason API stopped working for me while ago, I removed all of the codes, And now when I set the server count by postman, It changes itself!
@arctic arch You might wanna take a look
cache
I cleared the cache
Then what should I do?
It's nearly impossible to use it now, I had to remove codes and it's not kinda updating it due to cache
it is updating
you're just not seeing it right away because we're serving a cached version for a while
They are not the same
But what about the numbers?
I've sent 7
And it shows 2
I've sent 16476
It shows 16483
you're posting two server_counts
which means an array
which means server counts for individual shards
and this is the end result
so, on the api documentation, it sas .hasVoted returns if the person has voted in the past 24 hours. is that actually 24 hours or is it 12, because you can vote every 12 hours?
okay because i have a .hasVoted set up , so if someone does my vote command, if hasvoted comes back true, it tells them "thank you for voting" and if it comes back false, it displays the vote link
but i tested it today when i knew i hadnt voted for 12+ hours and it gave me the thank you message
ill have to check my code
thanks
Hello,
I would need a person who takes care of checking the bots for the meters on the site of discordbots and, who speaks French please. Thank you.

(node:1046) UnhandledPromiseRejectionWarning: Error: 403 Forbidden
at IncomingMessage.res.on (/rbd/pnpm-volume/badc03b8-a538-46b8-a786-efd67ab85be3/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:1046) 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:1046) [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.
TOKEN IS NOT WRONG, ive tested and checked many times
Im using glitch, and this has worked befoe
i have it set up like this
const DBL = require("dblapi.js");
const dbl = new DBL("a token that is here and correct", client);
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 800000)
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
its for a bots stats
You don't need the set interval or post stats if you include client in the new DBL code
either way it does not work, i need a fix
logged it
DBLAPI {
_events: { posted: [Function], error: [Function] },
_eventsCount: 2,
_maxListeners: undefined,
token:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ4MDQyMTQ4MzU3NTkwMjIwOCIsIvdCI6dHJ1ZSwiaWF0IjoxNTQ0MTI0NzQ0fQ.HRPvPW1US8by9BX0fdmK2m_eaNO8lcvpRUGkyJnAP2Q',
options: {} }
got that
took 2 things from token btw, dont bother tryin it
can you log the options in the _request
if you only removed two things it could still be found out
i dont care, im changing it as soon as its fixed
why am i getting incorrect token error
if the token is correct
so you're posting stats?
yes
looking at recent logs I see no requests that result in a 403
Oops! Error: 403 Forbidden
it'd be so much easier if the request options were known so you can attempt to reproduce it in postman
can you log e.body
its not undefined if you get the forbidden logged
dbl.on('error', e => {
console.log(e.body);
})
and what was the spam?
could be someone else using glitch





