#topgg-api

1 messages · Page 37 of 1

lunar tide
#

is their a way to test the vote stuff instead of waiting 12hrs? i know the test button does it but i want it so it will show my user id

inner venture
#

the test button sends a fake vote event with your id as the user ^^

lunar tide
#

oo ok ty sir

inner venture
#

The only way to tell if its not a test is by checking the type field

#

if its a test, then the type field will be be test

lunar tide
#

hmm ok ty

thin gulch
#

I'm getting a 403 when trying to POST the server data with dbl.py.

future: <Task finished coro=<Main.startup() done, defined at F:/Python/DiscordFireBot/main.py:32> exception=Forbidden('Forbidden (status code: 403): {"error":"Forbidden"}',)>
Traceback (most recent call last):
  File "F:/Python/DiscordFireBot/main.py", line 36, in startup
    self.bot = await bot.initialise(self.config.discord, self.db)
  File "F:\Python\DiscordFireBot\bot.py", line 23, in initialise
    await update_status()
  File "F:\Python\DiscordFireBot\bot.py", line 83, in update_status
    await bot.dbl.post_server_count()
  File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\client.py", line 100, in post_server_count
    await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
  File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\http.py", line 189, in post_server_count
    await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
  File "F:\Python\DiscordFireBot\venv\lib\site-packages\dbl\http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

I copied the DBL token from the mybots page

sullen nymph
#

Reset it and try again GWfroggyBlobThonk

#

Or, wait. You've put your DBL token, right?

thin gulch
#

yes

#

The one from the mybots page

#
bot.dbl = dbl.Client(bot, config["dbl_token"])
await bot.dbl.post_server_count()
#

And from a quick look, the start and end of token are the same and I'm pretty sure I copied and pasted it right

inner venture
#

are you posting the stats to the correct bot?

thin gulch
#

I would assume so - it's the same bot token I'm using in production

#

