#topgg-api

1 messages · Page 85 of 1

jagged pine
#

let me see

vapid cape
#

so now that you have a webserver running in your machine, that means your machine can receive requests from outside, just like if you were running a website in it

jagged pine
#

so the webserver will be on my pc?

vapid cape
#

you just need to give top.gg the correct URL of your webserver, which depends on where your server is hosted

jagged pine
#

uhm

vapid cape
#

if your bot is hosted on your pc, then the webserver will also be running on your pc

jagged pine
#

OK got this

vapid cape
#

so the address of your webserver becomes the IP address of your pc

jagged pine
#

So, my bot is hosted on a server I bought, how can I get the webserver adress? Is it just the IP?

vapid cape
#

yes, its the IP address of your server

#

and the Port of your choice

jagged pine
#

I'm using vultr for reference

#

webhookPort: 5000 in this case 5000 if I got this right

vapid cape
#

yes

#

so your URL will be YOUR.VPS.IP.ADDRESS:5000/dblwebhook

#

/dblwebhook is the default page created by dblapi.js

jagged pine
#

thanks dude! I'm so new to this

#

Then I'll have to change some firewall settings too I guess

vapid cape
#

so basically what happens is that wen someone votes, its similar to if top.gg would open yourip:5000/dblwebhook in their browser

jagged pine
#

got it

vapid cape
#

and your webserver will do something with it

#

if vultr has a firewall, yes, you need to allow port 5000

jagged pine
#

oh ok

#

nice

#

thank you once again

tired ivy
jagged pine
#

There are issues with the site right now

#

Tim, so I can do all of that in another bot right? Doesn't need to be on the actual bot of my bot page.

vapid cape
#

yes

#

when you go to the bot's edit page, you can put whatever URL you want

#

since you only have one server, you can make all your bots sent webhooks to the same URL

#

and you can have a single webserver receive all of them

#

doesnt matter on which file this webserver is running

restive otter
#

yay backend problems

#

things happen

jagged pine
#

Why does it log this? Webhook running at http://0.0.0.0:5000/dblwebhook

#

This is wrong right?

green mantle
#

no

sullen nymph
#

Replace 0.0.0.0 with your external IP when entering the URL somewhere

#

and you get a proper URL

jagged pine
#

I did

#

already

#
//Votes on top.gg
const DBL = require('dblapi.js');
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'mypassword' });
```And that's the rest of the code
#

And I put my ubuntu server IP in the webhook

#

My.IP:5000/dblwebhook

green mantle
#

yes

#

make sure http:// is before My.IP

jagged pine
#

oh

#

freak

#

thanks

#

Why does it log this? Webhook running at http://0.0.0.0:5000/dblwebhook
this still shows up like this, but I get the votes. So it's all good right?

green mantle
#

yup

#

0.0.0.0 just means

#

on any range

vapid cape
#

its also hardcoded in dblapi because it doesnt do IP discovery

balmy hamlet
#

lmao

arctic arch
#

maybe later™️ mmLol

regal flower
#

Diddly dick

restive otter
#

I need help with the API. The /botid/votes endpoint isn't returning the correct number of voters.

#

I have 9 votes, and only 6 show in that endpoint.

sly violet
#

does top.gg api have anyway to query servers?

vapid cape
#

if you mean a bot's server count, no

sly violet
#

i mean servers listed on top.gg

#

i want to check if a server is listed on top.gg

vapid cape
#

ah there should be an endpoint for that, let me check

#

or not

#

there's nothing about servers on their api docs

sly violet
#

yeah i checked the docs

#

what im doing atm is really slow

#

just basically requesting the servers page and checking the status code

vapid cape
#

well there was a huge drama last year about server crawlers helping raids and shit like that

#

a lot of services that provided server lists were flamed to oblivion

#

might be a reason for why if there is an api it isnt public

sly violet
#

i mean completly possible without an api

#
if (await self.bot.session.get(f"https://top.gg/servers/{g.id}")).status == 200:
    topgg = f"[Top.gg](https://top.gg/servers/{g.id})"
else:
    topgg = None

this is what i have atm

#

its just painfully slow

vapid cape
#

how many servers are you checking?

sly violet
#

none

#

well

#

1

#

its in my serverinfo command

vapid cape
#

oh is it just like a server info command

sly violet
#

yeah

vapid cape
#

then that should be fine

sly violet
#

i might change it to servers/id/join

vapid cape
#

it shouldnt be that slow tho, how slow are we talking?

sly violet
#

3ish seconds

vapid cape
#

jesus

#

you could try making a HEAD request instead

#

its like a GET request but only gets the headers and not the body

sly violet
#

ill try

#

i changed it to /id/join

#

significant perfomance increase

#

head request is faster

vapid cape
#

im testing it with reqbin

#

a 200 takes 150ms, a 404 takes almost 2 seconds Lol

#

/join gives you 403 tho

sly violet
#

it does?

#

damn yeah it does

#

the web browser fooled me with cloudfare

vapid cape
#

i tested a few different methods and no luck

#

if the server doesnt exist, the 404 will take 2 seconds to respond no matter what

#

but if it exists, it takes < 200ms

#

so you could play around that lmao

#

or you can send a response with everything else except the top.gg url, and then edit it in

sly violet
#

thats what ive been doing

outer kiln
#

oh

languid plaza
#

if(message.content.startsWith !=== "prefix") return

green mantle
#

Not the right channel

languid plaza
#

I know

green mantle
gloomy fractal
#

@restive otter @true sonnet This channel IS ONLY for topgg api questions. If you don’t have one don’t post here.

jagged pine
#

Does the vote.user.avatar return an URL?

sullen nymph
#

The vote.user returned from webhook isn't a user

jagged pine
#

oh

#

it's just the id?

sullen nymph
#

Yup

jagged pine
#

can I get the user avatar from the vote?

junior tusk
#

yes you can using dbl.getUser(userid)

sullen nymph
#

get user (from cache if possible) and get their avatar

jagged pine
#

ok thanks, is that the quickest way?

#

yes you can using dbl.getUser(userid)

junior tusk
#

ok thanks, is that the quickest way?
@jagged pine no, but you can't assume the user is in your client.users. So I chose that safe method

pearl coral
#

hey guys, can someone let me know if there's anything wrong with this code:

    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = "my token" # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='my password', webhook_port=5000, autopost=True)


    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("got event!")
        

def setup(bot):
    bot.add_cog(DiscordBotsOrgAPI(bot))```
