#topgg-api

1 messages · Page 109 of 1

rapid kettle
#

Yes

dreamy skiff
#

awww

#

does it also apply for webhooks?

rapid kettle
#

Yes

dreamy skiff
#

ok

restive otter
#

I just changed my vps.
My webhook is not recieving anything anymore, eventhough I changed the webhook URL on dbl's page to my new IP adress.

This is my code:

require("dotenv").config();
const _dbl = require("dblapi.js");
const dbl = new _dbl(
    process.env.TOKEN,
    {
        webhookPort: "5050",
        webhookAuth: "my_password",
    },
);

dbl.webhook.on("ready", hook => console.log(hook)); // this always works => { hostname: '0.0.0.0', port: '5050', path: '/dblwebhook' }
dbl.webhook.on("vote", vote => console.log(vote)); // I never recieve this.

In dbl settings:

Webhook URL: http://ip/dblwebhook
Authorization: my_password
#

Please ping me if you're able to help me. 🙂

plucky lance
#

Check ur firewall if port 5050 will be dropped

soft salmon
#

For the Widgets tab I input it in index.html but now my website shows as Not secure

#

Any idea how to fix that now?

#

It had a SSL Cert before I input it in index.html

plucky lance
#

Because images or other content is being fetched by a different domain

soft salmon
#

What do I put on the DNS then?

plucky lance
#

It doesn’t mean it’s „insecure“

soft salmon
plucky lance
#

Click on it and read the description

soft salmon
plucky lance
#

Do u even use a ssl connection?

soft salmon
#

Yes

#

Cloudflare Full

#

I need to input something else on the DNS since of the widgets part in index.html

#

But I don't know what to input since of that.

plucky lance
#

Dunno what u mean
The domain name system has nothing to do with ur html file

soft salmon
#

wait one sec

plucky lance
#

As I said:

Because images or other content is being fetched by a different domain

#

Means a site can be shown as note 100% secure because it fetches content from different site

#

The browser doesn’t check the other sites for a ssl connection it just says it’s insecure

#

If ur browser shows not secure in general it’s just trash

soft salmon
#

It's chrome

plucky lance
#

Just proxy the widget (image) and the issue is gone

#

If this is the issue.
I dunno since I can’t check it

soft salmon
#

How do I make it show the amount of servers my bot is in on the bot page?

soft salmon
#

Sorry just new with a bot getting approved on top.gg so don't know what I need to do lmao.

night fern
#

@soft salmon read api docs on website

soft salmon
#

I don't get it.

night fern
#

well

soft salmon
#

I'm a bit dumb when I'm tired

night fern
#

i had one code which actually worked but i lost it

#

and the new one is not working ;-;

#

ill have to spend some time testing and coding it

soft salmon
#

K.

quartz crag
#

!join

plucky lance
#

How do I make it show the amount of servers my bot is in on the bot page?
@soft salmon Save the amount of guilds in your bot application into a file or database.
Probably with a timer refreshing the value every X hour/day etc.
Fetch the file/database on your website and that’s it.

rapid kettle
#

No

#

he means post it to the top.gg API

plucky lance
#

Oh lel

#

Well if so just do a simple curl request to the top.gg endpoint including the header (API token) and the server_count field as JSON string.
Method needs to be POST as u can see in the docs.
Just create a cronjob running the task every 6 h for example.
But you still need to get the amount of servers from somewhere.
For example from a file or database, probably a file - easier and faster.

#

Easy to do in each language, JS, PHP, batch, shell etc.

cursive steppe
#

I've added the code in my bot, so when will it post server count on the website?

plucky lance
#

It should update as soon as u send the post request

charred zodiac
#

how do i make my bots status not disapear after awhile? heres my code:

