#topgg-api

1 messages · Page 61 of 1

worn quail
#

const e = whatever e was supposed to be

dense basalt
#

@dim halo You can look further for a traceback to the place the error is at, then you can change your code

bold edge
#

I'll try it without the port and see what happens, it's something I've not tried yet

polar mirage
#

Make sure you save before hitting test

worn quail
dim halo
dense basalt
#

Traceback to it, and show the piece of code the error is in

dim halo
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);

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

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

I removed e

worn quail
#

Put your dbl api token in 'token'

dense basalt
#

That's not the issue

dim halo
#

I'm not stupid, I entered

worn quail
#

Ah

#

K

dim halo
#

so what?

dense basalt
#

Can you show the exact line the error is at

dim halo
#

ye

#

@dense basalt

dense basalt
#

No like, the exact line of your code the error is in

shut ibex
#

error event returns an item

dim halo
#

what?

#

xd

shut ibex
#

from the docs

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

did you put the comma

dim halo
#

ye

shut ibex
#

try to put (e)

dim halo
shut ibex
#

yes

dim halo
#

still the same

#

help me plase

#

xd

#

@shut ibex

worn quail
#

@arctic arch

#

Get over here pls

arctic arch
#

sooo what

dim halo
#

it does not work

hearty lintel
#

give it a second to update

#

its not gonna be instant

shut ibex
#

the problem is the code doesn't work @hearty lintel

hearty lintel
#

wdym

dim halo
#

but the error shows in the console

hearty lintel
#

whats the error

arctic arch
#

third time's the charm

dim halo
#

?

hearty lintel
#

at eval?

arctic arch
#

what are you evaling

hearty lintel
#

^^

dim halo
#

but what should I mean?

hearty lintel
#

um

#

Ok well, this doesnt seem to be a dapi error, this is on your end i think because as far as im aware there's not emitting/anything having to do with the evalling of an error or posting stats

bold edge
#

Look at line 307

arctic arch
#

according to the first line in the stack trace you are using eval()

#

what code did you place inside eval

dim halo
#

so if it's not a mistake, why does not it work

hearty lintel
#

probably cuz its not running?

#

if your code errors out like that your client wouldnt fire a ready, and wouldnt post stats

dim halo
#

I know that

hearty lintel
#

Ok then this issue isn't api related. Look at your line 307 and fix your code and if you get stumped on that somehow ask in #development

dim halo
#

🤔 '

hearty lintel
arctic arch
#

they're trying to set up stat posting
help with the API / libraries belongs here

hearty lintel
#

theyre providing an error that has nothing to do with api-- idk what to say really

#

the only way the client would post undefined is if you didnt login, and manually emitted a ready event
or if it never posted ig

arctic arch
#

just gotta know what they're evaling

#

the only way the widget can say undefined is if you never posted

#

@dim halo paste the code you evaled

dim halo
#

what code?

#

bot.js?

hearty lintel
#

yes

arctic arch
#

no

#

jpb have you ever javascript

hearty lintel
arctic arch
#

bot.js line 307 is literally a fucking eval()

hearty lintel
#

yea so line 307 of the bot.js

#

has the eval

arctic arch
#

I want to know the code supplied to eval, either through a command or by another function

dim halo
#

so what should I change in this line?

arctic arch
#

bot.js is literally no use for debug purposes

hearty lintel
#

show the code of that line and on until the func ends

#

im telling him where to get the code to show u tonkku sad

dim halo
hearty lintel
#

uh

dim halo
#

?

#

what should I change there?

hearty lintel
#

show the full thing around that

arctic arch
#

content is message content

#

just

#

what did you paste to an eval command

hearty lintel
#

unless youre running the eval to post the stats?

#

ohhh i see

dim halo
hearty lintel
#

no send the code u used in ur eval command

arctic arch
#

last line of stack trace = messagecreate event

#

its an eval command

#

geez

hearty lintel
#

yes i bigDumb

#

i think they already sent it tho

dim halo
#

What should I change?

#

I'm not from England

hearty lintel
#

send the code you put into the eval command

dim halo
#

and do not laugh at me XD

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

You are running an error event through an eval?

arctic arch
#

is that the whole code

hearty lintel
#

why arent you putting that into your code originally? dont put it in the eval what

#

are you setting up dbl in an eval command at this point idek

dim halo
#

this is the whole code

#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('xd', client);

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

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

youre putting that into eval?

dense basalt
#

That code is correct, don't move it to into an eval

dim halo
#

no

dense basalt
#

Just put it in your bot file on it's own

hearty lintel
#

ok gud so whatre you doing with eval

#

if youve already added a listener for ::error

dim halo
#

I put this script in the command

#

xd

dense basalt
#

wat

hearty lintel
#

so, youre, setting up the dbl post. in an eval.

dim halo
#

and when he enters the command and then the error is shown

dense basalt
#

And you are evaluating that string of code above?

dim halo
#

what?

dense basalt
#

You put that code you sent a minute ago, into that eval?

arctic arch
#

so confusing

dense basalt
#

indeed

dim halo
#

what a fck eval, I have no idea what it is

dense basalt
#

Just, the code you sent above. Move it outside the eval, into your bot's main file

hearty lintel
#

the command

dense basalt
#

Outside of any events

hearty lintel
#

did you send that code in discord to run it?

dim halo
#

to bot.js, where? for what?

dense basalt
#

Yes

#

That will trigger once your bot is online

#

No need to run any command to active it

#

