#topgg-api

1 messages · Page 38 of 1

leaden lagoon
#

I keep trying different webhook ports and get no errors yet when my friend votes nothing logs.

restive otter
#

did you open the port. and did you edit the webhook port on ur bot pahe?

polar mirage
#

So getVotes does return the last 1000 votes of this month

#

Perhaps updating the documentation wouldn't be a bad idea

#

¯_(ツ)_/¯

sleek topaz
#

I tried to run the sample python code and this happenedpy AttributeError: module 'dbl' has no attribute 'Client'

#

the line was ```py
self.dblpy = dbl.Client(self.bot, self.token)

rigid jasper
#

is there a test button so i can code vote events,etc?

arctic arch
#

yes, on the edit page

rigid jasper
#

thank you very much

#

is it the one at the very bottom?

arctic arch
#

yea

rigid jasper
#

sorry for asking im new to coding, but how can i find the url that i have into that text field

#

or can i put any url in there?

arctic arch
#

it should point to your bot

#

so http://your.bot's.ip.address:port/path

rigid jasper
#

oh okay thanks

rigid jasper
#

could you explain it again it doesnt work 😦

#

i think i just dont understand it

tidal burrow
#

the url must lead to your bot, which means you need a webserver

rigid jasper
#

and how do i make a webserver

sullen nymph
#

@sleek topaz don't call your folder or file dbl

#

Anything but already existing ones' names or dbl

cursive coyote
#

Hello, is that normal that the webpage shows "2 upvotes" where

        console.log(votes.length);
    })``` 
shows 21 rows ?
#

Using javascript api

humble bison
#

@cursive coyote that's total votes from the API

#

the page shows monthly votes only

cursive coyote
#

OH alright

#

but, something still weird

#

do u know the refresh time ?

#
        if (votes.find(vote => vote.id == msg.author.id)) console.log(msg.author.name + " has voted;");
    });``` does not log once I post, but I've voted 5mn ago
humble bison
#

your votes don't count

#

since your an owner

#

lmao

cursive coyote
#

haha ok

#

Seems legit ^^'

#

May I ask one of you just a test ?

humble bison
#

why do you need a test

#

just wait for somebody real to vote

cursive coyote
#

type +risibank test, then vote, then retype +risibank test 😃

polar mirage
#

what lol

#

My bot counts my votes

#

??

restive otter
#

every vote counts, the reason your vote is not showing up is dbl api hasnt updated/cached ur vote

shut ibex
#

tom pls

restive otter
#

so instead, you should use a webhook to get every vote live and save it to ur own db, and stop relying on dbl

#

oi

shut ibex
#

that pfp

restive otter
#

i dont liike it

rose finch
#

Ummm, I'm trying to add bots but its using my old account instead of this one

inner venture
rose finch
#

Thank you

restive otter
#

/api

#

lmao i thought that was a "/" not a #

#

im kinda rart

polar mirage
#

What if I get more than 1k votes a month and still use getVotes

#

What's gonna happen

#

🤔

topaz wyvern
#

It will just get most recent ones I'm guessing

turbid jasper
inner venture
#

@polar mirage the endpoint will return exactly what it says it will return

polar mirage
#

Doesn't say anything about it being the monthly votes

#

But okay

#

Wouldn't say "exactly"

restive otter
#

Just use webhooks they are more efficient

polar mirage
#

yes yes

shut ibex
#

use the webhook

light crag
#

Yes

#

Setup a webserver that accepts POST requests and point DBL to the url where you want to receive the data.

polar mirage
#

yes

#

thank for same reply x3

#

I get it now

#

👌

red cove
#

I need help.. I need a bot for patch notes for an app on Google Play and the App Store

topaz wyvern
#

this isnt the right channel

#

for that

red cove
#

I figured as much lol. Where would I need to go?

topaz wyvern
red cove
#

@topaz wyvern ty 👋

topaz wyvern
#

np

red cove
#

What is an api and webhook?

plain timber
sleek dirge
#
const userID = message.author.id
const url = `https://discordbots.org/api/bots/${botid}/check?userId=${userID}`
const snek = require("snekfetch")
const voted = await (snek.get(url)).body``` Im trying to fetch the voted from the page
#

but the output is always undefined

#

isnt the page a json ?

plain timber
#

@sleek dirge use the js lib

sleek dirge
#

okay thanks

plain timber
unique ruin
#
exports.run = (client) => {
    client.user.setActivity('Suggestions', {
        type: 'WATCHING'
    });
    console.log("\n---=[Events & Commands has been loaded succesfully!]=---");
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
}
#

is this right?

#

for posting the stats for my bot?

plain timber
#

yeah that should work

restive otter
#

How can I check if someone has voted for my bot? I don't really understand this... /bots/{bot.id?}/check Like how to use it

plain timber
#

@restive otter what language?

restive otter
#

I use Python

#

Forgot to mention sorry

plain timber
#

theres a dblpy lib

inner venture
#

i dont believe it has support for thtat

restive otter
#

Yeah I saw the example for updating server count. But I don't know, its a bit complicated

plain timber
#

hm

#

well, do you know how to make a http/get request?

restive otter
#

yes

plain timber
#

just make a request to that url

restive otter
#

My bot url right?

plain timber
#

https://discordbots.org/api/bots/BOTID/check?userId=USERID

restive otter
#

Oh alright

plain timber
#

you'll need to set the Authorization header to your bot token

restive otter
#

Whats that? If its in the post_server_count example I have it, because i use it to post server count

plain timber
#

yeah

#

you can get the token from the bot edit page

inner venture
#

shoudltn the lib dot hat

restive otter
#

Alright, thanks a lot

unique ruin
#
exports.run = (client) => {
    client.user.setActivity('Suggestions on ${client.guilds.size} servers', {
        type: 'WATCHING'
    });
#

love when this dont work

#

xD

#

am dead

plain timber
#

use ` not '

unique ruin
#

oh shit

#

just seen

#

lmfao

#

ty ma man

restive otter
#

Well I get an error "Unauthorized" 🤔 Luca

sudden depot
#

U did not send auth header then

restive otter
#

This is what I have

@commands.command(pass_context = True)
    async def test(self, ctx, user: discord.Member):
        url = "https://discordbots.org/api/bots/408439037771382794/check?userid={}".format(user.id)
        async with aiohttp.ClientSession() as session:
            async with session.get(url) as resp:
                asd = (await resp.json())
                print(asd)```
#

How do I do that @sudden depot

sudden depot
#

I dont speak snake but where do u seend the auth header

restive otter
#

I dont understand

#

anyone?

plain timber
#

did you send the Authorization header?

restive otter
#

How

plain timber
#

check the docs for the request lib you're using

restive otter
#

So somthing like

requests.get(url, header='token')```
plain timber
#

idk python or whatever request stuff ur using

restive otter
#

