#topgg-api
1 messages Ā· Page 28 of 1
with a PUSH request to your url 

heyo guys quick question what data structure is the dbl.hasVoted(userid) supposed to return using the official .js lib?
ping me please
a Promise<Boolean>
okay thanks thats what i expected but is wasn't specified anywhere, maybe add this info to the docs?
I mean, it's kind of obvious
would still be helpful if ones not sure whats causing the errors one has
oh another question, it only says "This function hasVoted can be used to check if a user id has voted"
does that say true if the user has voted anytime or is it meant for inside of the daily cooldown
In the 24 hour time span
okay then i did something wrong haha
thanks for the help anyways
@blazing egret flask
So... What do I do with the token in Discord.js? Does discordbots.org's token replace Discord's? E.g. I past the token from ur website where I put the token from discord. Is this true? Please @mention me to answer! (That is the way I can find ur message š )
@lethal ravine No. It's a complete seperate token to access the info-page of your bot on discordbots.org and add/update stuff like the current Guild-count
/bal
@hoary timber So... how do I use it?
Uuuuhm
i just started using the js lib and i get false for hasVoted(myID) even after having voted
is the api dead or bugged or whats wrong?
could you wait 5-10 minutes and try again? this might be a caching issue
oh okay ill try that, ill be back at 21:00 to update you if its fixed:D
its still false 
@lethal ravine That's how I use it:
https://github.com/Andre601/NekoBot/blob/master/src/main/java/net/Andre601/core/Main.java#L29
https://github.com/Andre601/NekoBot/blob/master/src/main/java/net/Andre601/core/Main.java#L57
https://github.com/Andre601/NekoBot/blob/master/src/main/java/net/Andre601/listeners/ReadyListener.java#L26-L27
https://github.com/Andre601/NekoBot/blob/master/src/main/java/net/Andre601/listeners/ReadyListener.java#L69
@elfin solstice its still not fixed so don't think its cache related
uh
@woeful grove The module is broken, I'll get what I made to fix it one sec
Hold on, could you try editing a file in the package for me? In the node_modules/whateverthedblpackiscalled/src/index.js change ```async hasVoted(id) {
if (!this.token) throw new Error('This function requires a token to be set');
if (!id) throw new Error('hasVoted requires id as argument');
const response = await this._request('get', 'bots/check', { userId: id }, true);
return !!response.body.voted;
}
toasync hasVoted(id, botid) {
if (!this.token) throw new Error('This function requires a token to be set');
if (!id) throw new Error('hasVoted requires id as argument');
const response = await this._request('get', bots/${botid}/check, { userId: id }, true);
return !!response.body.voted;
}```
I just copypasted my old message
@woeful grove Use that ^
Are you sure?
yeah only discordbots.js and discordbotslist.js
Oh you're on an old version of the package
What exact module are you using?
run npm install dblapi.js@2.0.0
i have 2.0 now
and it seems that it correctly gets the voting state now
at least my bot didnt message me that i can vote again
you made the lib?
hm ok
well thanks anyways hope its fixed now
@lavish helm there's a bugger in the module?
@arctic arch There's been some issues with people having old versions of the module installed, also just want to make sure that bots/check is an endpoint and not bots/:bot_id/check
the id is optional
Are you sure? I'm getting error code 400 on that endpoint
You need a user id to check
lol
lower case D
I've also had a number of uses report to me that they've just voted and did not receive their daily bonuses (even an hour or so later), I'm not using a module, I'm using snekfetch requests.
who here that knows discord.js can help me set up connecting my servercount/dbl key to my bot? pls ping me to reply š
and what exactly is a webhook? im new to dbots xD
@lethal ravine read the wrapper docs and api docs
i did. didnt help. š¦
copy pasta
const Discord = require("discord.js");
const client = new Discord.Client();
const snekfetch = require('snekfetch')
const token = 'dbl token';
client.on('ready', () => {
setTimeout(() => {
snekfetch.post(`https://discordbots.org/api/bots/stats`)
.set('Authorization', token)
.send({"server_count": client.guilds.size})
.then(() => console.log('Updated discordbots.org stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body.error}`));
}, 3000);
});
client.login("ur bot token")```
if it says "Updated discordbots.org stats." just close the terminal/console
tell me if it works
@lethal ravine :/
should this be in a separate file? Where should this code be?
u can just put
setInterval(() => {
snekfetch.post(`https://discordbots.org/api/bots/stats`)
.set('Authorization', token)
.send({"server_count": client.guilds.size})
.then(() => console.log('Updated discordbots.org stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body.error}`));
}, 60000);```
in ur ready function
also u need the "token"
is this instead of the code u sent earlier?
its the same code
a npm module
ok... do I need to change that?
BTW i used ur code and it did nothing.
OMG NVM THANK YOU SO MUCH IT WORKED @restive otter THANK YOU!!! ā¤
no prob
Wot
So, is this a known issue @arctic arch ?
nope
caches between clusters could explain why it's sometimes different and sometimes not
but
i dont know why the list is so short
well, do you know how I could solve this?
because of this I'm right now not able to reward users for voting
that's the problem I have.
he's not wrong
webhooks are recommended
And you could reward them instantly when they vote
I made it quite simple on the module
look at pins
Instead of checking every nth minute or so
okay, thanks I'm gonna take a look at webhooks.
tbh, I didn't know webhooks are that easy.
but that's offtopic so I'm sorry
Its alright, they are much better in a sense that you don't need to check who voted
In the pinned example, is vote just a user id or a whole user object?
https://discordbots.org/api/docs#webhooks
it's the object here
in data format
Just curious what if the bot is offline
^
It won't receive any webhooks due to it being offline
And when you have more than 1k votes/day
have webhooks in a separate process
Yeah well fair enough
and keep it always online
I have an other question.
What if the user isn't online/cached for the bot?
But you need a user object?
For example to send them a DM.
you can most likely fetch it
dont you have the same problem for regular voting checks
@sudden rampart .fetchUser() only works for user accounts (djs)
wat
bots can fetch any user 
yup
For some reason
dbl.webhook.on('ready', hook => {
console.log("Webhook running at https://" + hook.hostname + ":" + hook.port + hook.path);
});
```doesn't work for me.
I'm getting
TypeError: Cannot read property 'on' of undefined
What did I do wrong?
Whatās inside the code
edited it.
I'm on latest.
webhook is undefined wat else
wait, found my bug


@restive otter can you send the whole code for your previous vote check?
you mean the one where I just requested an array full of the ids?
function check_votes () {
dbl.getVotes()
.then(votes_ => {
var votes = [];
var time_now = new Date().getTime();
for (i=0; i<votes_.length; i++) {
votes.push(votes_[i].id);
}
console.log(votes);
// below is unrelated
});
setTimeout(check_votes, 60000*4);
}
-bots @restive otter
@raven matrix
I'm getting the full array consistently
How often have you tried?
and with which delay?
I have been trying over 30 minutes every 4 minutes.
and once every 5 times or so it fails
@arctic arch hello? :3
mmh, okay.
const DBL = require("dblapi.js");
var dbl;
if (client.shard.id === 0) {
dbl = new DBL(config.dbtoken, { webhookPort: 998, webhookAuth: config.dbWebhookToken });
} else {
dbl = new DBL(config.dbtoken);
}
if (client.shard.id === 0) {
dbl.webhook.on('ready', hook => {
console.log("Webhook running at https://" + hook.hostname + ":" + hook.port + hook.path);
});
dbl.webhook.on('vote', async (vote) => {
console.log("Webhook received...");
console.log(vote);
}```
It prints out:
Webhook running at https://0.0.0.0:998/dblwebhook
On discordbots I entered this:
For some reason I don't get printed anything in console.
Does anyone know why the Webhook isn't working?
did you get something?
I don't think so.
I think you arent able to bind ports lower than 1024 without root/administrator permissions
try using some higher port
doesn't say Webhook received... in console.
okay, one moment.
minecraft 
because it's minecraft
xDD
high five
yep, dont bind ports lower than 1024
unless you have admin perms
or root
depending on os

thank you
https://discordbots.org/api/bots/myBOTid/check?userId=message.author.id
I'm trying to do a GET on that but it requires authorization for it to happen. How do i do that?
with the api? or some other for of getting like snekfetch?
@restive otter What language and modules are you using?
You need and Authorization header with the value as your discordbots.org token
@restive otter ```js
app.post('/api', (req, res) => {
console.log(req)
res.status(200); //OK
})
Anything seem wrong with this?
Why did you ping me 
Sry..
it ok
nothing it wrong with that
req.body is what you're looking for
make sure to have the body-parser middleware
Cause somehow the test isn't reaching my machine. (and i'm trying to see what all will be coming with the request btw)
@wanton matrix snekfetch
Language?
JS
he is.
then say that :p
anyway it'll be something like
snekfetch.get(`https://discordbots.org/api/bots/${client.user.id}/check`)
.query({ userId: message.author.id })
.set({ Authorization: dbl bot token })
.then(res => {
console.log(res.body);
});```
async version: js const { body } = await snekfetch.get(`https://discordbots.org/api/bots/${client.user.id}/check`) .query({ userId: message.author.id }) .set({ Authorization: dbl bot token }) console.log(body);
Needs header
Any idea why i'm not receiving the test jacz
Maybe because you're trying to use a localhost ip?
is the port open
I'm using public and yes.
"I'm using public" what?
ip
ur machine ip?
no
then what?
Public Router/ISP given
then you'll need to port forward the app... Use ngrok or something
I've portforwarded
15|fishy | (node:26752) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 messageReactionAdd listeners added. Use emitter.setMaxListeners() to increase limit
15|fishy | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
15|fishy | Error: getaddrinfo ENOTFOUND discordapp.com discordapp.com:443
15|fishy | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
15|fishy | (node:26752) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND discordapp.com discordapp.com:443
15|fishy | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
15|fishy | (node:26752) 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: 12464)
15|fishy | (node:26752) [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.
is this caused by dbl?
nope
It's a promise rejection on your code and Error: getaddrinfo ENOTFOUND discordapp.com discordapp.com:443
Jacz, i think i may have figured it out.
except its still broke
i mean i'l still try ngrok.
Im listening
Some other sites I used to test it said something about CORS
I also tried using dbls webhook class and still won't receive
my bot is having trouble posting stats to the api, its coming back with an error saying access denyed.. any idea how I can fix this?
Are you sending an authorized request?
i have entered my api key,
[2018-04-14T12:56:36.321] [ERROR] logfile - { error: 'Unauthorized' }
[2018-04-14T12:57:06.358] [ERROR] logfile - { error: 'Unauthorized' }
What lang/lib?
javascript + discord.js
And you're using what module to post stats?
snekfetch,
ok, do you have .set('Authorization', keyhere) in your post request?
yes
What url are you posting to?
It's a z not an s in Authorization
np
u idiot lol
obviously told you š š
I'm getting error unauthorized while posting server count using dbl package, but the token is correct? :/
@coarse flax What is your code?
client.shard.broadcastEval('this.guilds.size').then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})``` @lavish helm
How did you initialize dbl?
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL);```
Example
Are there any rate limits for the API
60 request per minute per ip
i agree
The DBL module has broke most of our commands and is spitting errors constantly. Something about being unauthorised, whereas the token is correct?
I think you might want to double check the token by printing it to console against the one online
And spell Authorization correct or else DBL canāt detect it
broke most of our commands

if you're checking for upvote on all commands you're going to have a nice 429
:^)
Or 401?
Show your headers
dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})```
and then to check for votes it's:
dbl.hasVoted(msg.author.id).then(results => {
if(results == true) {
// code here
}
return;
});```
Can you show us the error from the console?
You are on version 2?
It's too long to put on discord
Screen shot it
I can't it's too long
Wew
Welp
Hmm
Hmm have you tried regenerating a new token from DBL and using that to try?
If not there might be something wrong with the dblapi library
trying that right now
Something must be wrong, I reset the token and changed it in bot.js, but still it's erroring and in the header, it's trying to authorize with the OLD token ```js
_header: 'GET /api/bots/check?userId=223919574536552449 HTTP/1.1\r\nHost: discordbots.org\r\nAuthorization: oldtoken\r\nUser-Agent: snekfetch/3.6.4 (https://snekfetch.js.org/)\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\n\r\n',

did you restart it
Maybe try reinstalling the library?
yes I did restart it
Ok so now in the header it says the correct token, but still errors.
and it crashes the shard when it errors
ĀÆ_(ć)_/ĀÆ
Yeah are you using an outdated version of the api?
Or maybe you should reinstall the api library
I'll give that a shot..?
I guess reinstalling it fixed it? Weird though, idk what went wrong? My code was correct.
Yeah prolly the library was outdated and stuff
What version of DBL do you have?
does dblapi.js's webhooks work yet
yes
Iām using the updated version
hmm i added the example code but its not logging when someone votes
but on boot it did say Webhook running at http://0.0.0.0:5000/dblwebhook
i see you there unb 
and you set up DBL to post there?
yeah, its not working (i did try the actual url instead of 0.0.0.0)
using the test button
How do I make my bot's status 'online' on the site?
It goes through Luka, is what I was told, so your bot would have to be in this server.
Once its been fixed then message them asking for the bot to be reinvited.
No, it has been accepted but they instantly kicked it from here
Whast your bot's name?
Kick | Case #5189
Bot
Member Count#7205 (@Member Count)
Moderator
Melmsie#0001
Reason
will spam "NEED ADMIN PERMS" if it doesn't have them. Soooooo
Today at 10:30 AM
You'd have to do that in your code or however you do it b/c they don't have time to be doing that
I understand that. Like if the guild is this, return?
Most likely
Well it doesn't spam it
only when a user leaves or joins š
I changed it now. Ignores this server. How can I get it invied again?
DM a Moderator
I guess Aetheryx is the unlucky one
user join and leave is quite spammy, disable that by default lol
Does dblapi.js use a module called accepts? ERRORā EINVAL: invalid argument, readlink '/rbd/pnpm-volume/8e3492ef-dd7b-4c65-b27c-f566f0ed1254/node_modules/accepts'
Getting this every time on restart
nope
maybe cause u had the old version

I don't have website and github to put widget, can i apply for certification program?
Hey, this doesn't seem to be working. I can write but it gets stuck getting the response. C#
Can you find something immediately wrong with the code?
var request = (HttpWebRequest)WebRequest.Create($"https://discordbots.org/api/bots/{client.CurrentUser.Id}/stats");
request.Method = "POST";
request.Headers.Add("Authorization", botConfig["httptoken2"]);
using (var writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write($"{{\n \"server_count\": {count}\n}}");
}
string response;
using (var reader = new StreamReader(((HttpWebResponse)request.GetResponse()).GetResponseStream()))
{
response = reader.ReadToEnd();
}
Hey, which C# version and .Net Version are you on?
net core 2.0
Very good, you might want to consider HttpClient instead of WebRequest and casting then.
It combines the best of both worlds and is (imo) easier to use.
I see
Also, I haven't used WebRequests in a long time, but should there not be some async/await? You use the API correctly from what I see.
hmmm, might be, actually
I also happened to set the function as async and I hadn't done that before
but I'm trying out the HttpClient format and see if it works
Sure, let's move to #development then as this has less to do with the API and more with C# š
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/root/disbot/********/*****/dibot.py", line 25, in update_stats
await self.dblpy.post_server_count()
File "/usr/local/lib/python3.5/dist-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/usr/local/lib/python3.5/dist-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/usr/local/lib/python3.5/dist-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
any idea?
i got aiohttp not compatible with that pip but if upgrade then discord.py not working ...
How many ram and what cpu is running Dank Memer bot?
- wrong channel
- ask the owner
- why do you need to know
I think it's because they had a job posting in the #434058442764714002 channel earlier.
so I created my bot a few days ago and it got verified but It still says its not in any servers, which I know it is because the log is return a lot of users using commands, how long does it usually take for it to show the amount of servers it is in?
Post your server count to DBL
Server count on DBL is accomplished through use of posting to the API
Using the access token from your bot page
thanks
You could also use a library for helping you automatically do so
There are libraries for python, java, javascript and c#
ok
var list = await DBots.GetVoterIdsAsync(1);
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.UInt64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '[0].username', line 1, position 13.

Wow
@lucid vale that's been removed from the api
@sudden rampart are there other deprecated endpoints?
i don't think so
@sudden rampart https://github.com/DiscordBotList/DBL-dotnet-Library/pull/1 can you merge this? š
@vital anvil
Ah, thank you
what i did on mine was do the normal request but map to ids
I'd personally not do that because that pollutes peoples code or rather your library. Also encourages "hacky" behavior and makes your lib code harder to maintain and read.
i deprecated but added a fallback so existing code wouldn't break
next major version the methods will be gone
Oh, nice idea then. š
Done
Thank you š
How can I make the action happen when I vote?
weebhook webhook
web server and register a webhook at the dbl; docs: https://discordbots.org/api/docs#webhooks
ok so I tried making it so that it shows the amount of servers my bot is in but no matter what I do it doesnt seem to work (Discord.NET)
@restive otter what is your code
I don't know C# but I can see if you're posting correctly
I know .NET š
did u check #312614469819826177 :/
noooo stop referencing that
That channel needs to be gone (even though it may have some interesting stuff)
Lol I still use an example from #312614469819826177 and it works great
Yes, Iāve used both examples available with C# and neither of them worked out for me
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[DiscordBotsList.Api.Internal.Entity]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'error', line 1, position 9.
got this a consecutively 3 times in a row.. then it stopped. assuming someone is working on it.. just thought id share
DblApi.GetVotersAsync(1) threw that
that endpoint is deprecated iirc
so using DblApi.GetVotersAsync(1).. shouldnt that return the last 1 day of votes?
like 24 hours ago from the time now
the GetVoterIds isnt working anymore
so i need to write my own http request or whatever to get votes?
Oh, sorry I was talking bullshit. GetVoterIds is obsolete.
The other one should work..
Hold on, I'm taking a look
Man, I should have read the chat history
I have no idea why that throws
it only happened a couple times.. and im pretty sure its unrelated to the issue im having
just thought id mention that error incase it meant something
just maybe im using the method wrong.. i assume a 1 in the params would be equal to the last 24 hours
Yea, thanks for letting us know. I will observe if more people report this. For now I'd simply suggesting to make a try catch as temporary hack.
yeah i caught it in a catch, added try catch when the site went down for a few moments the other day
any feedback why that method would return all the votes ive recieved over the last 4 days? instead of just the last 1
Mh, I think the library is out of date
There is no query parameter "days"
unless it's not documented I can't find any endpoint that has the same signature and accepts "days" as param.
So I'd say the endpoint got update at some point but the library not and therefore the days parameter is basically ignored.
ok, yeh im not sure how to write those requests.. suppose ill have to figure it out lol
GET/bots/{bot.id?}/check
this endpoint says it will give the last 24 hours
i can run the check when the user runs the command
is there any example youre aware of for a GET request? related to this lib, not sure how it checks for a single user even
Ah sorry, forgot to answer. If it's not in the official API it won't work. You can however use webhooks and build your own database that way.
no idea how to even set that up.. dang.. bot is growing exponentially faster than i expected. rip lol
idk how to do that. trying to get someone to help me out with webhooks.. which i think will ultimately be more helpful
What lang do you want the weebhook handler to be in?
c#
oooo
you could use ASP.NET
and just learn about POST requests and how to get the body
id have to figure out how to actually post it.. to the right link.. etc
I can help you
can you get a white/light or custom theme of the bot widget? my entire website is dark and it doesn't exactly look that good (see below)
Who does work on the API?
@humble bison look at the docs, scroll down to customization: https://discordbots.org/api/docs#widgets
thanks
how do I use webhooks to get the voters per day?
cretae a webserver
u also should read the docs
yea, I read them, but I would like some points of start
Rias im in the same boat
so im just grabbing users when GetVotersAsync changes, adding a timestamp and keeping track myself
i made an object with UserId and TimeStamp and just serialized it into xml and stored it.. u could do json on a db would be easy too
This kind of data storage works for small data sets. But it's not scalable.
In the long run you want an actual DB.
if someone can help me to build one 
I don't know from where to start
which lib are you planning on using? and which lang? @terse trellis
Just ignore the Analytics stuff
I'll see
I need help with the Voting check system...
Im not smart enough to understand it. š
I always get an error.
@rotund cave give me a dm
Who works on the API? would be slick if the getvoter methods got fixed
for js it's tonkku
That is not the API though š
sry
@elfin solstice
Could you help me make the bot's server count? In discord bot list website
@tardy crater
Could you help me make the bot's server count?
@junior goblet
Could you help me make the bot's server count?
Could you help me make the bot counter that appears in the bot profile on the discord bot list site?*
first off dont ping more than 1 mod
second
there are librarys for the bigger languages you can use, they have examples and everything
look at https://discordbots.org/api/docs
and then >Tools
I know, I've seen it. But when I boot my bot
I know, I've seen it. But when I boot into my bug bot
@slate pilot what error are you getting
@junior goblet
no
what you can do
npm install -g n
sudo n latest
@junior goblet
ok now do sudo n latest
const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL('Your discordbots.org token', client);
is that correc5
wheres should i put
its installed
put it in your bot file
@junior goblet in 'your discordbots.org token put my bot token?
yes
@junior goblet
the ... The same error continues: c
please try to keep your token out of the screenshots
@slate pilot don't put your bot token where it says discordbots.org token
put the token found on your DBL edit page
I need help...
const DBL = require('dblapi.js');
const dbl = new DBL(config.discordBotListToken, { webhookPort: 5000, webhookAuth: 'Webhook Authorisation Token, I have replaced it for security reasons'});
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
I got people to vote however, nothing seems to be happening in console.
did u set the bot to post to your server
No, just to log to the console when a user upvotes
So I create a new webhook on the channel i want it to be posted to? Then use the Webhook URL in the DBL Webhook thingy
nonono
you get the public ip of your server, place that there
Public IP? š
like http://your.public.ip.here:theport/path
Where can i find my Public IP?
do you have a VPS
No
home hosted?
Well, kinda, I host it at home while configuring the bot, but use Glitch when im not editing it or when I sleep
does glitch give you a url where your app is hosted
Let me check a sec lol
I believe it was meant to be a webhost
No, It can also host Node Apps
you can use that as your public ip
So how would I get that? Is it something like, Your bot is being hosted on public.ip:port, in my console or something like that?
Wait
so I just made a new project
Would this be it?
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
and I have this url https://plum-town.glitch.me/
A cool thing made with Glitch
Oh okay, so I would set that as the webhook url?
so project-name.glitch.me should work if port is 3000
I clicked test and nothing happened still lol
Ah okay, so can the Authorization box be a random one or can you spam your keyboard?
So basically, can you put anything you want into the Authorization box?
the authorization on the website needs to match what you have in webhookAuth
anything works as long as it's the same
Ah i get ya. Thanks
@arctic arch Please do not get mad but, is this correct?
const DBL = require('dblapi.js');
const dbl = new DBL('Link to the Glitch Project followed by the /dblwebhook', { webhookPort: 5000, webhookAuth: 'My Auth Token' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
(tbh i used express)
you hosting it on glitch?
Yeah
well one obvious thing is that you need to label your DBL
'Link to the Glitch Project followed by the /dblwebhook' should be the discordbots.org token
no
'My Auth Token' is the thing you set in the webhook options on the website
'Link to the Glitch Project followed by the /dblwebhook'
should be projectname.glitch.me/dblwebhook
no it shouldnt
RIP
right. okay seems i looked a bit to deep
@restive otter change the port to 3000
Just did, but then it came up with a huge error
You have 1 app on port 3000
š
Is that why it is doing that?
something's already running on that port
Oh lol okay give me a minute
Ctl Shift X
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
this code you posted earlier is the thing running on that port
comment out the app.listen line and I think it should all work fine
What other apps do you have running?
Like what are they used for
in this glitch project
I just literally deleted them all
I only have one App
This is the very first piece of my code on Glitch.com
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
Surely I can change this to make it work, right?
//app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
I would try this
Okay, is that all i would need to do to make it work lol?
Oh wow, thanks guys š It works now lmfao
Now, to make it send a message to a specific channel on discord, would I do:
client.channels.get(channelid).send("So and so?")
?
looks good
Alright thank you lol.
What did that line of code even do? The one that we put into a comment?
it's the line that starts using the port
but now that you're running the webhook you shouldn't need that
Okay. Thank you š
wew just like the guy before
set port to 3000
$PORT should be 3000 ($PORT = process.env.PORT)
Can I have help with some code in js?
this channel is to do with the DBL api, not with any Discord library
does anyone know how to get total members in all guilds in discord.net?
try #development
For some reason, DBL documented code for 'posting guild size' causes a huge mem leak on my bot. Fixed it by making a function for it then call it at setinterval on ready. Is this some sort of bug
thats how you are supposed to use the API, you have to have it with a interval
how do I setup the webhook?
š¤
@robust hinge Check the pinned message š
How is the User Snowflake handled?
Or what datatype i suppose..
I tried decoding json into strings. But thats not working
What do you mean by that's not working?
tried to breakdown user variable.. but i dont think thats what im looking for
do u know what the POST request of the webhook looks like
by chance
query? String Query string params found on the /bot/:ID/vote page. Example: ?a=1&b=2
thats on the webhook docs on DBL.. but i dont see any query string params on the vote page
i suppose this isnt an API question :/
I am trying to setup the API with my bot but apparently IBot does not exist while using the .net library... am I doing something wrong?
AuthDiscordBotListApi DblApi = new AuthDiscordBotListApi(
You didn't even read my message š¤¦
there is IDblBot
that doesn't work...
what docs are u reading that say use IBot?
I am just reading what they say to do
oh, getting bots, idk might be obselete.. doesnt seem there has been work on the api in some time
what are you trying to do exactly
I am just trying to use the api to update my bot's stats
I think I got it now
idk
yeah this api is not very good...
I am removing it doesn't work
I don't even think it works with .net core..
i use it on c#.. both GetVoter methods are not functioning.. well GetVotersAsync does, but not properly.
Why dont the api docs mention monthlyPoints on https://discordbots.org/api/docs#bots ?
How do i add variables into my commands?
This channel is for the DBL api, you should ask in the #development channel instead
@arctic arch There are confusing instructions on https://discordbots.org/api/docs#jslib. https://uwu.whats-th.is/80c41c.png
@severe mist You should of said it varies.
@inner rune wdym?
I was trying to make a joke
trying
But York, do you use the dblapi.js thingy in Misaki
@inner rune what's confusing
The fact that options is optional
it's cleared up in the contructor part
and the examples are not instructions 
they're pretty much there for the lazy dev to copypaste 
or noob ĀÆ_(ć)_/ĀÆ
Tonkku, tried to reach you about webhook parameters. In the header request i didnt see anything that defines what user voted. In the docs, it says there is.
are you sure you dont have anything about the user
@inner rune no I do not, but I might be soon as my original concept isn't viable atm
there should be a user variable with the id of the user
I only saw bot, Upvoted and... type? Only 3 and none were user
Upvoted isn't even a thing 
In a webhook you saw that?
I was reading the request payload sorry. But i dont say any thing. What are the name of the parameters, and what all gets passed?
BotId, UserId, and Upvotes
If I'm not mistaken
or just BotId and UserId
Upvotes might be a thing on my end I have
Ill try them. The docs say they are listed on the vote link for each bot. But i didnt see any

Eh i got it. Thanks guys

I can't seem to get https://discordbots.org/api/users/{USER_ID} to show me supporter status using my API key
how's it going, my dudes, what does the ? mean on some fields?
I would assume it means optional
that makes the most sense yeah
all those fields are things that you may not necessarily have
also user end point doesn't require auth
How do I check supporter status of a user for my bot then?
the api returns the supporter status of a user
Yes, but without an API key, how does it know which bot I'm referring to?
Know what I mean?
why would you need to
i think supporter is just support of dbl itself
i have no idea what supporter even is so
If they've voted for the my bot within the last 24 hours
some bots lock features behind that, like Pokecord
so it has to be checkable
oh, you're verifying a vote?
yes
there's a method for that
I'm looking through the api docs right now
I had assumed it was what the supporter field meant
You're supposed to be able to use your api key to verify a vote
but all I get are 404 errors
I think I got it
https://discordbots.org/api/bots/{BOT_ID}/votes
headers: {Authorization: DBL_API_KEY}
that works, I was thinking /check
But you can't use that endpoint with over 1000 supporters apparently, so keep that in mind
Webhooks š
come on man how do I run /check
hey I got it
only took 3 headaches and a pain medication and a whole lotta irb http://files.chew.pw/77e13a8540434d154f053328b075f4dd.png
Would anyone suggest a way to use the dblapi.js with sharding? cuz if you shard you can't post stats for both shards nor run the webhook for one shard.
just don't use dblapi
Do the votes reset each month or each day?
Monthly.
Okay thanks
No problem.
so i added my discord webhook to the api webhook for my bot. I also added a authorization, and hit test. Nothing happens...does it only work for real votes, or does test not work?
discord webhooks won't work
oh
the format is different from what discord requires
@indigo trout , are you trying to get upvotes to send to discord?
ye
you have a website by chance?
even a free webpage that supports php
really simple way to do php to get upvotes.. dm me if anyone needs
shilling my script here: https://github.com/lolbot-project/dbl-hook-server
dbl-hook-server - discordbots.org upvote handler. upvote => hook => discord hook.
it's a pretty easy python script
(it does work ofc)
@short forge where does it save it to? or does the person using this have to do that part
if you have a hosted webpage, ill offer free pages too. Users wont see it, just need discord webhook link. the php is really simple
@cosmic summit where does what save to?
the votes?
those go to a discord webhook
(which you do have to config yourself, but it's pretty easy to edit a yaml file lol)
gotta do any sort of portfowarding or anything with that?
how do you use dbl dark mode?
i am literally clueless
I think someone told you in development to goto the main page of dbl and scroll to the bottom.. dark mode switch
not sure if this is the right chat for the question... But, what ever happened to the help page on the bot list? it showed you what to download and how to start... now i cant find it

I have a API problem.
When I'm posting my bot stats for the first time, It's working but in the second time I'm getting this error:
[25/4/2018 - 14:57:12 | ERROR]:
There was an error when I tried to post my servers count on https://discordbots.org/.
Error: 401 Unauthorized
So I restarted my bot API token and tried again, worked. Restart the bot and boom, the same error!
Btw I didn't pass the rate limit
Looks like API key error and how the code handles the key
Are you using latest version of the library?
I just got 4 upvotes at the same time, 3 of them we're apparently from me?
u upvoted multiple times this month?
Yeah but the webhook already did its thing back then, I'm just wondering why I got a bunch of upvotes suddenly
@austere swallow I'm using my code
@restive otter The code don't need to handle the key the code is good I think this is an internal API error
I restarted my key 4 times and it's post for the first time but in the second time it's gives me error
whats the rror?
Error is 401 unauthorized
it works the first time
ĀÆ_(ć)_/ĀÆ
Good to hear
@errant kiln i got a bunch of votes from myself today too, according to my webhook channel.. like id tested a bunch of times..
@arctic arch is the DBL webhook option broken right now? Test isnt sending anything, but confirmed working yesterday
yeah happened to me earlier too.. got like 7 of my own
have you tested earlier
guess its time to pull the thing completely
there's a backlog as the webhook is catching up
i have not been on ur website for days
i tested, and it was working for when people used it yesterday
we're fixing it
ok, thank you
How would I get a webhook's id and token?
i think he is asking about discord webhook
Oh please fix this Bug with the webhook omg
Scroll up
Yeah, I have already seen but do it faster
ok
Is there still a bug with the API? Seems my bot isn't posting the current server count anymore, it is 179 on the website and 182 in reality
I use the code from the example list (discord.py)
-botservers
wait a while
Still doesn't work
do u manualy post it? or something
I'll send you code later @weary ember
hi
hum now it worked
would there be any way to make bots/id/votes only return the last 24h?
For some reason cant send in Bugs channel so heres next best
http://sh0dan.ga/439587505537286144/2.png
On the left is svg of my bot on the right is the png
http://can-you-plz.givemefish.com/439587001696780288/5.gif Also when i click on my bots profile
(its online and hasent been offline for a while)
https://discordbots.org/api/widget/358463108433575937.svg in event still exists this is the badge
it is the last message in there
hi
API talk here only @queen turtle
@restive otter thereās a 24h check endpoint, /bots/{bot.id?}/check to check for the last 24h
@karmic hound https://github.com/DiscordBotList/issues
Can an array of all the possible tags be added to the api, if you're searching by tag it'd be good to know all the possible tags you can choose from.
#414124730715734068 @slate merlin
@pseudo patrol that has a ratelimit tho
and sending 200 requests to that wouldn't work well
use webhooks and record timestamps on post 
Anyone know an npm or api that gives me a youtube video url based on name?
or maybe a video id based on name
?
@restive otter not the right channel (it's for DBL api) anyways take a look here: https://developers.google.com/youtube/

need help with an API, someone help?
DBL?
Discord Bot List
if you need help with an API that isn't the Discord Bot List api, try #development
okay ty
how do you find out who voted for your bot to give them extra permissions?
in python
- Webhooks
GET /bots/{bot.id?}/votesto get last 1000 votesGET /bots/{bot.id?}/checkto see if a user voted in the last 24 hours.
https://discordbots.org/api/docs#bots
in the link?
the link is just reference for the requests
someone got my token. I regened it but now it wont let me update the server count so what do i do
@restive otter is my bot
whats the error @restive otter
are you sure your dbl token is correct
Ive regened copied and pasted 4 times
are you putting your bot's discord token as the dbl token?
Cuz copying and pasting the token in discordbots.org is my bots token
whats with the attitude lmao
same i've been up for 26 hours
Lol
but honestly too tired to debug rn
a
this channel is only for the dbl api
yep
403 error means that the server received the request, but isn't able to do anything with it with a reason other than authorization
if the error was 401 (unauthorized), it would be invalid token
yes
Whats shards?
Shards are a discord itself thing. https://discordapp.com/developers/docs/topics/gateway#sharding
Thanks
They aren't just a discord itself thing, but I'm not going to go to discussion in this channel
@void sparrow go to testing channels or shitpost if you want to post random stuff
What do you need help with?
Well it won't work here anyway
ISelfBot me = await DblApi.GetMeAsync();
// Update stats sharded indexShard shardCount shards
await me.UpdateStatsAsync(24, 50, new[] { 12, 421, 62, 241, 524, 534 });
// Update stats guildCount
await me.UpdateStatsAsync(2133);```
What is ISelfBot exactly supposed to be here? Because it comes up as an error.
you need to import the namespace
š
using [namespace here]
at the top
w-what
I'm using
using DiscordBotsList.Api;
using DiscordBotsList.Api.Internal;
(Sorry send on accident ;;)
well click on show potential fixes and look what namespace you need to use aswell