Just move it to the bot.js file, and when your bot is online it will automatically post it to DBL

dim halo
#

and you can not give an interval that will refresh every few minutes?

hearty lintel
#

you do not run the dbl stuff over discord, it should already be in your code as it is. not through a command

dense basalt
#

@dim halo It will do it on it's own

#

Not sure what the time between posts is

arctic arch
#

the module will automatically add an interval

hearty lintel
#

30m

dim halo
#

/:

#

/:

#

/: 0:

arctic arch
#

place the code into your main file

hearty lintel
#

dont spam and did it say it posted?

dim halo
#

I did it

worn quail
dim halo
#

no

hearty lintel
#

did it say "Server count posted" in console

dim halo
#

just "Bot is ready"

dense basalt
#

Give it some time

hearty lintel
#

if it didnt say server count posted it didnt fire ::posted

#

so

#

no not time, just broke again, send the whole new beginning of your code please

arctic arch
#

does bot.js start with something like

const Discord = require("discord.js");
const client = new Discord.Client();
dim halo
#

idk

#

xD

hearty lintel
#

wtf do u mean you dont know

#

do you know what youre doing at all?

dim halo
#

I do not know

#

I'm pasting the script, I think

dense basalt
#

I would suggest you learn the basics of JavaScript first, then come back

dim halo
#

em my bot has 100 commands, so

#

I just can not speak English, do you understand it?

hearty lintel
#

and yet you dont understand how to use code without throwing it through an eval script.

#

what's your native language?

dim halo
#

pl

dense basalt
#

polish?

dim halo
#

ye

dense basalt
#

hm

arctic arch
#

where have you pasted the script

dim halo
#

in bot.js

arctic arch
#

you're not supposed to paste the first two lines since those should already exist in the file

dim halo
#

wut?

hearty lintel
#

eyeyey id say just drop it and come back another day or another year tbh cuz you dont understand basic js

dim halo
#

wh*re, how many times do I have to tell you that I know discord.js but I just can not speak English and I do not understand what you write to me.

arctic arch
#

anyone know any polish people?

hearty lintel
#

disrespectful too i see

dense basalt
#

@dim halo Przenieś kod, który masz do głównego pliku, upewnij się, że nie ma żadnych zdarzeń i nie definiuj rzeczy dwa razy, a następnie uruchom ponownie bota i powiedz nam, co to jest nowy błąd.

dim halo
#

xdd

#

google translate

dense basalt
#

can you understand it or not

dim halo
#

run bot?

dense basalt
#

with the actual token yes

dim halo
#

the token is well typed

dense basalt
#

Any further logs?

dim halo
#

no

hearty lintel
#

client is the 3rd param

#

new DBL("token", {}, client)

dim halo
#

token from here?

hearty lintel
#

or just null

#

yes

dense basalt
#

@hearty lintel what the heck are you talking about

hearty lintel
dense basalt
#

You don't need options

#

e

#

const dbl = new DBL('suck my ass', bot); works fine

dim halo
#

test numer 2

dense basalt
#

I defined client as bot

#

so you should still use client

dim halo
#

cricital error xd

hearty lintel
#

bruh he just said to still use client

dim halo
#

even with the client it does not work

hearty lintel
#

also id suggest getting something better than mspaint black highlighter because at this point i could literally ocr your token rn

worn quail
#

^

dim halo
#

what?

hearty lintel
worn quail
#

One sec

dim halo
worn quail
hearty lintel
#

yes and use something that isnt a damb highlighter

#

show your full code please

#

at the very start

#

with all the dbl shit

dim halo
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('xd', client);
hearty lintel
#

no dbl.on?

dim halo
#

??

hearty lintel
#

hastebin your code

dense basalt
#

This

dbl.on('posted', () => {
})
hearty lintel
#

full code file

#

idc at this point

dim halo
#

okay, I will not get farther away with this shit

#

best regards, and hello xd

dense basalt
#

ok

hearty lintel
#

ok

dim halo
#

bye

#

I do not know who the fck came up with

#

only man pi*ses off

arctic arch
#

@hearty lintel options is an optional argument

hearty lintel
#

ik?

