#topgg-api

1 messages Ā· Page 28 of 1

pseudo patrol
#

server

#

Lol

orchid fulcrum
#

how

#

dbl

#

push

#

to

#

server

#

that sounds complicated asf

pseudo patrol
#

with a PUSH request to your url mm

orchid fulcrum
#

my

#

URL? D:

#

DUFUK

#

PUSH!? D::::

pseudo patrol
orchid fulcrum
#

DDDDDDD::::

#

ye prob wayyyy too complex for me cuz i don't get that shitt

woeful grove
#

heyo guys quick question what data structure is the dbl.hasVoted(userid) supposed to return using the official .js lib?
ping me please

uncut crystal
#

a Promise<Boolean>

woeful grove
#

okay thanks thats what i expected but is wasn't specified anywhere, maybe add this info to the docs?

idle haven
#

I mean, it's kind of obvious

woeful grove
#

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

idle haven
#

In the 24 hour time span

woeful grove
#

okay then i did something wrong haha
thanks for the help anyways

edgy nexus
#

@blazing egret flask

lethal ravine
#

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 😃 )

hoary timber
#

@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

hearty garnet
#

/bal

lethal ravine
#

@hoary timber So... how do I use it?

woeful grove
#

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?

elfin solstice
#

could you wait 5-10 minutes and try again? this might be a caching issue

woeful grove
#

oh okay ill try that, ill be back at 21:00 to update you if its fixed:D

woeful grove
#

its still false thonkEyes

lethal ravine
#

thanks! 😃

#

Darn it- I use discord.js. I think I got it, tho!

woeful grove
#

@elfin solstice its still not fixed so don't think its cache related

elfin solstice
#

uh

lavish helm
#

@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 ^

woeful grove
#

one mom

#

in the src folder is no index.js for me

lavish helm
#

Are you sure?

woeful grove
#

yeah only discordbots.js and discordbotslist.js

lavish helm
#

Oh you're on an old version of the package

woeful grove
#

oh

#

i got it like a week ago though, through npm

lavish helm
#

What exact module are you using?

woeful grove
#

i used
npm install dblapi.js

#

but it updated now wait a mom

lavish helm
#

run npm install dblapi.js@2.0.0

woeful grove
#

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?

lavish helm
#

No, it's the official one

#

Although the one you had seems to be old

woeful grove
#

hm ok
well thanks anyways hope its fixed now

arctic arch
#

@lavish helm there's a bugger in the module?

lavish helm
#

@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

arctic arch
#

the id is optional

lavish helm
#

Are you sure? I'm getting error code 400 on that endpoint

arctic arch
#

huh

#

any more info?

shut ibex
#

are u sure id is optional?

vagrant kayak
#

You need a user id to check

robust olive
#

lol

lavish helm
#

lower case D

shut ibex
#

welp

#

i can read

severe mist
#

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.

tidal copper
#

some code may help

#

or some debug results?

lethal ravine
#

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

dapper copper
#

@restive otter ??

#

What did you mean to type?

calm torrent
#

@lethal ravine read the wrapper docs and api docs

lethal ravine
#

i did. didnt help. 😦

restive otter
#

copy pasta

restive otter
#
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 :/
lethal ravine
#

should this be in a separate file? Where should this code be?

restive otter
#

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"

lethal ravine
#

is this instead of the code u sent earlier?

restive otter
#

its the same code

lethal ravine
#

oh! yeah...

#

what is snekfetch?

#

@restive otter

restive otter
#

a npm module

lethal ravine
#

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!!! ā¤

restive otter
#

no prob

orchid fulcrum
#

ugh

#

not python users

pseudo patrol
#

Wot

restive otter
#

So, is this a known issue @arctic arch ?

arctic arch
#

nope

restive otter
#

that's weird.

#

I'm on latest version of dbl.

arctic arch
#

caches between clusters could explain why it's sometimes different and sometimes not

#

but

#

i dont know why the list is so short

restive otter
#

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.

austere swallow
#

w e b h o o k s

arctic arch
#

he's not wrong
webhooks are recommended

remote bramble
#

exactly

#

i said that like 4 times

austere swallow
#

And you could reward them instantly when they vote

arctic arch
#

I made it quite simple on the module
look at pins

restive otter
#

ow

#

didn't see that

austere swallow
#

Instead of checking every nth minute or so

restive otter
#

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

austere swallow
#

Its alright, they are much better in a sense that you don't need to check who voted

restive otter
#

In the pinned example, is vote just a user id or a whole user object?

arctic arch
#

in data format

restive otter
#