Pfff get error 'header'

#

Anyone knows python here? lol

#

For example how do you do it in js?

#

I must use only token? or it needs bot id too?

plain timber
#

well the id is in the url

restive otter
#

Got it, but now I get other error. add userId = to your request

#

but i do have it

#

I think its because "i" is not capitalized

#

hold on

#

Yup

#

Works. Thanks a lot Luca

plain timber
#

im not luca

#

@abstract moth is luca

#

lol

restive otter
#

lol

ripe linden
#

how do i get a webhook url?

plain timber
#

@ripe linden you need to set up a webserver to receive the post requests that DBL will send

#

what language are you using?

ripe linden
#

js

plain timber
#

you can use the dbl js lib

#

or, if you already have an express webserver, use that

ripe linden
#

i have an OVH vps and dont know how to create a webhook url

plain timber
#

use the dbl js lib i linked...

sullen nymph
#

@plain timber authorization header is unnecessary to do when using dblpy :^)

plain timber
#

@sullen nymph they arent using dblpy

#

since it doesnt support the /check endpoint

sullen nymph
#

Does GET request even require auth?

plain timber
#

yeah

sullen nymph
#

Oh, my bad

plain timber
ripe linden
#

for my webhook port can i use ssh?

shut ibex
#

wwut

uncut crystal
#

no

uneven hill
plain timber
#

@uneven hill looks like you didnt specify your token

uneven hill
topaz wyvern
#

yes

#

or the token is incorrect

uneven hill
#

ok i regen token and solved

#

thanks!

topaz wyvern
#

alright

#

np

turbid pollen
#

hi

restive otter
#

In how many minutes does it update when someone has voted?

little harbor
#

does what update? the webhook?

#

or the votes endpoint?

restive otter
#

For example i have a comment which Icheck if someone has voted or not

#

It respons with 0 if he didnt vote, but if he did it responds with 1

#

But when he votes it needs like some time to update

little harbor
#

so you're using the endpoint, it should be pretty fast, I don't think it could be more than a minute but I haven't used the endpoint in a while so idk

#

meanwhile the webhook updates almost instantly

restive otter
#

How do I use it

#

any example?

little harbor
#

depends on what language

#

you can probably just look up "[language] webhook tutorial" and find something but idk

#

I use a super ghetto system that sends it to my website, which sends it to a discord channel for easier logging topKEK

restive otter
#

Oh

#

I use python English

little harbor
#

looking up "python webhook listener" seems to bring up quite a few things, I'm very unfamiliar with python though so I can't help you

restive otter
#

ok ty

little harbor
#

npnp

surreal junco
#

Are the webhooks working for you guys 🤔

little harbor
#

nope

#

seems to be broken again

summer oracle
#

yup

#

@arctic arch @cobalt ruin pl0x fix

#

do your magic

cobalt ruin
#

@summer oracle @surreal junco Sorry, there was an issue with the queue, all the backlog of votes should process now

surreal junco
cobalt ruin
#

Ping me if anything else happens, shouldn't though, thanks guys

surreal junco
#

Will do

turbid jasper
polar mirage
#

Is it working now?

#

If I use the webhook test it works

#

But when someone actually votes, nothing gets send

#

¯_(ツ)_/¯

#

(╯°□°)╯︵ ┻━┻

#

nvm works now

restive otter
#

So i am using discord.js and host on glitch.com, for letting my bot be always online, i use this script:

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://nitrodiscordbot.glitch.me/`);
}, 280000);

And now i want to use a webhook from dblapi.js to receive upvotes, so i have to use this:

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!`);
});

But i can't use both(when i use 2nd script, first won't work -> my bot goes offline)
What can i do?

fast tapir
#

not use glitch

restive otter
#

...

#

Is there a way to disable autostatsposter?

#

And are there some other free services, that run NodeJs ? (I don't understand Heroku)

tidal burrow
#

best solution, get a vps

arctic arch
#

check the example of linking the webhook to an existing http server

restive otter
#

where?

#

nvm

unique ruin
#

Hey does anyone know if theres a way to get check which servers are using ur bot like exactly like with a discord invite and everything ?

#

using Js

restive otter
#

i think fetchInvites needs a permission. but you can do:

client.guilds.forEach(guild => {
   console.log(guild.name);
});
#

Btw, here you can see the properties of a guild (maybe you need it)
https://discord.js.org/#/docs/main/stable/class/Guild

humble bison
#

wrong channel

sudden depot
#

Still

# 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)!```
#

[04:53:58:527] Updated Discord Bot List Stats! {} { 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) raw: '{"error":"Oops, I think a bad happened, I\'m trying again just hang in there"}', body: { error: 'Oops, I think a bad happened, I\'m trying again just hang in there' }, status: 500, headers: { date: 'Wed, 05 Sep 2018 05:03:58 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '77', connection: 'close', 'set-cookie': [ '__cfduid=d94a2e706daf21b9b2b23f1e3734650361536123838; expires=Thu, 05-Sep-19 05:03:58 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ], 'x-powered-by': 'Express', etag: 'W/"4d-bawlvXmIX77Lqj+rNFbli5+PTRI"', 'x-cacheable': 'NO', 'x-varnish': '92700718', 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': '45562704a85c6be6-SJC' }, ok: false, statusText: 'Internal Server Error' }