for some reason the on_dbl_vote is never called when i vote for my bot
i know i'm doing something wrong but i'm not sure what
left egret
#

Make sure your server can listen to new webhook requests, and isn’t getting blocked by something like a firewall

pearl coral
#

it's an aws server

#

any way for me to ensure that?

left egret
#

You should have a setting about that in your customer panel

#

But not sure where exactly it is

pearl coral
#

u think that might be the issue?

#

does the code seem correct?

#

thanks for the idea 😄

left egret
#

Eh, should be

#

If you used our docs in our website

pearl coral
#

yeah

left egret
#

Try running your bot locally, disable your firewall and stuff, and see if it’s a firewall issue

#

I honestly don’t know how AWS handles that

pearl coral
#

i'll try that rn

#

uh

#

im gonna need someone to vote for it lmao

#

to test

#

😦

sullen nymph
#

on_dbl_test

pearl coral
#

perfect

#

ty

#

oh ya

#

when i ran it

#

it said windows firewall blocked access

#

and i had to press allow

#

it's weird cuz even when i press allow access nothing happens when i test

#

@sullen nymph does the on_dbl_test go in the main script where i run the bot or in a separate cog?

#

sorry for the questions im really struggling

sullen nymph
#

Anywhere where you can make it a listener/event

pearl coral
#

so i've tried both main and the cog

#

in the cog i do @commands.Cogs.listener()

#

and in the main i do @client.event

#

but still neither seem to be getting activated

sullen nymph
#

Cogs or Cog

pearl coral
#

and i told my firewall to allow access

#

Cog

#

@commands.Cog.listener()

sullen nymph
#

Are you sure your port is open and/or the URL you entered is correct

pearl coral
#

url is /dblwebhook

#

that's what it says on my bot's top.gg page

#

password is correct

#

the port is 5000

#

not sure what that means but it was on the docs so i kept it

sullen nymph
#

Full URL

pearl coral
#

i just have it as /dblwebhook

#

because that's what it is on my bot;s edit page

sullen nymph
#

The URL on your bot's Edit page

pearl coral
#

is /dblwebhook

#

fuck im an idiot sometimes

sullen nymph
#

And how do you expect top.gg to send a request to your machine without specifying an IP

pearl coral
#

wait i need an ip?

#

bro hoenslty idk

#

im new to this sorry

sullen nymph
#

Why would it be that

pearl coral
#

idk

sullen nymph
#

It needs to point at your webserver

#

a machine that's hosting the webserver

pearl coral
#

so my aws thingy

#

would i just put the IP?

#

as the url?

sullen nymph
#

http://<ip>:<port><webhook_path>

pearl coral
#

thank you very much

#

does the port matter?

#

sorry again for all the questions

sullen nymph
#

Not really

pearl coral
#

i've tried it with boht the private and public ip's of my aws server

#

no luck

#

still trying

#

they're IPv4 does that matter?

sullen nymph
#

IPv4 is supported, not sure about IPv6

pearl coral
#

this is weird

pearl coral
#

does anyone know how to allow aws to received stuff from dbl?

restive otter
#

API runs normally, at how much servers is your bot in. But if the value change it sais API Permission Denied. Even is is run by sudo (administrator) any help? (ubuntu 18.04 vps)

jade shuttle
#

@pearl coral you sure that port isn't blocked by your firewall

restive otter
#

@jade shuttle wich port

jade shuttle
#

The one their web server is running on

