#topgg-api

1 messages · Page 55 of 1

spiral steeple
#

It posts on ready as well

sudden rampart
#

postStats takes a number

#

the number of guilds to post

spiral steeple
#

Does it Thonk

#

Oh it does

#

Anyways, it should work

#

Wait wait

#

your config.dblkey is a string

#

And you dont get the error because you dont listen for error events from dbl

elfin haven
#

Oh really, cus it says it's posted then we wait 30mins and it's not posting

spiral steeple
#

Thonk with the token wrong it shouldnt post at all

elfin haven
#

The token is correct

#

We've checked that many times

#

even regenerated it

spiral steeple
#

is 'config.dblkey' why it says in your code?

#

because that's a string

elfin haven
#

yes

#

It's in a JSON file

spiral steeple
#

it's still a string

#

if you define config, it should be using the variable

quartz stirrup
#

a) make config.dblkey into a variable, not a string.
b) that will only post after the 30 minutes have passed. if you want it to post on ready and after 30 minutes, add a dbl.postStats() somewhere outside of the interval in your ready event
c) instantiating a new client can lead to all kinds of funky bugs in posting. i recommend passing your existing client in from somewhere else (the way this works depends on how youre fragmenting your code)

fleet pebble
#

i get an error when i run my bot, saying

RefrenceError: Discord is notdefined

and it says the error is in this line:
const client = new Discord.Client();

#

how can i fix that

jovial pine
#

you didn't import discord, most likely

fleet pebble
#

what do you mean?

#

like dblapi?

plain timber
#

@fleet pebble it's not related to dbl

fleet pebble
#

Ok, how can i fix it

plain timber
#

You don't have something like const Discord = require ('discord.js')

fleet pebble
#

but i do

plain timber
#

Why are you even having the error now

#

That code has nothing to do with DBL api

fleet pebble
#

i dont know

#

i have const DiscordJS = require('discord.js'); in the like 3 line of my file

plain timber
#

Then why are you using Discord.client

#

What are you doing

fleet pebble
#

im trying to get my server count on the site

plain timber
#

the code you posted has nothing to do with that

fleet pebble
#

ok

plain timber
#

Didn't you already define client/bot? (const client = new DiscordJS.Client()) or something
No need to do it again

fleet pebble
#

well someone told me to put this code in my file:

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

is that right

sudden rampart
#

don't just copy paste

fleet pebble
#

...

pulsar hare
#

sure but you should have already defined Discord and client before trying to post your server count

#

you don't need to do it again

plain timber
#

^

runic wasp
#

I posted an issue on the .NET wrapper of the API a few days ago, was wondering if anybody at least acknowledged it

proud sphinx
#

ask again

#

I might be able to help

runic wasp
#

I think this happens when the API is down

proud sphinx
#

oh that makes sense

#

it also may be an authentication error

#

so you got an empty string back as a response

runic wasp
#

Yeah!

#

I think the wrapper should deal with that

proud sphinx
#

PR it

runic wasp
#

I'll give it a try, but its a bit hard to debug that specific case

#

Or I could just try catch the whole thing :v

runic wasp
#

Actually I'm wondering if I should PR this because it would still break the wrapper in other places, so should it all return null or throw an exception im not sure

grand salmon
#

what does that mean

runic wasp
#

`503 Service Unavailable

The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.`

spiral steeple
#

It tells you the error

#

We literally cant tell you more than what you posted

grand salmon
#

its just blank page with this content

spiral steeple
#

Yeah, thats what happens with errors

plain timber
#

@restive otter wrong channel, and either you're not admin on a server or you're logged in to the wrong discord account in your browser

restive otter
#

Lol IdleRPG😂 GWmythsBlobPresent

plain timber
restive otter
#

I'm getting Error: 503 Backend fetch failed with dblapi
you know why?

terse nebula
#

Because the backend fetch failed?

spiral steeple
#

5xx are internal server errors

terse nebula
#

Yeah
4xx = You messed up
5xx = DBL messed up
2xx = Everyone is happy

jovial pine
#

3xx = you will be happy soon

#

1xx = what tf this isn't httpv1

#

Anything >=600 = we're making up our own bullshit

thorn violet
#

Anyone familiar with or using NGINX for the api endpoint for the dbl webhook?

pure lagoon
#

How do i show on discordbots how many servers my bot is in

stoic nebula
pure lagoon
#

@stoic nebula thx

#

gonna check

runic grove
#

just send http requests

#

the dbl python package is outdated and doesnt work

#

afaik

pure lagoon
#

So checking at the example

#

i guess i need to sned a post

#

using a Authorization header

#

right?

sullen nymph
#

pydbl...

#

Just

#

How

#

@runic grove It works but barely

#

Correct, Adautop

#