I'm assuming there's not a way to add a testing bot that can also work with it so I don't have to do all the dbl stuff on the same bot as all my servers all the time?
(Not what I'm doing now but would be nice to know)

lunar tide
#

question on the api for bots
owners: [ '131417543888863232', '412374698987487242' ], how do i list each owner and make them tag

#

i tried <@${body.owners.first}> but it did not work

#

tag me if you can help

inner venture
#

@lunar tide Not really relevant to here, but why didnt it work

#

@thin gulch and no, there isnt sadly

lunar tide
#

umm idk it just showed as undefined and i tried this (img). the code for that was just <@${body.owners}> and it did that since their was 2 how do i make it to tag each owner?

arctic arch
#

js arrays dont have the property first

lunar tide
arctic arch
#

first, iterate over the array to create mentions by using Array.map() and then put them together with Array.join()

lunar tide
#

ahh ok thanks

thin gulch
#

(I'm still not sure what I've done wrong with my thing)

lunar tide
#

did it thanks @arctic arch

thin gulch
#

Well I found my issue. It seems to think my bot id is None

#

It wanted me to do this for some reason

dbl.Client(bot, config["dbl_token"])
bot.dbl.bot_id = bot.user.id
await bot.dbl.post_server_count()

(Forbidden, 403)

thin zinc
#

New announcement:

dawn fjord
#

Umm

#

No

olive leaf
#

a

humble bison
thin zinc
#

?

humble bison
#

this is for DBL api questions

#

not offtopic talk

olive leaf
#

sou brasileiro brow

willow ruin
#

Is there a chance to add 'points' field to answer of GET bot stats endpoint? The answer of bot <id> endpoint is huge and recently there is no need in other info except 'servers' and 'points'.

arctic arch
#

stats endpoint is for server and shard count

#

if you want you can limit the output of the bots (without id) endpoint

restive otter
#

sa

jaunty depot
#

@restive otter "ingilizceden başka diller için #memes-and-media kullanın" -tonkku

arctic arch
#

why are you quoting me on that

restive otter
#

is it possible i can just show server count on my website using dbl api?

inner venture
#

yes, its possible

restive otter
#

how?

inner venture
#

what language are you using?

restive otter
#

html

inner venture
#

what

restive otter
#

and css

inner venture
#

to code your bot in, friend

restive otter
#

oh

#

python

inner venture
#

okay, so there is a python lib but its kinda dated

#

I think it should work for what youre doing, though

#

take a look here

restive otter
#

not what i am looking for

inner venture
#

why?

restive otter
#

is it possible i can just show server count on my website using dbl api?

#

on my website

#

not on dbl page

inner venture
#

Oh my bad, i misread

restive otter
#

thats fine

inner venture
#

There are the widgets you can use

restive otter
#

yes i used them

#

but i mean just the count

inner venture
#

or you can use the API to get the stats and manually insert it into your page whever

restive otter
#

not the whole widget

inner venture
#

It doesnt require a token to get the stats or anything

restive otter
#

i am trynna look for an example

inner venture
#

-bots @restive otter

abstract mothBOT
#
PaPí#0001
Bots

@uncut lark

inner venture
#

You're probably gonna have to use some client side JS to call that url and parse it

#

I'm not too familiar with it

#

but it doesnt seem all that difficult

restive otter
#

not used to js

inner venture
#

Cant really help ya there, man

restive otter
#

its fine

restive otter
#

so this is what i was asking for

#

on a website

#

ping me if someone knows how

plain timber
#

@restive otter where you want the number to be put <span id="servers">Loading... </span> then use this js:

window.fetch('https://discordbots.org/api/bots/466007757183516703/stats').then(r => r.text().then(t => document.getElementById('servers').innerHTML = JSON.parse(t)['server_count']))```
restive otter
#

lemme try

karmic hound
#

wait wot i thought fetch was localised to service workers thats so much nicer if its global

restive otter
plain timber
#

what code did you copy from the site? I only see client.on in the postStats section

restive otter
inner venture
#

Wouldn't it be

#

client.webhook.on?

plain timber
#

uhh

inner venture
#

Its not really possible to tell without more code

plain timber
#

@restive otter what is your client

restive otter
#

its discord.js client thingy

#

const client = new Discord.Client();

plain timber
#

are you using the latest version of dblapi.js?

restive otter
#

Not sure

#

Yes

plain timber
#

that error makes no sense

inner venture
#

It makes plenty sense

#

He's trying to use the webhook function on the discord.js object

plain timber
#

it looks like its saying the client.on is in the dblapi code

#

but its not

#

and client.on works in d.js anyways

restive otter
#
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'mypassword' });
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!`);
});```
this is my code
inner venture
#

that is not the same code from your error, friend

restive otter
#

Well thats my code

#

But the error comes from other code

#

Not mine

inner venture
#

Ohhh, I see

plain timber
#

you're on an older version for sure

#

@restive otter

restive otter
#

I'm gonna try reinstall it

#

It installed the same version and its now working

#

epic

plain timber
#

lol

hushed reef
#

does anyone understand how I can use oauth2 to login on a website?

light crag
#

?

hushed reef
#

ik im looking at it

#

it seems that its just scopes passing json fields

#

but does anyone know like

#

the proper procedure as a html link to get it to request the username n stuff

light crag
#

and some other endpoints

hushed reef
#

ohhh

#

yeah

#

i just figured it out

#

i had to create the app thing

humble bison
hushed reef
#

wdym

#

Discord OAuth2 works directly on API parsing

#

in this case with a login request to sites

plain timber
#

@hushed reef this channel is only for the DBL API as it says in the channel topic

hushed reef
#

k 👍🏼

tired apex
#

How many times a day should I post the stats of my bot?

inner venture
#

It's pretty safe to post it like once an hour

#

@tired apex

tired apex
#

OK thanks

fast tapir
#

I mean, I post every 30 seconds, so...

#

haven't run into any issues yet

inner venture
#

I mean

#

posting every 30 seconds is safe,t oo

#

the ratelimits on dbl are fairly generous, from what i remember

#

(60 a second? something like that?)

fast tapir
#

something like that

inner venture
#

Either, way it doesnt really matter

#

I just suggested every hour because it probably wont have changed inbetween then

#

for most small bots

fast tapir
#

🤷 ok

humble bison
#

Posting whenever your bot joins/leaves a server is fine until you start hitting ratelimits, then it's best to post every minute or so.

light crag
#

Would just start with the best practice.

plain timber
#

yeah and that would mean discord outages would spam it

dawn fjord
#

I need some help with the botlist.space api

plain timber
dawn fjord
#

yes

twilit tapir
#

:tickno:

#

xD

restive otter
#

Hey

humble bison
tawdry pine
#

Is there some delay in the /stats?

#

I am sending the server count

#

when I check through the API it shows the correct count

#

but on the site itself it shows the outdated one

#

oh well it updated

#

¯_(ツ)_/¯

sullen nymph
#

Browser cache issue

inner venture
#

@tawdry pine Ctrl shift r

tawdry pine
#

@inner venture yeah it updated

inner venture
#

😊

twilit tapir
#

Tony I don't know what you just said.

#

And change my nickname or I'm leaving.

tardy crater
#

then leave. and stop having a generalised conversation in here.

twilit tapir
#

fuck you and bye

tardy crater
#

okay

shut ibex
#

I remember this guy

#

He was getting pissed because I told him to ask in rythms support server when he needed help with the bot

hushed reef
#

lool

#

salty boi

past reef
#

There seems to be a problem with DBL's host.

#

Ok nvm.

#

I came here too quickly my bad.

#

I might also need help with setting up a webhook in my bot.

#

What is meant with the URL? How do I set up a URL?

plain timber
#

you need to set up a web server to accept a post request

past reef
#

So, for example, IFTTT?

plain timber
#

uh

#

i dont think so?

#

idk if ifttt has anything relating to that

past reef
#

IFTTT has the possibility of webhooks.

#

But then again, how would I be able to get the info from the webhook? I might want to check the d.js docs

jade cloak
#

What language are you using?

humble bison
#

no, you need to setup a web server that can accept POST requests @past reef

past reef
#

Ah okie

restive otter
#

How can I check if someone voted and give him a role?

#

Or for example if he didn't upvote the bot a command will not work.

inner venture
#

What language are you using?

#

@restive otter

restive otter
#

discord.js

#

Javascript

inner venture
#

@restive otter take a look at this

#

specifically, the has voted methdo

restive otter
inner venture
#

refresh

restive otter
#

still the same problem

#

but I found it

#

Damn

#

hmm

frosty basin
#

1 hour to make a code for my server to give member that voted a role but deleted all of it because tha api didn't answer my requests XD

#

i kept getting that it uses id as an argument

#

but i gave it a defined id that should work right?

summer pine
pulsar saddle
#

How are you trying to update the server count?

summer pine
#

What do you mean? I used the example code on the API page, and changed it to use my token

pulsar saddle
#

Okay, well if its a 403 your getting refused by the server

summer pine
#

Huh, what could cause that

pulsar saddle
#

Not exactly sure as I haven't used the API myself but potentially something is not sending correctly?

summer pine
#

Hmm

pulsar saddle
#

There are some other examples to use for the api

summer pine
pulsar saddle
#

On the server-count-examples there is this example:

#

dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}

async def on_ready():
    payload = {"server_count"  : len(bot.servers)}
    requests.post(url, data=payload, headers=headers)

async def on_server_join(server):
    payload = {"server_count"  : len(bot.servers)}
    requests.post(url, data=payload, headers=headers)

async def on_server_remove(server):
    payload = {"server_count"  : len(bot.servers)}
    requests.post(url, data=payload, headers=headers)```
summer pine
#

huh

#

I'll try it

#

where is that?

pulsar saddle
#

The channel or?

summer pine
#

The code

#

Where did you find it

pulsar saddle
summer pine
#

Ok

#

Error: Traceback (most recent call last): File "C:\Users\Admin\Desktop\ Bot\servercount.py", line 10, in <module> import requests ModuleNotFoundError: No module named 'requests' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x03E8FE10>

pulsar saddle
#

You need to import requests

sullen nymph
#

That's just a bad idea

#

Use dblpy

#

The official library and the example on its GitHub page

summer pine
#

Thats what I was using before

#

It didn't work

sullen nymph
#

403?

pulsar saddle
#

Yeah

summer pine
#

Yeah

sullen nymph
#

Try resetting your token

summer pine
#

Ok

shut ibex
#

there is a lib for the dblapi in python

sullen nymph
#

Also make sure you are putting the DBL token

summer pine
#

I am xd

restive otter
#

how do i make a discord bot

sullen nymph
#

Wrong channel

restive otter
#

oops

#

sorry

wise bear
#

Um, I'm getting an Not Authorized error

mystic wing
#

are you sending your token

shut ibex
#

^

wise bear
#

Yep, on an Authorization header.

mystic wing
#

bot token or dbl token

wise bear
#

headers: {
"Content-Type": "application/json",
"Authorization": "<oof>"
}

#

I got the token in reference

#

But

#

I'm dumb

#

Sorry 😂

mystic wing
#

think_dumb ok

summer pine
#

Still getting 403 @sullen nymph

sullen nymph
#

Do you mind sending the code with your token in DMs? (you are free to reset it before sending)

summer pine
#

Ok

summer pine
#

Still isn't working

#

Error 401