restive otter
#
0|jb       | { Error: 500 Internal Server Error
0|jb       |     at IncomingMessage.res.on (/home/pi/Desktop/jb2/node_modules/dblapi.js/src/index.js:115:25)
0|jb       |     at IncomingMessage.emit (events.js:185:15)
0|jb       |     at IncomingMessage.emit (domain.js:422:20)
0|jb       |     at endReadableNT (_stream_readable.js:1106:12)
0|jb       |     at process._tickCallback (internal/process/next_tick.js:178:19)
0|jb       |   raw: '{"error":"Oops, I think a bad happened, I\'m trying again just hang in there"}',
0|jb       |   body: 
0|jb       |    { error: 'Oops, I think a bad happened, I\'m trying again just hang in there' },
0|jb       |   status: 500,
0|jb       |   headers: 
0|jb       |    { date: 'Wed, 05 Sep 2018 05:10:40 GMT',
0|jb       |      'content-type': 'application/json; charset=utf-8',
0|jb       |      'content-length': '77',
0|jb       |      connection: 'close',
0|jb       |      'set-cookie': 
0|jb       |       [ '__cfduid=da68843e4d2ccb122d4e8932c0495c0d21536124240; expires=Thu, 05-Sep-19 05:10:40 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ],
0|jb       |      'x-powered-by': 'Express',
0|jb       |      etag: 'W/"4d-bawlvXmIX77Lqj+rNFbli5+PTRI"',
0|jb       |      'x-cacheable': 'NO',
0|jb       |      'x-varnish': '80054117',
0|jb       |      age: '0',
0|jb       |      via: '1.1 varnish-v4',
0|jb       |      'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
0|jb       |      'x-content-type-options': 'nosniff',
0|jb       |      'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
0|jb       |      server: 'cloudflare',
0|jb       |      'cf-ray': '455630d55c009cf6-AMS' },
0|jb       |   ok: false,
0|jb       |   statusText: 'Internal Server Error' }
``` help
shut ibex
#

Site was down

restive otter
#

"was"?

#

it happend 3 days in a row!

#

@shut ibex

obtuse flicker
#

I am just getting a white screen on the site so something is happening

restive otter
#

Is it possible to post the shard count with the python api wrapper?

sullen nymph
#

dblpy lib

restive otter
#

how can I check if someone hasVoted ?

#

I want to do some commands to be vote-only

#

I tried using the library

#

but it doesn't work

topaz wyvern
#

lib?

restive otter
#

javascript

plain timber
#

@restive otter what was the issue with the dblapi.js lib?

restive otter
#

let me try it again and I will send you the error

#

It tells me "Cannot read property 'hasVoted' of undefined"

plain timber
#

can you send your code?

restive otter
#

sure

#
const Discord = require("discord.js");
const superagent = require("superagent");

module.exports.run = async(bot, message, args) => {

    let hasVoted = bot.dbl.hasVoted;
    if (!hasVoted(message.author.id)) return message.channel.send("You need to up-vote the bot to use this command.")
    
    let {body} = await superagent
    .get(`https://nekos.life/api/v2/img/Random_hentai_gif`);
    if (!message.channel.nsfw) return message.reply(":underage: NSFW Command. Please switch to NSFW channel in order to use this command.");
  
    let hentaiEmbed = new Discord.RichEmbed()
    .setColor("RANDOM")
    .setImage(body.url);

    message.channel.send(hentaiEmbed);

}
#

Sorry if I made any mistake it's 4 AM here so I'm kinda braindead.

plain timber
#

you didnt put the const dbl blahblah code there

restive otter
#

oh

#

lemme try

plain timber
#
const DBL = require("dblapi.js")
const dbl = new DBL('Your discordbots.org token')```
#

add that before your module.exports.run line

restive otter
#

yeah

#

still the same error

plain timber
#

uh

#

looks like there are some more issues

#

let hasVoted = bot.dbl.hasVoted; not needed

restive otter
#

oh aight

plain timber
#

here use this

let voted = await dbl.hasVoted(message.author.id)

if(!voted) return 'you have not voted stuff'
restive otter
#

I think it works

#

1 sec.

#

lemme use my alt

#

It works

#

Thanks a lot man !

plain timber
#

yw

restive otter
#

Nope

#

I have another problem now.

#

It all works, but after people vote it still doesn't work

#

Like I mean , you get the message that you didn't voted, you go to vote and after you retry the command it still says that you didn't upvoted

plain timber
#

hm

#

if you console.log(voted) it says false?

restive otter
#

lemme try

#

Ok, so after I voted and restarted the bot

#

it says true

#

let me try with another guy

#

yeah

#

It says false

restive otter
#

@plain timber Sorry for pinging you, but did you find a solution to this?

high iris
#

anyone have an idea as to why this is just giving me the regular array, not just ids and not only in the past day?
upvotes = await self.dblpy.get_upvote_info(onlyids=True, days=1)

plain timber
#

iirc onlyids was removed

high iris
#

rip

#

its still in the docs and the current version of the python library

#

oh well, I more care about the days

#

its easy to get past the id stuff

plain timber
#

maybe the python lib wasnt updated

#

but its not in the actual api docs

heady flax
#

How would I make it so only people who have voted can use a command?

#

(discord.js)

fast tapir
#

Look at the above image and read it. Then use logic mmLol

heady flax
#

Does the js lib create its own webhook or do you have to handle all that yourself?

tidal burrow
#

How do you expect getting information about who voted by sending a webhook message?

#

It's talking about you having a webserver that will accept POST requests, and then it's up to you to forward that request to your bot

#

Example link would be https://your.ip/port

heady flax
#

Thanks

restive otter
#

@tidal burrow let ur bot get the vote.user (e.g voter's ID) and thats it

tidal burrow
#

He was talking about webhooks last

#

Please read the context first

fluid inlet
#

i need help i cant really figure out how to use javascript library on weebhoks

#

i mean i dont know how to provide a weebhok password and stuff

humble bison
#

weebhook

tidal burrow
#

webhooks need passwords and stuff? Thonk

humble bison
#

it helps, but they aren't needed usually

high iris
#

can someone help me set up a webhook with python to get voter ids over the past day?

plain timber
#

@high iris a webhook is basically DBL telling you "this person just voted", if you want to store the webhook data you'll have to use a database

restive otter
austere swallow
#

you can find your token in the edit page of your bot

restive otter
#

not the question

humble bison
#

thats what you need to do tho @restive otter

#

authorization is your bots token

plain timber
#

i think they mean sending it

#

and check the docs for whatever http request library you're using @restive otter

#

it should have something for setting headers

torpid rivet
#

How can I make a Vote command?

humble bison
#

@torpid rivet a command that checks if someone has voted?

torpid rivet
#

Yes

#

@humble bison

humble bison
#

@torpid rivet check the docs for your lib

#

DBL API js has hasVoted

restive otter
#

@plain timber ah I see should have been easy

surreal junco
#

@cobalt ruin Are the webhooks down?

cobalt ruin
#

Sorry I should post an update here as well

#

We are investigating downtime / increase latency in web hook POSTs - we believe this is being caused by a third party hosting provider.

surreal junco
#

I see, was this posted in like certified or something? 😂

cobalt ruin
#

Yea 😛

surreal junco
#

Haha

cobalt ruin
#

Can confirm to any of you still having issues, webhooks are 100% instant again 👌🏻

surreal junco
ashen flume
#

I'm gonna need a little walk through on how to get webhooks to work in python.

#

I just wanna check if a user has voted

smoky trench
#

Webhooks immediately notify you when a user has voted, you cant (unless you store the user ids) check if a user has voted through webhooks.

#

i have basically no knowledge of python myself, but there should be lots of tutorials online because you're basically just listening for a http request from dbl.

surreal junco
mellow kraken
#
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
  File "/root/wowsb-bot/cogs/wowsb.py", line 149, in update_stats
    await self.dblpy.post_server_count()
  File "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dbl/http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
sullen nymph
#

Incorrect DBL token

mellow kraken
#

I will check it.

#

I will not repair ...

clever rock
#

do we need our "token" as well on fetching a bot's stats

sullen nymph
#

No GWchadThink

#

Well, /bots/{bot.id}/stats doesn't require DBL token

clever rock
mellow kraken
#
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
  File "/root/wowsb-bot/cogs/wowsb.py", line 149, in update_stats
    await self.dblpy.post_server_count()
  File "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/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 "/root/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dbl/http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

I get an error even though I input the token correctly.

steady charm
#

is it bad to post server count everytime a new guild is joined or should i do it on an interval?

sullen nymph
#

The interval is better if your bot is somewhat big

steady charm
#

yeah i have to shard aswell so

#

would an interval in the ready event update correctly tho? and if im sharding one shard is going to be ready before the other one so it would drop the server count then go back up

restive otter
#

Guys how can i post my bot stats to DBL?

plain timber
#

@restive otter what language?

restive otter
#

Discord.js

#

And sharding

plain timber
restive otter
#

i tried this but it posts wrongly

plain timber
#

can you explain?

restive otter
#

example: my bot's server count is 4100 but it posts 1300

#

i think it posts just one shard

plain timber
#

try removing client from the new DBL and instead use dbl.postStats

arctic arch
#

what library?

plain timber
restive otter
#

Discord.js

plain timber
#

@arctic arch d.js

arctic arch
#

it should auto-detect shards

restive otter
#

so what code i will write

#

Just dbl.postStats(client.guilds.size, client.shard.id, client.shard.count)?

arctic arch
#

thats what the library should be doing, what do you get when you console.log those values

fringe bear
#

i have 403 forbidden error in my bot

#

It says it's because of dblapi.js

final lotus
#

Lol

fringe bear
#

pls help me

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

do i put this in the discord js ready function

#

or outside of it

fringe bear
#

ok

#

i test it

toxic acorn
#

?

fringe bear
#

it's no't a work

toxic acorn
#

what

#
const DBL = require("dblapi.js");
const http = require('http');
const dblApp = express();
const serverino = http.createServer(dblApp);
const dbl = new DBL(config.dblapi, { weebhookPort: 1337, weebhookAuth: "somerandomPASS", webhookServer: serverino  }, bot)

//DBL API SETTINGS

dbl.on('error', e => {
 console.log(`DBL API ERROR! ${e}`);
})

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!`);
  });

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