Sorry, missed that in the docs facepalm

#

thx.

austere swallow
#

Just curious what if the bot is offline

restive otter
#

^

austere swallow
#

It won't receive any webhooks due to it being offline

#

And when you have more than 1k votes/day

sudden rampart
#

have webhooks in a separate process

austere swallow
#

Yeah well fair enough

sudden rampart
#

and keep it always online

restive otter
#

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.

sudden rampart
#

you can most likely fetch it

arctic arch
#

dont you have the same problem for regular voting checks

austere swallow
#

bot.users.get('id').send('My little DM');

#

for djs

restive otter
#

@sudden rampart .fetchUser() only works for user accounts (djs)

sudden rampart
#

wat

restive otter
sudden rampart
#

bots can fetch any user thonk

austere swallow
#

yup

restive otter
#

wait xD

#

misread it

restive otter
#

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

arctic arch
#

@restive otter can you send the whole code for your previous vote check?

restive otter
#

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);
}
arctic arch
#

-bots @restive otter

abstract mothBOT
#
Ishidres#1666
Bots

@raven matrix

arctic arch
#

I'm getting the full array consistently

restive otter
#

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

arctic arch
#

i did them in a quick succession

#

and have kept requesting every once in a while

restive otter
#

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?

proud sphinx
#

did you get something?

restive otter
#

I don't think so.

cunning forum
#

I think you arent able to bind ports lower than 1024 without root/administrator permissions

#

try using some higher port

restive otter
#

doesn't say Webhook received... in console.

cunning forum
#

like 10000

#

or 3000

proud sphinx
#

^

#

use 25565

restive otter
#

okay, one moment.

cunning forum
#

minecraft mmLol

proud sphinx
#

because it's minecraft

restive otter
#

xDD

proud sphinx
#

high five

restive otter
#

You guys are awesome @proud sphinx @cunning forum 😃

cunning forum
#

yep, dont bind ports lower than 1024

#

unless you have admin perms

#

or root

#

depending on os

restive otter
proud sphinx
#

thank you

restive otter
wanton matrix
#

with the api? or some other for of getting like snekfetch?

lavish helm
#

@restive otter What language and modules are you using?

#

You need and Authorization header with the value as your discordbots.org token

wanton matrix
#

@restive otter ```js
app.post('/api', (req, res) => {
console.log(req)
res.status(200); //OK
})

Anything seem wrong with this?
restive otter
#

Why did you ping me mmLol

wanton matrix
#

Sry..

restive otter
#

it ok

#

nothing it wrong with that

#

req.body is what you're looking for

#

make sure to have the body-parser middleware

wanton matrix
#

Cause somehow the test isn't reaching my machine. (and i'm trying to see what all will be coming with the request btw)

restive otter
#

@wanton matrix snekfetch

wanton matrix
#

Language?

restive otter
#

JS

wanton matrix
#

Just use the api.

#

Its actually easier

restive otter
#

he is.

wanton matrix
#

I'm talking about dblapi.js

#

:)

restive otter
#

then say that :p

lavish helm
#

That just uses up disk space

#

Unneeded

restive otter
#

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);

lavish helm
#

Needs header

wanton matrix
#

Any idea why i'm not receiving the test jacz

restive otter
#

Maybe because you're trying to use a localhost ip?

sudden rampart
#

is the port open

wanton matrix
#

I'm using public and yes.

restive otter
#

"I'm using public" what?

wanton matrix
#

ip

restive otter
#

ur machine ip?

wanton matrix
#

no

restive otter
#

then what?

wanton matrix
#

Public Router/ISP given

restive otter
#

then you'll need to port forward the app... Use ngrok or something

wanton matrix
#

I've portforwarded

hot oxide
#
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?

vagrant kayak
#

nope

#

It's a promise rejection on your code and Error: getaddrinfo ENOTFOUND discordapp.com discordapp.com:443

wanton matrix
#

Jacz, i think i may have figured it out.

#

except its still broke

#

i mean i'l still try ngrok.

restive otter
#

Im listening

wanton matrix
#

Some other sites I used to test it said something about CORS

#

I also tried using dbls webhook class and still won't receive

junior stirrup
#

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?

lavish helm
#

Are you sending an authorized request?

junior stirrup
#

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' }

lavish helm
#

What lang/lib?

junior stirrup
#

javascript + discord.js

lavish helm
#

And you're using what module to post stats?

junior stirrup
#

snekfetch,

lavish helm
#

ok, do you have .set('Authorization', keyhere) in your post request?

junior stirrup
#

yes

lavish helm
#

What url are you posting to?

junior stirrup
lavish helm
#

It's a z not an s in Authorization

junior stirrup
#

oh lol

#

thanks xD

lavish helm
#

np

stiff forge
#

@junior stirrup u idiot xD

#

Even tho im like in a call with you

#

lol

#

xD

junior stirrup
#

u idiot lol

stiff forge
#

obviously told you šŸ™„ šŸ˜‚

junior stirrup
#

yeh course

#

:P

coarse flax
#

I'm getting error unauthorized while posting server count using dbl package, but the token is correct? :/

lavish helm
#

@coarse flax What is your code?

coarse flax
#
client.shard.broadcastEval('this.guilds.size').then(results => {
      dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})``` @lavish helm