restive otter
#

hi

#

how do I get the guild count when I want to update the bot guild count using the api?

// Update stats           guildCount
await me.UpdateStatsAsync(2133);
#

I'm using another project from the original bot

inner venture
#

@restive otter I'm not sure what you mean -- like, how to get the actual guild count from your bot?

restive otter
#

yes

inner venture
#

what lib are you using

#

discord l ib

restive otter
#

eh

#

I'm using this only

summer pine
#

Anyone know why I'm getting Error 401 when I try and run the code that updates the bots servers count?

inner venture
#

I mean... how else are you supposed to know what your bots guidl count is.... @restive otter

restive otter
#

It's not my fault, I use discord.py for the original bit

#

bot

#

Wait one minute

summer pine
#

403 now

jade cloak
#

Tim maybe send your code

plain timber
#

sounds like wrong token

wise bear
#

I have a question

#

What does a dbl webhook send when it is submitted?

#

req.body parameters, yeah?

humble bison
#

I guess so, never done much with it.

wise bear
#

Weird

plain timber
#

yeah it does

wise bear
#

Okay thanks ^^'

gilded summit
#

How do I use webhooks???

#

What do I put in webhookServer?

inner venture
#

Please read the docs @gilded summit

gilded summit
#

I don't know the format of an "HTTP server"

#
const express = require("express"),
  http = require("http"),
  app = express(),
  server = http.createServer(app),
  DBL = require("dblapi.js"),
  dbl = new DBL(TOKEN, {
    "webhookPort": process.env.PORT,
    "webhookServer": server
  });
dbl.webhook.on("vote", (bot, user) => console.log(bot, user));
app.get("/");
server.listen(process.env.PORT, () => console.log("Listening"));

I have this, and I set my webhook URL to http://96.250.125.31:8080/, but it's not working

restive otter
inner venture
#

@gilded summit default path is /dblwebhook

gilded summit
#

I tried that and it still didn't work

inner venture
#

how did you "try" it

gilded summit
#

I set the webhook URL to http://96.250.125.31:8080/dblwebhook

inner venture
#

did you set the environment variable PORT to 8080

gilded summit
#

Yes

#

And it's port forwarded

#

The site is definitely online

inner venture
#

the site?

gilded summit
#

Not site, but server

#

Because it actually connects, is what I'm saying

#

Cannot GET /dblwebhook

inner venture
#

i mean, of course you cant GET that

#

because its only accepting post requests

gilded summit
#

Well, when I tested, it still didn't work

#

Wait

#

I got it to work

hollow edge
#

What is the version of the API for Gradel

#

dependencies { compile 'com.discordbots:DBL-Java-Library:VERSION' } stuggling to find it

#
Could not find com.discordbots:DBL-Java-Library:2.0.1.
Searched in the following locations:
    https://jcenter.bintray.com/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
    https://jcenter.bintray.com/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
    https://repo.maven.apache.org/maven2/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
    https://repo.maven.apache.org/maven2/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
    https://jitpack.io/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
    https://jitpack.io/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
    https://repo.noxal.net/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.pom
    https://repo.noxal.net/com/discordbots/DBL-Java-Library/2.0.1/DBL-Java-Library-2.0.1.jar
``` and error I get when doing 2.0.1
inner venture
#

Oh shoot

#

I mistyped

#

it should be

#

org.discordbots

#

@hollow edge

#

let me fix that rn

hollow edge
#

Lol no worries thanks @inner venture

inner venture
#

lmk if that works

hollow edge
#

👍

#

it worked @inner venture

inner venture
#

awesome!

hollow edge
#

Is the Discord bot ID the Client ID to the bot or it unique to discordbots.org?

#

Because we believe we set it up correctly, but we haven't noticed any change with our bot on the website.

sudden rampart
#

client id

hollow edge
#

👍

chilly jacinth
#

rip discords bandwidth

hollow edge
sudden rampart
#

what token are you using?

hoary timber
#

Uhm....

#

Did DBL change the link for the maven-repo again?

#

*groupId

hollow edge
#

@sudden rampart The discord bot token

sudden rampart
#

you need to use the dbl api token

hollow edge
#

Oh?

sudden rampart
#

that token

hollow edge
#

That's what we're using yes.

sudden rampart
#

anything in the logs?

hollow edge
#

Nope

inner venture
#

@hoary timber I just updated it to the more concise version

hollow edge
#

N/A

inner venture
#

the original one should still work

sudden rampart
#

can you try just api.setStats(serverCount)?

hollow edge
#

Sure.

inner venture
#

Add a consumer and check if its throwing an error

sudden rampart
#

gson isn't thread safe

inner venture
#

Its not?

sudden rampart
#

nope

inner venture
#

Should I use jackson in place of it

sudden rampart
#

an easy fix would be thread local

#

personally i'd just use org.json and manual deserialization

inner venture
#

hmm

sudden rampart
#

i got some broken data (out of bounds) a few times which threw when parsing

inner venture
#

wth

hollow edge
#

Well only using Servers worked @sudden rampart 🤔

sudden rampart
#

can you print the other variables you were sending on the first attempt?

#

Bot.getAllGuilds().size(), 0, Settings.SHARDS

hollow edge
#

Didn't work

dblApi.setStats(Bot.getAllGuilds().size(), 0, Settings.SHARDS);

Server Count, Shard ID, Shard Count

Worked.

dblApi.setStats(0, Settings.SHARDS, getAllGuilds().size());

Shard ID, Shard Count, Server Count

The github documentation may be wrong.

The data for setStats in the current source, shows different data than what the documentation does.
Documentation, which is wrong:
https://i.imgur.com/SrMgSSS.png

While the code, shows something different:
https://i.imgur.com/ELv7G3u.png

inner venture
#

my apologies -- ill rectify that

hollow edge
#

No worries. 😃

#

#gibfreecertificationfromistakes kappa.
We'll let you know if we find anything else. 👍 😃

inner venture
#

🙏

steady charm
#

is 401 a credentials error?

dawn fjord
#

yes

steady charm
#

ye i guess i accidentally regenerated the token somehow, thanks ;p

restive otter
restive otter
#

ok then

sullen raptor
#

um

#

I has issue with Java library

#

I put 'yes' in the bot file and it didn't work

#

help me

summer pine
#

For some reason the code for posting server count isn't doing anything, using python

jaunty depot
#

maybe they would work

summer pine
#

ok

sullen nymph
#

Use DBLPY

#

and well, maybe report a bug if your token still doesn't work

#

Or you can always try posting it mnaually with aiohttp :^)

summer pine
#

How do you do that?

#

@sullen nymph

#

Also, this is with another bot that doesn't work as well. The previous one I got a friend to do it using the .Net library which worked fine

sullen nymph
#

I had the code somewhere, give me a minute

summer pine
#

Ok

sullen nymph
summer pine
#

Ok

green kayak
#

hello

thin gulch
#

I fixed mine by adding an additional line that I'm assuming is undocumented

sudden depot
#
# Unexpected error!
# Error caused by Error : Error: 500 Internal Server Error
    at IncomingMessage.res.on (/opt/app-root/src/node_modules/dblapi.js/src/index.js:115:25)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)!```