#

why is not logging the weebhook

#

it should log this

#

Webhook running at http://${hook.hostname}:${hook.port}${hook.path};

restive otter
#

kool

dawn kernel
#

I don't do nodejs

#

gl

toxic acorn
#

;-;

#

oh i see i am saying weebhook instead of webhook

#

lol

inner venture
#

bwhahahahhahah

toxic acorn
#

;-;

#

nope not from that

half acorn
#

how do i hide my dbl token in my bot.js file.

#

?

plain timber
#

@half acorn put it in another file

#

such as .env or a config.json

half acorn
#

i did but im having a hard time telling my bot.js file where it is. This is what I have:

const dbl = new DBL(config.dbl, client)
plain timber
#

and it doesnt work?

half acorn
#

no

#

i get this error:

C:\Users\Josh\Documents\GitHub\Skywarn>node .
(node:15260) UnhandledPromiseRejectionWarning: DiscordAPIError: 404: Not Found
    at item.request.gen.end (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
    at then (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15260) 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: 2)
(node:15260) [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.
plain timber
#

that seems to be unrelated

half acorn
#
(node:9188) UnhandledPromiseRejectionWarning: Error: This function requires a token to be set
    at DBLAPI.postStats (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\dblapi.js\src\index.js:139:28)
    at Client.DBLAPI.client.on (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\dblapi.js\src\index.js:54:14)
    at Client.emit (events.js:187:15)
    at WebSocketConnection.triggerReady (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:125:17)
    at WebSocketConnection.checkIfReady (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:141:61)
    at GuildCreateHandler.handle (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
    at WebSocketPacketManager.handle (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\Josh\Documents\GitHub\Skywarn\node_modules\ws\lib\event-target.js:120:16)
(node:9188) 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: 4)
^C
C:\Users\Josh\Documents\GitHub\Skywarn>
plain timber
#

hm

#

try console.log(config.dbl)

half acorn
#

ok.

#

@plain timber

plain timber
#

its not related to dbl @half acorn

half acorn
#

ok

#

@plain timber its still not working

plain timber
#

what?

half acorn
#

that console.log thing, i can't figure out where to put it

plain timber
#

console.log is just to see what dbl.token is

half acorn
#

oh

#

but where does it go?

plain timber
#

anywhere in your code...

#

try putting it right above the new DBL line

ripe kernel
#
(node:26206) UnhandledPromiseRejectionWarning: Error: 500 Internal Server Error
    at IncomingMessage.res.on (/Aurora/node_modules/dblapi.js/src/index.js:115:25)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:26206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26206) [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.```
plain timber
#

yeah DBL is having issues

ripe kernel
#

should i just disable the api part of my bot now until it is resolved

plain timber
#

no need, it shouldnt cause problems

ripe kernel
#

well it's crashing my bot sooo... i think it is

#

I already went and disabled it

plain timber
#

just .catch it

ripe kernel
#

oh duh 🤦 ya i'll do that instead

#

sorry i have been coding all day my brain is slightly fried

plain timber
#

lol

ripe kernel
#

I am refactoring my bot and is going to take a while so since it is the weekend i thought i would spend the day working on it but is frying my brain

#

making me realize how bad i did the first time too 😂

restive otter
tawny oxide
#

idk why it stopped working NotLikeThis

elfin solstice
#

Probaly Miki Rest updated but the Lib didnt

arctic arch
restive otter
#

. . .

#

@arctic arch that does not work for me for glitch.com . . .

arctic arch
#

why

topaz wyvern
#

It works fine for me when I use glitch

arctic arch
#

you use glitch?

topaz wyvern
#

Yes, I can't afford a vps currently

arctic arch
#

oof

dire cairn
topaz wyvern
#

no

dire cairn
#

why

topaz wyvern
#

Because I need to store stuff

#

Like perfixes

#

Server settings

dire cairn
#

in .json

#

or

#

any other

topaz wyvern
#

What

sullen nymph
#

What

#

Do you know how bad Heroku is?

#
  • Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.

  • Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.

  • Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.

  • Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)

  • Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.

dire cairn
#

oh

#

then glitch is best

sullen nymph
#

Half of their servers are banned from Discord, afaik

dire cairn
#

i think in place of server ip

#

by the ways no problem

restive otter
#

Type of the vote. Is always "upvote" except when using the test button it's "test".
Where can i find this test button?

humble bison
#

bot edit page

#

also no, the best is a vps

#

both heroku and glitch are shit

topaz wyvern
#

Atleast glitch can write files without reverting back

fringe bear
#

Oops! Error: 403 Forbidden

topaz wyvern
#

Incorrect token

#

Or no token

fringe bear
#

i change it

#

but no't work

humble bison
#

did you replace it

fringe bear
#

YEP

#

but no work

restive otter
#

@humble bison TYSM

humble bison
#

np

restive otter
#

i am stupid, now i found where i can set the link to the webhook 🤦

humble bison
#

lol

fringe bear
#

Oops! Error: 403 Forbidden

shut ibex
#

did you set your token

fringe bear
#

yep

#

but did not work @shut ibex

plain timber
#

iirc 403 means there is a token but its wrong @fringe bear

fringe bear
#

someone help me change token is did not work

restive otter
#

oh

fringe bear
#

at IncomingMessage.res.on (/rbd/pnpm-volume/32032b92-43ab-4834-81ba-73835762a4c1/node_modules/.registry.npmjs.org/dblapi.js/2.2.0/node_modules/dblapi.js/src/index.js:115:25)

    at IncomingMessage.emit (events.js:185:15)

    at endReadableNT (_stream_readable.js:1106:12)

    at process._tickCallback (internal/process/next_tick.js:178:19)

(node:15620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:15620) [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.```
restive otter
#

you sure you have a token?

sullen nymph
#

403 is wrong token

polar mirage
#

@sullen nymph heroku's free hours never run out

#

¯_(ツ)_/¯

plain timber
#

Isn't there an uptime limit per month?

sullen nymph
#

Not really

#

Well, those hours kept expiring for me when I used Heroku. My bots never went offline because of that

restive otter
#

lol...

#

heroku is never made for discord bots support

#

use glitch with uptime robot inside ur file

summer oracle
#

@arctic arch @cobalt ruin webhooks dead again

cobalt ruin
#

should be good now?

summer oracle
#

can confirm it works, thanks!

cobalt ruin
#

np

lilac oracle
#

What is the channel for bot commands?

severe iron
elfin solstice
#

how comes that the webhook die all the time tho?

#

how can that even happen

#

Thenky shouldn't it just have a queue and if something is in the queue try to send if finished go to next one

arctic arch
#

thats literally what it is

elfin solstice
#

how can it stuck then

#

👀

arctic arch
#

things can break in various different ways

elfin solstice
#

hmm

summer oracle
#

well thats easy to handle
just add this snippet to your code:

if (things.areBroken()) {
  things.unbreak();
}
elfin solstice
arctic arch
#

Uncaught ReferenceError: things is not defined

fast tapir
#
const things = include("things.js");

pretty sure I did that right

arctic arch
#

wrong

shut ibex
#

is include a thing?

arctic arch
#

no

fast tapir
#

ok

#
from life import things

and

import life.misc.things;
arctic arch
restive otter
#

sorry

restive otter
#

wut

gritty glade
#
import { weeb } from 'life'```
obtuse flicker
#

const thonking = ("thonking.js"); tonking.thonkicide();

loud gulch
#

this is for the dbl api not shitpost

#

im not minimodding thats the truth mmLol

restive otter
#

So what is this API for?

tidal burrow
#

mostly for posting your bot's server count to your bot's page

restive otter
#

api for reading the channel topic

alpine raven
#

How can i use dbl vote check ?

#

I tried this ;

#
dbl.hasVoted(msg.author.id).then(voted => {
    if (voted) {
        if has vote
    } else {
        if not
    }
});

#

But doesn't work

shut ibex
#

.hasVoted checks within the last 24 hours

alpine raven
#

Code is not working

tidal burrow
restive otter
#

@alpine raven use google mmLol

alpine raven
#

Fun

restive otter
#

m

woven pendant
#

How can I know my port, password and token please in the code :

 const dbl = new DBL (yourDBLTokenHere, {webhookPort: 5000, webhookAuth: 'password'});
sullen nymph
#

DBL token is on the bot's edit page

woven pendant
#

Ok

sullen nymph
#

Webhook port and password are specified by you when setting up a webhook :^)

woven pendant
#

Ok thanks ^^'

#

{"name": ..., "channel_id":..., "token": ... , "avatar": ..., "guild_id": ... "id": ...}

#

what is the port?

sullen nymph
#

wdym

woven pendant
#

const dbl = new DBL (yourDBLTokenHere, {webhookPort: '5000', webhookAuth: 'password'});

where is the port in the code above in the page :
{"name": ..., "channel_id":..., "token": ... , "avatar": ..., "guild_id": ... "id": ...}

#

or in the setting of the webhook

restive otter
#

you set the port, then in the webhook address put that :port

woven pendant
#

So if I put port: 1895 it will put 1895?

#

but now I have that :

dbl.webhook.on('ready', hook => {
^

TypeError: Cannot read property 'on' of undefined

restive otter
#

dbl.webhook is undefined awesmart

woven pendant
#

const dbl = new DBL(tokendbl, bot);

Anyone know why he does not find my vote when I did it?

dbl.getVotes().then(votes => {

            if (votes.find(vote => vote.id == message.author.id)) {

}
})
topaz wyvern
#

owner votes don't count iirc

arctic arch
#

the endpoint mite be a bit broken

#

owner votes do count

topaz wyvern
#

they do?

#

oh

#

i thought they didn't

woven pendant
#

Even the players can not make the command ...

woven pendant
#

Would it be possible to know when will it be repaired?

snow sky
#

The DBL webhook for votes is a bit buggy too, I can't get get it to work

proud sphinx
#

how do I get the guild icon when it's the letters? (oauth)

#

like the default guild icon

arctic arch
#

what do you mean

proud sphinx
ashen flume
#

await dblpy.get_upvote_info(days=1) just gives me the last 31 days instead of 1

ashen flume
#

was onlyids and days removed?

arctic arch
#

yes

ashen flume
#

may aswell remove that shit from the api imo, going to use webhooks then

humble bison
#

its still useful

restive otter
#

i

dapper karma
#

🅱️urst

restive otter
#

how does the website know a bot is online

#

because somehow two of mine show as offline with a ???

#

its status in this server iirc

#

what about

#

profile images

sullen nymph
#

Your cache

restive otter
#

I even tried with another browser and they dont show

#

removed cache

#

still default greenies

arctic arch
#

submit an edit

restive otter
#

Can you confirm the online status being based on this server while your here 🤠 ?

arctic arch
#

seeing as the bots are not here, we also can't detect avatar changes

restive otter
#

ohh

#

Yeah I had them all deleted and re-submitted since my main Discord got banned

arctic arch
#

status is based on this server

restive otter
#

might not have been reinvited

#

Ok the Edit updates the profile image nice

#

How do I get them re-invited in here

#

or can I just manually join with them

restive otter
ashen flume
#
from flask import Flask, render_template, request
import requests

app = Flask(__name__)


@app.route('/hook')
def votes():
What do i type o.o

if __name__=='__main__':
    app.run(debug=True, host='IP', port='5000')
#

ive got everything setup correctly, not sure how to exactly get the data. has anyone used flask b4?

#

i.e im getting requests from the site, but just dont know how to use it

pseudo patrol
#

json.loads(request.data) hahayes

sturdy lance
#

can anyone help me how to code my bot on mobile pls

restive otter
#

Unrelated to API.

#

just use a fucking computer weSmart

loud gulch
#

^

restive otter
#

I can confirm what Arda#0061 reported in Saturday, DBL in d.js (dblapi.js) seems to be posting server count only from first shard unless we both did something wrong lol

#

(await client.shard.fetchClientValues("guilds.size")).reduce((prev, val) => prev + val, 0) gives 289 , await client.shard.fetchClientValues("guilds.size") gives [ 147, 142 ] (don't bother why 2 shards at such servers amount just testing forward xD)

#

site currently reports 150 servers - 2 shards, inconsistency could be due to some servers leaving since last post or am I doing something wrong?

shut ibex
#

the real question is why you're sharding at 300

restive otter
#

irrelevant

#

just to test out how sharding works etc

#

much rather do it at 300 than be forced to do it when it hits the limit

shut ibex
#

or just do it at 1k

restive otter
#

🤷

#

I've created a PR that should fix the issue

restive otter
#

ok nvm I get it now, it works as intended, its just supposed to run from each shard and I was limiting it only to the first one for some reason because of webhook (I ended up limiting just the webhook in the first shard), I guess Arda is doing something similar bloblul

tawny cargo
#

Is webhook working rn?

tiny swallow
#

^ yeah are webhooks dead?

restive otter
#

yes

summer oracle
#

@arctic arch @cobalt ruin hi webhooks no work plz magic

restive otter
#

I have same issue ^^^

#

is the vote thing down?
somehow i dont get any calls anymore if someone votes

#

yes its down

restive otter
#

I Want My Robot Used After The Vote. How Do I Do That?

tidal burrow
#

do that and get your bot removed from dbl

royal fiber
#

Why is @Discord Bot List Ofline?

tidal burrow
#
  1. why is this a relevant channel for that?
  2. why did you just try to mention a server?
obtuse flicker
#

Not server... He mentioned the entire fucking app called Discord

#

This aint twitter buddy

tidal burrow
#

it's obvious that @Discord Bot List was meant to be one whole thing, so yes, he tried to mention the server since that's the name of the server

sullen nymph
#

He meant @wild lantern

restive otter
#

..

polar mirage
#

yes

#

yall stupid

amber dune
wanton finch
#

I had an error for dlbposter: ```
0|main | RangeError: You need to provide a client to bind to, either in the constructor of dblposter or in the bind function!
0|main | at DBLPoster.bind (/root/bot/node_modules/dblposter/src/index.js:38:22)
0|main | at Object.<anonymous> (/root/bot/main.js:32:11)
0|main | at Module._compile (internal/modules/cjs/loader.js:689:30)
0|main | at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
0|main | at Module.load (internal/modules/cjs/loader.js:599:32)
0|main | at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
0|main | at Function.Module._load (internal/modules/cjs/loader.js:530:3)
0|main | at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:75:21)
0|main | at Module._compile (internal/modules/cjs/loader.js:689:30)
0|main | at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
0|main | RangeError: You need to provide a client to bind to, either in the constructor of dblposter or in the bind function!