restive otter
#

@jade shuttle for me is bugged idk

#

even if i remove it

jade shuttle
#

@restive otter I asked the other guy about the port, not you (I responded to "which port" because I thought you might be curious about what I meant)
I have no idea what your question means so can't help ya

restive otter
#

sry

vast bolt
#

hey I was just wondering the vote checks take about a minute or so to update, is that normal?

restive otter
#

yes

vast bolt
#

thank you

solid wharf
#

Why does the test feature for the API not send anything to my endpoint, I'm catching every type of request and there is nothing coming through..

#

I don't get it, and I've tried this Glitch setup too and still no dice Thonk

spiral steeple
#

did you save?

solid wharf
#

Of course I saved, what kind of question is that OMEGALUL

#

jk yeah I have.

spiral steeple
#

well you did bring up glitch

#

¯_(ツ)_/¯

solid wharf
#

¯_(ツ)_/¯ i might just scrap it, nothing is even going to my requestbin

#

Bro this api is fucking trash I'll just work on something else

solid wharf
#
app.post("/dblhook", (req, res) => {
  console.log("wow request found")
});```
#

This doesn't even work

vapid cape
#

did you test it with reqbin?

dapper copper
#

that should still technically return if dbl posts to it

#

so if its not working you should make sure your port is open sudo ufw allow <port> if that doesnt work make sure you're telling the lib to bind to 0.0.0.0 and then if that doesnt work idk, something is really fucked @solid wharf

solid wharf
#

its returning in 1128ms

#

lmao

shadow seal
#

is there anything close to a google images api thing

zenith trout
#

?help

abstract mothBOT
#

@zenith trout

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

golden adder
#

I have a problem where my bot has been showing offline since yesterday (it's been online this whole time), but the server count is updating just fine... 👀 It's showing online on other bot list websites. I haven't touched the DBL code. Any ideas?

https://top.gg/bot/675996677366218774

#

It's clearly getting the count through ok but not the online status for some reason 🤔

#

But both of those are being passed to the DBL API using client

spiral steeple
#

Status is determined by your bots status in this server

#

Btw, your support server's invite has expired

#

@wary hamlet

#

It may have been kicked from here

golden adder
#

Yeah I asked for it to be removed

#

🤔

#

So that affects the online status for the website?

spiral steeple
#

Then it will show ??? and offline as its status

golden adder
#

🤦

spiral steeple
#

The website pulls status from the data in this guild

golden adder
#

Damn

#

How can I get it back in here? 😂

spiral steeple
#

Ask a mod I suppose

golden adder
#

Any mods out there? I don't wanna ping you! 😂

spiral steeple
#

As long as you ping only one it should be fine, just dont ping the role

golden adder
#

@gloomy fractal could you please help me with this?

gloomy fractal
#

@golden adder With?

golden adder
#

I need PixxieBot reinvited to this server for the online status to be set

#

It was removed because I requested it

#

But wasn't aware of the online thing

gloomy fractal
#

-api

abstract mothBOT
gloomy fractal
#

DM me

lusty hornet
#

heya

#

I regened token.

languid plaza
#
console.log(`${vote.usename} just voted!`)
})```
Output:
``` ```
#

Its not logging when someone votes

cinder orbit
#
const DBL = require('dblapi.js');
const dbl = new DBL(TOKENU TAU DBL, { webhookPort: 5000, webhookAuth: 'password' });

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

where must I insert my bot id?
idk how this works

willow spindle
#

you need to put dbl token

cinder orbit
#

now what?

#

@willow spindle

willow spindle
#

setup webhook url and auth password
click "Edit" on bot's page and scroll down

cinder orbit
#

is this webhook good?

willow spindle
#

no

#

that is https://serverip:port/dblwebhook
https://<project-name>.glitch.me/dblwebhook for glitch

cinder orbit
#

aaa

willow spindle
#

yes

cinder orbit
#

hmm?

#

anyway

#

now what?

#

is this good?

willow spindle
#

did you set the authorization key

cinder orbit
#

no

#

i set this too

#

now what?

#

i dont know how to set the auth key i swear xd

willow spindle
#

new DBL(dbltoken, { webhookPort: port, webhookAuth: 'auth key' })

cinder orbit
#

how can I find the webhook port?\

trail sigil
#

what port are you using?

willow spindle
trail sigil
#

only port 3000 can be used on glitch

cinder orbit
#

new DBL(dbltoken, { 3000: port, webhookAuth: 'auth key' })

#

and the auth key how can i get that?

trail sigil
#

switch the '3000' and 'port' round

cinder orbit
#

new DBL(dbltoken, { webhookPort: 300, webhookAuth: 'auth key' })

#

?

trail sigil
#

your auth key is chosen in the authorisation box, where your webhook url is

willow spindle
#

and the auth key how can i get that?
@cinder orbit what you wrote in "Authorization"

cinder orbit
#

i wrote nothing

#

i wrote reallywow

#