austere swallow
#

How did you initialize dbl?

coarse flax
#
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL);```
restive otter
#

Example

hasty vault
#

Are there any rate limits for the API

elfin solstice
#

60 request per minute per ip

restive otter
#

i agree

hot oxide
#

why server number is not updating

#

my bot is on 180 servers, on website 146

light crag
#

Did you look at response to your post request?

#

And try clearing cache

coarse flax
#

The DBL module has broke most of our commands and is spitting errors constantly. Something about being unauthorised, whereas the token is correct?

austere swallow
#

I think you might want to double check the token by printing it to console against the one online

light crag
#

And spell Authorization correct or else DBL can’t detect it

sudden rampart
#

broke most of our commands

austere swallow
sudden rampart
#

if you're checking for upvote on all commands you're going to have a nice 429

#

:^)

coarse flax
#

I have logged the token and it is correct.

#

429? :/

austere swallow
#

Or 401?

light crag
#

Show your headers

austere swallow
#

They make a difference

#

There should be some error in the console

coarse flax
#
      dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})```
light crag
#

Oh the dbl module

coarse flax
#

and then to check for votes it's:

dbl.hasVoted(msg.author.id).then(results => {
    if(results == true) {
    // code here
}
return;
});```
austere swallow
#

Can you show us the error from the console?

light crag
#

You are on version 2?

coarse flax
#

It's too long to put on discord

light crag
#

Screen shot it

coarse flax
#

I can't it's too long

light crag
#

Wew

austere swallow
#

Welp

sudden rampart
austere swallow
#

Split it up or use hastebin

coarse flax
#

k

light crag
#

Hmm

austere swallow
#

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

coarse flax
#

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',

austere swallow
sudden rampart
#

did you restart it

austere swallow
#

Maybe try reinstalling the library?

coarse flax
#

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

#

ĀÆ_(惄)_/ĀÆ

austere swallow
#

Yeah are you using an outdated version of the api?

#

Or maybe you should reinstall the api library

coarse flax
#

I'll give that a shot..?

#

I guess reinstalling it fixed it? Weird though, idk what went wrong? My code was correct.

austere swallow
#

Yeah prolly the library was outdated and stuff

coarse flax
#

Nah, I'm still getting the same error.

#

it's erroring when using hasVoted

light crag
#

What version of DBL do you have?

plain timber
#

does dblapi.js's webhooks work yet

light crag
#

yes

coarse flax
#

I’m using the updated version

plain timber
#

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 unb

light crag
#

and you set up DBL to post there?

plain timber
#

yeah, its not working (i did try the actual url instead of 0.0.0.0)

#

using the test button

arctic arch
#

got the auth correctly?

#

is your port open?

thorny parrot
#

How do I make my bot's status 'online' on the site?

charred portal
#

It goes through Luka, is what I was told, so your bot would have to be in this server.

thorny parrot
#

But they kicked it from here xd

#

Added and instantly kicked

charred portal
#

Once its been fixed then message them asking for the bot to be reinvited.

thorny parrot
#

No, it has been accepted but they instantly kicked it from here

charred portal
#

Whast your bot's name?

thorny parrot
#

It can be turned off though so...

#

Member Count

charred portal
#

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
thorny parrot
#

ooh

#

Well like i said it can be turned off :p

charred portal
#

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

thorny parrot
#

I understand that. Like if the guild is this, return?

charred portal
#

Most likely

vagrant kayak
#

or just disable that stuff by default

#

... or you know DON'T spam something

thorny parrot
#

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?

charred portal
#

DM a Moderator

thorny parrot
#

I guess Aetheryx is the unlucky one

vagrant kayak
#

user join and leave is quite spammy, disable that by default lol

thorny parrot
#

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

arctic arch
#

nope

thorny parrot
#

Fixed it

#

Had to uninstall all packages and reinstall them

restive otter
#

maybe cause u had the old version

remote bramble
restive otter
#

hi

#

how to put discord bot list API

#

on my bot

#

dm me

#

if u know

pseudo patrol
hot oxide
#

I don't have website and github to put widget, can i apply for certification program?

restive otter
#

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();
}
idle haven
#

Hey, which C# version and .Net Version are you on?

restive otter
#

net core 2.0

idle haven
#

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.

restive otter
#

I see

idle haven
#

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.

restive otter
#

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

idle haven
#

Sure, let's move to #development then as this has less to do with the API and more with C# šŸ˜›

restive otter
#
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 ...

remote bramble
#

wrong token

#

make sure you are using the dbl token

#

not your bots token

hot oxide
#

How many ram and what cpu is running Dank Memer bot?

sudden rampart
#
  1. wrong channel
  2. ask the owner
restive otter
#
  1. why do you need to know
jaunty umbra
restive otter
#

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?

austere swallow
#

Post your server count to DBL

jaunty umbra
#

Server count on DBL is accomplished through use of posting to the API

restive otter
#

ahh

#

ok

austere swallow
#

Using the access token from your bot page

restive otter
#

thanks

austere swallow
#

You could also use a library for helping you automatically do so

#

There are libraries for python, java, javascript and c#

restive otter
#

ok

austere swallow
lucid vale
#
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.
oak saffron
#

Wow

sudden rampart
#

@lucid vale that's been removed from the api

idle haven
#

@sudden rampart are there other deprecated endpoints?

sudden rampart
#

i don't think so

idle haven
sudden rampart
#

@vital anvil

idle haven
#

Ah, thank you

sudden rampart
#

what i did on mine was do the normal request but map to ids

idle haven
#

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.

sudden rampart
#

i deprecated but added a fallback so existing code wouldn't break

#

next major version the methods will be gone

idle haven
#

Oh, nice idea then. šŸ˜„

vital anvil
#

Done

idle haven
#

Thank you 😃

restive otter
#

How can I make the action happen when I vote?

reef apex
#

weebhook webhook

restive otter
#

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)

edgy nexus
#

@restive otter what is your code

#

I don't know C# but I can see if you're posting correctly

idle haven
#

I know .NET 😃

weary ember
vagrant kayak
#

noooo stop referencing that

#

That channel needs to be gone (even though it may have some interesting stuff)

dense compass
restive otter
#

Yes, I’ve used both examples available with C# and neither of them worked out for me

hollow wraith
#
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

restive otter
#

that endpoint is deprecated iirc

sudden rampart
#

only for ids

#

for all voter info it isn't

hollow wraith
#

so using DblApi.GetVotersAsync(1).. shouldnt that return the last 1 day of votes?
like 24 hours ago from the time now

idle haven
#

The endpoint is obsolete

#

The library (VS) should tell you this though šŸ˜›

hollow wraith
#

the GetVoterIds isnt working anymore

#

so i need to write my own http request or whatever to get votes?

idle haven
#

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

hollow wraith
#

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

idle haven
#

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.

hollow wraith
#

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

idle haven
#

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.

hollow wraith
#

ok, yeh im not sure how to write those requests.. suppose ill have to figure it out lol

#

this endpoint says it will give the last 24 hours

idle haven
#

Yea, but only for a single user

#

Has user X voted for the bot : bool

hollow wraith
#

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

idle haven
#

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.

hollow wraith
#

no idea how to even set that up.. dang.. bot is growing exponentially faster than i expected. rip lol

light crag
#

just treat it like a POST request

#

if u know what that means

hollow wraith
#

idk how to do that. trying to get someone to help me out with webhooks.. which i think will ultimately be more helpful

light crag
#

What lang do you want the weebhook handler to be in?

hollow wraith
#

c#

light crag
#

oooo

#

and just learn about POST requests and how to get the body

hollow wraith
#

id have to figure out how to actually post it.. to the right link.. etc

wanton matrix
#

I can help you

humble bison
#

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)

hollow wraith
#

Who does work on the API?

reef apex
humble bison
#

thanks

terse trellis
#

how do I use webhooks to get the voters per day?

calm torrent
#

cretae a webserver

weary ember
#

u also should read the docs

terse trellis
#

yea, I read them, but I would like some points of start

hollow wraith
#

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

idle haven
#

This kind of data storage works for small data sets. But it's not scalable.

#

In the long run you want an actual DB.

terse trellis
#

if someone can help me to build one whenDspairGetsAtYou
I don't know from where to start

calm torrent
#

which lib are you planning on using? and which lang? @terse trellis

proud sphinx
#

Just ignore the Analytics stuff

wanton matrix
#

@terse trellis Hosting mine VIA glitch.com, with express and rethinkdb

#

works well

terse trellis
#

I'll see

rotund cave
#

I need help with the Voting check system...

#

Im not smart enough to understand it. šŸ˜‰

#

I always get an error.

golden field
#

@rotund cave give me a dm

hollow wraith
#

Who works on the API? would be slick if the getvoter methods got fixed

edgy nexus
#

for js it's tonkku

idle haven
#

That is not the API though šŸ˜‰

elfin solstice
slate pilot
#

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?*

elfin solstice
#

first off dont ping more than 1 mod

#

second

#

there are librarys for the bigger languages you can use, they have examples and everything

#

and then >Tools

slate pilot
#

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

junior goblet
#

@slate pilot what error are you getting

slate pilot
junior goblet
#

you need to update your node.js version

#

do you know how to do that?

slate pilot
#

no

junior goblet
#

what you can do

npm install -g n
sudo n latest
slate pilot
junior goblet
#

ok now do sudo n latest

restive otter
#

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

junior goblet
#

put it in your bot file

slate pilot
junior goblet
#

yes

slate pilot
#

@junior goblet
the ... The same error continues: c

junior goblet
#

please try to keep your token out of the screenshots

slate pilot
#

oke

#

p-p

edgy nexus
#

put the token found on your DBL edit page

restive otter
#

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.

light crag
#

did u set the bot to post to your server

restive otter
#

No, just to log to the console when a user upvotes

light crag
#

You have to set it

#

Edit the webhook section of your bot

restive otter
#

Okay

#

What do it edit?

light crag
#

edit this section

#

set the url to wherever it is

restive otter
#

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

light crag
#

nonono

arctic arch
#

you get the public ip of your server, place that there

light crag
#

it doesn't support Discord webhooks

#

yes

restive otter
#

Public IP? šŸ˜‚

arctic arch
restive otter
#

Where can i find my Public IP?

arctic arch
#

do you have a VPS

restive otter
#

No

arctic arch
#

home hosted?

restive otter
#

Well, kinda, I host it at home while configuring the bot, but use Glitch when im not editing it or when I sleep

arctic arch
#

does glitch give you a url where your app is hosted

restive otter
#

Let me check a sec lol

arctic arch
#

I believe it was meant to be a webhost

restive otter
#

No, It can also host Node Apps

arctic arch
#

you can use that as your public ip

restive otter
#

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

arctic arch
#

so I just made a new project

restive otter
#

Would this be it?

app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
arctic arch
restive otter
#

Oh okay, so I would set that as the webhook url?

arctic arch
restive otter
#

Okay

#

but the port says it is 5000

arctic arch
#

okay works

restive otter
#

I clicked test and nothing happened still lol

arctic arch
restive otter
#

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?

arctic arch
#

the authorization on the website needs to match what you have in webhookAuth

#

anything works as long as it's the same

restive otter
#

Ah i get ya. Thanks

wanton matrix
#

@restive otter

#

Still having problems?

restive otter
#

@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!`);
});
wanton matrix
#