#

I randomly get that

plain timber
#

maybe the site went down

keen pagoda
#

Anyone able to deeply help me with API, I need to make a API bot but im completely unfamilier with how to do so

plain timber
#

@keen pagoda this channel is only for help with the DBL API

#

for general development go to #development, but remember people will only help with specific questions, not just stuff like "help me make a bot"

keen pagoda
#

thats why i asked for deep help 😄

brittle iron
#
    at org.json.JSONTokener.syntaxError(JSONTokener.java:451)
    at org.json.JSONObject.<init>(JSONObject.java:196)
    at org.json.JSONObject.<init>(JSONObject.java:320)
    at org.discordbots.api.client.impl.DiscordBotListAPIImpl$1.onResponse(DiscordBotListAPIImpl.java:243)
    ... 5 more
    Suppressed: java.lang.NullPointerException```
🤔
#

seems discordbots is down

sudden rampart
#

what method did you call?

brittle iron
#

probably #hasVoted method, idk that came right now

#

I also get a 502 bad gateway error on my browser

sudden rampart
#

yeah it's down

#

@inner venture might want to check the response status code and throw something like "http error xyz" instead of letting json parsing fail

inner venture
#

it does ^^

brittle iron
#

and yes it's the hasVoted method

inner venture
#

or...

#

it should 🤔

#

@sudden rampart oh i know what broke there. I added a little thing to parse the body if it fails

#

because DBL sends error messages in the body instead of the status message

sudden rampart
#
JSONObject errorBody = null;
try {
    errorBody = parse
} catch(JSONException e) {
    throw ...(response.code());
}```maybe?
inner venture
#

yeah ill add it ^^

#

its just cos cloudflare is sending the responses here

turbid steppe
#

I like poop

#

I like shit

#

I like everything in the world

shut ibex
covert sun
#

i'm getting Module dbl has no Client member on python

sullen nymph
#

Don't name your file (or class) dbl

jaunty hamlet
#

@sullen nymph

sullen nymph
wise bear
#

I need some help with the webhooks :/

inner venture
#

What's up?

restive otter
#

lol

meager pasture
#

I need some help with people having to react to a message to get a role

inner venture
meager pasture
#

oh sorry my bad

restive otter
#

At what time does the voting multiplier get active?

loud gulch
#

on weekends

restive otter
#

inb4 when is a weekend

#

when exactly?

#

like 12pm or somewhen else

light crag
#

Be aware of time zones. There is also an endpoint to check.

restive otter
#

get isWeekend from webhook so no need to check awesmart

restive otter
#

well I want to send a simple message if the multiplier is active, checking the endpoint every hour for that isnt really great

restive otter
#

how do I get my guild count on js

dawn fjord
#

what lib?

sweet delta
#

I noticed you provide an authorization token in the header. To check if the request comes from DBL.
However you don't encrypt it Thonk
Wouldn't that be better to for instance create a hash (sha1) with the authorization secret/token. And we could just create an hash in our side using the same token. Both matching would be that the request comes from DBL.

arctic arch
#

yeah that was a quick and noob friendly approach to verifying that the request is from dbl
There will likely be a signature thing lin the future for those concerned

sweet delta
#

thanks that would be much better

dawn fjord
#

um

restive otter
#

s

#

WHAT

restive otter
#

um

misty geode
#

?

#

after i added <meta name="keywords" content="Fortnite Bot">

#

in the html

#

also what is this?

humble bison
#

you cant add keywords in the body iirc

misty geode
#

😦

#

rip

#

kk

humble bison
#

and that means you allow dsicordbots to use your video you link

#

this channels for the dbl api

misty geode
#

tru

#

kk

bronze arch
#

so I'm using dblapi and wondering how to use their webhook feature. If I'm correct it actually builds it for you? But the path defaults to /dblwebhook but I don't have that filepath, so I'm wondering if I do index.js or what 🤔

#

Is it just asking for my ip:port where it's hosted at or what

arctic arch
#

the path isn't a filepath, its an url path

#

so ip:port/dblwebhook

bronze arch
#

ah

#

lol

#

is /dblwebhook based off of where the program is stored or is that something I need to configure

inner venture
#

no

arctic arch
#

no, its completely arbitary

#

it can be anything

bronze arch
#

so can I just have it opened on my vps which is just ip:port and I change that attribute like so
new DBL(config.discordBots, {webhookPort: config.dblWebhookPort, webhookAuth: config.dblWebhookPass, webhookPath: config.dblWebhookHost+":"+config.dblWebhookPort});
Or am I thinking of this wrong

#

because I believe this uses the port and creates it for me right? At least when I was trying to host it on express it said there was a conflicting port every time

arctic arch
#

the path is what comes after ip:port

#

if you want just ip:port, set path to '/'

bronze arch
#

ah

#

so if I type in my ip:port into the web browser when running DBL I should at least be getting a blank screen right, like no connection errors?

arctic arch
#

are you typing it in your browser?

bronze arch
#

well the ip and the port yes

arctic arch
#

yeah blank screen sounds about right

bronze arch
#

okay

#

thanks sorry if these questions seemed dumb lol

restive otter
#

just curious, is posting guild count every 10 seconds (only posts if diferent from last time) too fast?

snow fiber
#

Why would you care about a 10 sec interval?

#

I mean no harm in once a minute

#

Personally I post every 5

#

Also 10 sec is just asking for trouble if you do anything else

pulsar saddle
#

I think that if multiple people were to do it, it may be a problem as even big APIs have difficulties taking that many posts. boop

raven zinc
#

that's exactly what he is doing

pulsar saddle
#

nice

#

apparently I cant read

raven zinc
#

Well, it is kinda spam tho, personally post every hour as you don't really need your guild count to be up to date that much, i don't see any point in posting that frequently

pulsar saddle
#

Yeah even with the check every 10 seconds its still spammy imo, if I was running the API I probably wouldn't appriciate it

restive otter
#

well mine is listening to a db changefeed for my stats which is updated every 10 seconds. same interval for updating stats on my site. but I could increase it to 1 hour for posting my guild count

raven zinc
#

ya it's prob better to increase it

shut ibex
#