const dbl = new DBL('token bla bla', { webhookPort: 3000, webhookAuth: 'reallywow' })

#

is it good now?

willow spindle
#

save and click "test"

cinder orbit
#

now what?

trail sigil
#

check the console

cinder orbit
#

errors

trail sigil
#

you might need to specify the port in the url too btw

#

so .glitch.me:3000/dblwebhook

cinder orbit
trail sigil
#

yup

cinder orbit
#

still erroring

#

i didnt have the package

trail sigil
#

smh

willow spindle
#

lol

cinder orbit
trail sigil
#

yes, it always helps to have the package lmao

cinder orbit
#

HELL YES

trail sigil
#

awesome

cinder orbit
#

now what? =))

willow spindle
#

click test now

cinder orbit
#

yes

#

i pressed

willow spindle
#

check console

cinder orbit
#

logs or console?

#

nothing

#

mhm?

#

wait lemme remove :3000

#

still nothing

#

hmm

#

wth

trail sigil
#

are you using the port for anything else?

cinder orbit
#

wdym

#

aaa

#

i'm idiot

#

this isnt the link

#

that;s my main project

#

smh

trail sigil
#

lol

cinder orbit
#

HELL YES

trail sigil
#

nice

cinder orbit
#

and how can I do when someone votes: message.channel.send('usr id voted')

#

?

trail sigil
#

you need to find the channel to send the message to first

cinder orbit
#

i have the id

willow spindle
#

get it from client

trail sigil
#

^

cinder orbit
#

wait

#

i just need to change that

#

console.log bla bla

#

1 sec

willow spindle
#

<Client>.channels for discord.js

cinder orbit
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} a votat voxility)

#

200 iq

willow spindle
#

yes

cinder orbit
#

lets test

#

nothing

#

i tested

#

and nothing

#

hmm

#

wth

trail sigil
#

discord.js v12?

cinder orbit
#

wait

#

ik

trail sigil
#

@tame edge wrong place to ask

cinder orbit
#

TypeError: bot.guilds.get is not a function

#

this is the error

trail sigil
#

are you using discord.js v12?

cinder orbit
#

i am idiot

#

i didnt defined

#

discord.js

#

smh

willow spindle
#

guilds.cache.get

#

channels.cache.get

trail sigil
#

just do client.channels.fetch(CHANNEL ID);

open garden
#

Discord.js stuff in #development remember, TopGG api only in here, thanks.

cinder orbit
trail sigil
#

sorry

cinder orbit
#

its about api

#

vote

#

but anyway

trail sigil
#

yeah

cinder orbit
#

so

#

what now?

restive otter
#

Here i can advice for a bot?

cerulean monolith
#

that webhookauth can be literally anythiung right?

trail sigil
#

yeah

#

treat it like a password though i.e. make it a decent number of characters and use letters as well as numbers and special characters

cerulean monolith
#

Imagine doing it exactly literally anything

#

Im doing a kind of alternate sentencing

#

wut

#

http://0.0.0.0

#

why is it running it here

#

;-;

trail sigil
#

that is fine

cerulean monolith
#

ohkay

trail sigil
#

it means it is listening

cerulean monolith
#

its on vps btw

#

Coolio

cerulean monolith
#

F

#

It doesnt seem it be working

#

It just aint working no error whatsoever

open garden
#