(tbh i used express)

restive otter
#

Oh poop. I never seen your message Transform lol

#

So is mine right Transform?

wanton matrix
#

you hosting it on glitch?

restive otter
#

Yeah

wanton matrix
#

well one obvious thing is that you need to label your DBL

arctic arch
#

'Link to the Glitch Project followed by the /dblwebhook' should be the discordbots.org token

wanton matrix
#

no

restive otter
#

okay lol

#

But I did try that but still nothing happened

arctic arch
#

'My Auth Token' is the thing you set in the webhook options on the website

wanton matrix
arctic arch
#

no it shouldnt

restive otter
#

RIP

wanton matrix
#

right. okay seems i looked a bit to deep

arctic arch
#

@restive otter change the port to 3000

wanton matrix
#

yeah that is true on glitch

#

as glitch hates that being different

restive otter
#

You have 1 app on port 3000

#

šŸ‘€

#

Is that why it is doing that?

arctic arch
#

something's already running on that port

restive otter
#

Oh lol okay give me a minute

wanton matrix
#

i could say look for node processes

#

in console

#

ps -au app

arctic arch
#

I dont think you can console in glitch

#

but you followed York's tutorial right?

wanton matrix
#

Ctl Shift X

arctic arch
#
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

restive otter
#

You can console in glitch