topaz wyvern
#

const dbl = new DBL('token', <client>)

#

<client> is what you defined Discord.Client() as (ie. bot, client)

#

Oh wait

#

Are you using a third party api?

#

@wanton finch

humble bison
#

@wanton finch don't use it, it's outdated

#

use the official api

topaz wyvern
#

^

plain timber
plain timber
#

@restive otter wut

neon geyser
#

ARRIBA ESPAÑA

wet tapir
#

Hello, someone knows a bot that has custom commands and can do this: for example I create a command /lol and it executes the command %weather of another bot

topaz wyvern
#

OMG

restive otter
#

non related questions yes

obtuse flicker
#

wht

mystic wing
#

@wet tapir you could have it send the activating command but if you don't own the other bots almost all bots block other bots from running commands

#

in the event that you own the bot yeah u could

#

(both)

plain timber
#

@inner venture link to probably nsfw video

digital narwhal
#

Is API the packages on .js?

#

So like weather-js

topaz wyvern
#

what

digital narwhal
#

For d.js, is api the packages?

topaz wyvern
#

wut

mystic wing
#

No…

#

This channel is just for DBL api

limber night
#

How i can post my guild size? And my shard count? Im trying use it in ready events but its not working

loud gulch
#

POST request to the api

#

use them for reference