#
this.options = options || {};```
arctic arch
#

and that means the client can be the second argument

late mesa
#

hi, can i use bot to send messages from my account

#

or all bots should be own instance

sullen nymph
#

Bots should stay on bot accounts, and you should use proper channels

ornate abyss
#

uhm selfbots..

bold edge
#

Selfbots are against the TOS

ornate abyss
#

^

worn quail
#

I mean I made a selfbot that isnt a selfbot at the same time. Image recognition and events supplied by @remote star

#

Uses default client, and types it out using pynput

young copper
#

Tos = Term of security

calm zodiac
#

@young copper tos is terms of service

young copper
eternal charm
#

How do I get my API token?

dense basalt
plain timber
#

i think your bot needs to be approved first

graceful condor
#

yes

eternal charm
#

Oh

#

Okay

#

When I have my bot approved, how would I make it so that when someone votes, they get a role 12 hours?

plain timber
#

did you read thedocs?

late mesa
#

Can i somehowe get information who acctually talk on my channel via bot or smth?

plain timber
#

@late mesa this channel is only for help with the DBL API, as it says in the channel topic

late mesa
#

Mea culpa

worn quail
restive otter
#

Can i inv my bot here

worn quail
#

no

#

it needs to be approved

amber dune
#

dbl faq @restive otter

#

fuk

#

dbl ping

#

damn

#

anyways

restive otter
#

How @amber dune

worn quail
sullen nymph
placid goblet
#

does anyone had an issue where the gateway closes websocket connection for one single shard with close code 1011 which means internal server error?
this happens only for one specific shard, a lot of others are working fine

restive otter
#

How to fix??? @sullen nymph

sullen nymph
#

The server list looks like id, id2, id3

restive otter
#

I put that

#

528857070636630017,582149879757930507,536233549272055837

#

3

sullen nymph
#

forgot a space

restive otter
#

Where

sullen nymph
#

I literally just sent the example

#

a comma with a space is a separator

restive otter
#

Thanks

#

Now waiting for approval

clear kayak
#

Is it just me or does the api take a while to register votes ?

restive otter
#

Idk

clear kayak
#

Usually when people don't know the answer they ignore it and not reply.

restive otter
dense basalt
#

DBL should register the vote nearly instantly. What are you using to get the vote?

#

A webhook?

restive otter
#

I never have ignored anyone in my life if i know the answer or not i always rep

clear kayak
#

Directly getting it from the api /check

cursive sinew
#

@clear kayak If you use a webhook its slow asf

sullen nymph
#

I use a webhook and it's instant for me. So are the votes

clear kayak
#

https://discordbots.org/api/bots/botid/check?userId=id

dense basalt
#

I would suggest that you setup a webhook for it

#

It's fast

clear kayak
#

Might have to, was just checking if I was the only one experiencing the slow registration of the votes.

#

Thank you.

#

@restive otter There is no need to reply, idk doesn't help and just pushes the question further up in the chat.

restive otter
#

From idk it will not go so much further @clear kayak

clear kayak
#

@restive otter It does when we start arguing about it.
Either way thanks for your answer was really helpful, have a good day.

restive otter
#

Np

graceful oar
#

Does anyone know why the test vote isn't arriving to my webhook server? I've used the dblapi.js and followed the guide on the docs.

#

Oh nevermind, I had to manually edit dblapi.js to use the correct IP.

chrome canyon
#

u sure there's no config

toxic niche
#

It isn't printing anything

sullen nymph
#

Are you sure the cog is even loaded mmLol

azure plover
#

I'm looking at the /bots endpoint

#

How could I get all the bots?

#

Over the 500 endpoint

#

I'm considering the offset param but idk exactly how that works

spiral steeple
#

get the max you can then offset by that max

azure plover
#

how can I tell when i've gotten all of them

spiral steeple
#

uh

#

idk it probably will return a 400 code

azure plover
#

ok

spiral steeple
#

or be empty

graceful condor
#

the vote check is really slow

#

takes about 2-3 mins for me

#

might be a cloudflare thing idk

buoyant sandal
#

It does take 2 - 3 min for that method to update. Use the dbl api to get info when someone votes and check if someone voted instant and accurate

eternal charm
#

How do I check if a user voted for my bot in the last 12 hours?

#

(discord.js library)

sullen nymph
#

hasVoted(id)

eternal charm
#

How do I setup the full thing?

full socket
eternal charm
#

Thanks.

#

@full socket What's all this webhook stuff all about?

full socket
#

Webhooks are used to receive realtime events on your webserver when a user votes

eternal charm
#

How do I set one up?

#

@full socket

full socket
#

The page has a tutorial on how to do that

#

iirc

eternal charm
#

I don't see that.

#

Oh.. I see now.

full socket
#

You need to be able to listen to http requests

eternal charm
#

Uhh.. what does that mean??

full socket
#

Nvm me just follow the page lol

eternal charm
#

Sooo what website URL does it want me to put in @full socket

#

I just wanna make it so the bot sends a message when someone votes

#

Surely it shouldn't be this hard

full socket
#

You're hosting your bot on a VPS or something else?

eternal charm
#

Nope.

full socket
#

Then it's your glitch project's public url

eternal charm
#

Oh

full socket
#

Plus the endpoint at which you're listening to the webhook

eternal charm
#

What does that mean

#

Lmao

#

Sorry

full socket
#

Something like https://projectName.glitch.me/webhook or something

eternal charm
#

How do I get that

full socket
#

You're probably not even using your webserver for anything but hosting the bot so don't worry about that. Just follow the tutorial

eternal charm
#

I swear I don't see a tutorial

#

I only see this ^

full socket
#

@eternal charm on the js lib page that I sent you above

eternal charm
#

It's not there

full socket
#

Just scroll down

eternal charm
#

Where do I get the password from tho

full socket
#

You set the password and check for it on the server. It could be anything

#

Or you could just leave it empty

#

It's just there to make sure than no user sent the request manually to your webserver to fake a vote

eternal charm
#

So what are the downsides if I don't put it?

runic grove
#

anyone can fake votes

eternal charm
#

So I need a password?

full socket
#

You don't need it, but it's better to have one

eternal charm
#

Ok how do I set it up

full socket
#

Just type a password there. Anything

#

Don't use your personal password though

eternal charm
#

Okay

#

Then what happens with it?

full socket
#

It gets sent with the webhook message. Then you should check with your code if the password matches the one you set on the website

eternal charm
#

How would I do check

#

I'm sorry for annoying you

#

I'm new to this API

full socket
#

You see this line: const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

#

Set your password there

eternal charm
#

Yeah then how do I check

full socket
#

Also use the same password on the bot's page on DBL

#

The library does the check for you

eternal charm
#

Oh

#

What password on DBL?

#

Oh, token?

full socket
#

Edit your bot

eternal charm
#

Wait.. but I've already defined DBL

full socket
#

You will find a password field

eternal charm
#

??

#

At the top

full socket
eternal charm
#

🤦

full socket
#

Click edit

eternal charm
#

I'm on a new subject now xD

full socket
#

And scroll down

#

It's the same subject lol

eternal charm
#

Do you know that code where it says const dbl

#

I already have it defined

full socket
#

Okay change 'password' to whatever you want

eternal charm
#

Didn't you say put password as the DBL password

full socket
#

Then go to your bot's page on discordbots.org and edit your bot and use the same password in the webhook password field

#

Read this ^

eternal charm
#

OHHHHH

#

Okay

#

1 sec

#

There isn't a password field there

#

@full socket

full socket
#

Did you scroll all the way down to the webhook section?

eternal charm
#

There's URL and Authorization

full socket
#

Yes, Authorization

#

That's the one

eternal charm
#

Ah

#

Saved

full socket
#

use console.log() to test if the webhook works first, then hit the Test button on the bot's edit page under Authorization

eternal charm
#

Oh.. I'm having another issue

#

On the weekend event

#

I did bot.channels.find("id").send("hi") and it's saying:

#

DeprecationWarning: Collection#find: pass a function instead UnhandledPromiseRejectionWarning: Error: Value must be specified.

plain timber
#

use .get instead of .find

eternal charm
#

Cannot read property 'send' of undefined

full socket
#

Is there anything you need to await?

eternal charm
#

I don't think so

plain timber
#

is your client ready?

#

is bot your client?

full socket
#

Advaith can you take over? Idk js lol

eternal charm
#

Yes @plain timber

#

It's in the dbl weekend event

#

Thingy

plain timber
#

what

eternal charm
#

Do you know the event that checks if it's a weekend

plain timber
#

there is no weekend event

#

theres a method that you can manually check whenever you want

eternal charm
#

dbl.isWeekend

plain timber
#

thats not an event

#

its a method, dbl.isWeekend()

full socket
#

Returns a Promise

eternal charm
#

Whatever it is then xD

plain timber
#

when you check it, it will tell you true or false

#

how are you using it

vast elk
#

Is quick-db apart of the lib

full socket
#

And I guess promises are JS's async objects that you await somehow

plain timber
#

and, is it inside the client ready event

eternal charm
#

Uh.. no?

vast elk
#

me?

full socket
#

Show us the code @eternal charm

eternal charm
#
if(weekend) {
bot.channels.get("id").send("hi")
}
});```
vast elk
#