client.once('ready', () => {
    console.log('Quack!');
    client.user.setActivity("Your Servers!", {
        type: "WATCHING",
      });
sullen nymph
#

This channel is for help with top.gg API

plucky lance
#

Add a timer which checks the bot status and if it’s different to the one u wanna have, update it.

charred zodiac
#

@plucky lance how would i do that, can you dm me?

plucky lance
fringe panther
#

where can I find my DBLtoken?

cyan wyvern
fringe panther
#
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
#

what does the webhook do?

#

I tried using the example in the docs

#

but i tried voting and nothing happens

fringe panther
#

"To activate the webhook, navigate to the edit section of your bot and set the webhook URL to something that points to your bot's server. This could even be the bot's IP"

#

how do i do this?

hazy venture
#

What bot scopes do I need. I currently have
-bot
-identify
-connections

Enabled. Would I need any others?

sullen nymph
mortal drift
#

can anyone help me please

#

The awardbot n/a

#

i wanna do it like

#

tickety 19k servers

#

how can i do it?

sweet sandal
#

you need to have a bot on the website and go to the api section on the website

pastel light
#

Does this work for the auto server posting? and yes im importing it

zenith elm
#

how can i put the amount of servers the bot is in on my bot's profile?

jaunty plank
zenith elm
#

i still dont get it

#

im probably just dumb

jaunty plank
#

well, what language do you use

zenith elm
#

js

jaunty plank
#

you can just install dblapi.js
npm install dblapi.js

then this is the basic example of what needs to be run

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

the top.gg token listed on the 4th line can be gotten from
https://top.gg/api/docs#mybots

#

the library will pull your guild count from the client and post it every 30 minutes

zenith elm
#

you can just install dblapi.js
npm install dblapi.js

then this is the basic example of what needs to be run

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

the top.gg token listed on the 4th line can be gotten from
https://top.gg/api/docs#mybots
@jaunty plank i put this in my code?

jaunty plank
#

Well, the parts you dont have.
Obviously don't need to get discord.js again or make another discord client.

restive otter
#

.

nova sierra
#

i would like to ask does vote reset at 12am utc on first day of each month?

soft salmon
scarlet cobalt
#

One message removed from a suspended account.

soft salmon
#

Oh I searched that in my node package manager

#

Nothing showed up

#

except fake one

jaunty plank
#

Its the one listed in the docs

#

npm install dblapi.js

soft salmon
#

my host doesn't allow npm install or that they only allow npm package manager that has a bunch of them and shows them but they don't have some that I need like the dblapi.js

jaunty plank
#

Not sure why the lib isn't on npmjs.com
The library is pretty simple if you go to the github and just use the code itself

soft salmon
#

Yeah I will have to add it in package.json my host just said.

stiff ingot
#

npm i github:top-gg/dblapi.js

jaunty plank
#

Weird host you have there

soft salmon
#

they don't allow that either @stiff ingot

#

@jaunty plank It's pebblehost

jaunty plank
#

Ah overpriced for the resources

stiff ingot
#

do it in an empty directory and inspect the package.json that is created

soft salmon
#

$3 over priced for 1gb ram?

stiff ingot
#

then modify your current one as necessary

jaunty plank
#

The give like .2 of a cpu

soft salmon
#

Yes but a bot doesn't use much CPU

#

CPU Usage = 0%

jaunty plank
#

But you could get a whole one for the same price with 1 gig of ram from any other provider

soft salmon
#

I don't have money on me rn.

jaunty plank
#

With more bandwidth and storage

soft salmon
#

I got -£1.00 so can't afford one

stiff ingot
jaunty plank
#

Lucky bois

#

I max out my cpu currently quite a lot :(

soft salmon
#

I don't since pebble use a xeon that is a good xeon ngl

stiff ingot
#

i want a gpu accelerated vps that isnt $100000

jaunty plank
#

I need gpu acceleration too

#

My bots on a ryzen system 🤷‍♂️

#

More single core performance

stiff ingot
#

ai powered censorship bot

#

i want the gpu to accelerate the speed of evaluation

jaunty plank
#

Ah, I do rendering. Looking to move to opengl sometime in the next few months

stiff ingot
#

we should probably move somewhere else

jaunty plank
#

Psh mods are not looking ;)

stiff ingot
#

in any case I am using NLP to analyze phonemics and context to find bad words rather than a simple replacement filter

jaunty plank
#

Sounds exciting

stiff ingot
#

i am also harnessing OCR to look at ascii art and attachments

#

but I need to figure out how to scan videos quickly

#

i'll probably also extend the OCR to include emotes

soft salmon
#

then modify your current one as necessary
@stiff ingot I had done this but now bot won't start up

stiff ingot
#

@stiff ingot I had done this but now bot won't start up
@soft salmon i can't see how an npm package would make the bot stop working

soft salmon
stiff ingot
#

show me more of the package.json

soft salmon
stiff ingot
#

ah you pasted a whole new block

#

so remove everything after the comma that is highlighted red (and the comma too)

#

so everything after line 34

#

and then in between lines 22 and 23 add a line containing ```
"dblapi.js": "github:top-gg/dblapi.js",

#

@soft salmon does that work?

soft salmon
#

lemme test

#

Bot started up

stiff ingot
#

no problem

soft salmon
#

right lets see if this works

#

Any idea how to fix?

jaunty plank
#

initilize dbl after client

soft salmon
#

I did

jaunty plank
#
const Discord = require("discord.js");
const client = new Discord.Client(); // this before
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client); // this
soft salmon
#

oh yeah forgot to do const client

#

dumb me

raw pike
#

How do I show the bot's server on top.gg discord.js version v12

sweet sandal
raw pike
#

thank you

soft salmon
#

any idea how to fix my error?

sweet sandal
#

you have more than 1 const client =

soft salmon
#

Yes

sweet sandal
#

you need to change the name of one of the clients to something else

#

they can’t have the same name

soft salmon
#

k

jaunty plank
#

you shouldnt do that, you want your const client to be the actual bot client

soft salmon
#

I got those for that

#

you shouldnt do that, you want your const client to be the actual bot client
@jaunty plank So any fix to it then? should I change the top.gg one to bot instead of client?

jaunty plank
#

there is no top.gg client, there is your bot client and the dbl initilization(called dbl), which takes in your bot client

soft salmon
#

const dbl = new DBL('Your top.gg token', client);
I meant this should I change where it says client to bot?

jaunty plank
#

if you named your bots client bot

#

whatever Client is called

soft salmon
#

change that Discord.Bot

jaunty plank
#

discord clients cannot be initlized before requiring Discord

soft salmon
#

How the hell am I supposed to fix this then?

#

All i want is to post my server count on the bot's page

jaunty plank
#
const Discord = require("discord.js"); //this must happen before the next line
const client = new Discord.Client(); // this must happen before the last line
const DBL = require("dblapi.js"); // this must happen before the last line
const dbl = new DBL('Your top.gg token', client); // this must happen after the three above lines

restive otter
jaunty plank
#

you have to do things in order

#

do you have the presence intent @restive otter ?

soft salmon
restive otter
#

Yes

soft salmon
#

that's in order though @jaunty plank ?

jaunty plank
#

not at all

rapid kettle
#

Oh my god

#

I just had a stroke looking at that code

jaunty plank
soft salmon
#

k

rapid kettle
#

And the DBL is trying to use client

#

which isn’t bot

soft salmon
#

Yeah just changed that now

jaunty plank
#

he just named his client to bot, even after i said dont 🤷‍♂️

soft salmon
#

that fine?

jaunty plank
#

its in the right order for top.gg, not sure if its in the order for commando to work too 🤷‍♂️

restive otter
#

do you have the presence intent @restive otter ?
@jaunty plank What should I do for this?

jaunty plank
soft salmon
jaunty plank
#

you cant declare client twice

soft salmon
#

how tf can I fix it then

#

I wanted to do one SIMPLE THING

jaunty plank
#

delete the client line you added

soft salmon
#

this: const client = new Discord.Client();

#

?

jaunty plank
#

yep

soft salmon
#

k

#

trying now

jaunty plank
#

then everything else goes after const client = commando client

soft salmon
jaunty plank
#

YES

#

things go in order

#

dbl cant be initilized until client is

#

because dbl depends on client

soft salmon
#

then everything else goes after const client = commando client
@jaunty plank that doesn't make sense

#

at all

jaunty plank
#

why not

#

because they need to go after it

#

as i said 6 times

soft salmon
#

done

#

lemme try

#

Fucking doing the same thing

#

move const discord = require discord.js thing up above?

jaunty plank
#

discordjs needs to be required above client and dbl initlization

soft salmon
#

done that now

#

Doing SAME THING

#

fucking hell

jaunty plank
#

can you show me all your code?

soft salmon
#

Send the index.js file here?

jaunty plank
soft salmon
#

k

raw pike
#

I did things to show the server, but the console is not getting a notification. Help

soft salmon
#

oh wait

#

fuck

#

sorry for ghost ping Woo

#

that had my token

jaunty plank
#

kek

soft salmon
#

dumb me sometimes

stiff ingot
#

just regen your tokens

jaunty plank
#

regen your token

#

hastebins are public

soft salmon
#

done regenned

#

Did you see the code though?

jaunty plank
#

you didnt move dbl initliziation below where you initilize client

#
const client = new CommandoClient({
  commandPrefix: prefix,
  owner: '520377453668204545' // change this to your Discord user ID
});


#

thats your client line

#
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);
#

goes below that

soft salmon
#

oh dumb me

#

Shows that now

jaunty plank
#

did you update your token?

soft salmon
#

Oh yeah

#

Dumb me again KEKW

#

right starting bot with updated token

jaunty plank
#

it might take 30 minutes to an hour for guild count to actually show on your bots page from the first post due to the caching.

soft salmon
#

Thanks though Woo!

jaunty plank
#

ay

#

we got there in the end 😄

#

@raw pike so, what language are you using?

soft salmon
#

Yep! Thanks a lot Woo!

raw pike
#

javascript v12

soft salmon
#

@jaunty plank It's already showing the guild count on the bot page

#

quick

jaunty plank
#

do you have these two events

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

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

yeah, just gotta give that warning just incase it takes longer. sometimes cloudflare likes to cache things for awhile @soft salmon

soft salmon
#

Yeah cloudflare like that

raw pike
#

@jaunty plank yes available

jaunty plank
#

these two aswell?

const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

raw pike
#

available

jaunty plank
#

I'm not sure then, might have to wait till someone else comes around sorry.

raw pike
#

@jaunty plank Actually my problem is that there is no notification like in ChoiceSquiddy.

#

Do you want me to post source code?

jaunty plank
#

the notification just happens in your bots post event in console;

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

if its not notifying, or giving an error, I have zero clue how to debug it.

raw pike
#

I am writing the necessary things, it does not give an error but it does not give a notification.

limpid bane
#

idk whats wrong

jaunty plank
#

looks like your fetching a message that was deleted

#

probably a better question for #development
this is more for top.gg api questions not discord api

limpid bane
#

oh okay

restive otter
#

I get this error when trying to fetch server count

#
const dbl = new DBL('my topgg token', client);
dbl.on('posted', () => {
  console.log('Server count posted!');
})```
#

that is my code

#

can someone help me?

knotty lark
#

const DBL = require("dblapi.js");
const dbl = new DBL(settings.topggtoken, client);

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

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

@restive otter This is my code, and it works for me, maybe try and refresh your topgg token and try that

#

@jaunty plank try adding this piece to debug it

dbl.on('error', e => {
 console.log(`[TOP.GG] Oops! ${e}`);
});
knotty lark
#

im sorry, I read the messages wrong...

#

I thought you only had the posted event and were trying to debug it

#

I need sleep... or coffee

restive otter
#

ah i figured it out

#

the token cut off one letter on the my bots page

#

so i went to the webhooks page

#

and got it from there

restive otter
#

I need help setting up vote updates on top.gg while hosting on heroku

orchid cargo
#

Is it possible to give reward to user if user votes my server (instead of my bot)?

restive otter
#

Ok im new to this can I get help please

#

Okie

torn vessel
#

how to make this counting

frosty quail
#

how to get port path and ip and stuff on glitch?

stray hatch
#

how can i track server votes

crisp merlin
#

brug

cursive steppe
#

I've added api in my bot and it's still not posting server count

#

Do i have to do something else also?

#

Ping me when answered

cyan wyvern
#

seem on_dbl_test is not working for me (any python user can help me pls)

fossil aspen
#

I've added api in my bot and it's still not posting server count
@cursive steppe have you got the intent on for server members ?

cursive steppe
#

Yes

#

Both intents are on

cursive steppe
#

I don't know what's next

torn vessel
#

i cannot server count 2

left totem
#

i added the bot to my server but it doesnt show in my profile?

grave sundial
#

i must have missed something. dblapi.js is no longer maintained is there going to be another way to get bot/user data? pls @me

sullen nymph
#

@grave sundial Someone might take over but for now I'd suggest sending requests manually

grave sundial
#

ah

zenith elm
jaunty plank
#

Pretty simple, follow the librarys instructions listed on the api page

zenith elm
#

here?

jaunty plank
#

If your using go yeah

zenith elm
#

the github link doesnt work tho

jaunty plank
#

Not sure if the url changed or what

plucky lance
#

Simply use curl (POST method) to post a JSON string {"server_count": value} to the API https://top.gg/api/bots/<bot.id?>/stats as u can see in the docs: https://top.gg/api/docs#bots
And don't forget to add the header --H "Authorization: token"
Can be done in any coding language
A cronjob every X minutes, hours (whatever) ... done

jaunty plank
#

can it be done in scratch dblWink

sturdy moss
#

Puta q oferton

restive otter
#

how to get vote updates without using webhooks?

plucky lance
#

Just send a curl request to the DBL API endpoint https://top.gg/api/bots/<bot.id?>

#

It will return a bot object

#

Including points (montly votes)

restive otter
#

how to do in discordjs?

pale fulcrum
#

@sturdy moss not very nice

restive otter
#

How would I check if a user (fetched from a specific ID) shares a server with my bot without using the user cache?
I'm under the impression it's impossible but it would be helpful if I could
(discord.js, no intents, ping me when responding)

restive otter
#

I need help setting up webhook vote updates on top.gg while hosting on heroku. Can someone help me? (please ping)

jaunty plank
#

I really need to start writing down the rules for the diffrent hosts like heroku and glitch and repl.
Pretty sure for heroku its the same as the example but you use the PORT environment variable and the heroku project url.

sturdy moss
#

Flood

main shoal
#

-play senın ananı babanı bacını

#

-play

oak spruce
oblique kestrel
#

@cursive steppe try client.guilds.cache.size. For me this is working

radiant peak
#

why doesnt the servers update? my bot is in more than 160 servers rn, I have members intent, my code is in python

uncut granite
#

does anyone knows how the api works for .Net?

uncut granite
#

@jagged escarp you know how it works right?

jagged escarp
#

um I guess haha

#

whats up

dusty wraith
#

just check the docs

#

docs make you big brain

restive otter
#

@radiant peak how do I get my bot in more servers

restive otter
#

how do I get my bot in more servers
@restive otter people like it and they add it

manic crescent
#

Is there a express-handler for top.gg webhooks? (ping me if there is)

#

Like the Laffey NPM-Package for another botlist its a express-handler for another botlist's webhooks.

rapid kettle
#

You don’t need a handler?

manic crescent
#

You kinda do if you want to also have a website in the same port

rapid kettle
#

I mean can’t you just make a route on the site?

manic crescent
#

Just.. stop it.

#

You think you're helping but you're not.

rapid kettle
#

ok then

manic crescent
#

Just, is htere a express-handler for top.gg webhooks? Like Laffey's.

rapid kettle
#

no idea tbh

median badger
#

No there isn't, make your own route

#

Just console log req.body and you have the variable names

next turtle
white wyvern
#

Yea? How can I have my bot Page have the server count

plucky lance
errant crater
#

@zenith elm - Resend invite! I cleaned out my list. You were a casualty:(

fluid rock
rapid kettle
#

yes?

fluid rock
#

not work on vote

rapid kettle
#

what did you put as your DBL webhook url

#

and is your webhook auth the same as in the code

fluid rock
#

ouiiii

#

Yes

rapid kettle
#

where are you hosting?

fluid rock
#

Purecpu

#

i have a vps

rapid kettle
#

so you have a public ip?

fluid rock
#

yes

rapid kettle
#

http://vps.public.ip.address:5000/dblwebhook

#

oh god

#

@trail sigil remove ip pls

fluid rock
#

?

rapid kettle
#

thats your VPS ip

#

you can be DDoSed

fluid rock
#

ok

trail sigil
#

zoomeyes sorry i was afk

fluid rock
#

do you have any idea why it doesn't work?

rapid kettle
#

is the URL correct?

fluid rock
#

yes

#

not work

#

😕

plucky lance
#

Port 5000 opened for incoming TCP connections?

fluid rock
#

idk

#

How can I check it?

#

@plucky lance

plucky lance
#

Depends on the OS and which firewall it/you uses

fluid rock
#

I don't have a firewall

plucky lance
#

Which OS does the VM has?

fluid rock
#

kvm debian 10

#

@plucky lance

plucky lance
#

Login via SSH and check if for example IPtables is active by default

#

sudo iptables --list-rules

fluid rock
#

@plucky lance

plucky lance
#

Hmm incoming connections are accepted

#

Even if that’s a huge security risk... not gonna discuss about that

fluid rock
#

So why the votes are not received by my vps

plucky lance
#

Did you try the test button?

fluid rock
#

Yes

#

not respond

fluid rock
#

How do I whitelist top.gg on my vps?

plucky lance
#

back... got some disaster going aroung

fluid rock
plucky lance
#

someone else was complaining yesterday already, probably the webhook test doesn't work atm, idk

fluid rock
#

It's my host who blocks a lot of things we did tests while it worked and they told me to whitelist top.gg
so my code and authorizations are good

#

the webhook test works

plucky lance
#

just check if you can access the webhook URL in your browser, not receiving an error

royal dock
#

does work

#

i tested it 5 minutes ago

#

but the first try takes 5 minutes

royal dock
#

Question:

#

Is the authorization value in the request header?

rapid kettle
#

Yes

marble quiver
#

How can I do a command that is Exclusive for voters?

#

Im using Node.js

rotund pecan
#

Save in a database if they have voted or not, then proof by executing the cmd if their database entry is true or false....?

thick cosmos
#

so i want to make a bot voting system, and i wonder what the API needs to update or vote for the System.

restive otter
#

"For the System"?

thick cosmos
#

for the Top GG API.

#

i got when the user already voted it literally says that but now i stuck at the actually vote system

restive otter
#

Like vote for the bot when they use that command?

thick cosmos
#

yes

restive otter
#

I don't think that's possible

thick cosmos
#

wait was it possible to make a System to vote for a server? but not for the bot?

#

or i am just really stupid rn?

restive otter
#

It's not possible

thick cosmos
#

for server and bots?

restive otter
#

This could be abused if it was possible but it isn't

#

Making accounts to easily everytime and you could maybe have 300 users voting every 12 hours which it why it isn't possible

thick cosmos
#

but is it like possible when the user votes on the bord to somehow get it?

restive otter
#

Possible thing, maybe top.gg can just put an endpoint that let's you do a post requestes to actually vote

thick cosmos
#

because i did it on a other Server and the same time i voted i got Server Coins on the Server

restive otter
#

DBL api can be used to receive votes

thick cosmos
#

but not actually vote?

restive otter
#

Nope

thick cosmos
#

aye aye

#

thanks for the help xD

restive otter
#

Np

cold creek
#

How to authentication

willow spindle
#

what

restive otter
#

@cold creek put your dbl token on header

cyan wyvern
#

How to webhook_path

cold creek
#

@restive otter ok

sullen nymph
#

Ok

#

Petition to rename webhook_path to webhook_route

cold creek
#

@restive otter didn't understand in which header

sullen nymph
#

rtfd

#

Shortly, if you send requests manually, Authorization header

balmy abyss
#

is there any way of testing the vote integration?

golden adder
#

@balmy abyss in your bot edit page, go to the "webhooks" tab and click "test"

balmy abyss
#

Thanks

ember swan
#

hi

#

as my bot has just been verified,

#

i try to use the dbl api

#

but when i lunch my program, it told me that "on" is not defined

#

can someone help ?

golden adder
#

@ember swan show your code

ember swan
#

Actualy i cant, i’ll told you next to 6pm (sorry for my english im french😅)

ornate pelican
#

but when i lunch my program, it told me that "on" is not defined
@ember swan it usually means you're trying to call an event listener that isn't an event listener in javascript

#

if you could send me the snippet I could help you debug it

ember swan
#

Ok i’ll do next to 6pm

ornate pelican
#

allright

golden adder
#

@ember swan tu peux tester ton code en allant sur ta page de bot > "Edit" > l'onglet "Webhooks" > "Test"

ember swan
#

Ok merci ^^

golden adder
#

Comme ça tu n'as pas besoin d'attendre 12h pour tester ton code.

ember swan
#

Ok merci bcp ^^

#

Je regarderai ça vers 18h

golden adder
#

Ah d'accord j'avais pas compris 😅

ember swan
#

x)

rapid kettle
#

DBL -POST request-> Your server

uneven aspen
#

can anyone tell me what is the use of api

#

i dont know anything about api

jaunty plank
#

The top.gg api can be used to post your server count to top.gg so it can be displayed properly.
Webhooks to receive vote events.
And a few requests for bot info and vote info.

uneven aspen
#

oh thanks for the info @jaunty plank

jaunty plank
#

You use the public ip, and portforward the ip on your router

uneven aspen
#

how can i set up an api.

jaunty plank
#

The webhook is passed for free anyway. Its just an http request.

#

Which part? The portforward? Or getting the public ip

#

Type into Google "what's my ip"

Google will tell you

#

Discord webhooks are not compatible with top.gg webhooks

#

portforwarding depends on your specific router, that site has guides for all the major routers

uneven aspen
#

@jaunty plank Thanks

oblique axle
#

--> Question. How can i make the bot upvotes to be send in a specific channel?

jaunty plank
#

get the webhook and then send them to that channel

oblique axle
#

lol im dumb

#

thanks anyways

empty creek
#

get the webhook and then send them to that channel
@jaunty plank how to do that

#

Can you tell me steps

jaunty plank
#

webhooks are only available once you have an api token, which you only get when you have an approved bot

empty creek
#

Ok

#

How to get bot developer role

jaunty plank
#

once you have an approved bot

empty creek
#

Ok

fast meteor
#

is the thing where some bots show how many servers theyre in to do with the api?

#

i.e do i have to do something with the api to make this happen

#

or is it all on the website

#

ahh no forget it i found the solution

ember swan
#
const dbl = new DBL('tkt j'ai mis mon token', client);

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

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!`);
});``` @golden adder
#

voila le code

fair sparrow
#

once you have an approved bot
@jaunty plank how do I do that?

jaunty plank
#

how to submit it? or how to approve it?

fair sparrow
#

Both

jaunty plank
#

to submit

fair sparrow
#

I’ve already submitted my bot

jaunty plank
#

and it will be reviewed by a bot reviewer in 8+ weeks

#

you said both

#

🤔

fair sparrow
#

Thought it was through discord

#

Lmao my bad

#

Buttt

#

What about the approve part?

jaunty plank
#

it will be reviewed in 8+ weeks

fair sparrow
#

Mmmk

jaunty plank
fair sparrow
#

Yup

#

I might violate rule 6.... time to fix that

golden adder
#

@ember swan dac... et quelle était l'erreur déjà ?

ripe ether
#

I want to test if my vote works, but I can only test it once every 12 hours, is there a way to send sort of a test so I can develop it much faster?

jaunty plank
#

On your bots edit page, in the webhook section there is a test button

ember swan
#

but when i lunch my program, it told me that "on" is not defined

#

@golden adder

#

Quand je lance le bot ça me dit que ‘on’ est undefined

ripe ether
#

and it will send a fake vote @jaunty plank ?

jaunty plank
#

Yep

ripe ether
#

alright, thanks!

grim anchor
bronze kindle
#

c.help\

#

c.help

grim anchor
#

...

jaunty plank
grim anchor
#

nmv

#

i got it

jaunty plank
ripe ether
fair sparrow
#

I’m confused and the documents section is too big for my iPhone screen

jaunty plank
#

no, its the url to your webhook receiver. Also, it wont work until your bots approved

fair sparrow
#

Oh ok also how do I get the receiver?

#

If I need a pc then I’ll ask when it’s my birthday

oblique axle
jaunty plank
#

the basic format
http://ip:port/path
ip is the public ip of the receiver, port and path are defined in the receiver.
the code for all this can be found on the api docs.
https://top.gg/api/docs
@fair sparrow

fair sparrow
#

It’s too big for my phone

#

The tabs on the side almost take up the whole screen

jaunty plank
#

@oblique axle did you fill in the url and auth on your bots edit page?

oblique axle
#

i left URL empty. I don't know what to put in there.

jaunty plank
#

the url to the webhook receiver

#

the basic format
http://ip:port/path
ip is the public ip of the receiver, port and path are defined in the receiver.

oblique axle
#

wait. Where do i put that?

jaunty plank
#

your bots edit page, in the webhook section

oblique axle
#

and then i have to press the test button again or i have anything else to do?

jaunty plank
#

fill in the auth with the auth you blocked out in the screenshot

oblique axle
#

yeah i have filled that

jaunty plank
#

if you have any firewalls on your server this is running on the port needs to be allowed through that

#

if its on a home network it needs to be port forwarded aswell

odd viper
#

why wont it respond

jaunty plank
oblique axle
#

bro i barely understand what ur saying xd

next pendant
#

is there any way to see the number of times a user has voted? or do I have to keep track of this myself

jaunty plank
glossy basin
#

would this be correct?

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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")
    
    async def on_guild_post(self):
        print("Server count posted successfully")
jaunty plank
#

I feel like you need a listener for each event

#

and i belive you need to add the cog

#
def setup(bot):
    bot.add_cog(TopGG(bot))

fast meteor
#

with the on_dbl_vote, thats only for your bot right? im confused.com about this as theres a bot keyword in the data

jaunty plank
#

yes.
I believe they send the bot data with it if you want a single webhook receiver for multiple bots.

fast meteor
#

ahh ok thank

glossy basin
#

and i belive you need to add the cog
@jaunty plank i have that

jaunty plank
#

for each event?

glossy basin
smoky yew
#

what is webhook_path supposed to be? do we need to change it from /dblwebhook or can we just leave it

jaunty plank
#

you can leave it

smoky yew
#

so all i need to change is token and password

sullen nymph
#

Petition to rename webhook_path to webhook_route

smoky yew
#

so for python i can just create a dbl.DBLClient then have a bot.event called on_dbl_vote?

glossy basin
formal sparrow
smoky yew
#

and about how long will it take for the vote to register?

sullen nymph
#

so for python i can just create a dbl.DBLClient then have a bot.event called on_dbl_vote?
@smoky yew Yup. That's mainly why it requires the bot object passed in arguments in the first place

#

(More like I cba to make it optional but let's just say it's intended)

smoky yew
#

and about how long? i made my alt vote a few minnutes ago and no print is getting printed

sullen nymph
#

Should be instant. I suggest using on_dbl_test and the Test button in the webhook settings for easier testing.

Make sure your port is forwarded (if hosting locally) and that no firewall is blocking requests to your machine

smoky yew
#

i'm not hoting locally

#

all i need to change is token and password from the example right?

jaunty plank
#

and put the url in your bots top.gg webhook section, update the auth/password there too

#

if your on a home network you need to port forward.

#

if you have a firewall you need to also open the port there

smoky yew
#

i'm on a vps

sullen nymph
#

URL is http://ip:your_port/dblwebhook

#

all i need to change is token and password from the example right?
yeah

smoky yew
#

ok lemme see if i got it right

#

and public or private ip

sullen nymph
#

public

primal heart
#

Pls use be

sullen nymph
#

Whatever you just said, no

smoky yew
#

oh and @sullen nymph using a random test bot to test shouldnt break anything right

sullen nymph
#

As long as you have a valid bot running, yeah

glossy basin
smoky yew
#

hmmm its not firing it i just have

dbl = dbl.DBLClient(bot, 'token', webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@bot.event
async def on_dbl_test(data):
    print(data)

and inside the website
the webhook url is http://ip.sepereated.by.dots:5000/dblwebhook
and the Authorization being the password

anything you can spot here thats wrong?

sullen nymph
#

@glossy basin what does your code look like

#

@smoky yew Make sure no firewall is blocking requests

smoky yew
#

ok

glossy basin
#
import discord
from discord.ext import commands
import dbl


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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")
    
    async def on_guild_post(self):
        print("Server count posted successfully")


def setup(bot):
    bot.add_cog(upvote(bot))
#

@sullen nymph

smoky yew
#

yup it was a problem with the firewall, what data does on_dbl_vote recieve?

jaunty plank
junior sage
#

Ive just gotten my bot on top.gg and idk how to make a voting reward. Ive looked at the api thing and cannot figure it out

jaunty plank
#

use the webhooks

junior sage
#

How?

jaunty plank
#

what language is your bot in

junior sage
#

And what is a webhook?

#

node.js

#

or javascript

jaunty plank
#

webhooks are like web requests, you receive the request to get the info

junior sage
#

ah

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

then on your bots edit page, in the webhook section you set the webhook url and auth to your settings, with the correct IP

junior sage
#

I dont understand the document at all

#

Makes no sense

jaunty plank
#

what makes no sense?

junior sage
#

The whole document

#

Too much to look at

jaunty plank
#

its 7 lines of code

junior sage
#

None of them are 7 lines

jaunty plank
#
const DBL = require('dblapi.js'); //this gets dblapi module
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); //this initlizes dbl to receive webhooks
dbl.webhook.on('ready', hook => { // an event of when the webhook receiver is ready
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); // log the url
});
dbl.webhook.on('vote', vote => { // event for when a webhook is received
  console.log(`User with ID ${vote.user} just voted!`); // log 
});
junior sage
#

Do I just wack that in the script somewhere?

jaunty plank
#

pretty much

#

auth to something reasonable

#

port can stay the same presuming its not in use

junior sage
#

What parts do I need to change to make it work?

jaunty plank
#

well, you can technically get away with just three lines for just receiving webhooks

#
const DBL = require('dblapi.js'); //this gets dblapi module
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); //this initlizes dbl to receive webhooks
dbl.webhook.on('vote', vote => { // event for when a webhook is received
  console.log(`User with ID ${vote.user} just voted!`); // log 
});
#

this will not have a ready event, which isnt a problem presuming you dont need it

junior sage
#

So, where does the thing go?

#

So ppl can get the reward

jaunty plank
#

this code doesnt have a reward system, its just for receiving webhooks.

#

youll have to make a reward system yourself

junior sage
#

So when the webhook is sent how will my bot give the user the vote reward? I dont want to manually do it

jaunty plank
#

depends on what your rewarding

#

and how your rewarding

junior sage
#

When the user votes they will get a crate. Basicly changing the users data

jaunty plank
#

like in a database?

#

just make a database request to add the item to their inventory, or whatever system you have

junior sage
#

Database?

jaunty plank
#

well yeah, only way to store data

#

only good way*

junior sage
#

True

#

I got the code in

#

Ill see if this works

#

Where it says your DBL token here do I put my dbl token there?

jaunty plank
#

yes

junior sage
#

I now have 2 errors

#

line 5 says Expected ')' and saw ;
missing semicolon

And in line 2 Unexpected '9'

jaunty plank
#

whats on line 5 and line 9

junior sage
#

Line 5 is });