dbl.webhook.on('vote', vote => { @cinder orbit

#

there is vote defined

cinder orbit
#

ok

#

where

#

must I close that?

#

@open garden

open garden
#

Of course.

cinder orbit
#

where must i insert

#

that?

restive otter
#

And you shouldn't post your token btw

cinder orbit
#

ITS NOT THE ALL TOKEN

#

this isnt offtopic bro

#

here is just for help

#

not to judge

restive otter
cinder orbit
#

i regen it after all

#

...

restive otter
#

aight then, just saying

cinder orbit
#

i dontt need

open garden
#

If your using glitch (which it looks like) then use process.env.DBLToken

so it's safe and hidden

cinder orbit
#

ik

#

but i will regen it

#

anyway

#

so

open garden
#

Since your project isn't probably private, so anyone can find your token

cinder orbit
#

whats the point

#

it is private

#

-_-

#

so

#

where must i insert that

#

dbl.webhook.on('vote', vote => { @cinder orbit
@open garden *

open garden
#

Wherever you want the vote event to be

cinder orbit
#

idk

#

tell me

#

I just wanna work

#

pls

open garden
#

Well you got it already

cinder orbit
#

yes but is error

#

i didnt defined it yet*

#

a

#

wtf

open garden
#

let user = client.users.get(vote.user)
let tag = user.tag

cinder orbit
#

well done

#

lemme test

open garden
#

It won't work

#

Well it could

#

But please format it correctly, and don't copy and paste text

willow spindle
#

this is not related with top.gg API @uneven brook

cerulean monolith
#

@open garden That wont work

#

Well

#

it can and cannot lmao

#

Nvm lol

open garden
#

😉

#

tbh I'm getting tired, been helping on this one thing for hours and just not being followed all instructions/comments

cerulean monolith
#

If the user it cached(Chances are not) then it will work

open garden
#

^

cerulean monolith
#

is*

#

he should probably do if(!user)return;

open garden
#

else fetchUsers iirc, haven't coded in ages

#

or put it as "unknown" or smth so it logs

cerulean monolith
#

Well Yea but he is doing user.tag that will throw error cannot get tag of undefined

#

he will have to put that in else statement

open garden
#

Mhm

#
let user = client.users.get(vote.user)
if(!user){
  var tag = "Unknown"
} else {
  var tag = user.tag
}```

iirc?
cerulean monolith
#

I think so

cinder orbit
#

@open garden

open garden
#

So that means the bot hasn't cached your user.

#

But it shouldn't error as we added the unknown option

cerulean monolith
#

.fetchUser @cinder orbit

#

instead of .get

#

client.fetchUser

cinder orbit
#

1 sec

open garden
#

if you don't want it to rely on cache stuff ^

cinder orbit
#

good?

open garden
#

Test it

vapid cape
#

@cinder orbit you are mixing client and bot

open garden
#

But your mixing client and bot again I believe

vapid cape
#

which one do you .login() with?

cerulean monolith
cinder orbit
#

bot.login

vapid cape
#

then use bot, not client

cinder orbit
#

but it works

vapid cape
#

client doesnt exist for you

cinder orbit
#

1 sec

#

const client = new Discord.Client();

vapid cape
#

no

cerulean monolith
cinder orbit
#

undefined

open garden
#

@vapid cape unfortunately it does, they defined both, I keep telling them to use 1 but

cinder orbit
#

hmm?

vapid cape
#

look

#

when you do new Discord.Client() you are creating a NEW bot program

cinder orbit
#

what must I change?

vapid cape
#

so if you have bot and client, then you have 2 bots in your program

cinder orbit
#

aa

vapid cape
#

if you do bot.login(), then bot is logged in, but client is not

open garden
#

The "bot" can't do stuff you tell "client" to do and vice versa.

cinder orbit
#

now is it good?

vapid cape
#

are you using v11 or v12?

cinder orbit
#

v11

#

"discord.js": "^11.4.2",

vapid cape
#

fetchUser is a promise, you have to await it

open garden
#

They downgraded to v11 since they don't understand v12; despitelinking the guide.

cinder orbit
#

so what must i do?

cerulean monolith
vapid cape
#

async vote => {
await bot.fetchUser()

cerulean monolith
#

var user=bot.fetchUser() i guess?

runic grove
#

@cerulean monolith that will just return the promise

open garden
#

^

cerulean monolith
#

Ah rip

open garden
#

changing "let" and "var" does nothing (in simplest terms)

cerulean monolith
#

i meant

cinder orbit
#

i dont understand

cerulean monolith
#

await bot.fetchUser()

#

my bad lmao

cinder orbit
#

all of you tell me different

#

things

open garden
#

more like it

cinder orbit
#

WHAT?

cerulean monolith
#

I'm gonna leave Rip

cinder orbit
#

what must i write

open garden
#

@cinder orbit We're saying the same thing

#

async vote => {
await bot.fetchUser()

#

change those bits so it's like that.

cerulean monolith
#

Why do i feel like we are doing this?

cinder orbit
#

is it good rn?

cerulean monolith
vapid cape
#

dude...

cinder orbit
#

im idiot

#

i swear

vapid cape
cinder orbit
#

aaa

vapid cape
cerulean monolith
#

Damn nice editing lol

cinder orbit
#

lightshot i think

open garden
#

ShareX iirc

#

Got the same stuff

cinder orbit
#

xd

open garden
cerulean monolith
#

OwO i use ShareX never used editing lmao

cinder orbit
open garden
#

Anyway, working now @cinder orbit ?

cinder orbit
#

let me change

cerulean monolith
#

We are going offtopic lmao

vapid cape
#

i like lightshot better, i dont like that sharex always saves them in the history

cinder orbit
#

now/

open garden
#

Ah I like that function tho Tim xd

cinder orbit
#

?

open garden
#

Since I can snap something and refer back ie ban reasons easily

cerulean monolith
#

still wrong.

cinder orbit
#

what the hell

open garden
#

You're mixing client and bot again

cerulean monolith
#

how did you even made this mistake lmao

open garden
#

as well as await needed

cinder orbit
#

ohh god...

#

and what must i change?

cerulean monolith
#

remove client.fetchUser

#

and one bracket from end

open garden
#
let user = await bot.fetchUser()```

etc, as said
cinder orbit
cerulean monolith
#

^

cinder orbit
#

whre is the unexpected token error?\

cerulean monolith
#

Ah here we go again

cinder orbit
cerulean monolith
#

remove this }

cinder orbit
#

Ah here we go again
@cerulean monolith im dumb ik but i dont understand

#

xd

open garden
#

it's even highlighted for you as well.

cinder orbit
#

what the hell

vapid cape
cinder orbit
#

ok

cerulean monolith
#

Well here is a mod here who is spoon-feeding with me so i got no worries

cinder orbit
#

17 - unexpected token

open garden
#

Well here is a mod here who is spoon-feeding with me so i got no worries
@cerulean monolith your fine, we're not code dumping the correct code but trying to give the answers

cerulean monolith
#

Kewl

open garden
#

The error says it all

#

and glitch even provides a nice circle to see the error before testing it.

cerulean monolith
#

^

vapid cape
#

@cinder orbit what do you have at the end of line 11?

cinder orbit
#

nothin'

vapid cape
#

dont put .login in there

#

login has to be outside of the vote event

cerulean monolith
#

Ah well @vapid cape he never closed the bot.on ready bracket

vapid cape
#

also that, good one

cerulean monolith
#

^_^

cinder orbit
#

bro what i am missing

#

the bot.on is closed

#

from vode is closed

#

the gbl hook closed

#

wth

vapid cape
#

you have to close vote

cinder orbit
cerulean monolith
#

His bot.on is not closed only

#

others all are closed

#

@cinder orbit add }) after 5th line

cinder orbit
#

1 sec

vapid cape
#

vote and .on("ready") are both open

cerulean monolith
#

wait no

vapid cape
#

you're only closing one of them on line 12

cinder orbit
cerulean monolith
#

@cinder orbit after 4th line rip

vapid cape
#

no

cinder orbit
#

still error

vapid cape
#

now you're breakingDBL

cerulean monolith
#

Yea

cinder orbit
vapid cape
#

ok your last one should work

cinder orbit
#

nope

vapid cape
#

you did }}