o
yea it isn't an actuall selfbot
i thot it was a class name or something 
well let me test it real quick
using DiscordBotsList.Api;
using DiscordBotsList.Api.Internal;
using DiscordBotsList.Api.Adapter.DiscordNet;
using DiscordBotsList.Api.Extensions.DiscordNet;```
I'm using these, only the first one is being used
@abstract herald the docs are kinda outdated, you need to use ```CSharp
AuthDiscordBotListApi DblApi = new AuthDiscordBotListApi(BOT_DISCORD_ID, YOUR_TOKEN);
IDblSelfBot me = await DblApi.GetMeAsync();
// Update stats sharded indexShard shardCount shards
await me.UpdateStatsAsync(24, 50, new[] { 12, 421, 62, 241, 524, 534 });
// Update stats guildCount
await me.UpdateStatsAsync(2133);
that works 
Yeah I just found IDblSelfBot and was screwing around with it, thank you!
If I may ask, why is the number in guildCount 2133?
Owait
It's a manual server count
k
what specifically is the problem
is the code you put inside the login function not being run?
did you check that DISCORDBOTS_TOKEN is valid?
nvm
somehow it displayed now or may be need to reach 100 server to display?
just showing after reach 100 server
same
This channel is only for the DBL API
So i've tried getting the bot voters via the (java) api now and also via HttpPost (Apache) and none of it seems to work
DiscordBotListAPI api = new DiscordBotListAPI.Builder().token(token).build();
System.out.println(api.getVoters(botId));
gives me [] (though the bot does have votes)
HttpPost post = new HttpPost("https://discordbots.org/api/bots/"+botId+"/votes");
post.setHeader("Authorization", token);
HttpClient cl = HttpClients.createDefault();
try {
HttpResponse res = cl.execute(post);
byte[] buf = new byte[1024];
res.getEntity().getContent().read(buf);
System.out.println(new String(buf));
} catch (IOException e) {
e.printStackTrace();
}
(Hacky, i know, but it's just for testing)
That one alyways gives me {"error":"Not Found"}
(even when i remove the "/votes")
HttpPost
that's your error
it's a get
also using a fixed size 1024 byte buffer would error if response is bigger than that
Okay, that makes sense. But that doesn't explain the API not working
Also, i know that a fixed buffer size is bad. I just used that to test it
Status update: HttpGet does work, but the API seems to be broken
RIP Java API
is that notepad++
you are not authorized @restive otter make sure it is the right token
like the api token and not your token
@loud gulch my editor visual studio code..
it looks like notepad++ tho xd
token right.
I recommend using the jslib, it may fix your problem https://discordbots.org/api/docs#jslib
okay
GetVoters is depreciated
since when
erm maybe works in JS.. doesnt work in .net
If the endpoint is deprecated it doesn't matter which language you use
yeah, i was told by Brian, one of the mods its depreciated.. about 3 weeks ago
getvotersbyid doesnt work correctly either
@hollow wraith that is brian
?
Hi š
Someone is fucking with my nickname
And I'm not a mod anymore, that might have confused you š¤£
Resigned