amber dune
#

they are deprecated b1nzyhyperban

loud gulch
#

nah

amber dune
#

oof

limber night
#

What events?

#

Ready events?

restive otter
#

what

tidal burrow
#

how I do it is I have a while loop in ready event, and it posts server count every 10 minutes while bot is online

limber night
#

Idk how to get the token

plain timber
#

@limber night what language?

limber night
#

Js

plain timber
#

use the DBL js library

limber night
#

Are the dbl token in edit session?

plain timber
limber night
#

K

#

@plain timber

plain timber
#

wot

limber night
#

Any method for posting the guild count?

shut ibex
limber night
#

I will try it

humble bison
#

didn't my fucking post mean anything

tidal burrow
#

tony, they are called "examples" for a reason

loud gulch
#

no it didnt

humble bison
#

devi, they are in the "other channels" area for a reason

topaz wyvern
#

TonkkuToday at 6:32 AM
This channel is an archive of old examples.

Please see https://discordbots.org/api/docs for new examples and libraries```
humble bison
#

👏

loud gulch
#

you can still use it as example GWcmeisterPeepoShrug

tidal burrow
#

it's still useful for those that don't know what an API even is, and how it looks like in code, nor how to use it in their language

#

they can still use that channel as a reference

topaz wyvern
#

but like

humble bison
#

they aren't even guaranteed to work

topaz wyvern
#

^

humble bison
#

stop referencing to them

tidal burrow
humble bison
#

i'm gonna get somebody to delete the channel

shut ibex
#

nou

tidal burrow
#

for the love of god, how am I suppose to tell you that I'm not telling them to actually USE them in their own codes

humble bison
#

linking them to it = telling them its ok to use it

loud gulch
#

no

#

not essentially

tidal burrow
#

omg facepalm it's... fine be it your way, idfc anymore

loud gulch
#

linking them to use it as an example

#

learn from it

#

not saying to actually use the code itself

humble bison
#

learn from old code, got it

#

great logic

loud gulch
#

some of it still works

tidal burrow
#

sam just leave it, it's impossible to talk to him

loud gulch
#

yes i see

humble bison
#

smh

restive otter
#

i agree with @humble bison

humble bison
#

ok

merry marsh
#

Why am I getting 403 when I try to send my server count?

sullen nymph
#

Incorrect token

misty geode
#

403 is not found

#

Meaning the page you sending the post info is not valid

#

Or incorrect token

light crag
#