#

Oh, so I need to change that?

#

But if so, to what?

wanton matrix
#

What other apps do you have running?

#

Like what are they used for

#

in this glitch project

restive otter
#

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?

arctic arch
#
//app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);

I would try this

restive otter
#

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?")

#

?

arctic arch
#

looks good

restive otter
#

Alright thank you lol.

#

What did that line of code even do? The one that we put into a comment?

arctic arch
#

it's the line that starts using the port

#

but now that you're running the webhook you shouldn't need that

restive otter
#

Okay. Thank you 😃

light crag
#

wew just like the guy before

arctic arch
#

set port to 3000

short forge
#

$PORT should be 3000 ($PORT = process.env.PORT)

pliant raven
#

Can I have help with some code in js?

severe mist
#

this channel is to do with the DBL api, not with any Discord library

restive otter
#

does anyone know how to get total members in all guilds in discord.net?

uncut crystal
clever rock
#

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

charred portal
#

thats how you are supposed to use the API, you have to have it with a interval

robust hinge
#

how do I setup the webhook?

wheat iris
#

šŸ¤”

versed ice
#

@robust hinge Check the pinned message 😃

hollow wraith
#

How is the User Snowflake handled?

#

Or what datatype i suppose..

#

I tried decoding json into strings. But thats not working