I update guild count on my site every time I get a new guild

#

Or lose one

restive otter
shut ibex
#

I use node-ipc

#

Set up an ipc server on the webpage

#

Connect to it on the bot

#

Then send

raven zinc
#

i would use a websocket to do that but i guess that's another way to do it cuteThink

shut ibex
#

@raven zinc I'm to lazy to set up a websocket

raven zinc
#

i don't think it would be any harder than using node-ipc tho

shut ibex
#

mainly I didn't understand websocket at that time also

restive otter
#

yeah i cant do the updating every time it changes thing, since im using eris-sharders stats. i just save it in my db every time stats event fires, btu stats are likie all together

#

changing source to get stats from each cluster all realtime sounds like a pita

shut ibex
#

and also I just checked I put it in my ready event

#

since I'm sharded I just fetch all guilds after all shards are done spawning

raven zinc
#

well you could have each cluster listen to guildCreate and guildDelete and make them relay that

restive otter
#

yeah tru

raven zinc
#

though i guess 10sec is pmuch as fast

shut ibex
#

Then set it on a loop to fetch all of them every one minute and send

restive otter
#

yeah it is fast enough

#

its clsoe enough to live for my site so im happy

#

lol i cant program

#

cause idk how to

clever rock
#

for me, only one shard posts the stats to api's. other shards just relay the data to the shard that does the work

bronze arch
#

I'm using dblapi.js for server count and voted events in discordjs. I'm using a webhook that says it's ready to use, and then I post the server stats after a 5 second delay. However, the posted event in dbl.webhook.on doesn't trigger. I can visit my url in a browser, but it doesn't seem that discordbots or dblapi.js is handling the events or receiving the data. The authentication is also the same on both ends. I'm just kind of confused.

arctic arch
#

@bronze arch are you using dbl.postStats to post your server count?

bronze arch
#

yes

#

Does it ONLY trigger when it's autoposted?

arctic arch
#

the events are for the "autoposter"

bronze arch
#

hm

arctic arch
#

you can use promises or async/await to get the completion of the post

bronze arch
#

even then, I don't think my vote event works, I'd have to wait a while to test it out again (unless you have another idea to test the webhook with discordbots)

arctic arch
#

are you testing by actuallu voting

bronze arch
#

yes

arctic arch
#

there's a test function on the edit page

bronze arch
#

god damnit lol

arctic arch
#

have you even filled in the url lol

bronze arch
#

yeah the webhook seems to be on 0.0.0.0:port/ and then I have the right ip:port on discordbots

arctic arch
#

do you have http:// at the front

bronze arch
#

yeah

#

wow

#

I wish I knew that testing thing earlier lmao

#

thanks

left spear
#

where is the api of dbl?

#

@restive otter you're baldi lmao

left spear
#

I have a anwers

#

answer*

#

How i use the api of DBL to get info of another bots?

#

i look in the api page and i don't know

plain timber
left spear
#

i learn that

#

but i don't know how to use

plain timber
#

well

#

just do a GET request to that endpoint

left spear
#

i make get like thhis

#
var s = require('snekfetch')
s.get("url").then(r => {
    r
})

#

bad?

#

or how

plain timber
#

yeah thats ok

left spear
#

and how i put in url

#
var s = require('snekfetch')
s.get("https://discordbots.org/api/bots").then(r => {
    r
})
#

?

plain timber
#

you need to put the bot id after /api/bots/

left spear
#

but the bot id what will be selected by command, example *dblinfo @AngelicBot#7047 or another bot

plain timber
#

yeah you need to get the id from that then put it in

left spear
#

how

#

HOW

inner venture
#

No need to get aggressive

plain timber
#

smh just learn javascript and whatever discord lib ur using

left spear
#

but how

plain timber
#

how do you learn javascript?

#

google it

left spear
#

its hard

plain timber
#

if its too hard for you to learn the language you're using then you shouldn't make a bot tbh

wanton finch
#

Hey

plain timber
#

spoonfeeding isnt allowed here

left spear
#

spoonfeding?

plain timber
#

like

#

giving code out

#

telling someone exactly how to do something

umbral sorrel
#

Python is more recommended for beginners to programming, then JS and so on, in Britain that's how the education system works anyway lmao

plain timber
#

🤔

#

here they dont teach programming in school

umbral sorrel
#

Oh aha

#

Python is taught Year 10+, Universities generally teach Java

#

For general CS

#

For more specific areas, different languages are taught

#

I.e. Data science = Python and R

hot needle
#

.

restive otter
#

yeah for some reason my uni is making first years do python now

#

hey are gonna be fucked in 2nd year

#

doing C

#

usually first year comsci is java

#

these kids gonna get fucked by nullpointers

karmic hound
#

uni's tend to do java or python as first year heck knows why youd do python

restive otter
#

java so they underatand OOP and types

karmic hound
#

python doesnt seem that useful in industry imo unless your going into something like ai in which case get good with py

restive otter
#

theyre gonna be screwed learming python first

karmic hound
#

if you know something like java then you can easily pickup things like c

restive otter
#

exactly

karmic hound
#

and pickup python

#

but python doesnt translate into java

restive otter
#

java -> pythong

#

or anything to python

#

is easier

karmic hound
#

yeah

#

just knowing OOP is good really

restive otter
#

exactly

#

especially coa 2nd year at my uni

karmic hound
#

GWcfcThonk and we should probably move out of api channel

restive otter
#

is OOP and algorithms

#

in C

#

they are ao fucked

#

oy ya...

#

ahit

olive leaf
#

fuck you

#

oh sorry

#

my fiend

#

send this

jade cloak
#

Delete it then lol

wise aspen
#

plz kick me

restive otter
#

There a way to upvote by command in JavaScrit ?

#

Script

loud gulch
#

no

median orbit
#

Why

restive otter
#

I want to give a role to my voters who have a code ready

hoary timber
#

I still don't really get, what query actually is in the webhook.
Can that be anything I add after the link in the webhook-section of the botpage?
For example: thedomain.com/vote?uniqueid=<id>
Or how is that mean with /bot/:ID/vote? Is there anything I can do at the vote-page?

#

It's so confusing...

#

I'm afk for now.
If someone has an answer to that (Specially on the question on if you can send a own param through webhook) mention me pls.

sudden rampart
#

/bot/:id/vote?k=v

#

the query field in the webhook object will be "?k=v"

gloomy geyser
#

erhmm how can I see if the author of the message voted today so like if i have a command called vote and when you do it if you didn't vote it would say you didn't but if you did it would say you did. How could I do this? (using dblapi.js)

#

@hoary timber

hoary timber
#

@gloomy geyser I'm not sure about js, but there's hasVoted(id) that returns a boolean