404 is not found.

#

403 is forbidden.

gusty maple
#

!çal senden daha güzel atatürk

vale tartan
#

Adaaam

vale onyx
#

Probably a simple one you get a million times a day - I got my API auth code and I'm supposed to put it in the authorization header, but I have no idea where that is.

restive otter
#

f

restive otter
#

@vale onyx what are you using to something involving your api token

vale onyx
#

I got it figured out - thanks 😃

#

It wasn’t an error with the API key, but with the service it was tied to

restive otter
#

oh ok

honest minnow
#

s

barren kelp
#

Hi everyone, do you know how do I choose the webhook hostname please ?

ivory gorge
#

What do you mean?

barren kelp
#

Nevermind, i'm just an idiot, i find out the problem

#

Thanks anyway

ivory gorge
#

👌

restive otter
#

For some reason I'm getting 400 errors trying to post my bot stats. It all works just fine in the Postman program but not in my code. I fail to see why thonk
This is the entire response I get back: https://p.nobooli.me/xacawifeto.js

I'm using node-fetch (https://www.npmjs.com/package/node-fetch) and I have temporarily hardcoded server count and ID while testing:

      const test = await fetch('https://discordbots.org/api/bots/376520643862331396/stats', {
        method: 'POST',
        body: JSON.stringify({server_count: 75}),
        headers: {
          Authorization: process.env.discordbotskey,
          'Content-Type': 'application/json-rpc'
        }
      });

// temporary code to log the response, normally the fetch is not assigned to a constant at all
      console.log(inspect(test, {
        showHidden: false,
        depth: null,
        color: true
      }));

the method of posting should work as this works just fine for the strawpoll API and is also the documented method for node-fetch

await fetch('https://www.strawpoll.me/api/v2/polls', {
          method: 'POST',
          body: JSON.stringify({
            title,
            options,
            multi: false,
            dupcheck: 'normal',
            captcha: true
          }),
          headers: {'Content-Type': 'application/json'}
        })
glacial summit
#

Try setting content-type to application/json? I can send the request in postman if the content-type is application/json but not application/json-rpc @restive otter

#

just a thought

restive otter
#

huh.. that's odd. I meant to put it as application/json but copied it incorrectly but when removing the Content-Type header altogether it doesn't work either. I thought it would default to application/json thonk

#

ohwell, problem solved I guess.

slate thicket
#

How do I make a server invite for another server ?

restive otter
#

get that other server by ID or name, get a channel by ID or name on that server and then create the invite for that channel

slate thicket
#

I can’t I’m not in it but I have the server name

#

Someone keeps asking me does help and they won’t invite me to their server

restive otter
#

if your bot is not on the server for which you need the invite you cant do it

tidal burrow
#

so you are trying to break into their server instead?

slate thicket
#

They don’t know how to get a server invite to me

tidal burrow
slate thicket
#

Thanks

ripe linden
#

how do i get my vps port?

#

and the url?

obtuse flicker
ripe linden
#

well it is

#

because i need to do the voting request

mystic wing
#

@ripe linden you run the code on a specific port specified in the constructor/default is 5000 iirc

#

so get your vps's ip and add :5000

#

1.1.1.1:5000

tawny oxide
dense compass
#

Yeah they changed it guess they forgot to update the docs

covert sun
#

when i initialize the dbl client, pylint is saying that Module 'dbl' has no 'Client' member?

restive otter
#

you know you have to define it after you define discord client and stuff

#

i mean i don't know python lmao

#

but i got an error similar to that with js

#

i had to define all of discord and client beforehand

covert sun
#

yeah ik, i did that

sullen nymph
#

@covert sun Don't call any file (that probably includes classes) dbl

restive otter
#

Does it work to write who voted the bot?
With DBL API

noble iron
#

@restive otter are you asking can you check who voted

restive otter
#

yeah

noble iron
restive otter
#

this is invalid?

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
noble iron
#

idk js

restive otter
#

@noble iron I have one more question

#

I know I'm stupid
I do not know where I find my token

#

🤷

noble iron
restive otter
#

for my bot?

noble iron
#

yes

restive otter
#