Um hello?

full socket
#

Yes carma?

runic grove
#

@vast elk its not

vast elk
#

ok

eternal charm
#

@full socket My code is above.

full socket
#

Idk js honestly

#

Can you send the full code?

#

Not all of it, but just a bit before and after those lines

eternal charm
#

Well it's kinda some private code

#

That's all the code for this

plain timber
#

@eternal charm that only runs one time

#

that will check it one time

eternal charm
#

How do I get it to send the message every weekened

plain timber
#

you dont

eternal charm
#

.

full socket
#

It's a function not an event

plain timber
#

you would need to code that with an interval or someting

full socket
#

Like advaith said

plain timber
#

but clearly you don't know js

full socket
#

You have to call it yourself

eternal charm
#

:/

#

I do know js

#

Don't bully me :(

#

You're certified so a higher level than me

#

But I guess Kef is better than me cos I don't even know the difference between a function and an event

full socket
#

Did you even replace "id"?

eternal charm
#

Yes lmao

full socket
#

Idek JS dude lol

eternal charm
#

I'm not that dumb

#

Ikr

full socket
#

Well just asking just in case you forgot mmLul

eternal charm
#

xD

#

So uh how do I setup the interval @plain timber

full socket
#

I assume that's discord.js

eternal charm
#

Yes

full socket
#

Fix the error first then worry about the interval later lol

eternal charm
#

I did

#

it worked now

full socket
#

Also I'd suggest making the check every time a user votes instead of a timer for now

plain timber
#

yeah thats a good idea

full socket
#

No "intervals" needed

eternal charm
#

Wdym? I'm on about sending a message every weekend

plain timber
#

you would need to check it every x time

full socket
#

The reason the weekend check exists is because votes are doubled during the weekend

eternal charm
#

Yeah..

full socket
#

So you only need to know if a vote counts as double or not, that's all

#

So, make the bot check if it's weekend or not with every single vote

#

-User votes
-Check if it's weekend
-If true do something. Otherwise do something else
-Repeat

eternal charm
#

Ohhhhh

plain timber
#

its even sent in the vote data

full socket
#

I forgot about that lol. You don't even need to call the method anymore then

toxic niche
sullen nymph
#

Yes last time I checked

toxic niche
#

I wasn't thinking about that. I was thinking that the @commands.command decorator was needed for each background process

#

But stupid me I guess

dense basalt
#

My bot has 70 monthly votes atm, but running dbl.getVotes().then(r => r.length) only return 43.

sullen nymph
#

That's for commands FeelsKekMan

toxic niche
#

I noticed 😐

#

😂

#

Gtg to bed now (for like 3 hours)

craggy sentinel
#

@dense basalt weekend bonus

#

weekend votes count twice but only appear once

dense basalt
#

Oh alright

eternal charm
#

How do I make it display the amount of users on the website? (I already have it displaying the servers.)

dense basalt
#

You can't

eternal charm
#

What else can I list?