#

instead of })

cinder orbit
#

oops

cerulean monolith
#

Oh Wew

cinder orbit
#

wth...

cerulean monolith
#

This code still wont work btw

#

tag is undefined

#

user.tag

cinder orbit
#

a yes

cerulean monolith
#

user is undefined too btw in this case

cinder orbit
#

now it works

#

brackets are ok

cerulean monolith
#

bot.fetchUser(vote.user)

cinder orbit
#

still

#

error

cerulean monolith
#

user.tag should be there

cinder orbit
#

wait

#

no

#

wait

#

what about this

cerulean monolith
#

nope

cinder orbit
#

😦

cerulean monolith
#

user.tag

cinder orbit
#

its working

#

let me try it

#

I LOVE YOU GUYS

#

YASSS

cerulean monolith
#

Enjoy ^_^

cinder orbit
#

pls can you vote 1 time to test it?

cerulean monolith
#

Lol now thats begging

cinder orbit
#

🙂

#

xd

#

i just wanna be sure

#

let me ask a friend

open garden
#

It will work

cinder orbit
#

yes

#

thanks

open garden
#

Works for you? It'll work for everyone

cinder orbit
#

😉

open garden
#

So please don't beg for votes.

cinder orbit
#

ok

#

sorry

cerulean monolith
#

GG's

cerulean monolith
#

Can i DM users with my bot when they vote?

restive otter
#

LeL

cerulean monolith
#

i mean i know how to
am i allowed to do that?

restive otter
#

yes

#

when u have there id u can dm them

cerulean monolith
#

Aight thanks

#

Ofc i have ID when they vote

restive otter
#

let user_id = bot.users.get(vote.user);
user_id.send("You voted me");

cerulean monolith
#

That wont work most of the the time but thanks

restive otter
#

u sure ? it will work all of the time, cuz i am using this method to dm me

cinder orbit
#

Is there a way to do a voice counter for the votes with any api?

#

like the 111 thing

#

when someone votes

#

voice counter from 111 -> 112

restive otter
#

s

#

wtf

spiral steeple
#

It's one of the biggest bots

balmy hamlet
#

maybe they meant 'how can I do this to my botum™️'

median badger
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

oh thx @median badger ❤️

lusty hornet
#

When someone gets a chance

#

😄

spiral steeple
#

401 is unauthorized

#

your token is incorrect

#

I would just regen it if you are sure it's right

#

Make sure there's no trailing spaces

restive otter
#

@median badger

#

imagine not using .py 🐧

median badger
#

py is shit

green mantle
#

i mean not rlly

#

lol

median badger
#

js is better smh

sullen nymph
median badger
#

good point

lusty hornet
#

I already regend @spiral steeple

#

I know what 401 is, not sure why im getting it though with the correct token

spiral steeple
#

In your request, you have a question mark after the bot id, try to get rid of that

restive otter
#

any idea?

#

its installed correctly

#

ah sry i forgot

#

dbl.webhook.on

#

(it might be)

#

tried

#

worked?

#

no

#

whyyy

#

woah

#

impressive!

#

did you set auth, and URL correct?

#

nvm

#

but

#

how to make

#

auth

#

url

#

oof

#

@restive otter im not using glitch

#

Your bot's edit page