@noble iron ```js
{ webhookAuth: 'password', webhookServer: server }

but where can I find them?
noble iron
#

idk

copper iron
#

oops

restive otter
restive otter
topaz wyvern
#

ok

#

if it isnt api related

restive otter
#

Oh I see

#

Okay

#

thanks

lusty roost
#

where can I find it my token?

plain timber
#

@lusty roost your discord bot token?

#
  1. this isnt the place for that
lusty roost
#

discordbots token?

plain timber
#

uh

#

are you trying to make a bot?

lusty roost
#

no, I am trying to add my bot to the site

#

bir Türk olsa ne hoş olurdu şimdi 😒

plain timber
#

also english only

lusty roost
#

okay

plain timber
#

and your question isnt api related, so #general

lusty roost
#

i send dm

tidal burrow
#

how do I get dbots token?
Your question isn't API related

restive otter
#

he was asking how he adds a bot to the site

#

@tidal burrow

tidal burrow
#

According to his first messages he was asking how to get a token for his bot on dbl

restive otter
#

then a few moments later he said:

no, I am trying to add my bot to the site(edited)
discordbots.org
bir Türk olsa ne hoş olurdu şimdi :unamused:

-GabrielSSQ#4863
plain timber
#

@tidal burrow they just said "find it my token" I assumed they meant their discord bot token since they didnt have the bot developer role

tidal burrow
#

but they did mention dbl though

plain timber
#

I only said not API related after they said they were trying to add their bot to the site...

shell trench
#

Hey I’m having some trouble figuring out how to check if a user has voted so they can use a command in python

#

Haven’t really used dbl at all so I’m pretty clueless

elfin solstice
#

2 ways, make a request to the check endpoint or use webhooks and cache users

restive otter
#

....

#

why is 1 server

topaz wyvern
restive otter
#

@topaz wyvern what category?

topaz wyvern
#

What lang you use?

restive otter
#

for my bot?

topaz wyvern
#

Yes

restive otter
#

English

topaz wyvern
#

...

restive otter
#

or my lang?

topaz wyvern
#

No what programming language do you use for the Bot

restive otter
#

aha :)) discord.js

#
client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});
topaz wyvern
restive otter
#

yes and?

topaz wyvern
#

Use that section to find out how to post servers to dbl

restive otter
#

like this

bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.size);
    }, 1800000);
});
topaz wyvern
#

Yes

restive otter
#

It does not give any results.

#

@topaz wyvern what i can do?

#

not working...

topaz wyvern
#

Did you restart the Bot

restive otter
#

yea

topaz wyvern
#

Wait

#

A bit

#

ok

restive otter
#

k

#

oh

#

thank you

#

WebhookAuth is the webhook token?

#

@topaz wyvern

topaz wyvern
#

i havent messed with webhoooks

#

idk

light crag
#

It probably works. It's waiting 30 minutes to POST.

restive otter
#
    throw err;
    ^

Error: Cannot find module 'dblapi.js'

dont say to me do npm i dblapi.js because ive already done that, and the file it says the error in isnt even requesting anything to do with that, and it says the error is on a blank line, wtf could be the problem

shut ibex
#

try npm i dblapi.js --save

#

with --save

restive otter
#

what does --save even do

twilit dust
#

Or npm i -g dblapi.js

shut ibex
#

-g is for global

twilit dust
#

^

shut ibex
#

i dont think youll need it for global

twilit dust
#

🤷

restive otter
#

wb dis error

C:\Users\User\Desktop\CatManiaBot FullRelease\index.js:278
const DBL = require("dblapi.js");
      ^

SyntaxError: Identifier 'DBL' has already been declared

there is nothing on that line even close to being related to dblapi

topaz wyvern
#

its already been declared

#

code

twilit dust
#

Yes

restive otter
#

ive only declared it once

#

ill double check

topaz wyvern
#

just

#

give

#

code

twilit dust
#

Your file already has a variable called that

topaz wyvern
#

correct

restive otter
#

is DBL and dbl the same, even though they are not the same because caps

twilit dust
#

Pretty sure they are never had to deal with that

restive otter
#

??

#

that doesnt answer me

#

question

twilit dust
#

Yes they are probably the same

#

Just try to change them and try again

restive otter
#

stoopid website shudnt have them the same then

shut ibex
#

the website example should be the same

topaz wyvern
#

DBL and dbl are not the same thing in js

#

in some langs it might

restive otter
#

yup, i figured that out, i used the find thing to find all lines that have dbl in it and its only declared once so why does it give error

#

no other file has this code

topaz wyvern
#

just give

#

the damn

#

code

restive otter
#

so, any fix?

#

or better question, should the error even exist?

#

@topaz wyvern

shut ibex
#

did you wait the 30 mins

#

also you know you can for loop instead of putting multiple fs.readdir

restive otter
#

i dont care and yes

#

ill try again...

#

wait

#

no, i didnt wait because my bot doesnt turn on because of a non existent error

#

@shut ibex

shut ibex
restive otter
#

did that, then i removed anything that had the phrase dbl in the index.json, still getting error saying it is already declared

#

wait new prob

#
const dbl = new DBL('im hiding this part', client);
                                                                                                                                                                                   ^

ReferenceError: client is not defined
#

@shut ibex

shut ibex
restive otter
#

client still not defined

shut ibex
#

it should be

#

oh

neat bolt
#

@restive otter You showed your api key...

topaz wyvern
#

f

neat bolt
#

and your bots token is there...

restive otter
#

fuck

#

screw thr yt api that doesnt really matter, and why tf would u say all that is there, then people will just go look

shut ibex
#

so you don't get your not hijacked

#

????

sterile sleet
#

I looked mmLol

#

but I deleted your message, still I'd recommend renewing your token

topaz wyvern
#

ok so when you get api banned from the yt shit youll be sorry

neat bolt
#
const server = http.createServer(app);
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.key, { webhookAuth: process.env.pass, webhookServer: server });


dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

Can someone help me with Webhooks?

#

My console just says Webhook running with path /dblwebhook
is that right?

sullen nymph
#

Sounds about right

neat bolt
#

hm

restive otter
#

docs

sullen nymph
#

You could try testing it with a Test button :^)

neat bolt
#

i am

#

nothing happened

shell trench
#

so this is the url that we can use to get info about whether or not a person has voted... how do you specify a user in Python? (I still don't quite get how this all works)

tidal burrow
#

it literally says in the field: userId

#

but I don't recommend checking if a user voted after every command locked by upvotes

#

since you'll get banned from dbl api for 1 hour if you exceed 60/60 requests

shell trench
#

I guess I would be better to check after a certain interval?

restive otter
#

use a webhook, save the votes to the DB.

#

will be almost instant, best experience for your users and no api ratelimit problems

onyx pine
#

Test

restive otter
#

hey, quick question. How do i know what webhook password i should use?

#

im trying to get a onVoted function

narrow geyser
#

@restive otter Use a LONG password, of your choice

restive otter
#

ok, thanks

restive otter
#

i get the Webhook running message, but i dont get a webhook when someone upvotes?

plain timber
#

That's not much info

#

Details, code, language

restive otter
#

Language: NodeJS
Code:

const DBL = require("dblapi.js");
const dbl = new DBL(*token*', { statsInterval: 900000, webhookPort: 5000, webhookAuth: '*password*!' }, client);

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
  console.log(`new vote`);
  console.log(vote)
  console.log()
  try {
   *secret code, sorry*
  } catch(err) {
    console.log(err)
  }
});

Console Output:

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

even when i upvote using my friends account, i still dont get a new vote in the terminal

#

plz help ~w~

proud sphinx
#

Is the port forwarded?

#

And what url did you set on the website

amber dune
#

@restive otter what vps provider are you using

restive otter
#

Hosting it locally, and yes all ports are forwarded to my computer

mystic wing
#

what url did you set on the website

restive otter
#

Wdym

#
const DBL = require("dblapi.js");
const dbl = new DBL('{token}', { statsInterval: 900000, webhookPort: 5000, webhookAuth: '{authPassword}' }, client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted at: ' + client.guilds.size);
  for(var i = 0; i < client.guilds.size; i++) {
    console.log(client.guilds.array()[i].name + " : " + client.guilds.array()[i].id + " : " + client.guilds.array()[i].members.size)
  }
})

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

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
  console.log(`new vote`);
  console.log(vote)
  console.log()
  try {
    *private code&*
  } catch(err) {
    console.log(err)
  }
});
#

im gonna kill someone

#

@inner venture, you're a Library Developer right? Whats going on here????

#

sorry for ping, but im gonna go mad

sudden rampart
#

what url did you put in the bot page?

restive otter
#

WDYM? where's the bot page

#

all i see is a token

sudden rampart
#

you need to put your webhook url on your bot page

restive otter
#

like, my ip?

sudden rampart
#

it won't magically find where to send the webhook

restive otter
#

is there something i need to do in order for the server count to show up on discord bots web page?

#

isnt that public tho

#

cause my bot is in over 200 servers but it shows N/A for server count

sudden rampart
#

no

#

that's website

#

webhook is at the bottom

#

@restive otter post server count

restive otter
#

ah, thanks!

#

whoops wrong char

sudden rampart
#

remember to add http(s) before the ip

restive otter
#

wait what? post server count?

sudden rampart
#

yes

restive otter
#

can someone try upvote, i've used my daily allowance. (i tried the test and it didnt work)

#

thanks

#

voted

#

nothing thanks anyway

#

how do i do post server count thing?

#

really though wats going on