sullen nymph
#

Shards if you have any

#

That's it

fiery maple
#

are ther any girls ??

eternal charm
#

Oh, ok. @sullen nymph

sullen nymph
#

@fiery maple Wrong channel

fiery maple
#

why

sullen nymph
fiery maple
#

okey

restive otter
#

How to check if a user has voted or not?

#

using dbl api?

worn quail
#

Api calls
What lib

#

/lang

restive otter
#

js

worn quail
#

ah

#

well api calls can work, and check if the user ID is in the list

#

That's what I do. Obv delay, but webhooks are needed for instant, and idk how to set up webhooks ;-;

restive otter
#

;-;

sullen nymph
#

dblapi.js has hasVoted function

plush ore
#

Since the built in webhook didn't work for me i wrote my own one

#

Basically set up an express server and then parse the data using body parser and there, you have your data

restive otter
#

hmm

restive otter
#

?help

sullen nymph
#
  1. Wrong channel
  2. Don't use common prefixes
worn quail
sullen nymph
#

What's the difference between id and clientid fields in JSON response for GET /bots?

plain timber
#

@sullen nymph old bots have a seperate bot id and client id

#

that might be it? idk

sullen nymph
#

¯_(ツ)_/¯

plain timber
#

im surprised there isnt a seperate input on the add bot page

earnest reef
#

hello is this discord for Icarus bot? if so im having issues with Icarus leaving my VC after i performed a countdown. when i disconnect it, it pops back in almost instantly. was wondering if anyone can help and tell me what im doing wrong 😅

calm zodiac
#

No please go to the support server listed on the bots page

#

@earnest reef

earnest reef
#

ahhh gotcha, keep getting an invalid link when i click it. finally got into this but i see now its for discord bots. thank you anyways @calm zodiac 😁 i will try to see if i can find a valid link

plain timber
earnest reef
#

thank you so much @plain timber !!!!!!!!!!!!! 🤗 🤗

plain timber
#

yw

worn quail
cedar juniper
#

Invalid link? I'll have it fixed

ornate abyss
#

Stupid question, is my token also changed when it was kicked?

plain timber
#

no

ornate abyss
#

Kicked from the website I mean?

plain timber
#

bots cant be "kicked from the website"

#

you mean it was deleted?

ornate abyss
#

Yeah

plain timber
#

if it was deleted, no data is stored so yeah

ornate abyss
#

Ah thx

acoustic niche
#

Wow

earnest osprey
#

Is there a quicker method to checking if a user voted without the api or webhook? i've tried using aiohttp.clientsession.get and it's taking up to a minute to check and sometimes it's not even accurate as in it takes 4 times before it registers a user had voted

sullen nymph
#

Faster than API: webhook
Faster than webhook: only assuming

earnest osprey
#

alright well I got the dblpy now I was wondering with the on_dbl_vote will it auto say if a user hasn't voted say if I add in a db where it saves the output for vote would it auto output as false after the 12 hours are up? or?

sullen nymph
#

Nope, it's up to you to handle that

#

on_dbl_vote is only called when someone votes for your bot (including yourse;f) :p

bold fulcrum
#

Hi

hot portal
#

how do i get dblapi.js to work with ts??

spiral steeple
#

Isnt js and ts different?

#

Not significantly, but it isnt the same is it?

hot portal
#

lol for me they are basicly the same lol

#

ts is js with typing

#

the webhook methods just dont work or not included in the code??

#

nvm i was using the wrong version

hot portal
#

what url do i put when editing my webhook

runic grove
#

wha

hot portal
#

webhook i ment

runic grove
#

the url your webhook is listening on basically

hot portal
#

is that including the port and path?

runic grove
#

yes

#

just dont put something like 127.0.0.1 or 0.0.0.0

hot portal
#

ill just try it again

#

@runic grove still nothing...

#

you can see the dev url and the port

hot portal
#

...

worthy quail
plain timber
#

@worthy quail please don't

amber dune
#

@worthy quail how old are you

worn quail
#

probs 5

#

that game old

shadow swan
#

@spiral tree

spiral tree
#

Yes?

shadow swan
#

This channel

#

Wow

#

White namer

#

😜

spiral tree
#

o

ripe merlin
#

O

spiral tree
#

Imagine calling yourself bot developer

shadow swan
#

lmao

ripe merlin
#

I just joined

spiral tree
shadow swan
#

OP

ripe merlin
#

And already have the role lmao

runic grove
#

imagine not keeping the api channel on topic

restive otter
#

Hi Everybody , " Your bot has a publicly available token. " I get this error . "Heroku" Hosted Me . Please help me .

ripe merlin
#

Whoops

shadow swan
#

👀

runic grove
#

@restive otter is your code on github?

restive otter
#

Yeah.

runic grove
#

your token is in that repo then

#

search up "nodejs heroku environment variables"

restive otter
#

Thanks.

#

I have reached the solution.

runic grove
#

great

neat wedge
#

any ETA?

sullen nymph
#

A few minutes

neat wedge
#

it's being slow and won't let me login

#

ah okay

hot portal
#

I'm trying to get the webhook to work but I'm still having issues, it's not a function?

#

DBL.webhook

plain timber
#

@hot portal send code

hot portal
#

@plain timber should I send you the GitHub?

plain timber
#

just send your dbl code here

#

in a codeblock

hot portal
#

Mmm okay, my code is heavily customized. I'm using typescript.

#

It's the exact same one that is in the API docs.

#