#

@restive otter im not using glitch
@restive otter me too..

#

i set auth

#

but how to set url

#

and wht

#

to be on that

#

Url can be http://yourprojectname.glitch.me/dblwebhook

#

oh sorry, not https

#

i dont use glitch x2

#

sorry my mistake

#

your vps ip

#

and where to set url

#

no

#

but how

#

nvm

#

i found out

green mantle
#

yes

restive otter
#

^^ works (test webhook)

#

How to make it work non-forced? I mean if i put it from test command in-panel it works but if vote someone it don't work

#

what is wrong

#

i dont understand

#

what to do?

#

that's the problem, it says missing permission but it's run by sudo

#

ufw disabled

#

any idea?

restive otter
#

How can you send a message when a user votes

#

currently i have

await dbl.getVotes().then(votes => {
    if(votes.find(vote => vote.id === message.author.id)) message.author.send('Thank you for voting!');
})
worn rivet
shut ibex
#

discordbots webhook don't work with discord webhooks

worn rivet
#

So what, i must do?

shut ibex
#

you'll have to code your own webhook receiver

worn rivet
#

Pls ready webhook thanks vote code ❤️

balmy hamlet
#

omfl

#

no one is gonna give you that code

#

what kind of dev are you

#

and try to use google translate

#

it can do better than Pls ready webhook thanks vote code heart

#

huh

vapid cape
#

the problem is that webhooks depend on where your bot is hosted, so you cant make a video tutorial for every single host

#

like your own computer? then you will need to port forward your router

#

ah so then you should have some experience with servers

#

you need to create a webserver to receive webhooks from top.gg

#

top.gg's official libraries can also do that for you

#

yes

#

likely your server's IP address and webhook port

#

and afaik, the library sets up a /dblwebhook path as default

#

so the full url should be http://YOUR.IP:PORT/dblwebhook

#

unless you change the webhook_path option

#

just post here, someone will help you

echo salmon
#

api down too?

median badger
#

the sites down so yes

echo salmon
#

not necessarily yes

#

but thanks

#

nvm i got a connection?

jaunty steppe
#

/bots/{bot.id?}/votes Is this for the month's votes, or just the last 24 hr's?

#

I need a way to get every user that's voted in the last 12h without having to GET that thing at 50 requests per minute which would take about 38 minutes to get it all

#

I mean i could just write it to a DB but that would be really inefficient as it means i have to get a webhook too

gloomy fractal
#

Its the entire month iirc

jaunty steppe
#

mkay

#

Ill go with webhook then

restive otter
#

Who know how to make the bot 24/7????

#

Pls

vapid cape
restive otter
#

What does "API" means?

vapid cape
restive otter
#

How to use api in discord.js Thonk

restive otter
#

@restive otter depends on the api but this channel is for the top.gg api only

#

If thats what you need help with theres an example pinned i think

#

also

restive otter
#

Ok

shrewd turtle
#

When it asks for a webhook auth password in the code for webhooks, what does that mean? and how does this discord webhook url get broken up into http://${hook.hostname}:${hook.port}${hook.path}

lusty hornet
#
-e const axios = require('axios')

axios.post('https://top.gg/api/bots/645737776783949873/stats', {
   headers: {'Authorization':'myDBLToken'},
  data: {
     server_count: mailbox.client.guilds.size
  }
})
#

This still returns a 401

#

not sure whats going on

#

please ping

willow spindle
#

your dbl token is invalid @lusty hornet

lusty hornet
#

i already tried resetting

#

still same thing

willow spindle
#

i suggest use official dbl library

lusty hornet
#

eh

willow spindle
lusty hornet
#

yeah i know but if i can avoid another package i will

#

its just a request idk why it wouldnt be working. token is fine.

#

ill reset it for the 3rd time lol

#

Yeah same thing

#

This is the right token right

#

under that

devout cairn
#

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

Can you see with this how many times your bot in invited by the top.gg page

worn rivet
restive otter
#

You should pry click the link if you’re unsure :)

It’ll help you

worn rivet
#

Yeah, i know, but i read all of api, and i still don't know what to write there.

restive otter
#

just enter the url where you want the webhook to be sent to

#

im trying to think of a way to explain it

#

basically

#

when a vote happens it send a request to the url you put there

#

the auth you can put whatever you want just make sure its hard to guess because thats how youll be able to tell if the request is real

worn rivet
#

const Discord = require("discord.js");
const DBL = require("dblapi.js");
const client = new Discord.Client();
const dbl = new DBL('hide', client);
const bot = new Discord.Client({disableEveryone: true})

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

#

@kind trench Mamy problem ;b

kind trench
#

Hmm

#

A jaki?

#

Po za tym że heroku crashuje co kilka godzin?

worn rivet
#

Że na top.gg nie ma liczby serwerów 😭

kind trench
#

No wiem 😦

#

A czm?

worn rivet
#

nwm, próbuję włączyć

kind trench
#

Ok

worn rivet
#