(if it's in a bot, use aiohttp)

pure lagoon
#

Well

#

the example didn't work

#

and i've tried ```python
session = aiohttp.ClientSession()
await session.post("https://discordbots.org/api" ,json = {"server_count": len(client.guilds)}, headers = dblHeaders)
await session.close()

#

no success too

sullen nymph
#

The link is https://discordbots.org/api/bots/YOUR_BOT_ID/stats

#

Also, keep your indents clean

pure lagoon
#

Gonna try the endpoint

sullen nymph
#

If the line above doesn't have : at the end, don't change the column of the next one

pure lagoon
#

thanks man

#

And yeah, its just discord messing

#

the indents are ok

#

ausdhs

sullen nymph
dawn fjord
#

No

#

Why would you want to?

#

What?

#

You should not be using another bot's votes for your own bot

plain timber
#

yes

#

but you can just send whatever number you want

#

you can get the real server count from the real bot and send that

#

or just send stats on the real bot and catch votes on the other one

#

there's nothing blocking you from using 2 bots

restive otter
#

I'm a bit confused about the webhook thing
I've got it working before but honestly -- I don't remember how
How exactly do I setup the webhook address that I put into DBL?

#

Are you using vpn?

#

?

#

No

plain timber
#

@restive otter what language?

obsidian needle
#

No

restive otter
#

@plain timber nodejs, im having someone do it

#

but dbl.on('vote', vote => {

#

is a thing right

#

its not just with webhook

plain timber
#

@restive otter it needs to be dbl.webhook.on

#

read the docs

restive otter
#

@plain timber do I need to connect a webhook for thtat to work then?

#

I just want it to update a json file

#

also, how do I store the userid with on vote

plain timber
#

wdym connect a webhook

#

if you use the example code it will start a webserver

#

then dbl will send a post request to it

restive otter
#

do i need to mkae this

#

I don't need to use it

#

also @plain timber how do I get the userid from the user voting

plain timber
#

you do need that

restive otter
#

But why

#

I just want it to update a json file when they vote

plain timber
#

webhooks are the way to run code when a user votes

#

yes you need webhooks for that

restive otter
#

I don't know how to setup the webhook

plain timber
#

and its vote.user

restive otter
#

it never works

plain timber
#

did you use the code...

restive otter
plain timber
#

i already sent you the link to the docs

#

it has example code

restive otter
#

i know

#

ive tried a dozen times

#

I have NO idea

#

how to set it up

plain timber
#

??

#

read the docs...

restive otter
#

what even

#

do i do

plain timber
#

it has example code

restive otter
#

ive read it a billion times

#

dude

#

the code isnt the damn problem

#

it's the connecting the webhook

#

i dont even need a webhook

plain timber
#

yes you do

#

...

restive otter
#

i dont need to post anything to it?

#

i just need it to edit a json file upon someone voting

plain timber
#

dude... using webhooks is the only way to run code when a user votes

restive otter
#

ugh

#

but

#

what do I even put as url

#

help me out here

#

it never works

plain timber
#

it should log a url to the console

#

if you use the example code

restive otter
#

also

#

I use thsi

plain timber
#

in that url, change 0.0.0.0 to the ip of the server

restive otter
#

and it works perfectly fine

plain timber
#

thats separate from voting

restive otter
#

api says use .webhook.

#

but I don't and it works

plain timber
#

posted has nothing to do with votes...

#

posted is for when it sends the server count

restive otter
#

how do I get the ip of "the server"

#

which ip is it

plain timber
#

you're hosting the bot on a server aren't you?

restive otter
#

yes

#

ipv4?

#

which is it

plain timber
#

yeah sure

restive otter
#

what port..

#

any /links/

plain timber
#

it will log the url to console

#

if you use the example code

restive otter
#

what port

#

do i need any /sublinks/

plain timber
#

can you read

#

it will log it

restive otter
#

bro

plain timber
#

with the port and the rest of the url

restive otter
#

I HAVE TO ENTER A PORT!?

#

it says I do

plain timber
#

yes

#

it will log the port

#

to your console

restive otter
#

which port

#

do I put

#

on the site

plain timber
#

put the port that it logs blobfacepalm

#

are you just trolling now

restive otter
#

or what

#

no

#

seriously

plain timber
#

yes

restive otter
#

i have no idea what you're talking about

#

you tell me not to put a port

#

but log the port

plain timber
#

i told you to put the port

restive otter
#

i dont know what the damn port is

plain timber
#

the code will log the port

#

use that port

restive otter
#

im really confused at this point

plain timber
#

its not hard ree

#

it will log a url with a port
put that url in the site and put in the ip

restive otter
#

dude

#

dude

#

ok

#

it tells me

#

to put a port myself

plain timber
#

just leave that

restive otter
#

and I dont know if I have to use the :50000 port or not

#

then what do i put in the code!?

plain timber
#

leave it as it is

restive otter
#

SO NO CODE

#

WHAT DO YOU MEAN

#

my brain is spiraling

plain timber
#

use 5000 in the code ...

restive otter
#

couldve just said that

#

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

#

so i dont put the ip

#

just that

plain timber
#

yes..

#

but change password to something else

restive otter
#

i put that in dbll

#

right

plain timber
#

yeah

#

just take the url that it logs

#

and change 0.0.0.0 to the real ip

restive otter
#

jeez ok

#

thanks

plain timber
#

yw

restive otter
#

@plain timber

plain timber
#

hi

restive otter
#

dbl.webhook.on('test', test=> {

#

does that work for testing?

#

or

#

do i just use dbl.webhook.on('vote', vote => {

plain timber
#

its just vote

#

but you can check if its a test by checking if vote.type is test

restive otter
#

its supposed to say that

#

right

#

@plain timber

plain timber
#

yes

restive otter
#

ok so

#

I checked api page

#

and

#

so i put this in

#

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

#

clicked test button, but didn't work

sudden rampart
#

what url do you have on the bot page?

restive otter
#

ipv4 is the ip obv

sudden rampart
#

is the port open/forwarded?

restive otter
#

I think its open

#

forwarded blobshrug

#

what am I supposed to do

sudden rampart
#

check if you can access the ip in your browser

restive otter
#

its on a vps

#

it says no safe connection

#

insuffcient reaction

sudden rampart
#

remove the s

#

https -> http

#

you don't have a ssl certificate

#

so you can't use https

restive otter
#

page not found

sudden rampart
#

okay

#

now try sending a test

restive otter
#

nothing happened

sudden rampart
#

without https as well

restive otter
#

i did that

#

nothing happened

sudden rampart
#

it should be posting now Thonk

#

try saving then clicking test

restive otter
#

i did save

#

ill delete img in 3s

#

;p

#

it had the ip on it so

#

i suppose I can trust a mod

#

i hit save & test nothing

#

@sudden rampart does it have to be forwarded or whatevs?

plain timber
#

make sure the Webhook Authorization on the edit page is correct

restive otter
#

it is

plain timber
#

it should be the same as webhookAuth in the code

#

k

restive otter
#

is the url supposed to display a page or just page not found @plain timber

plain timber
#

not found

restive otter
#

ok

#

weird

plain timber
#

because it will only work with a post request

restive otter
#

do i just wait a bit

#

for it to maybe update

sudden rampart
#

do you have any kind of firewall?

restive otter
#

uhm

#

I think its enabled

sudden rampart
#

i'm trying to send requests to your ip but they never manage to connect

restive otter
#

how exactly do I disable / find an antivirus on a vps

#

lmao

#

windows defender showed no results

sudden rampart
restive otter
#

its off

#

try now

#

my test didnt work

sudden rampart
#

Thonk connection refused on port 5000

restive otter
#

change port?

sudden rampart
#

it manages to reach the server now

#

is the listener running?

#

okay it's working

restive otter
#

not for me

sudden rampart
#
< HTTP/1.1 403 Forbidden
< Date: Sun, 07 Apr 2019 00:04:16 GMT
< Connection: keep-alive
< Content-Length: 0
<```
restive otter
sudden rampart
#

no auth so 403

#

but it reached dblapi.js

restive otter
#

do i change port?

sudden rampart
#

no

#

can you DM me the password?

#

and watch the logs

restive otter
#

is there any way to make it so when they can vote again, it messages them on discord

plain timber
#

for d.js you can use client.users.get(vote.user).send('whatever')

restive otter
#

reeeeeeeee

plain timber
#

what

quartz stirrup
#

that wont get uncached users

plain timber
#

well yeah you may want to fetch them first

quartz stirrup
#

2 hours late but felt it should be noted

plain timber
#

but chances are if they're voting they're already cached blobshrug

#

but the fetch user is different per the version

#

on 11 its .fetchUser and on 12 its .users.fetch

quartz stirrup
#

mhm

spark osprey
#

i just want to express my thanks for making the dbl npm package support webhooks so i dont have to fuck around with it manually
doing gods work

clever rock
#

if you want an independent webhook system there is as well

restive otter
#

Is webhooks died?

hard saffron
#

Hey,i want to verify my email address and i check my email but it's appear nothing

#

Any know what to do?

arctic arch
#

if you are talking here it means

  1. you are in the wrong channel
  2. you have a verified email address
#

if you're getting the error when adding a bot you're most likely logged in to the wrong account

#

@restive otter webhooks are alive

restive otter
#

lol my webhooks gg

weak night
#

Hello, you know how to get the password webhook for the webhookAuth in const dbl = new DBL(process.env.BOTLISTTOKEN, { webhookPort: process.env.PORT, webhookAuth: process.env.PASS }); ?

arctic arch
#

you decide it

#

on the bot edit page

weak night
#

OK I'll take a look

dire tangle
weak night
#

thank you, and in "URL" I can not put anything?

arctic arch
#

you need to point to the url of the webhook

#

you can see it when you run the webhook, you just need to replace 0.0.0.0 with your public IP

weak night
#

ok

weak night
#

If my vps to a dynamic ip I do how?

#

xD sorry

#

ok no I found

#

In "URL" I have to put in this form: http://0.0.0.0:25305/dblwebhook ?

arctic arch
#

yes, but replace 0.0.0.0

restive otter
#

tonkku

native plank
worn quail
#

I think

#

But you can't do much with it when your bot isn't added yet

native plank
#

so i cant use it until its accepted?

#

ok

#

makes sense

worn quail
#

Ye

spiral steeple
obsidian needle
#

I wanna be a bot developer:(

safe girder
#

Then develop a bot

sullen nymph
#

Learn a programming language, create a good Discord bot, submit it on discordbots.org and be happy if it gets accepted

#

Also, this is wrong channel for that kind of questions

restive otter
#

How to configure Webhook?

#

?

dawn fjord
#

If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.

restive otter
#

I'm trying to do

sullen nymph
#

You're not trying hard enough

plain timber
#

@restive otter as moose said, you need to send your language and stuff

signal echo
#

Is there a place in this discord that I can advertise my server?

plain timber
#

no

smoky breach
#
const DBL = require('new-dblapi');
const dbl = new DBL(apiKey[client]);

dbl.getVotes().then(votes => {
    if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
});

So I found this code on the docs, but how would you make it check when someone other than Tonkku has voted?

azure forum
#

Hello I have a problem with the dbl API, I had it configured on the beta version of my bot being only on 5 servers, since I configured it on the main bot (which has more than 100 servers), the storyteller and the statistics displayed are those of the bot beta ... can you help me?

#

And sorry for my bad english, im french

wise agate
#

@smoky breach switch the vote.id comparison

#

also, try and use webhooks if you can

#

itll simplify that a lot

smoky breach
#

I'm still having trouble actually connecting the bot to the api.

#

Does the bot have to be verified to use the api? I currently have two instances of the bot. One for main-stream and one for beta.

dawn fjord
#

Yes

smoky breach
#

I see.

dawn fjord
#

If it's not listed on DBL you can't access the API

smoky breach
#

Makes sense.

dawn fjord
#

It must be approved before you can get access

#

Yeah

smoky breach
#

Surely I don't put it in the html thing on the website, because then the token will be public for people to see.

dawn fjord
#

What are you trying to do?

smoky breach
#

Says I need to authorize.

dawn fjord
#

Are you trying to make an API request?

smoky breach
#

Basically, all I'm trying to do is just get a message to console when someone votes.

#

Then I can do whatever from there.

dawn fjord
#

So your setting up webhooks?

smoky breach
#

I guess.

#

I don't want the webhook to message the channel though, just the console.

#

So would this be correct?

dawn fjord
#

No

#

What you put in that auth field is what DBL will send with the vote when they send you a vote. It's a way to make sure you know the vote is coming from us and not someone who is trying to fake votes

smoky breach
#

Could you give an example of what would go in there? I'm not really understanding...

#

The docs aren't really that helpful.

smoky breach
#

Hmm... I don't really understand why/how I'm making a webhook. Do I just create a webhook as I normally would?

#

Since it's messaging the console I don't understand why I need to make a Discord webhook.

unborn quartz
#

I need help setting up my cord😔

plain timber
#

What

grim hazel
#

hey im using glitch, what do i have to put for the url?

#

is it just 0.0.0.0

#

for the ip

grim hazel
#

ok nvm that, but i got everything setup just the voting isn't working

#

i've already setup the voting part

#

but it doesn't send a message when i test it / actually vote

arctic arch
barren tundra
#

yea

#

thats the default port

grim hazel
#

yup

#

i have it as https://<projectname>.glitch.me:3000/dblwebhook

#

it doesn't send any logs saying someone voted

#

ah

#

ok

#

it works now

#

i had to remove the port

#

https://<projectname>.glitch.me/dblwebhook

#

i have it as taht

barren tundra
#

how did you get the dbl token again?

grim hazel
#

the bottom of your bot's page edit

#

or the api page

barren tundra
#

oh okay

restive otter
#

Is there a way to like use my domain for dbl webhooks? So that i wont need to constantly edit the dbl webhook ip :/

barren tundra
#

my webhook isnt really working

#

i think i am missing some arguments

wise agate
#

@restive otter yes

#

point your domain to the ip

#

stop switching ips tbh

grim hazel
#

hey i still have 1 problem, i tested the vote on the bot's edit page it works, but once i try to actually vote, it doesn't work

restive otter
#

@wise agate im not switching ips

#

My vps provider is

#

So im switching vpses soon

wise agate
grim hazel
#

can anyone help with my problem

runic grove
#

he did say it above

solemn knot
azure forum
#

Hello I have a problem with the dbl API, I had it configured on the beta version of my bot being only on 5 servers, since I configured it on the main bot (which has more than 100 servers), the storyteller and the statistics displayed are those of the bot beta ... can you help me?
And sorry for my bad english, im french

wise agate
#

Are you requesting the right bot ID

#

It sounds like you aren't requesting the right bot, double check that

#

I'm not sure if you are making a post or get request based on your phrasing

opaque plaza
#

suck me dick haha💩 🖕

wise agate
#

oh

azure forum
#

I checked

#

It's the right ID

#

It's just stuck on the wrong bot

wise agate
#

Oh are you updating stats on the website

#

if yes, it's likely the cache, give it a bit to refresh

azure forum
#

Thanks, I tried but the stats are the same

proud sphinx
#

oh the embed? did you try refreshing the page?

minor raven
#

XD

restive otter
#

@azure forum C'est quoi ton problème ?

#

French people are so funny, when they try to speak english :p

dawn fjord
#

@Bmw seria 8 cuope#4220 None of that in here please

gloomy cypress
#

@grand blade ?

#

^^^

grand blade
#

idk

#

im just a mod, not support, soz

gloomy cypress
#

oh ok

restive otter
#

My bot has high latency around 200-300

#

Any ideas why

#

It works on google’s servers

#

So internet is pretty fast

heady geode
#

are the webhooks broken again? im not receiving anything

arctic arch
#

its funny how often people say that

#

but webhooks havent been broken for ages by now

heady geode
#

well im sending tests but nothings coming through

#

though if i do it manually its fine

arctic arch
#

did you change any settings

#

before testing

heady geode
#

not that im aware of

arctic arch
#

just tested and they work

heady geode
#

hm ill try messing around some more then

grim hazel
#

mine is similar to that, the testing works but actually voting doesn't work

#

oh nvm

#

its working now

faint yew
#

Why do i get a forbidden 403 error when trying to post my server counts using dblpy?

sullen nymph
#

DBLPY being high on 010110 etc

#

You should just send HTTP requests manually with aiohttp

faint yew
#

where do i send them to?

sullen nymph
#

On the bottom, you can find the endpoint

static valley
#

Ok I'm very confused, my bot is clearly posting stats to discordbot.org as it is giving me the posted event, but has off the walls wrong stats. When I look on my bots page it says it is only 2 guilds, but when i check with client.guilds.size it returns 41. I'm using the following to post so any idea on what is wrong would help. js setInterval(() => { dbl.postStats(client.guilds.size, client.shard.id, client.shard.count); }, 1800000);

vivid surge
#

How many shards are you running?

static valley
#

about 2

#

tho 1 has no point

plain timber
static valley
#

yes

#

idk what i added list the url

#

ok it just fixed itself

fleet pebble
#

ok, im using discord.js... and im wondering what to put in the client space in this script:

const dbl = require("dblposter");
const DBLPoster = new dbl(`DBL_API_KEY`);

// Then, depending on what you called your client
DBLPoster.bind(client);
#

this is for the DBL api stuff

plain timber
#

@fleet pebble you should be using dblapi.js instead of dblposter

fleet pebble
#

ok, but what do i put into the client spot?

#

@plain timber

plain timber
#

Probably just your discord.js client object (so probably just client)

#

But this is for help with official libs, not unofficial ones like dblposter

quartz stirrup
#
// standard d.js code
const { Client } = require('discord.js');
const client = new Client();

// setting up dblposter
const DBL = require('dblposter');
new DBL('apikey', client).bind();```pass in your existing client, do not instantiate a new one
spiral steeple
#

Wtf why not just use the official dbl lib Thonk

quartz stirrup
#

no idea

#

but he asked for this so..

spiral steeple
#

I mean whatever works, I use my own

plain timber
#

pretty sure dblposter is older

#

i use blapi

quartz stirrup
#

i use the official one but put it into events myself lol

spiral steeple
#

And people questioned why it even existed

kind jewel
#

xD

next mantle
#

Hey my bot has been getting 503 twice during the past days
Is there any explanation to this error... ? (It updates every 30 minutes)

restive otter
#

How to get the remaining time for a member when have voted for the bot 🙄?

plain timber
#

@next mantle it's just the site broken

faint sleet
#

Uh this is kind of annoying, so I'm trying to post to my bots page using dblapi.js module, but it's not even changing... My bots page sitll says 16 servers when I have 68..

next mantle
#

K just wanted to know if it was my fault
Thanks

plain timber
#

@faint sleet code?

faint sleet
#

ye wait

plain timber
#

@restive otter just check the last time they voted? It's 12 hours after that

faint sleet
#
    const dbl = new DBL(client.dblToken, client);
    client.log.ready(`Ready at [${new client.utils.Timestamp().timestamp}]`)
    client.manager = new PlayerManager(client, client.config.nodes, {
        user: client.user.id,
        shards: 1
    });
    client.website.load(client)
    setInterval(() => {
        dbl.postStats(client.guilds.size);
    }, 1800000);```
#

Let me try adding a console.log after postStats

#

on my ready event ^

#

hm

#

didnt work

#

didnt eve lol xd

restive otter
#

@plain timber But if the user voted 2 hours ago and uses the order to claim his voting gift and in my database I launch a 12-hour timer, but since he made the order 2 hours after bah it's like he had to wait 14 hours before voting

faint sleet
#

so anyone know why

plain timber
#

@restive otter use webhooks and store when they vote

faint sleet
#

nvm on my quesiton fixed

smoky breach
#

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

TypeError: Cannot read property 'on' of undefined

#

?

#

Copied straight from the docs.

quartz stirrup
#

dbl.webhook is returning undefined

#

gonna have to show more code

smoky breach
#

const dbl = new DBL(dblToken, { webhookPort: process.env.PORT, webhookAuth: dblAuth });

#

Both dbl vars are defined in config.json.

quartz stirrup
#

that should be correct. are you sure those are valid values?

smoky breach
#

I got both of them from the /edit page.

quartz stirrup
#

well that looks correct. i dont know what to tell you. try console.log(dbl) and see what you get

smoky breach
#

I'll change my token then paste.. one moment.

quartz stirrup
#

well theres the problem

smoky breach
#

The port?

quartz stirrup
#

webhookPort: undefined

smoky breach
#

But process.env.PORT

#

?

quartz stirrup
#

also you should probably remove all of those tokens

smoky breach
#

I did before I posted.

quartz stirrup
#

console.log(process.env.PORT)

#

console.log() is the best debugging tool ever invented

#

your dbl tokens are still in the hastebin link

smoky breach
#

I changed them before I posted the link.

quartz stirrup
#

ah okey

smoky breach
#

Meaning they're different.

#

Yeah, undefined for some reason.

quartz stirrup
#

did you set up your .env file correctly?

restive otter
#

is there a listener for the DBL python library for when a user votes for the bot? if not, there's a good idea

sullen nymph
#

I made one if you wanna check it out

#

(It's just a listener, dblpy is still outdated as hell)

tacit drift
#

hello lovely people. I am using the node.js bot api. Anyways I was wondering if i could fetch the current total votes for my bot. I was looking and their is a way to get them but it has a limit of 1000 (which I haven't hit yet but I want to future proof it.) also the get bot doesn't have points. Any help?

plain timber
#

Get bot does have points

tacit drift
#

hmmm

#

I only have js { server_count: 36, shards: [] }

spiral steeple
#

You can set up a webhook and then store the vote to a db and delete it after 12 hours if you really need a way to get every single vote and you passed 1000

tacit drift
#

ok well I will look into. I guess I can use the get points for now

#

Oh i was using getstats instead of getbot 🤦

plain timber
#

Yeah

restive otter
#

@sullen nymph id love to

#

i have no experience with http or anything like that

#

so tracking votes has been a very daunting task for me

sullen nymph
#

I'll send it later in DMs

restive otter
#

alr thank

timid osprey
#

Hey was gonna ask is there any examples of a webhook in python?

sullen nymph
#

The webhook for DBL?

buoyant bridge
#

What is webhook?

restive otter
#

lel

sour garden
#

what do you want to check, voted in last 24 hours or last month

#

and what lang u using

#

the library is irelevant i just wanted to know lang

#

anyway

#

i can't give you the actual code because idk js

#

but

#

basically

#

python

#

no lmao

#

that is not what you need to do

sudden rampart
#

replace 0.0.0.0 with your public ip

sour garden
#

the webhook is only for getting a list of all voters, only if u have more than 1000 votes

#

YOU DONT NEED THE WEBHOOK

runic grove
#

nothing. you dont need the webhook to check votes

#

the dbl api has great documentation

#

how about you read it

sour garden
#

you will get back {"voted":<0 or 1>}

#

0 if that person has not voted, 1 if they have

#

thx for voting btw

#

==widget

#

oof not testing

#

do you not know how to send requests?

#

i can't help you because its javascript

#

oh also

restive otter
#

anyone in here know python/flask/windows

sour garden
#

replace the number in the url with your bot's id

#

yes

#

i know flask

restive otter
#

im just having some trouble listening on a local port

sour garden
#

oh

#

i've only ever used flask in https://repl.it

restive otter
#

smh

runic grove
#

@restive otter is it related to the dbl api?

sour garden
#

my 220-server bot is hosted on repl.it

restive otter
#

i mean, i guess?

runic grove
#

ive used flask before, what do you need help with?

restive otter
#

like i said above, listening on my local machine instead of a vps/etc

#

what port i use, what address i use, etc etc

runic grove
#

app.run(host="0.0.0.0", port=8000)

restive otter
#

port 8000

#

hm

runic grove
#

the port can be anything above 1023

restive otter
#

do i have to change it from 5000 to 8000 on the edit bot page?

runic grove
#

as long as its free

#

if the dbl webhook is running on it, yes

restive otter
#

okay

#

okay, i think i have it set up, now how can i check if i actually go tthe request

#

can i just throw a print under the app.route?

runic grove
#

@restive otter yeah

restive otter
#

ffs

#

then it aint working

runic grove
#

send ur code

restive otter
runic grove
#

hmm i have no idea, sorry

restive otter
#

smh

#

assuming i put the correct external IP, it should work?

runic grove
#

yeah

#

if the ip is 192.168.a.b you put the wrong thing

restive otter
#

@runic grove no i put my external IP

runic grove
#

then i have no idea

restive otter
#

damn

#

ill ask in the python disc

#

its probably bettter suited than this channel anyways since my question isnt really related to the api

grim hazel
#

votehas

#

or you can save it into a database

sour garden
#

i already explained all this

#

@quartz heron

#

you send the request with headers={"Authorization":<your_dbl_token>} and params={"userId":<user_id>}

sullen nymph
#

They gave you the instructions

#

twice

#

Use aiohttp for sending HTTP request to an endpoint

sullen nymph
#

Where what?

spiral isle
#

Can someone give me an example webhook request body? I tried to get it using a request bin and the 'Test' button but it didn't work

raw sparrow
spiral isle
#

I saw it, is Snowflake a 64 bit integer or a string?

raw sparrow
#

youll get is as a string "user": "123123123", "bot": "1231232"

spiral isle
#

Oh ok, thanks 😃

proud sphinx
#

@spiral isle JavaScript can't work out 64bit integers anyways

visual narwhal
#

Hello

#

I'm to Russia

spare thistle
#

why my bot is not mentioning everyone when it sends @everyone

restive otter
#

that was close

runic grove
#

because it doesnt have permissions

#

and thats dbl api related

#

so wrong channel

spare thistle
#

ah ok, ty anyways

neon basin
#

my bot was thrown from dbl What is the reason

restive otter
#

Id? @neon basin

maiden shore
#

Sir/Madam, As you can see in #mod-logs the person got muted for 4 hours

restive otter
#

Anyone know how many api requests can be made?

#

Per (x) amount

sullen nymph
#

To what

plush garden
#

The api doesnt seem to work for me
I voted for a bot and when I send the "has voted" request it responds with false (not voted).. I'm using the DBL Java API. Is this some kind of bug?

hasty patio
#

I have a voting system on my bot but the problem is that I have to wait a few minutes before the vote is taken into account by my bot is it normal? 🤔

wet sequoia
#

I have some vote check issues too

sour garden
#

don't use a library just send a GET request using a requests library....

plain timber
#

@hasty patio yes it is, especially if you aren't using webhooks

livid surge
#

l

limpid sorrel
#

yeah use the webhooks, i never had any issues with them

restive otter
#

||||||||||

quartz pumice
#

Hey,
The api always returns {"voted":0} even if the user has voted, any idea why ?

clever rock
#

the api is kinda slower as far as Im concerned

#

webhooks are faster

quartz pumice
#

webhooks send a POST request... how can I make my bot find out if the user has upvoted 😕

clever rock
#

receive the POST request

torpid elbow
#

?join

#

=join

sterile sleet
runic grove
#

oliy was fast af

craggy sentinel
#

@runic grove bearcop ghost ping

runic grove
#

oliy was faster ok

craggy sentinel
#

big oliy big fast

dawn fjord
#

big oliy

sly rampart
#

Hello, How to get the name of a voter instead of the id $ {vote.user} ?

dawn fjord
#

Are you using Discord.js? @sly rampart

sly rampart
#

Yes

#

@dawn fjord

restive otter
#

For some reason, when I try posting my bot stats using the dblapi.js module, it doesn't say it posted and no errors, it doesn't say anything besides that I used the eval command (manually posting)

#

here is the code that I put in my bot;

const DBL = require('dblapi.js')
const dbl = new DBL(config["apiKeys"]["discordbots.org"], bot)
dbl.on('posted', () => {
    console.log('Server count posted!');
  })
  bot.on('ready', () => {
    console.log(bot.user.tag + " (" + bot.user.id + ") is online on " + bot.guilds.size + " servers!")
    defgame()
    setInterval(function() {
        dbl.postStats(bot.guilds.size);
    }, 120000)
})
  dbl.on('error', e => {
   console.log(`Oops! ${e}`);
  })
proud sphinx
#

@restive otter put the ready before you set everything up

#

bot onReady {
dbl = new DBL(...)
...
}

restive otter
#

Ah okay I see

#

Let me try that

#

Nope, didn't post.

glass solar
#

Does the API support discord.py version 1.0.0 (the Rewrite version)

proud sphinx
#

What's bot

sullen nymph
#

@glass solar I'm not sure why it wouldn't

proud sphinx
glass solar
#

hmm ok

proud sphinx
#

It should

restive otter
#

It still isn't posting the server stats to dbl, it doesn't console log that it posted after 2 mins

proud sphinx
#

What's bot

#

Is the code even called?

sly rampart
#

Hello, How to get the name of a voter instead of the id ${vote.user} for Discord.js ?

dawn fjord
#
let username = <Client>.users.get(vote.user).username
sly rampart
#

Thank you ❤

#

But if the bot does not know the user?

dawn fjord
#

Then you can't get the name

proud sphinx
#

You can you just need to fetch with the id

#

await bot.fetchUser(id)

sly rampart
#

ahh no it's a web server that returns a webhook discord ... so I can not check it with my bot

silver lily
#

my bot is not showing online in discord bot list

proud sphinx
#

it's a known bug

silver lily
#

ohh thanks..

worn quail
#

Discord broKe

silver lily
#

i just read above

worn quail
#

That's all

wild patio
#

hi

#

does anyone have this error with discord.js 'Invalid WebSocket frame: RSV2 and RSV3 must be clear'

azure pollen
buoyant bridge
#

how to put the words in color ?

exotic tendon
#

Get a colored pen

#

✌✌✌

worn quail
#

In html @buoyant bridge?

buoyant bridge
#

On discord @worn quail

worn quail
#

Oh

#

Using markdown

#

But this isn't a question for here I don't think

spice cypress
#

api shit its pants

#

cheking an ID that has voted returns false

quartz stirrup
#

you return false uwu

sullen nymph
#

The URL is one string, arguments are different

sullen nymph
#

"your url", params=... , headers={'Authorization': 'DBL token'}

hasty patio
#

@plain timber excuse me for the late message, webhooks you say ?

plain timber
#

Yes

languid ibex
#

Just wondering, are you allowed to store data coming feom Discord in an external database? I was thinking about user id's for example.

plain timber
#

And yeah if your bot needs it

languid ibex
#

Oh sorry, wrong channel ;)

#

Ok thanks!

restive otter
#

I'm unable to post the total shards to the site; says total is undefined

#

Bot is sharded

#

I'm doing exactly as the API docs suggest

plain timber
#

Code?

#

And what lib

restive otter
#

D.js and simply from the docs

bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
    }, 1800000);
});

Says Id is undefined and total too

#

client = bot in my file

runic grove
#

@restive otter if your bot isnt sharded, the shards property wont exist

plain timber
#

Also i don't think it exists if you use internal sharding

runic grove
#

it should

plain timber
#

No, you need to use client.ws.shards.size

runic grove
#

oh

normal slate
#

i can't make that freaky role for upvote

plain timber
#

?

normal slate
#

im new with webhooks in coding ._.

plain timber
#

What language?

normal slate
#

JavaScript

upper wren
#

can someone help me with setting up a webhook from DBL?

plain timber
#

@upper wren what language

upper wren
#

wdym?

plain timber
#

@normal slate use dblapi.js

normal slate
#

do i really need to make webhook server ?

plain timber
#

What programming language

upper wren
#

I want to setup a webhook on my discord server that says when someone voted...

plain timber
#

Yes you need to code that

upper wren
#

oh really?

#

damn

plain timber
#

Yes

upper wren
#

can you help me?

plain timber
#

What language

upper wren
#

my bot?

normal slate
#

ugh i didn't used express

sullen nymph
#

What's your programming language

upper wren
#

language of my bot?

plain timber
narrow zenith
#

oh boy

normal slate
#

yes

#

of your bot

plain timber
#

@normal slate you don't need express, dblapi.js makes the server for you

upper wren
#

my bot uses node.js

normal slate
#

oh k

plain timber
#

K look at the link i sent

upper wren
#

well actually I use discord bot maker, but thats node.js

plain timber
#

Well you'll need to code the voting stuff

upper wren
#

oh

#

kk

#

can you give me the code please?

plain timber
#

Look at the link I sent

upper wren
#

I don't understand anything about that..

#

can you please help?

#

@plain timber

plain timber
#

It has example code

upper wren
#

ik

#

how do I copypaste it?

#

to let it work on my webhook?

plain timber
#

What

#

Do you even know how to code

upper wren
#

no

#

lol

normal slate
#

how did you got bot dev

upper wren
#

I use discord bot maker haha

normal slate
#

lol

upper wren
#

is actually pretty good bot

normal slate
#

so you can't use dbl api probably

upper wren
#

no

plain timber
#

Yeah, just learn how to code

narrow zenith
#

i don't think dbm uses code at all

upper wren
#

can't you just give me the code I have to copypaste and tell where i have to put the data I have about my webhook

runic grove
#

iirc it compiles to d.js code no?

#

no

#

thats not how coding works

normal slate
#

you're using dbm so

narrow zenith
#

basically making a discord bot without code

#

at all

runic grove
#

if coding was as simple as copypasting, being a software engineer wouldnt be such a well paid job

plain timber
#

Well if you're not gonna learn how to code then nobody's gonna help you

normal slate
#

xD

#

¯_(ツ)_/¯

upper wren
#

I do know some js

plain timber
#

¯_(ツ)_/¯

normal slate
#

last time i learned how to use canvas

#

now i made image profile

#

for my bot

#

¯_(ツ)_/¯

upper wren
#

and I know how to think in code bc that is what u still need in dbl but I don't know code

#

I can code in python

#

with classes and stuff

plain timber
#

Then use python

#

...

upper wren
#

??

#

how

plain timber
#

Code a webserver

#

Accept the post request

#

Do something

upper wren
#

wut? I feel so dumb rightnow!

#

no one who can help me?

plain timber
#

Probably because you don't know how to code 🤔

normal slate
#

because u are using dbm

narrow zenith
#

wait you said dbm uses node.js?

upper wren
#

yes

plain timber
#

It generates nodejs code

normal slate
#

+1

plain timber
#

But he doesn't know how to code

normal slate
#

for me dbm code is complicated lol

narrow zenith
#

do you not see a problem with that? if you only know python, then you can't use python for dbm

upper wren
#

and I know how to think in code bc that is what u still need in dbm but I don't know code

nimble steeple
#

what

plain timber
#

Well then learn how to code

normal slate
#

xD

nimble steeple
#

yes

upper wren
#

wow

#

thankyou all for the help!

nimble steeple
#

I don't even know what it uses

#

isnt it js

upper wren
#

I'm like 14 how can I be a website coder or something?

plain timber
#

I'm 14

upper wren
#

yes!

narrow zenith
#

learn

plain timber
#

Pretty much everyone here is a teen

nimble steeple
#

Its called practise

plain timber
#

And we can code

normal slate
#

i'm 14 too :V

upper wren
#

but I don't speak English as main so a lot of the functions I don't understand..

runic grove
#

not many people do

normal slate
#

i started coding using discord.js 1 year ago xD

nimble steeple
#

oof

upper wren
#

guys please help me!

runic grove
#

turkish kids can make shitty multipurpose bots without experience, so whats stopping you from learning?

normal slate
#

and that's how i learned javascript oof

upper wren
#

just give me the code I have to copy

normal slate
#

XDD

narrow zenith
#

jesus christ

nimble steeple
#

You are not in a language

narrow zenith
#

that's not how that works

upper wren
#

Why would I learn 2 years for just a webhook?!

nimble steeple
#

wat

upper wren
#

**Why would I learn 2 years for just a webhook?!
**

#

**Why would I learn 2 years for just a webhook?!
**

narrow zenith
#

visible confusion

nimble steeple
#

if you had to learn it would take a day

plain timber
#

^

nimble steeple
#

its called google

plain timber
#

And stop spamming

nimble steeple
#

I like it

#

no

narrow zenith
#

listen

#

it took me two months to learn to code a discord.js

#

and i'm still learning

upper wren
#

NO I'm to dumb! I don't learn that in one day bc I don't speak frezaking English!

narrow zenith
#

i read the do-

nimble steeple
#

There are tutorials in other documents

runic grove
#

turkish kids can make bots without any experience. whats stopping you from learning?

nimble steeple
#

langauges

#

i mean

true oyster
#

Wot

upper wren
#

bc its now 1 am and I want to setup my webhook otherwise I can't sleep bc I'm thinking about it!

nimble steeple
#

oh god

#

listen

upper wren
#

JUST HELP

runic grove
#

go sleep, and you will have more energy when you wake up and you will be able to understand it, trust me

nimble steeple
#

correct

true oyster
#

Yes I am pro coder

shrewd delta
#

what data is sent when you use "test webhook"

plain timber
#

LOL

true oyster
#

I made disocrd bot in scratch

narrow zenith
#

by this point i give up

nimble steeple
#

I made discord bot in the blood of mother russia

upper wren
#

@true oyster really? lol

plain timber
#

No

narrow zenith
#

we can't help you unless you actually learn how to code

plain timber
#

You can't

true oyster
#

Lol

normal slate
#

idk but i made this listeners and it's not listening

upper wren
#

kk

shrewd delta
#

in theory you could make a discord bot in minecraft

upper wren
#

gn everyone! xD

runic grove
#

sleep well

nimble steeple
#

night

shrewd delta
#

but anyway, what data is sent when you use "test webhook"

nimble steeple
#

I think we need to learn minecraft code to make a discord bot

runic grove
#

@shrewd delta what you would normally recieve

shrewd delta
#

so a user object?

#

as well as a header containing the secret

runic grove
#

try it, i have no idea

plain timber
#

Look at the docs smh

shrewd delta
#

the docs don't say

plain timber
#

They do @shrewd delta

#

It has the object

shrewd delta
#

oh

#

uh

#

...

#

I'm in the wrong server

#

I'm looking for discordbotlist help

runic grove
#

???

shrewd delta
#

no wait this is right

#

hold on I'm fuckin confused

narrow zenith
#

wrong server

plain timber
#

Don't send that here...

shrewd delta
#

okay phew I thought I was going nuts

plain timber
#

And just click API docs in the site header