#

Im not getting any of this 😭

jaunty plank
#

its just a syntax error, can you give me line 1 to 10?
obviously remove any tokens from those lines first

junior sage
#

there is only 8 lines

jaunty plank
#

in your entire file?

junior sage
#

const DBL = require('dblapi.js'); //this gets dblapi module
const dbl = new DBL(, { webhookPort: 5000, webhookAuth: 'password' }); //this initlizes dbl to receive webhooks
dbl.webhook.on('ready', hook => { // an event of when the webhook receiver is ready
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path}); // log the url
});
dbl.webhook.on('vote', vote => { // event for when a webhook is received
console.log(User with ID ${vote.user} just voted!); // log
});

#

Thats what I put in

jaunty plank
#

copy pasted these lines into my IDE, no issues appeared

#

are you sure you didnt delete something you shouldnt have from your main code?

restive otter
#

the token

#

did you add your token?

junior sage
#

I did put the token in and that's what caused the errors

restive otter
#

ah

#

i see

#

you have to make the token a string

#

like

#

const dbl = new DBL('yourtoken'

junior sage
#

Whats a string?

restive otter
#

it has the quotes

junior sage
#

ah

restive otter
#

so you cant paste your token in without the quotation marks, otherwise it causes an error, its probably a minor mistake on top.ggs side, forgetting to put the quotation marks in the example

jaunty plank
#

in the example it doesnt put a string there, it puts a placeholder

restive otter
#

ik but in the other examples it has 'yourDBLtokenhere'

junior sage
#

It fixed the errors!

restive otter
#

np

junior sage
#

Now how do I make it so ppl can get the voting rewards?

restive otter
#

what rewards are you talking about? also now this is more a development topic, #development

junior sage
#

👌

#

My bot isnt giving me the voting reward ):