Nie ruszaj ustawień takich nowych, co siępojawiły

kind trench
#

ok

worn rivet
#

Bo tam to jest zepsute, a może być gorzej

#

What is dbl token?

bitter crag
#

Wchodzisz na top.gg, klikasz "edytuj" zjeżdżasz na sam dół i masz token

worn rivet
#

No wm, ale mam w logach konsoli, że zły token ;/

bitter crag
#

;/

#

Regenerate token

worn rivet
#

no kk,

#

Ciągle zły

#

ReferenceError: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 is not defined
at Object.<anonymous> (C:\Users\filip\OneDrive\Dokumenty\Strona titona\test.js:2:21)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

bitter crag
#

:v

worn rivet
#

Ooo wm

#

Dałem to w nawiasie i śmiga 😄

kind trench
#

Jeej

#

😄

worn rivet
#

Teraz kolejny problem ;/

kind trench
#

To jaki problem?

worn rivet
#

🤦🏻

bitter crag
#

Tak ma być ;)

worn rivet
#

To nie może być na localhost

#

Uhmmm, teraz tylko nwm czy to działa 😐

kind trench
worn rivet
#

da

kind trench
#

A jak?

worn rivet
#

const Discord = require("discord.js");
const DBL = require("dblapi.js");
const client = new Discord.Client();
const dbl = new DBL('hide', client);
const bot = new Discord.Client({disableEveryone: true})

dbl.on('posted', () => {
console.log('Server count posted!');
})
@worn rivet

kind trench
#

No ok, ale do dbm przecież tego nie wstawię

worn rivet
#

No wiem, i dlatego top.gg zajmuje się ja.
To się da wstawić do dbm.

kind trench
#

To... weź to zrób, ja nie umiem 😄

worn rivet
#

Umm

#
const DBL = require('dblapi.js');
const dbl = new DBL('my token', { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

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

erm yea

#

whats the problem

worn rivet
#

Console reply me

true talon
#

yes this is normal

worn rivet
#

So, how to get ip?

true talon
#

you should know it

worn rivet
#

But public or private

true talon
#

it can be your glitch project link if you use glitch

#

public

worn rivet
#

Ok, i don`t use glitch

true talon
#

k

worn rivet
#

I will check it

true talon
#

what you use to host your bot

worn rivet
#

heroku

true talon
#

wait a sec

worn rivet
#

k

true talon
#

for heroku you just put https://[your heroku project link]:5000/dblwebhook

worn rivet
#

Okey,

#

But heroku project with bot, or with this script?

true talon
#

bot

worn rivet
#

ok

kind trench
#

:/

true talon
#

what link u used

#

show your link

true talon
#

no

#

this one

worn rivet
#

I try, but it still not work

true talon
#

in the url field, put the heroku link I just sent

worn rivet
#

ok

true talon
worn rivet
#

ok

true talon
#

then click save and then test

#

it should work

restive otter
#

Hmm

#

Thanks @true talon

true talon
#

for what

restive otter
#

I was waiting for someone to explain this from many days but no one replied

true talon
#

oh

restive otter
#

Only U did

#

Tysm

true talon
#

np

shrewd turtle
#

@true talon Im having issues with the webhook, you can use this for displaying votes in a server channel right? and how can you use the webhook code and server count code at the same time?

true talon
#

server count code is automatic, you dont need to worry about that one

shrewd turtle
#

yea

#

Im just having issues running the webhook code and the server count code at the same time

#

it displays errors whenever I try

true talon
#

as soon as you provide your client here

worn rivet
#

Ehh, and now what?

shrewd turtle
#

ahh okay

true talon
#

click the test button and see if it works

shrewd turtle
#

okay

worn rivet
true talon
#

yes

#

click the test button and see if it works
@worn rivet

shrewd turtle
#

so can you use discord webhooks for this well?

true talon
#

no

shrewd turtle
#

is it for console log?

true talon
#

yes

#

it logs a user id

shrewd turtle
#

okay cool

true talon
#

then you can do what you want with it

shrewd turtle
#

cool

worn rivet
#

It doesn't work ;/

true talon
#

f

restive otter
#

It didnt worked for me when i vote @true talon

#

whats the code for vote?

#

dbl.webhook.on(vote => {
console.log("test")
})

true talon
#

you need your bot to get approved

restive otter
#

Its approved

true talon
#

no

restive otter
#

🤨

true talon
#

you're not green

#

and your bot need to be here

#

and its not

restive otter
#

A min

languid plaza
#

see its approved

restive otter
#

Green name ^

true talon
#

you are not @restive otter

restive otter
#

Zoey is my account

#

Bot has been submitted by Zoey

true talon
#

why dont talk with it

restive otter
#

Because i get many dms in this account

#

Cant ignore dms :/

#

Website isnt working i cant take developer role

#

Whenever try to add my account as owner it refreshes the page

willow spindle
#

you didn't submitted any bot

restive otter
#

🤦‍♂️ oof