#

@sudden rampart That doesn't really answer my question.
How do I set those querys in the first place, without having the user to change it themself?

loud gulch
#

but that is js GWqlabsNotLikeNoot

gloomy geyser
#

i code in js

hoary timber
loud gulch
#

i did

sudden rampart
#

@hoary timber you give the url to users with query params set

hoary timber
#

that doesn't help tbh.....

#

I actually want to make a sort of Votelistener-bot (if that's allowed).
Currently use Sparkjava for making the votelistener.
Would it be possible, to make a post("/vote/:ID", ...) and then get the param :ID?
Not sure how parameters work in sparkjava.... if they are defined, or if you can give a own name...

sudden rampart
#
post("/vote/:id", (req, res) -> {
    var id = req.params("id");
})```
hoary timber
#

without the : in req.params?
Because the example of spark shows it with the :

sudden rampart
#

: in the route

#

no : in the method

hoary timber
#

ok

#

Because that way I could get a identifier to check info with the database...

#

Makes stuff a lot easier for me now.

wary zenith
#

Yo , I’m in python , but idk if someone can help me with this , since I asked on a python support server , but they said I needed the api something , to make it possible to let ppl „unlock“ a command when they upvote the bot on discord Bot List

obtuse flicker
#

Yes as long as you have an api key to their server or if they have a server where you can view the analytics of a bot

#

and as long you can call it in js

ocean pike
#

I'm confused how do i get the Webhook thingy that says on the edit page for your bot?

plain timber
#

@ocean pike some of the DBL API libs support it, if you're not using one of those languages you'll need to set up a webserver to receive the POST request

#

what language are you using?

ocean pike
#

Js

plain timber
#

then you can use the JS lib

ocean pike
#

Ahh Thanks

#

Okay btw i already have

const DBL = require("dblapi.js");
#

So i just need the other stuff?

plain timber
#

yeah

#

look at the webhook example

ocean pike
#

Oh

#

Thanks

restive otter
#

How do i authentify on the api how to enter the token?

plain timber
#

@restive otter are you using an api lib or directly accessing it?

restive otter
#

direct

plain timber
#

set the Authorization header

restive otter
#

how to?

#

Can you send me an example (json) @plain timber

plain timber
#

its not part of the body

#

its a header

#

check the docs for whatever request lib ur using

rustic coyote
#

@inner venture I was asked to ask you about my issue. So my issue is that my bot doesn't update it's guild count on the dbl website. It used to work but doesn't anymore, the token didn't change and I'm using the official DBL API for java.

My bots log: [08/26/2018 04:20PM][INFO] Sent 'on 51 guilds on shard 0/1' to DiscordBotList.org [08/26/2018 04:20PM][INFO] Playing status updated to: Watching 59616 members on 51 guilds!

My code for sending my stats:```java
Timer t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
long members = 0, guilds = 0;

            for (JDA j : jda.getShards()) {
                guilds += j.getGuilds().size();

                api.setStats(j.getGuilds().size(), j.getShardInfo().getShardId(), jda.getShards().size());
                Utils.logNoCmd("Sent 'on " + guilds + " guilds on shard " + j.getShardInfo().getShardId() + "/" + jda.getShards().size() + "' to DiscordBotList.org");

                for (Guild g : j.getGuilds())
                    members += g.getMembers().size();
            }

            if(!cmdPlaying.customPlaying) {
                jda.setGame(Game.of(Game.GameType.WATCHING, members + " members on " + guilds + " guilds!"));
                Utils.logNoCmd("Playing status updated to: Watching " + members + " members on " + guilds + " guilds!");
            }
        }
    }, 0, 500000);```

My code for the API:```java
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token(Secrets.DBLToken)
.botId(Static.botID)
.build();

inner venture
#

@rustic coyote hey. Can you add a callback to check if there's an exception being thrown?

rustic coyote
#

Sure

#

Let me just do that realy quick

#

Could you tell me how implement the callback since I'm not really familiar with Java as a normal language but rather only with the JDA DiscordAPI wrapper?

inner venture
#

oh one second

#

the parameter order for the setStats methos

#

You've got them out of order 😊

rustic coyote
#

Oh, probably happened when recoding the function

#

Would've never noticed

#

Thanks for helping ^^

inner venture
#

🙏

#

btw, timers are kinda outdated in java.

#

I would suggest using a ScheduledExecutorService

rustic coyote
#

oki

inner venture
#

If you need help, youre free to ask me

#

😊

rustic coyote
#

Thanks ^^

rustic coyote
#

Got it working now (had to do a mvn clean install bc intellij doesnt like me), also using scheduledexecutorservice now

inner venture
#

🙏

#

awesome!

#

glad i could help

rustic coyote
#

Thanks for that ^^

#

OMG I accidentally bombed the discordbots api

#

Forgot to put it on 5 minutes instead of ms xd

inner venture
#

hahaha

rustic coyote
#

I imagine that in the server log, like just 100 times my bot sending stats

blazing shale
#

.

harsh chasm
#

Is it normal for the API to not have permission when updating?

[DB.ORG] Attempting to post server count...
[DB.ORG] Failed. - Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