It just says that dhl.webhook.on... is not a function

#

They might need to add it in their typing folder

#

Plus what exactly is spos to happen when you hit the test webhook btn?

plain timber
#

you probably didnt include the webhook settings in the const dbl line

worthy quail
#

@runic grove

runic grove
#

yes?

sullen nymph
runic grove
#

of course

restive otter
#

owo how do I get past this?

flint lava
#

I need help setting up the webhook.

shut ibex
#

@restive otter send code

#

also

restive otter
#

idk If the code is the problem because it worked when I used it on glitch, now in my new vps this problem is occuring when I try running my server.js

plain timber
#

@restive otter that isnt valid js

#

you cant just type async in front of a function

shut ibex
#

@plain timber that's the module

#

look at the path

plain timber
#

ohh

#

thats weird

restive otter
#

oof

plain timber
#

what node version

#

probably outdated node

shut ibex
#

are you using a node version which supports async/await

plain timber
#

node -v

restive otter
#

v6.11.0

plain timber
#

yeah thats super old

#

switch to 10 or 12

restive otter
#

How do I update it?

#

/switch

plain timber
#

uh

shut ibex
#
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs
flint lava
#

I need help setting up the webhook please help

shut ibex
#

@restive otter one more command after those 2

restive otter
#

it said sudo cmd not found

plain timber
#

@restive otter what OS is it

flint lava
#

Please help someone

plain timber
#

whats the issue

shut ibex
#

debian needs to have sudo installed

flint lava
#

How do i do the webhook?

restive otter
#

Well right now I'm on windows and I think the vps is a linuxx system

#

linux*

plain timber
#

...

#

what linux distro

restive otter
#

can't spell

plain timber
#

@flint lava what language

shut ibex
#

send output of cat /etc/os-release @restive otter

flint lava
#

JavaScript

#

discord.js

plain timber
flint lava
#

Thanks

plain timber
#

yw

flint lava
#

What do I put in the webhook on my bot’s DBL edit page?

#

@plain timber

restive otter
#

turtle that didn't work

plain timber
flint lava
#

How do I know if it worked?

#

@plain timber

plain timber
#

save then test

shut ibex
#

1. hostnamectl
2. lsb_release -a

restive otter
#

whats the full updated version?

shut ibex
#

try one of those

restive otter
#

me?

shut ibex
#

yes

restive otter
#

No lsb modules are available

#

the other one didn't work

#

only lsb

#

I UPPDATED

#

Updated

shut ibex
#

try

su -
apt-get install sudo -y
usermod -aG sudo yourusername
#

oh

restive otter
#

all I did was n 12.6.0

flint lava
#

Is the website down?

restive otter
#

I need quick.db installed now

#

npm i -g quick.db

#

didn't work

shut ibex
#

what was the error

restive otter
shut ibex
#

it needs sudo permission

restive otter
#

how do I give it sudo permission?

shut ibex
#

you first need to get sudo

#

I posted commands up above

restive otter
#

how do I get sudp

shut ibex
#

after you do those

#

you have to logout and login again

restive otter
shut ibex
#

you forgot to set the name

#

for one of your commands

restive otter
#

Thats never happened to me

#

before

#

I mean it has

#

but all my cmds came off of glitch

#

when I inputted them into vsc

#

and my bots still online no errors

#

for glitch

flint lava
#

How do you know if the webhook Test worked?

plain timber
#

@flint lava it will run whatever you coded?

flint lava
#

dbl.webhook.on has an error

#

Cannot read property ‘on’ of undefined

plain timber
#

you didnt do it right

#

you didnt put the webhook settings in the const dbl line

flint lava
#

const DBL = require('dblapi.js'); const dbl = new DBL('SECRETCODE', bot);

#

That’s what I have

plain timber
#

change the second line to

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

password should be the same as the Webhook Authorization you set in the edit page

flint lava
#

Ok

restive otter
#

I looked through all my cmds ant there wasn't a error

flint lava
#

Ive just voted for my bot

#

But it hasn’t posted anything in the log

#

It’s supposed to post that I have voted for my bot

#

But I’ve got nothing

plain timber
#

you saved it?

#

you're sure the webhookAuth is correct?

flint lava
#

Yes

#

I’ve got the confirmation log for the server count

#

Webhook

plain timber
#

server count is seperate

flint lava
#

But nothing for the vote bit

#

This is the code

#
  console.log('Server count has been sent to Discord Bot List!');
});

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(`User with ID ${vote.user} just voted for Cryptonox!`);
});```
#

Why isn’t it working

flint lava
#

@plain timber

flint lava
#

This is my code for the vote bit:

  let embed = new Discord.RichEmbed()
    .setColor(0x0000FF)
    .setThumbnail("https://cdn.discordapp.com/avatars/560942447488794628/57a6cc87eafda490610284c6982a8918.png?size=2048")
    .setTitle(`New Vote`)
    .setDescription(`${vote.user.username} has just voted! Thanks!`)
    .setTimestamp()
    return votechannel.send({embed});
  console.log(`User with ID ${vote.user} just voted for Cryptonox!`);
});```
#

Nothing seems to be working

#

But everything else works

#

I’ve got no errors

plain timber
#

the url is probably wrong

#

or the port isnt open

restive otter
#

Hi, I have all of the api code in my index.js, but in my bot's profile page in discord bot list, the status part is still ???

plain timber
#

@restive otter ??? means the bot isnt in this server

restive otter
#

Then how do I add it?

#