idle haven
#

What do you mean by that's not working?

hollow wraith
#

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 :/

eternal anchor
#

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?

hollow wraith
#

AuthDiscordBotListApi DblApi = new AuthDiscordBotListApi(

eternal anchor
#

You didn't even read my message 🤦

hollow wraith
#

there is IDblBot

eternal anchor
#

that doesn't work...

hollow wraith
#

what docs are u reading that say use IBot?

eternal anchor
#

I am just reading what they say to do

hollow wraith
#

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

eternal anchor
#

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..

hollow wraith
#

i use it on c#.. both GetVoter methods are not functioning.. well GetVotersAsync does, but not properly.

plain timber
glass hound
#

How do i add variables into my commands?

severe mist
#

This channel is for the DBL api, you should ask in the #development channel instead

inner rune
glass hound
#

Okay thanks

#

Wrong chat anyway

inner rune
#

@severe mist You should of said it varies.

severe mist
#

@inner rune wdym?

inner rune
#

I was trying to make a joke

shut ibex
#

trying

inner rune
#

But York, do you use the dblapi.js thingy in Misaki

arctic arch
#

@inner rune what's confusing

inner rune
#

The fact that options is optional

arctic arch
#

it's cleared up in the contructor part

#

and the examples are not instructions mmLol

#

they're pretty much there for the lazy dev to copypaste mmLol

#

or noob ĀÆ_(惄)_/ĀÆ

hollow wraith
#

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.

arctic arch
#

are you sure you dont have anything about the user

severe mist
#

@inner rune no I do not, but I might be soon as my original concept isn't viable atm

arctic arch
#

there should be a user variable with the id of the user

hollow wraith
#

I only saw bot, Upvoted and... type? Only 3 and none were user

arctic arch
#

Upvoted isn't even a thing Thonk

vagrant kayak
#

In a webhook you saw that?

hollow wraith
#

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?

vagrant kayak
#

BotId, UserId, and Upvotes

#

If I'm not mistaken

#

or just BotId and UserId

#

Upvotes might be a thing on my end I have

hollow wraith
#

Ill try them. The docs say they are listed on the vote link for each bot. But i didnt see any

cunning prism
hollow wraith
#

Eh i got it. Thanks guys

vast sparrow
cunning prism
#

Thonk hmmm

#

šŸ˜„

steady hedge
#

I can't seem to get https://discordbots.org/api/users/{USER_ID} to show me supporter status using my API key

restive otter
steady hedge
#

I would assume it means optional

restive otter
#

that makes the most sense yeah

steady hedge
#

all those fields are things that you may not necessarily have

restive otter
#

also user end point doesn't require auth

steady hedge
#

How do I check supporter status of a user for my bot then?

restive otter
#

the api returns the supporter status of a user

steady hedge
#

Yes, but without an API key, how does it know which bot I'm referring to?

#

Know what I mean?

restive otter
#

why would you need to

#

i think supporter is just support of dbl itself

#

i have no idea what supporter even is so

steady hedge
#

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

restive otter
#

oh, you're verifying a vote?

steady hedge
#

yes

restive otter
#

there's a method for that

steady hedge
#

I'm looking through the api docs right now

#

I had assumed it was what the supporter field meant

restive otter
#

You're supposed to be able to use your api key to verify a vote

#

but all I get are 404 errors

steady hedge
#

I think I got it

#

https://discordbots.org/api/bots/{BOT_ID}/votes

headers: {Authorization: DBL_API_KEY}

restive otter
#

that works, I was thinking /check

steady hedge
#

But you can't use that endpoint with over 1000 supporters apparently, so keep that in mind

vagrant kayak
#

Webhooks šŸ‘Œ

restive otter
#

come on man how do I run /check

#

hey I got it

inner rune
#

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.

light crag
#

just don't use dblapi

thorny parrot
#

Do the votes reset each month or each day?

deft ember
#

Monthly.

thorny parrot
#

Okay thanks

deft ember
#

No problem.

indigo trout
#

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?

sudden rampart
#

discord webhooks won't work

indigo trout
#

oh

sudden rampart
#

the format is different from what discord requires

hollow wraith
#

@indigo trout , are you trying to get upvotes to send to discord?

indigo trout
#

ye

hollow wraith
#

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

short forge
#

it's a pretty easy python script

#

(it does work ofc)

cosmic summit
#

@short forge where does it save it to? or does the person using this have to do that part

hollow wraith
#

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

short forge
#

@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)