This is what comes up for me, however it works perfectly fine as it displays on the website (I'm using the Python library btw)

plain timber
#

looks like your token is wrong

#

if it successfully updates it shouldnt say forbidden

restive otter
#

How can I look up the name of the game that a user is playing using Discord API?

I am trying to learn how to make a bot and this little feature is kinda the core of the functionality I am trying to build

plain timber
#

@restive otter this channel is for the DBL API

#

for other stuff go to #development (also mention what library you're using)

restive otter
#

Okay thanks for the heads up

plain timber
#

yw

last cedar
#

how to use javascript api for heroku

#

anyone?

plain timber
#

@last cedar this channel is only for the DBL API, as it says in the channel topic
If you want help with a different API then go to #development

smoky trench
#

channel oof

last cedar
#

ye

smoky trench
#

go to #development if you need help with the heroku api or whatever it is

last cedar
#

javascript api for this

smoky trench
#

oh

last cedar
#

like when i tried it, it doesnt change the server count

plain timber
#

Well using the DBL API should be the same on heroku or anywhere else

smoky trench
#

do you have an error or sample code

#

that helps

plain timber
#

^

last cedar
#

nothing else besides commands

plain timber
#

Webhooks don't set the server count...

#

The webhook is to receive votes

last cedar
#

🤔

plain timber
#

Can you paste your code?

last cedar
#

alright nvm then

restive otter
hushed reef
#

Can you be more specific

bold aspen
#

@restive otter Webhooks are specific to each discord server, you need to manually add each hook to your bot and handle them separately. If you share the webhook publicely than the only thing you achieve is allowing everyone to spam the specific channel you made the hook for

shut ibex
#

I'm pretty sure he means the vote webhook

bold aspen
#

Yeah I knew that.... ej

restive otter
#

Hi

#

How can I check if someone has voted or not? Is there any example?

topaz wyvern
restive otter
#

Ueah checked that but didnt understand

topaz wyvern
#

What language and library do you use?

restive otter
#

Python

topaz wyvern
#

Lib?

restive otter
#

Discord

topaz wyvern
#

.py?

restive otter
#

yup

topaz wyvern
#

Well, I have never used python but some people that have used discord.py might be able to help you

restive otter
#

I found an example

topaz wyvern
#

Alright

restive otter
#

Can I post it here?

topaz wyvern
#

Sure

restive otter
#
bot_id = kwargs.get('bot_id', self.bot_id)
onlyids = kwargs.get('onlyids', False)
days = kwargs.get('days', 31)

return await self.http.get_upvote_info(bot_id, onlyids, days)```
#

Is that fine?

topaz wyvern
#

I'm not sure, I've never used python

restive otter
#

Alright

#

Thanks anyway

topaz wyvern
#

Np

royal fiber
#

How can i set a weebhook? For upvote feeds?

plain timber
#

@royal fiber you'll need to accept the request

#

either use the DBL JS lib or set up a webserver

#

you can set the URL in your bot's edit page

leaden lagoon
#

@plain timber Is there another way to do a webhook for dbl?

plain timber
#

@leaden lagoon what do you mean?

#

those are the two ways

#

thats it

leaden lagoon
#

what are the 2 ways

plain timber
#

what language are you using?

leaden lagoon
#

js

plain timber
#

then you can use the js lib

leaden lagoon
#

thx

plain timber
#

yw

leaden lagoon
#

wait...

#

how to get Webhook Port and Password? Where should i get the webhook?

light crag
#

The webhook port is a location/endpoint on your system which DBL might use. The password is simply authentication so you know if the request is coming from DBL. Webhook is simply a webserver which accepts POST requests to receive data and interpret it.

leaden lagoon
#

wut

#

But what is the webhook port and password then?

light crag
#

The webhook port can be any open port you like and the password is a string which should be strong.

#

Like a password to a website.

leaden lagoon
#

so anything?

light crag
#

The port can't be necessarily everything. Password can be.

leaden lagoon
#

ok

#

where can i find open ports

light crag
#

Just try a port and if you get an error which if I remember correctly is EADDRINUSE then that port is taken by some other program or the os.

leaden lagoon
#

ok

uncut crystal
#

you do not remember correctly

gusty maple
#

Hello, How can I bring you the obligation to use the DBL Vote command

humble bison
#

@gusty maple what

#

what's up with you people, you can't even ask a proper question

formal sparrow
#

I didn't change anything it just came

restive otter
#

Hello, i wanted to use webhook-voting for my bot, i use discord.js and host on glitch.com but i don't get how i should do it?

humble bison
#

express server

restive otter
#
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  response.sendStatus(200);
});
app.listen(5050);
setInterval(() => {
  http.get(`http://process.env.Name.glitch.me/`);
}, 280000);

I have

humble bison
#

doesn't look like it

loud gulch
#

thats not how it works

#

http://process.env.Name.glitch.me/

#

nope

restive otter
#

i changed that

loud gulch
humble bison
#

wew

restive otter
#
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  response.sendStatus(200);
});
app.listen(5050);
setInterval(() => {
  http.get(`http://nitrobot.glitch.me/`);
}, 280000);
loud gulch
#

you know

restive otter
#

This is my real code, but i don't wanted to advertise

loud gulch
#

you didnt actually setup the dbl webhook

#

right?

restive otter
#

yes

#

that is why i am here

humble bison
#

now add the dbl vote code

restive otter
#

....

humble bison
#

setup a post event

loud gulch
#

doesnt listen need a callback

#

and doesnt the port have to be a string

humble bison
#

port is a freaking integer

#

smh

loud gulch
#

no

#

string

#

smh

humble bison
#

integer

#

look at the docs if you have to

restive otter
#

tony go the fuck to bed

#

smh

#

@humble bison

humble bison
#

no u

loud gulch
#

it works as a string tony

humble bison
#

but it's a integer by default

restive otter
#

Webhook running at http://0.0.0.0:5000/dblwebhook

#

this is normal, isn't it?

loud gulch
#

yes

restive otter
#

lol, it worked i am so stupid

restive otter
#

Im having a bit of trouble with the API, not sure if its your api or the randomPuppy API, any idea what that would be?

(node:36658) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 38): TypeError: this.request.getHeaders is not a function

Im getting that when running a 4k command to do with NSFW

#

Thats all im getting, no line that the error is coming from neither

formal sparrow
#

But it works on my test bot

loud gulch
#

that is some error

#

forbidden Thonk

uncut crystal
#

well for one, uh, might want to delete that message because it has your IP in it

restive otter
#

Rip him

loud gulch
#

wait it does?

restive otter
#

Yep ^

shut ibex
#

lmao it does

restive otter
#

is there currently a voting issue?

arctic arch
#

no?

restive otter
#

some people are getting their dailys and others arent is why i am asking.. its been happening since yesterday was just wondering

hardy parcel
sudden rampart
#

you don't need a token to read data from bots

topaz wyvern
#

^

sudden rampart
#

you only need one to post stats/check votes

hardy parcel
#

That's not documented 🤔

#

Thanks for the clarification though

inner venture
#

The only endpoint that says "Requires authentication" is the "Post Bot's Stats" one

#

well

#

and the vote checking ones too

#

but my point stands

#

the only ones that require auth are the ones that explicitly say so

restive otter
#

to anyone that'll check LynxBot, it is offline until I can setup a heroku app for it

#

just ignore it and move onto another bot please

humble bison
#

wrong channel for it

#

also if its offline and checked it'll just get declined

restive otter
#

Speak spanish?

formal sparrow
#

@uncut crystal no it's not my ip. It's someone else's ip and it says that the owner of discordbots.org has banned it

#

Idk whose ip it is and why they banned it

#

So I can't update server counts anymore?

uncut crystal
#

depends on what they got banned for, if it's a ratelimiting ban it only lasts an hour

formal sparrow
#

Idk on what they got ban

#

How can I find and who got ban

topaz wyvern
#

No

#

I use glitch

#

It works fine

formal sparrow
#

Then who got banned here really

topaz wyvern
#

Idk

formal sparrow
#

@uncut crystal sorry for this ping but can you help me?

arctic arch
#

@formal sparrow whats the IP address

sleek dirge
#