@plain timber

plain timber
#

@restive otter it was probably kicked by a mod, you need to find the reason in #mod-logs, fix it, then ping the mod who kicked it

graceful condor
#

@plain timber his bot wasnt reviewed yet

plain timber
#

he has the bot dev role

graceful condor
#

not for me he doesnt

plain timber
#

he just deleted his bot

graceful condor
#

mega oof

worn quail
daring cove
#

Rippery

rough finch
#

Hello guys. I would like to get a list of users in a specific server. do I need to create a bot for that or i can use public rest apis?

worn quail
#

Bot is needed.

#

Dont use the api on yourself. You can get banned for that.

rough finch
#

ok thanks

hasty patio
runic grove
#

wrong channel

worn quail
#

^

#

Also that's illegal

hasty patio
#

Of ?

worn quail
#

Getting a user token is a no no

hasty patio
#

I do not want the token but the id of the person

runic grove
#

its an oauth2 token or smth

#

like access tokens

#

and such

worn quail
hasty patio
#

This system give the token of the personn who have registered but i want just the id of the personn, no her token

#

No offf

worn quail
#

Or in a lang, <class>.user.id

hasty patio
#

OOfffff you have not understand

worn quail
#

What are you trying to get then

sullen nymph
#

Are you sure this is the correct channel to discuss that

worn quail
#

^

hasty patio
#

Xuse me i do go where @sullen nymph

sullen nymph
worn quail
#

^

hasty patio
#

:/

#

Ok

sullen nymph
hasty patio
#

Oh ok

worn quail
#

Ye

hasty patio
#

Xuse me go developpement

worn quail
#

Petition: rename this channel to dbl-api

outer kettle
#

How to put my bot to dbd

#

Web

restive otter
restive otter
#

How to get my WEBHOOK Url?

restive otter
#

http://serverip/dblwebhook

restive otter
#

hi how to get dbl api

worn quail
#

...

#

You one need to have your bot approved first

#

And two, what lang

restive otter
#

how oppiverd

#

Turkish

amber dune
worn quail
restive otter
#

discord.js libray

worn quail
#

dblapi-js?

restive otter
#

What is this

#

I dont have

long yarrow
#

when I create a new DBL webhook, what am I supposed to do with the port and auth/secret exactly?

const dbl = new DBL(config.dblToken, { webhookPort: 5000, webhookAuth: "secret" }, client);
#

nevermind sorry I fixed it

plain timber
sullen nymph
#

Does DBL API not send the amount of API calls left until ratelimit?

spiral steeple
#

I dont think so

#

but when you pass it, it will send a "retry-after"

sullen nymph
#

Unfortunate

spiral steeple
#

but the ratelimit is a global 60 requests/60 seconds tho

sullen nymph
#

Thought about implementing it instead of local ratelimiter in dblpy but no luck

spiral steeple
#

you can store the amount of times you've sent a request in the last minute

sullen nymph
#

dblpy stores that in cache

solar crypt
#

Hallo, is there any way how can i get my github readme and directly use it on my bot description ?

#

so for example like if I updating my github readme, so my bot description also updated because it fetched from my github readme

plain timber
#

no

#

not on this list

#

well

#

you could just iframe it ig

solar crypt
#

hmm I see some bot using the description that same like in their website,

#

uh confused MegaThonk

plain timber
#

you can use html and markdown in the long description

#

and therefore you can iframe a site

solar crypt
#

alright lemme search how can I do that :P

plain timber
#

oh github doesnt allow iframing

#

rip

#

@solar crypt you could make it a github pages site and iframe that site

#

then it should sync with your readme

#

set source to master branch, and choose a theme

solar crypt
#

I see

#

thank very much

arctic arch
#

you can import a readme but it won't auto-update

solar crypt
#

how to import it pandasad

runic grove
#

fill in the "Github repository" field and the button should appear next to "Long description"

solar crypt
#

i don't get what you mean button should appear next to Long description

runic grove
solar crypt
#

Alright got it thank you very much

runic grove
#

but as tonkku said, it doesnt auto-update

runic grove
#

lmao what

plain timber
#

lmao

solar crypt
#

maybe because the repository is private?

plain timber
#

yeah probably

runic grove
#

oh yes

#

that makes sense

solar crypt
#

alright got it thanks for your time and help UwU

restive otter
main seal
runic grove
#

why

eternal crypt
#

why

distant trellis
#

why

sullen nymph
outer kettle
#

@restive otter thanks

delicate panther
#

is there an issue with the .NET library where IDblBot.IsCertified always returns false?

restive otter
#

Np

opaque pike
#

Why there is a timeout for the Discord Bot ?

fading lynx
#

What's the easiest way of knowing how many times a user has voted without using /bots/<id>/votes?

polar mirage
#

Use webhooks
Save votes to DB
Query DB

solar crypt
#

Hallo, is it safe to use my vps IP directly for making webhooks?

karmic hound
#

just make sure you have a static IP and it should be fine

solar crypt
#

idk what you mean with static IP, can you explain more please?

karmic hound
#

if your modem(or vps) reboots do you get the same IP

spiral steeple
#

Yes

#

your ip doesnt just change or vpn's would be pointless

plain timber
#

@spiral steeple your home ip does change

spiral steeple
#

since when mine has been the same for some time

solar crypt
#

alright

restive otter
#

For JavaScript

#

Does it mean client id or bot token

plain timber
#

@restive otter the token you get from the dbl site

#

Your bot needs to be approved first