hollow wraith
#

gotta do any sort of portfowarding or anything with that?

restive otter
#

how do you use dbl dark mode?
i am literally clueless

hollow wraith
#

I think someone told you in development to goto the main page of dbl and scroll to the bottom.. dark mode switch

agile plover
#

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

tidal burrow
hybrid herald
#

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

restive otter
#

Looks like API key error and how the code handles the key

austere swallow
#

Are you using latest version of the library?

errant kiln
#

I just got 4 upvotes at the same time, 3 of them we're apparently from me?

calm torrent
#

u upvoted multiple times this month?

errant kiln
#

Yeah but the webhook already did its thing back then, I'm just wondering why I got a bunch of upvotes suddenly

hybrid herald
#

@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

weary ember
#

whats the rror?

restive otter
#

Error is 401 unauthorized

weary ember
#

are u sure ur using the dbl token?

#

not ur bot token

restive otter
#

it works the first time

weary ember
#

ĀÆ_(惄)_/ĀÆ

restive otter
#

idk

#

It's probably in some language I don't even know

hybrid herald
#

I think this was an internal error

#

It's fixed now

restive otter
#

Good to hear

hollow wraith
#

@errant kiln i got a bunch of votes from myself today too, according to my webhook channel.. like id tested a bunch of times..

hollow wraith
#

@arctic arch is the DBL webhook option broken right now? Test isnt sending anything, but confirmed working yesterday

summer oracle
#

i did not upvote it

#

is the api borked?

hollow wraith
#

yeah happened to me earlier too.. got like 7 of my own

summer oracle
#

ugh

#

this is what I was hating about the webhooks

#

just 1 month and it happens

arctic arch
#

have you tested earlier

summer oracle
#

guess its time to pull the thing completely

arctic arch
#

there's a backlog as the webhook is catching up

summer oracle
#

i have not been on ur website for days

hollow wraith
#

i tested, and it was working for when people used it yesterday

arctic arch
#

we're fixing it

hollow wraith
#

ok, thank you

novel carbon
#

How would I get a webhook's id and token?

hollow wraith
#

@novel carbon u have your own website?

#

misread the question.. nm sorry

weary ember
#

i think he is asking about discord webhook

elder lily
#

Oh please fix this Bug with the webhook omg

clever viper
elder lily
#

Yeah, I have already seen but do it faster

hollow wraith
#

its been working ofr me

#

for*

cunning prism
#

-bot

#

-help

#

-botservers

restive otter
#

please

cunning prism
#

ok

shut ibex
#

@elder lily saying that won't do anything

#

Tonk has a life and will do it when he can

long spade
#

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)

novel carbon
#

-botservers

calm torrent
#

wait a while

long spade
#

Still doesn't work

weary ember
#

error?

#

does it say "Invalid Token" or something like that

long spade
#

Nope

#

I don't even get an error

weary ember
#

do u manualy post it? or something

long spade
#

I'll send you code later @weary ember

fresh oriole
#

hi

long spade
#

hum now it worked

restive otter
#

Should I edit something?

#

Oops, I solved that

restive otter
#

would there be any way to make bots/id/votes only return the last 24h?

karmic hound
vagrant kayak
#

Sorry I sneezed all over this channel

loud gulch
#

it is the last message in there

queen turtle
#

hi

tranquil rose
#

API talk here only @queen turtle

queen turtle
#

ok

#

srry

pseudo patrol
#