#

Is there something wrong?

jaunty plank
#

isnt giving the reward?

#

is it giving the vote notification?

restive otter
#

my bot is 1.600 server but it says 12 here why?

jaunty plank
#

are you posting your guild count?

restive otter
#

Hi

#

I’m new

#

client.on('ready', () => {
setInterval(() => {
dbl.postStats(totalGuilds);
}, 1800000);
}); is this @jaunty plank

jaunty plank
#

is the totalGuilds variable accurate?

restive otter
#

yes

glossy basin
#

if i have this:

token = '<token>'
dblpy = dbl.DBLClient(
            hb,
            token,
            webhook_path='/dblwebhook',
            webhook_auth='<password>',
            webhook_port=5000,
            autopost=True
)

@hb.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on top.gg."""
    print("Received an upvote:", "\n", data, sep="")

@hb.event
async def on_guild_post():
    print("Server count posted successfully")
#

is there anything else i need to do?

jaunty plank
#

you need to fill in both webhook url and authorization

glossy basin
#

with what?

jaunty plank
#

the route to your webhook receiver and the auth you put in webhook_auth='<password>',

glossy basin
#

do i need to create a webhook?

#

@jaunty plank

jaunty plank
#

the library creates a webhook receiver.

#

or if you want to make one with code you can

glossy basin
#

so /dblwebhook there then @jaunty plank

jaunty plank
#

the entire url

#

http://ip:5000/dblwebhook

glossy basin
#

?

jaunty plank
#

ip being the public ip

glossy basin
#

what ip

jaunty plank
#

the public ip of your bot/whatever network its on

glossy basin
#

so this: https://henos-bot.henos.repl.co:8080/dblwebhook

jaunty plank
#

well, your telling it to run on 5000, so youd need to change it in your code to 8080

glossy basin
#

oh

#

so https://henos-bot.henos.repl.co:5000/dblwebhook

jaunty plank
#

you might also have to change the port in code to use the port env var repl gives you, im not exactly sure if repl requires that

#

yes, thats the password you set

glossy basin
#

my bot runs off port 8080

#

and repl doesnt give me an env var

#

@jaunty plank

jaunty plank
#

mky

glossy basin
#

?

jaunty plank
#

glitch and heroku give env vars, since ive never used any of these platforms its hard to keep track of all their little internal rules

glossy basin
#

ok

#

i will upvote my bot now and test it

#

i dont get any output

#

@jaunty plank

jaunty plank
#

you set the port in both your code and url to the same one?
webhook_port=5000,

glossy basin
#

yes

jaunty plank
#

in your console?

glossy basin
#

web view

jaunty plank
#

hmm

glossy basin
#

thats in my uptimerobot monitor

jaunty plank
#

so both repl it and uptime robot are saying that?

glossy basin
#

yes

#

it goes when i comment out the dbl code

jaunty plank
#

repl makes helping for these things so much harder 🤔

#

i'm not sure how repl works, youll have to look at their docs

glossy basin
jaunty plank
#

your overwriting the replit default webserver with the webhook webserver

glossy basin
#

what do i do?

jaunty plank
#

when you vote, does it come up?

glossy basin
#

no

#

neither for test

jaunty plank
#

is your url set to 5000?

glossy basin
jaunty plank
#

you could also try dropping the 5000 from the url all together

glossy basin
#

ok

#

do i remove that kwarg too?

jaunty plank
#

try just from the url from now

glossy basin
#

ok

jaunty plank
#

ay

glossy basin
#

so uptimerobot cant keep it up

jaunty plank
#

potentially those two things are not compatible with each other.
You may need to make a webhook receiver yourself and give it two routes, one for dbl and one for uptime robot

glossy basin
#

actully, uprobot says 502 Bad Gateway

#

so it might be able to ping

#

ill see when that is resolved

#

it will ping in 5mins

#

how do i do that @jaunty plank ?

jaunty plank
#

do what

glossy basin
#

potentially those two things are not compatible with each other.
You may need to make a webhook receiver yourself and give it two routes, one for dbl and one for uptime robot

jaunty plank
#

i am not a python user, or a repl user. no idea how on either

glossy basin
#

ok

#

anyone else?

glossy basin
#

?

granite ore
#

how do i get the stats of a bot using dblpy?

distant crypt
#

This code throws a NoClassDefFoundError

    .token("token")
    .botId("733409243222507670")
    .build();```
restive otter
#

can someone help me with the web processes on heroku to receive an upvote; im using discordjs and im stuck

sullen nymph
#

@granite ore DBLClient.get_bot_info?

granite ore
#

so do i do DBLClient.get_bot_info(user_id)? or wgat

#

@sullen nymph

sullen nymph
#

method used on an instance of the DBLClient class

#

So initialize DBLClient, store it in a variable, use get_bot_info on it

glossy basin
#

can someone who knows the python lib help me?

kind atlas
#

what lib

glossy basin
#

dbl lib

#

@kind atlas

#

python

kind atlas
#

hm

#

i had it on my computer

#

but i forgot the github link

#

wait imma find it for u

#

k found it

#

@glossy basin pm me

frosty quail
#
const DBL = require('top.gg');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
``` what dbltoken?
sullen nymph
#

@glossy basin dblpy doesn't create a handler for the main route

#

Doesn't sending requests to the main URL work?

gaunt steeple
#

so uptimerobot cant keep it up
@glossy basin you know pinging repl instances like this is against their terms of use right, they could come down hard on discord bots like this at any time like glitch did. to quote their TOS:
10. Interfer with or disrupt the Services or create an undue burden on Replit's website or the networks or services connected to Replit's website;
This line in their TOS is basically open to interpretation by repl to mean 'you shouldnt be pinging to get around the fact it shuts down if idle'. Beware!

sullen nymph
#

They don't mind pinging services

gaunt steeple
#

its interesting that their moderators are saying you can

#

i just read so

sullen nymph
gaunt steeple
#

but their TOS basically says at any time we can interpret it as NOT allowed

#

i'd be aware of it, and that they might change their mind if it causes them undue load

frosty quail
gaunt steeple
#

because they dont make money out of these discord bots being hosted for free... they might

fiery spear
#

what request does the server list send for the webhook?

willow spindle
#

POST request to your webserver

fiery spear
#

Well

#

Ive been trying for like half an hour

#

havent received one yet

willow spindle
#

Show code

fiery spear
#

I get post requests from other sources tho

#
app.post('/vote', (req, res) => {

console.log("vote")
res.send("voted")

)}```
willow spindle
#

Did you click test button

fiery spear
#

Ive been doing that for half an hour

#

nevermind

#

suddenly began working like magic

frosty quail
#
const express = require("express");
const app = express();

app.get("/", function (request, response) {
  response.send('hi')
});

app.post('/vote', (req, res) => {

console.log("vote")
res.send("voted")

})

const listener = app.listen(process.env.PORT, () => {
  console.log("Your app is listening on port " + listener.address().port);
});
``` im using glitch.com and ive got this and tried webhook test but its not showing
glossy basin
#

@glossy basin you know pinging repl instances like this is against their terms of use right, they could come down hard on discord bots like this at any time like glitch did. to quote their TOS:
10. Interfer with or disrupt the Services or create an undue burden on Replit's website or the networks or services connected to Replit's website;
This line in their TOS is basically open to interpretation by repl to mean 'you shouldnt be pinging to get around the fact it shuts down if idle'. Beware!
@gaunt steeple the ppl in their discord helped me do it

gaunt steeple
#

yeah, for now theyre allowing it

#

just be aware it may not always be that way

glossy basin
#

ok

#

its once every 30mins too

#

not like once a minute

#

@gaunt steeple can you help with my problem?

formal sparrow
#

@willow sphinx I see that the PR in dblapi.js is approved, will it be merged and it'll be added in the next version soon? Or you can't do that?

glossy basin
#

@gaunt steeple ?

gaunt steeple
#

sorry i cant advise, as i dont use repl

glossy basin
#

ok

feral marlin
#

is there any way to have a event go of when someone votes on the bot?

distant oak
#

Yes check the docs

#

On the topic there is a link

willow sphinx
#

@willow sphinx I see that the PR in dblapi.js is approved, will it be merged and it'll be added in the next version soon? Or you can't do that?
@formal sparrow uh I can't merge because the commit isn't signed

formal sparrow
#

@willow sphinx um, idk anything about unsigned commits, do I have to do something?

formal sparrow
#

Uh, I couldn't really find a good guide to do it for pushed commits, is it even possible or I'll have to make a signed commit and then make a PR?

bronze kindle
#

@glossy basin why dont you use a server like vultr or something?

willow hill
#

does dbl.on_dbl_vote(data) (in python) only work for webhooks?

jaunty plank
#

Yes

halcyon zinc
#

Is there a way to obtain a authorization token for the API without having a bot on the website ?

versed storm
#

What woudl you get a token for if not a bot? Thonk

halcyon zinc
#

For getting user/bot data from the api 🤷‍♂️

versed storm
#

Ah, I guess not.

#

¯_(ツ)_/¯

halcyon zinc
#

Alright, thanks anyways

vital jasper
#

When testing webhooks, I am not getting an Authorization header.

rapid kettle
#

How are you accessing it

vital jasper
#

I have it going to a test webhook url that is sending me the data of the request so that I can see whats up.

rapid kettle
#

I mean the header

vital jasper
#

wdym.

rapid kettle
#

how do you access the header

vital jasper
#

I am sending myself all of the provided headers in the request when its received by the site.

#

None of them are Authorization

rapid kettle
#

weird

vital jasper
#

agreed

rapid kettle
#

my test requests always seem to have auth

jaunty plank
#

do you have the auth filled in on the site?

vital jasper
#

yes.

jaunty plank
#

can you show us the headers you are getting?

vital jasper
#

User-Agent: DBL\r\nHost: auxilus.ml\r\nAccept: application/json\r\nContent-Type: application/json\r\nContent-Length: 127\r\nConnection: close

#
User-Agent: DBL
Host: auxilus.ml
Accept: application/json
Content-Type: application/json
Content-Length: 127
Connection: close

so that

#

essentially

jaunty plank
#

honestly. might want to make a github issue

vital jasper
#
{
  "bot": "748586188885065768",
  "user": "312049173895839746",
  "type": "test",
  "query": "?test=data&notRandomNumber=8",
  "isWeekend":false
}
``` I am getting this as data response too
#

soo seems to be working right in every other way

jaunty plank
vital jasper
#

Meh ill probably make it a secret webhook url instead at this point. probs will be easier.

jaunty plank
#

honestly, if its only the tests that are not sending the auth header, it might not be a problem as long as your reject all tests.

vital jasper
#

I dont know if its only tests hmm

frigid crater
#

are the tokens for posting server count actually 150 characters long or have i pasted the wrong one?

vital jasper
#

mine is 156

jaunty plank
#

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjI2NDgxMTYxMzcwODc0Njc1MiIsImJvdCI6dHJ1ZSwiaWF0IjoxNDgzMDk5MjAwfQ.8tpNASxdSsfkVF7YparhyV1Ouy5ORQ3AM2jitd_Y-PI
example token

frigid crater
#

alr then i pasted the correct one

#

just checking

formal sparrow
#

@willow sphinx I've signed the commit, would you be able to merge it now?

restive otter
#

api

wheat tide
#

abuse

versed storm
#

Yes venus, this is in fact the api channel, well done, you know where you are 👍

restive otter
#

where do i learn api

versed storm
restive otter
#

null

patent lintel
#

just as you can post the bot guild count on a website, can you also post a server member count?

formal sparrow
#

It seems like no @patent lintel I'm not sure how DSL bot posts it, I don't find that endpoint in docs so it's probably private or undocumented

patent lintel
#

ok

#

@formal sparrow DSL can easily post it because we need to invite the bot to our server

#

and i could also just invite a bot i made to the server

#

but is there any easier way?

rapid kettle
#

Nah, you can't POST member count.

#

You have to let DSL handle it

patent lintel
#

oh

#

ok

steel acorn
#

how do I send it to the user who voted for my bot through private messages?

gritty jasper
#

Nah, you can't POST member count.
@rapid kettle my bot can

rapid kettle
#

Not to DSL.

jovial kiln
#

You cannot post member count to dsl

#

@gritty jasper

#

Anyone have examples of how to setup my webhook on DSL

#

Never tried it b4

violet spoke
#

Anyone have examples of how to setup my webhook on DSL
@jovial kiln what language?

jovial kiln
#

JavaScript

#

djs

steel acorn
#

how do I send it to the user who voted for my bot through private messages?
i use discord.js

violet spoke
#

I can't help then

#

I know python but not javascript

jovial kiln
#

@steel acorn for dbl, you get the user by ID on vote and then just do a .send() function and dm the message to them

steel acorn
#

do you have any sample code?

jovial kiln
#

so on the vote you would do ```js
dbl.webhook.on('vote', user => {
const user = client.users.fetch(user)
user.send(Here is your message bucko)
})

steel acorn
#

thank you

steel acorn
#

@jovial kiln

#

const user = client.users.fetch(user)

#

SyntaxError: Identifier 'user' has already been declared

placid ocean
#

0-0

jovial kiln
#

Then change user

#

👀

#

Because you already defined it

placid ocean
#
dbl.webhook.on('vote', (user) => {
const user = client.users.fetch(user)
user.send(`Here is your message bucko`)
})

is this right?

jovial kiln
#

What about it

#

Oh

#

Wait

#

I defined user twice in that

#

Change the second one to user2 or something

placid ocean
#

0-0

jovial kiln
#

When I press test it does not work?

#

What the fuck???

versed storm
#

looks like your address is already in use by something else.

#

OH, wait, no, you're sharded? You probably should have that in your sharding manager process not the various clients (which then each would try to bind to port 5000 which only one process can bind to)

glossy ledge
#

How do I set up the voting webhooks?

#

Can I get some help?

jovial kiln
#

@versed storm yeah I figured that out when I read the error correctly lol

versed storm
#

👍

craggy bone
#

can i use the token from dbl api in another bot?

rain heart
#

No?

#

@warm tapir read the channel topic in this channel, it will explain you how to get started with the top.gg api

warm tapir
#

ok

restive otter
#

Hello, I have a question :

#

It is possible to retrieve the comments on his bot, and receive them with a Webhook?

#

Please let me know if this is possible or not!

ruby ruin
steel acorn
#
const DBL = require("dblapi.js");
const dbl = new DBL('my token', { webhookPort: 5000, webhookAuth: 'my password' }, client);

  dbl.webhook.on('vote', () => {
     const userx = client.users.fetch(vote.user)
     userx.send(embing)
})
#

is not working

formal sparrow
#

Did you set the webhook url in your bot's edit page in site? @steel acorn

steel acorn
#

no girl_hm

#

what do I put in the webhook url?

#

@formal sparrow

formal sparrow
#

Or if you have a domain that resolves to your server's IP, you can use the domain instead

steel acorn
#

what do i put on the ip server?

formal sparrow
#

What?

#

Do you have a server/VPS or whatever

#

Where do you host your bot?