#

It's different from your discord token

restive otter
#

Ok

red cradle
#

anyone code there bot in c#

spiral steeple
#

Does this have to do with the dblapi?

worn quail
#

Perhaps. You never know

sudden flare
#

I am updating the server count of my bot but its status is shown as this

#

what should I do to send the status of my bot 🤔

worn quail
#

It may not be here.

#

That's not the server count

#

-bots @sudden flare noembed

abstract mothBOT
#

Midorina#6900's bots:
@velvet meteor

worn quail
#

What you were thinking of is the online status

sudden flare
#

I know, I said the status

worn quail
#

But dbl cache takes a bit, so wait a moment

#

You dont send that.

#

@abstract moth does it

sudden flare
#

ok

#

thanks

worn quail
#

Server count and shards are the only things you can post I think

sudden flare
#

ok ty

worn quail
#

I may be wrong as usual

fading lynx
#

Why does my boy says 191 guilds when i don't even send that data to dbl?

#

Does it automatically get it from the client parameter in the dbl class constructor? (dblapi.js)

spiral steeple
#

it will auto post if you provide a client, yes

fading lynx
#

How did i get 191 guilds then

sullen nymph
#

When dblapi.js posted the guild count /shrug

fading lynx
#

What about sharded bots?

#

The client object only has the amount of guilds on that shard

#

Does dblapi.js automatically use fetchClientValues?

sullen nymph
#

Might wanna dig around in dblapi.js source code for that 👀

shut ibex
#

afaik each shard posts it's data and dbl adds it up

spiral steeple
#

it checks if it's sharded

#

if it is it posts shards with guild count instead

frail meteor
#
const { log, error, success, load, debug } = require("/app/assets/main.js");

module.exports = (client) => {

  client.on('ready', () => {
setInterval(postStats, 1000000)
    success("Loaded postStats.js backend file.")
    
    function postStats() {
      debug("Posting Stats to bot lists.")
      
const DBL = require("dblapi.js");
const dbl = new DBL('my token is here', client);
dbl.on('posted', () => {
  console.log('Server count posted!');
})
dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
    }
  })
}

I have this code for posting the stats, and it logs the "Posting stats to bot lists", but I never get the log for dbl.on post.
Is there smth I am missing?

spiral steeple
#

you shouldnt make a new dbl every time you run that

#

you should have one then use the postStats method, or just provide a client, as you did, in the dbl constructor and it will auto post for you

ornate abyss
#

how do i track who voted on my bot?

#

or

#

i mean how do i set up the webhook?

ornate abyss
#

python

sullen nymph
#

dblpy has built-in webhook

ruby yarrow
#

Has anyone been able to import dbl on repl.it ?

ornate abyss
#

AttributeError: 'Client' object has no attribute 'get_bot_upvotes' hmmm

hot portal
#

@arctic arch can you guys update dblapi.js snekfetch@3.6.4: use node-fetch instead

sullen nymph
#

Update or use the correct Client

ruby yarrow
#

Is there a python example for logging votes?

full socket
ruby yarrow
#

So I've seen this one but I can't test it here unless there's a website that run python and can import dbl

#

Also I'm not sure is the example implying it's run with your bot or by itself? Maybe it wouldn't matter

arctic arch
#

@hot portal you are using an old version of the module

full socket
#

You're using a private vps right?

#

Or at least heroku

hot portal
#

2.3.0 is the latest on your GitHub

sullen nymph
#

Which example exactly?

#

@ruby yarrow

ruby yarrow
#

think I've seen both, I was using repl.it
Heroku will work? Never tried it

full socket
#

Does it provide you with a public URL for your app? Or at least an IP address?

hot portal
#

Heroku is what im using. there is a public Url in your deployment setting

arctic arch
#

version 2.3.0 doesn't use snekfetch anymore

ornate abyss
#

im on the latest from pypi

sullen nymph
#

Doesn't seem like it

#

unless you are using get_bot_upvotes on your discord.py Client

ornate abyss
#

hmmm Last released: May 28, 2019

#

well pypi isnt updated

hot portal
#

okay thanks

sullen nymph
#

There was some minor updates on Github repo

ornate abyss
#

yeah 24 days ago

sullen nymph
#

maybe not too minor but yeah

hot portal
#

XD

ornate abyss
#

some to the client GWloopyBlobShrug

sullen nymph
#

I should get back to it ngl. Anyway, get_bot_upvotes is still a thing :p

ornate abyss
#

hmmm

#

Found existing installation: dblpy 0.1.6
Uninstalling dblpy-0.1.6:
Successfully uninstalled dblpy-0.1.6
Running setup.py install for dblpy ... done
Successfully installed dblpy-0.3.1

#

that explains

sullen nymph
#

Yep

ornate abyss
sullen nymph
#

If it wasn't, it wouldn't be in the example

hot portal
#

why dont you use code sand box and set up a live share? thet put the setting to classroom

ornate abyss
#

maybe im doing some bs then
sd = self.dblpy = dbl.Client(self.bot, self.config.discordbotsorg)

sullen nymph
#

slap an import dbl into your code and then print dbl.__version__

ornate abyss
#

uhmmmmmmm

#

shit still 0.1.6

ruby yarrow
#

You in a venv?

ornate abyss
#

nope

ruby yarrow
#

So this code can just be added to the code block in https://discordbots.org/api/docs#pylib ?

As long as port is open and tokens are correct?

async def on_dbl_vote(data):
    print(data)```