How is the Authorization thing done? Im reading the docs but im still lost

restive otter
#

Use an API wrapper 😃

arctic arch
#

@formal sparrow found the screenshot
the IP was banned for heavy spam

formal sparrow
#

@arctic arch but whose ip it is

#

And why I can't use

#

Kindly ping and tell me please

snow fiber
#

Not Tonkku but, Glitch probably recycles IP's from instances that go down, if someone abuses on an instance that IP gets banned

#

It's like receiving a lot of spam calls from a phone booth

#

You don't know who's calling you but you can block the booths number

formal sparrow
#

Ik but how it happened automatically?

snow fiber
#

You can count how often someone hits your ratelimit and if it's above a threshold, IP banne

formal sparrow
#

So it is cuz somoene spammed a command that uses ip?

#

So what is the solution to make it work again? Changing project will work?

summer oracle
#

Your problem is Glitch

arctic arch
#

nice

summer oracle
#

Its a very important white paper.

restive otter
#

whats wrong with glitch

amber dune
#

read the whitepaper mmLol

restive otter
#

:)))

polar mirage
#

Does getVotes return the last 1000 votes for this month

#

Or all time

#

🤔

restive otter
#

Last 1000

#

It says on the docs @polar mirage

polar mirage
#

Yeh

#

Don't fully trust the docs considering they also say voting has 24h cooldown

#

Seems outdated

formal sparrow
#

@summer oracle so in your way, why some other bots running in glitch still can use dbl api

summer oracle
#

I think you did not read the white paper.

#

Just read it, things will be very clear.

formal sparrow
#

It is not like a white paper

#

Who made it lol

topaz wyvern
#

I use glitch because I'm poor

formal sparrow
#

Same goes here but still many bots can use api while I can't in glitch

summer oracle
#

I call bullshit. Maybe "poor" as in "poor life choices". The time spent to make a Discod bot work on such mutilated free services like Glitch or Heroku could be spent working a real job and earning enough money to run on some cheap af vps for years. The only legit reason anyone would ever choose to run on such a free tier is because it is a challenge to make things work on such a small, restricted, shared space, and some ppl enjoy that kind of challenge - in which case I'm the last person on earth that will ruin their fun by helping them solve it.

polar mirage
#

It works for me^^

#

😄

#

But yeh

#

I set up like 3 apps now

#

And even for the third app it still took me over an hour to get stuff running properly lol

topaz wyvern
#

@summer oracle im 13

#

i dont have 10$/month to spend

#

Where i live you cant legally get a real job until you are 15

shut ibex
#

parents

#

my parents pay for my vps

polar mirage
#

damn

restive otter
#

also bs i dont have a job and still make enough money to pay for a vps

trail shadow
#

its only $10 a month???

restive otter
#

When you do @Luca botinfo @botname it shows "No server Count" How can I make it show the amount of servers its in?

#

@trail shadow sometimes cheaper

mystic wing
#

DBL api

restive otter
#

by sending a post request to the api with your server count

mystic wing
#

Poststats (assuming node)

inner venture
#

Which language are you using?

restive otter
#

discord.js

#

Thats a library but blobshrug

steel hawk
#

I need help posting my server count to DBL

#

I've tried many methods but none of them have been working so far

topaz wyvern
#

lang?

steel hawk
#

discord.js

#

Here is what I'm doing ```js
dbl.on('posted', () => {
return console.log('All server counts posted successfully!')
})

dbl.on('error', (err) => {
return console.error(err)
})```

topaz wyvern
#

well

#

thats not posting stats

#

one sec

#

let me get an example

shut ibex
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
#

thats how u use the dblapi.js lib

steel hawk
#

Thats exactly what I have

trail shadow
#

@restive otter what kind of vps is that, ive heard there is many

steel hawk
#
const DBL = require('dblapi.js')
const dbl = new DBL(config.dblToken, client)

module.exports = async (client, guild) => {

  dbl.on('posted', () => {
    return console.log('All server counts posted successfully!')
  })
  
  dbl.on('error', (err) => {
    return console.error(err)
  })```
shut ibex
#

the dblapi.js lib posts every 30 minutes

#

how long did u wait for it

steel hawk
#

no time

#

Alright I'll wait

topaz wyvern
#

he's not even posting the stats

shut ibex
#

he is

steel hawk
#

Then how do you post the stats..

shut ibex
#

wait

topaz wyvern
#

no he isnt

#
.postStats(serverCount, [shardId], [shardCount])
shut ibex
#

what is client defined as in new DBL()

#

@topaz wyvern if u pass client into new DBL() it auto posts

topaz wyvern
#

oh

shut ibex
steel hawk
#

@shut ibex it didn't work

steel hawk
#

I still can't post server stats

#

To dbl website

plain timber
#

@steel hawk any errors logged?

steel hawk
#

nope

plain timber
#

before dbl.on('posted' can you try adding this on a new line? dbl.postStats(client.guilds.size).catch(e => console.error(e))

steel hawk
#
    at IncomingMessage.res.on (/root/ear-tensifier/node_modules/dblapi.js/src/index.js:115:25)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  raw: '{"error":"Unauthorized"}',
  body: { error: 'Unauthorized' },
  status: 401,
  headers:
   { date: 'Fri, 31 Aug 2018 23:25:46 GMT',
     'content-type': 'application/json; charset=utf-8',
     'content-length': '24',
     connection: 'close',
     'set-cookie':
      [ '__cfduid=dcaf1c5c4e6b6f9edaf975a2383c83da91535757945; expires=Sat, 31-Aug-19 23:25:45 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ],
     'x-powered-by': 'Express',
     'access-control-allow-origin': '*',
     'access-control-allow-headers': 'Authorization',
     etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
     'x-cacheable': 'NO',
     'x-varnish': '396133495',
     age: '0',
     via: '1.1 varnish-v4',
     'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
     'x-content-type-options': 'nosniff',
     'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
     server: 'cloudflare',
     'cf-ray': '4533421a3c262180-EWR' },
  ok: false,
  statusText: 'Unauthorized' }
#

Getting this error @plain timber

plain timber
#

your token is wrong

inner venture
#

401 usually means no auth was provided at all

plain timber
#

hm

#

try console.log(config.dblToken)

steel hawk
#

Yep

#

it printed out a token

plain timber
#

can you double check its correct?

inner venture
#

and that its for the right bot

steel hawk
#

Ok

#

Now it worked 🎉

plain timber
#

k, if the token's fixed you can remove the dbl.postStats line

leaden lagoon
#

Does anyone know why this doesn’t work?

const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path}); }); dbl.webhook.on('vote', vote => { console.log(User with ID ${vote.user} just voted!); });