@restive otter there’s a 24h check endpoint, /bots/{bot.id?}/check to check for the last 24h

arctic arch
slate merlin
#

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.

calm torrent
restive otter
#

@pseudo patrol that has a ratelimit tho

#

and sending 200 requests to that wouldn't work well

pseudo patrol
#

use webhooks and record timestamps on post mm

restive otter
#

Anyone know an npm or api that gives me a youtube video url based on name?

#

or maybe a video id based on name

#

?

reef apex
restive otter
worn belfry
#

need help with an API, someone help?

restive otter
#

If it's not the DBL api, then no.

#

This is support for the DBL api only

worn belfry
#

DBL?

restive otter
#

Discord Bot List

worn belfry
#

not Python AIOHTTP?

#

o

#

mines on there, but not approved

#

yet

restive otter
#

if you need help with an API that isn't the Discord Bot List api, try #development

worn belfry
#

okay ty

north drift
#

how do you find out who voted for your bot to give them extra permissions?

#

in python

restive otter
north drift
#

in the link?

restive otter
#

the link is just reference for the requests

restive otter
#

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

remote bramble
#

whats the error @restive otter

restive otter
remote bramble
#

are you sure your dbl token is correct

restive otter
#

Ive regened copied and pasted 4 times

remote bramble
#

are you putting your bot's discord token as the dbl token?

restive otter
remote bramble
#

whats with the attitude lmao

restive otter
#

Lol

#

Im tired asf

#

5:30 am for me

remote bramble
#

same i've been up for 26 hours

restive otter
#

Lol

remote bramble
#

but honestly too tired to debug rn

restive otter
#

Im about to be up for 24

#

So

rapid comet
#

a

loud gulch
#

this channel is only for the dbl api

restive otter
#

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

loud gulch
#

yes

grim beacon
#

Whats shards?

restive otter
grim beacon
#

Thanks

vagrant kayak
#

They aren't just a discord itself thing, but I'm not going to go to discussion in this channel

junior goblet
#

@void sparrow go to testing channels or shitpost if you want to post random stuff

uncut crystal
#

What do you need help with?

restive otter
#

Well it won't work here anyway

abstract herald
#
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.
elfin solstice
#

thats the type Thonk

#

its C#

abstract herald
#

im not that experienced

elfin solstice
#

you need to import the namespace

#

šŸ‘€

#

using [namespace here]

#

at the top

#

w-what

abstract herald
#

I'm using

using DiscordBotsList.Api;
using DiscordBotsList.Api.Internal;
#

(Sorry send on accident ;;)

elfin solstice
#

well click on show potential fixes and look what namespace you need to use aswell

abstract herald
#

It's only suggesting generating new interfaces

elfin solstice
calm torrent
#

selfbot GWcfcThonk

#

interesting name for your public bot

elfin solstice
#

@calm torrent thats how the C# lib call your self user

#

dont

calm torrent
#

o

elfin solstice
#

yea it isn't an actuall selfbot

calm torrent
#

i thot it was a class name or something GWqlabsKek

elfin solstice
#

well let me test it real quick

abstract herald
#
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
elfin solstice
#

@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 blobcatthumbsup

abstract herald
#

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

candid ferry
#

discord.js

junior goblet
#

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?

candid ferry
#

nvm
somehow it displayed now or may be need to reach 100 server to display?

#

just showing after reach 100 server

remote bramble
#

same

loud gulch
#

This channel is only for the DBL API

mint wolf
#

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")

sudden rampart
#

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

mint wolf
#

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

restive otter
loud gulch
#

is that notepad++

proud sphinx
#

you are not authorized @restive otter make sure it is the right token

#

like the api token and not your token

restive otter
#

@loud gulch my editor visual studio code..

loud gulch
#

it looks like notepad++ tho xd

restive otter
#

token right.

proud sphinx
restive otter
#

okay

hollow wraith
#

GetVoters is depreciated

shut ibex
#

since when

hollow wraith
#

erm maybe works in JS.. doesnt work in .net

idle haven
#

If the endpoint is deprecated it doesn't matter which language you use

hollow wraith
#

yeah, i was told by Brian, one of the mods its depreciated.. about 3 weeks ago

#

getvotersbyid doesnt work correctly either

edgy nexus
#

@hollow wraith that is brian

hollow wraith
#

?

idle haven
#

Hi šŸ‘€
Someone is fucking with my nickname

#

And I'm not a mod anymore, that might have confused you 🤣

hollow wraith
#

oh lol

#

yeah why are u not mod?

remote bramble
#

Resigned