#topgg-api

1 messages ยท Page 81 of 1

vapid cape
#

it tries to send you a vote event

distant trellis
#

Webhook URL and auth match for sure:

const DBL = require("dblapi.js");
const dbl = new DBL('<token>', { webhookPort: <port>, webhookAuth: '<auth>' }, client);

dbl.webhook.on('vote', vote => {
    console.log(vote);
});```
Webhook running at http://0.0.0.0:<port>/dblwebhook
Port is open, going to that link (with proper IP) gets me to an empty page
#

It doesn't print anything though

vapid cape
#

test it with reqbin

distant trellis
#

Hmm, POST with bearer token returns 404

#

CanYouSeeMe shows the port is open for that IP, what should I check?

vapid cape
#

if you're hosting in a vps, check if your hosting provider requires firewall unblocking in the admin panel

heady kindle
#

on the api docs it states that on weekends votes are counted as double the normal amount

#

but why fridays?

#

just wondering

naive dirge
#

how do I setup a webhook for something of my choice?

open garden
#

@heady kindle In some ways Friday is a weekend.

#

Friday evening/night more specifically, as you can still stay up late and have fun, since you got no work/school the next day.

heady kindle
#

@open garden i see, but the multiplier is all day friday right?, not just in the night?

open garden
#

I honestly don't know for certain but I believe so yes,

heady kindle
#

thanks for the help

open garden
#

No problem! ๐Ÿ™‚

fiery shadow
#

TheReal is chatting with other people?

#

What happend

open garden
#

@fiery shadow ??

fiery shadow
#

That was a bit weird, but I wanted to say with that I thought it was weird that you are writing here again. I haven't heard from you for a long time but also didnt read much about you, that's why I'm asking you now How are you? ๐Ÿ™‚

open garden
#

Good thanks, and yeah this lockdown stuff gives me loads of time.

distant trellis
#

if you're hosting in a vps, check if your hosting provider requires firewall unblocking in the admin panel
It's not blocked

steel hawk
#

Trying to make a vote webhook in js

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

    dbl.webhook.on('vote', async (voter) => {
        console.log('someone voted');
    });```
#

The ready event is on but the vote event doesn't emit anything

sullen nymph
#

Replace 0.0.0.0 with your external IPv4

steel hawk
#

Oh ok

#

Im stupid

#

Still doesn't seem to be working

#

Ready event is working tho

true talon
#

Is port corrzcr

#

Correct

steel hawk
#

yes

true talon
#

What do you use to host ur bot

steel hawk
#

a vps..

#

I have no idea whats causing the problem lol

distant trellis
#

Nor do I

vapid cape
#

have you tested with reqbin?

#

dm me your full url and authorization

steel hawk
#

Got it to work

#

(I think)

tender garnet
#

any further help ?

#

or at least a it is broken atm or it is normal with explanation

green mantle
#

@tender garnet

I dont think you can actually use the normal check for votes considering Koya gets easily over 1k votes a month
@green mantle

tender garnet
#

KoyamieYesterday at 3:07 PM
He should, this is only for getting 1000 latest votes
as API said
@green mantle

vapid cape
#

the check endpoint works for over 1000

#

the votes endpoint doesnt

tender garnet
#

yes, thanks

vapid cape
#

but i've seen many people reporting that the check endpoint can be slow, as slow as a few minutes

tender garnet
#

but this is not working atm, I receive {voted: 0} for every user ID

#

it is not slow, it is not working

#

or I am doing it bad but changed nothing for months and it stopped working suddenly

green mantle
#

I don't see what's wrong with using the webhooks -> overall better to use it

tender garnet
#

can you read ?

#

KoyamieYesterday at 2:56 PM
my website was offline this morning so webhooks stopped working

#

seriously

green mantle
#

If I had a chance to finish:

That could be solved by using a redundancy system and load balancer with kubernceles

tender garnet
#

yes it could

#

but this is not my case of use

#

and this enpoint should work

#

so I am reporting it

green mantle
#

ยฏ_(ใƒ„)_/ยฏ

tender garnet
#

so, nevermind I found the issue and it was on my side
still surprised that it stopped working without changing anything on my side or I am amnesiac
anyway sorry for disturb

oblique turret
#

im kinda a novice on all of this but how do you make a weebhook for voting??

maiden nacelle
#

What lib?

oblique turret
#

python

maiden nacelle
#

Thats not a lib

oblique turret
#

well its the language so i hoped you could guide me based on that

spiral steeple
#

dblpy

maiden nacelle
#

#alwaysreadthedocsbefore

oblique turret
#

i have but you need a webhook path for it and i want to know how to make that

maiden nacelle
#

Just make it as it is in the doc, /dblwebhook?

jaunty steppe
#

hey i keep getting this error upon GETting my bot's page. Is this some sort of ratelimit? aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://top.gg/bots/572842779374518283')

spiral steeple
#

Because a get to that page returns html not json

maiden nacelle
#

^

jaunty steppe
#

yea just realised im meant to /api/bots

#

not /bots/

oblique turret
#

yea i can't figure it out, i need to know how to make the url that a put in both the webhook_path section and in the webhook URL section on the edit page

#

i would appreciate it if anyone could help

maiden nacelle
#

In the website you put domain.ltd:port/webhook_path

#

make sure you replace with accurate stuff tho

heady kindle
#

im not sure how to check if its weekend with /weekend

restive otter
#
      console.log(`User with ID ${vote.user} just voted!`);
        let embed = new MessageEmbed()
            .setColor(`#5780cd`)
            .setAuthor(`<@${vote.user}> Upvote !`)
            .setTimestamp()
            .addField(`User ${vote.user} With ID ${vote.user} Just Upvote For my Bot `, `He UpVote in https://top.gg/bot/672883668594720773 `)
            .addField(`We Have ${vote.count} UpVotes `, `Thanks You Soo Much`)

let guild = bot.guilds.cache.get(`675254454139748352`)
client.channels.cache.get("694189734146211901").send(embed) });```
#

why in the embed dont mention the user

#

and in vote.count it says undefined?

heady kindle
#

you cant mention a user in author of the embed of the title of the field

restive otter
#

Ok

#

oh

#

yeah

#

one moment

#

Now Work but

#

idk why it Says Undefined

#

in vote.count

true talon
#

Vote.count don't exist

restive otter
#

and dont are a funtion to show current vote count of my bot?

#

you can use dbl.getBot

#

ok

heady kindle
#
dbl.getBot("264811613708746752").then(bot => {
    console.log(bot.username) // "Luca"
});```
#

change .username to .votes i believe

#

if not just log bot and check in the json what vote is

restive otter
#

yeah

#

im watching it in the api

heady kindle
#

nice

restive otter
#
    console.log(bot.votes) // "Luca"
});
      console.log(`User with ID ${vote.user} just voted!`);
        let embed = new MessageEmbed()
            .setColor(`#5780cd`)
            .setTimestamp()
            .addField( `New UpVote in https://top.gg/bot/672883668594720773 `, `User <@${vote.user}> With ID ${vote.user} Just Upvote For my Bot `)
            .addField(`Thanks You Soo Much`, `We Have ${count} UpVotes `)

let guild = client.guilds.cache.get(`675254454139748352`)
client.channels.cache.get("694189734146211901").send(embed) });```
true talon
#

Resolve promise

#

Await

restive otter
#

ok

#

it says the same

true talon
#

What's in Console ?

restive otter
true talon
#

Console.log(bot.votes)

restive otter
true talon
#

Try to log bot and see

#

See what is the value for the votes

restive otter
#

?

true talon
#

@restive otter console.log(bot) and look at bot proprieties to find what you want

restive otter
#

i put this

#

bot.monthlyPoints

true talon
#

Well it doesn't exist

#

Check ur version

restive otter
true talon
#

Of dblapi.js

restive otter
#

2.4.0

#

@true talon

true talon
#

Ok

restive otter
#

ok

true talon
#

hmm

#

lemme test

restive otter
#

ok

true talon
restive otter
#

i see it

#

So?

restive otter
#

@true talon ?

#

@restive otter

#
const count = get.monthlyPoints || 0```
try this
#

ok

#

thanks

#

and i cna get total upvotes?

#

changing monthlyPoints

#

wait a sec..

#

ok

#

ok

#

Thanks โค๏ธ

willow spindle
#

just console log it ๐Ÿค”

#

console.log(get)

bitter crag
#

Eh, despite many attempts, I can't connect webhook to my code

#

(node:2766) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

true talon
#

show what you put in your top.gg webhook settings

bitter crag
true talon
#

wt

#

idk I never used ksoft for webhook

bitter crag
#

This is my first time using a webhook

bitter crag
#

and my console shows Webhook running at http://0.0.0.0:3389/dblwebhook

#

:v

vapid cape
#

@bitter crag i checked ksoft's docs

#

if you chose to use them, then you dont need to use dblapi.js

#

they are a replacement for running your own webhook server and manage it for you

#

top.gg will send webhooks to them, they will store it and manage it for you, then you access them via the ksoft api

#

for example, to check if someone voted: https://api.ksoft.si/webhook/dbl/check

bitter crag
#

oh, ok. Do you know how to connect it to my code?

vapid cape
#

you use the ksoft api

#

if you want to go that route

bitter crag
#

I don't know which choice will be the best :v

vapid cape
#

it doesnt matter really

#

depends on what you want to do

#

top.gg sends a webhook when someone votes

#

do you need to store the vote?

#

or just execute an action when someone votes?

bitter crag
#

I want to be notified when someone votes

vapid cape
#

then you dont need ksoft

#

what are you using ksoft for?

bitter crag
#

I don't know. This is my first time using a webhook

vapid cape
#

are you using ksoft for anything else? did someone tell you to use ksoft?

#

or did you just randomly find a tutorial that uses ksoft and tried to use it?

bitter crag
#

I use ban-api which offers ksoft

vapid cape
#

ah alright

bitter crag
#

and I tried to connect ksoft with dbl

vapid cape
#

well its your choice really, if you want to use them for votes too, or just use dblapi.js

#

if you prefer using them, then you can remove dblapi.js

#

and then you use their api. do you know how to use their api?

bitter crag
#

No :v I don't know how to use

vapid cape
#

how are you using the ban api?

bitter crag
#

I am a beginner bot developer

vapid cape
#

yes, but you said you're using the ksoft ban-api

#

how do you use it?

#

show a code that uses it

#

because if you're using the ban-api, their dbl api should be very similar

bitter crag
#
const ksoft = new KSoftClient('f*79*f71071c5307##40**d3c466##4f96b6aa8');

async function checkBan(id) {
    const banned = await ksoft.bans.check(id);
    return banned;
}
#

My ksoft token is naturally different

vapid cape
#

well, apparently the ksoft.js library does not support the votes endpoint

bitter crag
#

I don't know what to do to make it work, ehh

vapid cape
#

the library does not support it

#

the only way to do it is making the requests yourself

#

do you know how to make an api request?

#

using an http library, such as node-fetch, axios, got, etc...

bitter crag
#

No, I have never used it

vapid cape
#

making a request is like loading a website inside your code and getting the result from it

#

there are many different libraries that do that

#

you would need to chose one to get started with

#

you would load a website like this const response = await got('https://websitehere.com');

#

in your case, you would need to load https://api.ksoft.si/webhook/dbl/check?bot=YOURBOTID&user=USERID to check if someone voted

#

this is how you would manually make requests to an API

#

now to receive webhooks its a different story, you need a webserver

#

because its the opposite process, they (top.gg or ksoft.is) will send you a request like that

#

and you need to receive it

#

dblapi.js makes a webserver for you. if you want to use ksoft, then you need to make a webserver for it. an example webserver is express.js

#

have you ever used express.js?

bitter crag
#

No :/ I only saw

vapid cape
#

then i would recommend you give up on ksoft and use dblapi.js

bitter crag
#

okay

vapid cape
#

with dblapi.js you need to use your own URL in top.gg

#

where is your bot hosted?

bitter crag
#

in google cloud

vapid cape
#

compute engine?

bitter crag
#

yes

vapid cape
#

then your URL will look like this YOUR.GOOGLE.IP.ADDRESS:PORT/dblwebhook

#

PORT can be any number from 1024 to 65550, defaults to 5000

#

but you need to open this port in your google firewall

bitter crag
#

okay

#

My external google ip, right?

willow spindle
#

your vps's ip

bitter crag
willow spindle
#

https://

bitter crag
#

My console write Webhook running at http://0.0.0.0:3389/dblwebhook

#

:v

steel reef
#

It's been a while, how do I send a simple GET request using my bot tokens?

#

I'm trying to find out what guilds my bot is in /users/@me/guilds

willow spindle
#

this channel is for top.gg api only @steel reef

steel reef
#

Oh excuse me, and I found out why my call wasn't working :p

willow spindle
#

@bitter crag that is correct

bitter crag
#

My console shows still (node:4685) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

#

:v

willow spindle
#

show your dbl code

bitter crag
#

const dbl = new DBL('mytoken', {webhookPort: 3389, webhookAuth: 'mysupersecretauthkey'}, Client);

#

and not working :v

vapid cape
#

unauthorized has nothing to do with webhooks

#

more likely your token is wrong, but it only affects posting stats, not the webhook

#

the URL should indeed being with http:// but not https:// unless you have SSL

#

did you allow port 3389 in your google firewall?

bitter crag
#

yes

vapid cape
#

dm me your ip and your authorization

gaunt quail
willow spindle
#

you can't

gaunt quail
sage ravine
#

Hello i need some help my DC server not have api kay but i need from Rust DC Core

#

Who can help me how do i can set

willow spindle
#

what is Rust DC Core?

sage ravine
#

Rust (game) Rust Discord Core (for plugin) Comunicate serverside and discord side too

#

And this game plugin need discord API

#

but my dc not have

vapid cape
willow spindle
#

this is not related with top.gg API

sage ravine
#

i rly dont know what i must do it for make API

willow spindle
floral phoenix
#

does the

DiscordBotListAPI api = new DiscordBotListAPI.Builder()``` need to be in the Launcher or can it be in a difrent class  ?
frank inlet
#

alright

#

so

willow spindle
#

explain your problem

frank inlet
#

my bot needs to catch when people vote

#

but I can't use my main bot for webhooks because I don't have a web server

#

and I use that to catch dbl webhooks

willow spindle
#

what did you put URL option on website

frank inlet
#

but then

#

wait for me to finish first

willow spindle
#

ok

frank inlet
#

but then

#

I use a different bot

#

to post the people who vote

#

and I use the main bot

#

to add their coins

#

but the problem is

#

that when I use my DBL token for the webhooks, I can't use it for my main bot to post a server count anymore

#

it complains Error: 401 Unauthorized

#

did I explain my whole situation?

willow spindle
#

401 means your token is invalid

frank inlet
#

no

#

I confirmed the token is correct

#

I copied it from the bot editing page

willow spindle
floral phoenix
#

Ehhh anyone got any idea why it says on the website my bots only in one server

#

When its in 600+

vapid cape
#

you did something wrong when posting

floral phoenix
#
        DiscordBotListAPI api = new DiscordBotListAPI.Builder()
                .token(config.getString("api.topggToken"))
                .botId("bot.ID")
                .build();
        int serverCount = shards.getShardsTotal();
        api.setStats(serverCount);```
#

Thats what i put

kindred sable
#

-servercount

abstract mothBOT
#

To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.

vapid cape
#

@floral phoenix arent you posting the shard count instead of the guild count?

floral phoenix
#

Ye

vapid cape
#

then thats why its 1 lol

floral phoenix
#

But im using Sharts and getShardsTotal() gets every guild in all my shards

vapid cape
#

are you sure?

#

you're using JDA right?

#

im looking at its source code, and from what i understand, it returns the total number of shards

little matrix
#

yah @gloomy fractal i have a corona bot. Approved 4 days ago. after it got approved. every hour the bot was beeing added in 30-40 servers or more. We got 3.5k this isnt so easy in 4 days. suddenly, last 6 hours no one added the bot. i doubt on it.

gloomy fractal
#

Ya, so it's not updating your server count?

little matrix
#

Maybe. cant figure out

#

Why did people stop inviting the bot? Its not possible

#

laat 6 hours no one added it. where we were getting 40-50 servers per hour

gloomy fractal
#

I doubt people stopped inviting it, probably just isnt updating your server count

little matrix
#

something is wrong in page or top.gg

gloomy fractal
#

Do you have like guild logs in the server?

little matrix
#

yah

gloomy fractal
#

Also post how you are posting your server count

little matrix
#

yes

#

Server count: 3327
Member count: 213982

gloomy fractal
#

And you said that isn't right?

little matrix
#

and it had 3330 6 hours ago

gloomy fractal
#

So topgg says those numbers?

little matrix
#

no. my bot sayscz_unamused_clown lemme Chexk

#

check

#

wrong emote. accidently

#

oh its working now

#

but whats the problem. about the last 6 hours topic

#

@gloomy fractal

#

sry for ping

gloomy fractal
#

I am not sure, come back if it doesn't start to work again, as long as it's posting your correct stats now that's good ๐Ÿ™‚

#

Also no worries about the ping.

little matrix
#

@gloomy fractal so you are saying that, it was showing wrong stats that's why it wasnt being added in servers?

gloomy fractal
#

I am not 100% sure really

little matrix
#

it was shoeing 3335

#

now showing correct one. 3326

#

so its about same.

#

maybe not for this. I checked by inviting the bot. there is lnp

#

np

#

even we are having 4 shards,

787
837
811
892

steel hawk
#

So is hasVoted delayed?

#

But the vote webhook is instant?

signal hawk
#

the webhook is instant, the hasVoted will need to run in your code

steel hawk
#

I know

#

Its delayed though

spiral steeple
#

Because of cache

#

It's recommended to use webhooks

rotund smelt
#

I just started messing with the api I'm a little confused on how to display monthly/total vote count for my bot

#

Nevermind I found it

restive otter
#

having issues with this

#

says server count posted
in console log
but doesnt show

tardy nimbus
#

what library? also can i see the code?

little harbor
#

Wumpus Giveaway?

#

it shows fine for me

#

your browser is probably caching the webpage

tardy nimbus
#

oh, its probablt cached

#

use Ctrl+F5

restive otter
#

its discord.js

tardy nimbus
#

use Ctrl+F5

restive otter
#

i did that

tardy nimbus
#

also salute for using d.js

#

try it in incognito

restive otter
#

okay

sonic sorrel
#

The caching of your client / browser isnt up to date. probably just clear your cache

restive otter
#

nah didnt work

little harbor
#

it looks fine for me

restive otter
#

oh

#

weird it doesnt show for me in incognito lmao

#

thanks

unique veldt
#

Im mking a bot

#

but it cannot do more than one process at once

#

it can only work for 1 channel not more

green mantle
thick idol
#

Anyone here with knowledge for the top.gg webhooks?

#

I get that the webhook is running on http://0.0.0.0:3010/dblwebhook

I then have this listener:

dbl.webhook.on('voted', (vote) => {
    console.log(`User has voted: ${vote.user}`);
});

But nothing gets logged when test voting

willow spindle
#

that is "vote"

#

not "voted"

thick idol
#

Ohh

#

Ffs.

restive otter
#

how can i get dbl api token ?

#

please meantion me if you can help

willow spindle
#

click "My Bots" @restive otter

dry mirage
#

Are there events for new votes?

#

So I can make like a notification in my Discord server when someone boosts the server

supple river
#

what do you mean by boosting

#

nitro boosting doesn't have to do with top.gg's API afaik

#

unless they have some api endpoint that for some reason does involve it

green mantle
#

@dry mirage Think you have miss-understood how it works,

you can set up a webhook server to get on vote events only from top.gg
detecting someone boosting the server or not would be with your discord lib's documentation and not about top.gg

supple river
#

^

#

some libs provide webservers for you to use with the webhook system i'm sure

green mantle
supple river
#

well this channel is top.gg only

rotund magnet
#

What is the response when you use /bots/:bot_id/votes but you have over 1k votes?

supple river
#

judging by the description, it indexes the most recent 1000 votes

#
Users can currently vote every 12 hours for each bot. The /votes endpoint for your bot (the one you use via getVotes) only indexes the last 1000 votes. Please implement the webhook instead if you plan to process over 1000 votes.
#

does not indicate that it will stop working past 1,000 votes

rotund magnet
#

Ah

#

Aweomse, thanks

dry mirage
#

@supple river @green mantle I didnt mean boost, I'm talking about upvoting

supple river
#

well then in that case the webhook system is the way to go

#

depending on what DBL lib you're using, it might include a webserver for you to use to listen to webhook calls

#

then you can just hook that logic up to announcing in your server ๐Ÿ‘

proven lark
#

Hey

dry mirage
#

<groupId>com.github.DiscordBotList</groupId>
<artifactId>DBL-Java-Library</artifactId>
<version>LATEST</version>

#

@supple river

supple river
#

i haven't used java lib but by the looks of it it does not have a webserver

#

though i'm sure there's plenty of web server libs on java

#

if you can find one that works for you, just open a port on your network, let the server listen to it, and you can set up the webhook settings on your bot edit page

#

it will POST your webserver webhook with that JSON, to which you can just decode it and see who voted ๐Ÿ™‚

dry mirage
#

isnt there an easier way?

supple river
#

but you shouldn't

restive otter
#

This is how I define DBL:

const dbl = new DBL(token, { webhookPort: port, webhookAuth: config.auth });

In the docs it says that options.statsInterval has a default interval of 30 minutes. However, it doesn't update for my Discord bot even though I don't overwrite the variable. Any idea why?

willow spindle
#

define your bot client in DBL

#
const dbl = new DBL(token, { webhookPort: port, webhookAuth: config.auth }, client);
```like this ^
restive otter
#

ah

#

tyvm!

dry mirage
#

I'm using Java tho haha

knotty garnet
#

someone said.....java?

dry mirage
#

Should I use api#getVoters or api#hasVoted for every user?

knotty garnet
#

you should setup a webhook server

#

manually checking for votes is a VERY bad solution

#

you can, but it's not recommended

#

since it's java, you can easily create one with springboot

dry mirage
#

I'm not using Spring tho

knotty garnet
#

you don't need to

dry mirage
#

how do I do it then?

knotty garnet
#

are you using gradle or maven?

#

@dry mirage

dry mirage
#

maven

knotty garnet
#

do you use JPA?

dry mirage
#

nah

#

dont evem know what it is haha

knotty garnet
#

ok, just a sec

dry mirage
#

even*

knotty garnet
#

asked that because there's a different setup if you use JPA with springboot

dry mirage
#

kk

thorn gate
#

hey im trying to vote lock a command
this is my code: if(!dbl.hasVoted(message.author.id)) return message.channel.send(Errorembed("You Need To Upvote us to use this command.").setURL(upvote));
and it seems to not work, and idea of how can i fix it?

#

oh wait i think i got it

#

its a promise

#

im dumb nvm

rotund magnet
#

I've got a question,
Does this mean that if server_count is an array, it will act as shards here (as and like can mean different things)

vapid cape
#

yes

restive otter
#

@rotund magnet If your bot has shards, that server_count should be an array. else it'll just be a single number

restive otter
#

Hay

#

Hi

#

Api

gloomy fractal
#

Do you need API help?

manic plaza
#

@remote flicker

gloomy fractal
#

You need API help? @manic plaza

red wasp
#

I need help

sharp musk
#

You need

gloomy fractal
#

@red wasp what do you need help with

red wasp
#

What do I keep doing wrong here?

#

I'm trying to post my bot

#

I got the invite url in there, and every time I submit-- I get an error

steel hawk
#

For the discord support server section you are only supposed to put the code

#

So like: hdjahg

red wasp
#

Is the code suppose to be there?

gloomy fractal
#

@red wasp That isn't the DBL API, head to that API's support server we don't help with other APIs.

steel hawk
#

@gloomy fractal I think they mean the support server code

#

Since he or she didnโ€™t fill that out

red wasp
#

Am I suppose to fill it out?

steel hawk
#

Yes

red wasp
#

I don't see the red star on it

steel hawk
#

Iโ€™m pretty sure itโ€™s required

#

Hmm

#

Oh

red wasp
gloomy fractal
#

Please move to #general as this does not deal with the API, please.

steel hawk
#

Your invite link might be incorrect

red wasp
#

@gloomy fractal okay

terse tiger
#

How to get the server count for my bot, I mean, Luca isn't being friendly.

gloomy fractal
#

-servercount

abstract mothBOT
#

To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.

terse tiger
#

@gloomy fractal Thanks.

gloomy fractal
#

Np

jaunty sable
#

How am I suppose to get the shard ID in ready event in Js

gloomy fractal
jaunty sable
#

Even I pass shard ID in, it's not showing up on top.gg

#

And when I didnt pass it in it logged 400 bad request

analog spoke
#

Hey, i want to setup a channel in my discord server that if someone votes it will send like <name> has voted for BOTNAME

#

how could i co this ?

smoky plover
analog spoke
#

aah didn't look into that thanks

smoky plover
#

๐Ÿ‘

rotund magnet
#

And the bot id is not that much a secret at all. You can find it easily. The thing which should be hidden is the token of the bot.

#

And you can't post the server invite to the bot, you need to use /bot/:id/edit and update it via HTML

analog spoke
#

i get 0.0.0.0/0:5000/dblwebhook what should i do next ?

smoky plover
#

what do you mean?

subtle matrix
#

@red wasp

#

Did you find the issue?

red wasp
#

No

red wasp
#

Ohhhh

subtle matrix
red wasp
subtle matrix
#

go to the website

#

press generator

#

then go to

#

and copy the Client ID

#

then done

eager dragon
#

can someone explain me about .isWeekend() api? does it return true if weekend (sat and sunday) or what?

vapid cape
#

yes because voting is doubled during the weekend

#

or something like that

#

so if isWeekend() is true, that means votes are more valuable than normally

eager dragon
#

thank you

restive otter
#

hello, I have no idea how webhooks work but I want to let my bot send a message when someone voted and I want to know if someone voted for my bot, but I have no idea how this works. I tried it, but I failed

#

can someone help me please?

vapid cape
#

language?

restive otter
#

js

vapid cape
#

are you using dblapi.js?

restive otter
#

yes

vapid cape
#

did you set it up like it shows in the webhook example?

restive otter
#

yes, I used this example

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

but like I said, I have no idea how webhooks work tbh

vapid cape
#

you put your top.gg token there and make up a password of your choice

#

then in the top.gg website, in your bot's edit page, in the webhook section, you fill up the Authorization field with your password, and the URL field with whatever top.gg can use to find your bot

#

depending on where your bot is hosted, the URL might be http://YOUR.BOTS.IP.ADDRESS:PORT/dblwebhook

restive otter
#

ah okay I maybe did something wrong with the URL

#

thanks

signal panther
#

Hello need help

sullen nymph
#

Have you read this channel's topic

pallid current
#

lol

weak stone
#

Just actident

#

Im sorry

pallid current
#

too late boi

#

u been caught

restive otter
#

When someone gives a vote to the bot, he will throw it into a channel. How can I do this?

signal hawk
#

This channel is for the api of top.gg only, not other apis

arctic arch
#

-api @autumn flume

abstract mothBOT
#

@autumn flume

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs

arctic arch
autumn flume
#

Ok thanks

#

I didn't read the channel topic

#

Sorry ://

manic basin
#

Is autovote bannable?

#

Plz help

green mantle
#

yes

manic basin
#

Ok thanks

green mantle
#

that essentially websraping the site to automatically vote

rotund smelt
#

Hey I'm a little confused on the webhooks as well. Let's say I was self hosting for bot testing how would I enter the link for the webhook?

restive otter
#

webhook?

vapid cape
#

@rotund smelt most likely your IP address followed by your webhook port

#

and you'll likely have to portforward in your router

knotty garnet
#

and configure a webhook handler

restive otter
#

-api

knotty garnet
#

That is about the api

full mesa
#

Am I allowed to make a wrapper for the DBL API?

#

To make it easier to use?

vapid cape
#

pretty sure you can

#

there are a few already

pale fulcrum
#

You can but it would be obviously unofficial

fluid river
#

Hi. How can I use this API to post my server count if the bot has sharding?

worn quail
#

iterate through all shards

fluid river
#

So, I have the normal codes in my file and it makes 2 shards/

worn quail
#

go through both and add the servers to a variable

fluid river
#

I want it to show the shards count too. How can I do it?

#

Should I need to have the codes in a new instance where there's no sharding or should I need to just have the codes in the main bot files where sharding is occurnng?

floral shell
#

yo, so i got all of the code to use the api, but i cant find any good apis to use for memes, does anyone have suggestions?

fluid river
#

That's not related to Top.gg api. IS it?

floral shell
#

oh sorry didnt read the top

terse tiger
#

I'm pretty sure i properly set it up

#

Halp!

knotty garnet
#

what server interface do you use?

#

tomcat, nginx or express?

terse tiger
#

Unm, express

#

I think

#

Actually

#

I installed dblapi.js

#

Is that supposed to be?

restive otter
#

please help me

#

it shows error

#

please mention me if you can help me

sullen nymph
#

Well what's the error

restive otter
#

@sullen nymph its glitch.com it just show red dot for errrors it dont show error

sullen nymph
#

I remember people showing errors on Glitch

restive otter
#

where can i check error ?

#

@sullen nymph ohh i find error

#

it says dbl is not defined

sullen nymph
#

well import it and define the DBL client? nekothinking

restive otter
#

please help me

#

@sullen nymphare you there ?

sullen nymph
#

Are you sure you have message anywhere within that code

#

or if you're even putting that code snippet where it's supposed to be

restive otter
#

yes i am sure

#

@sullen nymph now i add blacklits and now it dont shows error but it is working by non voters also

sullen nymph
#
  1. Make sure you are not hitting ratelimits since your bot could be getting way more than 60 messages per second
  2. Are you even checking if the returned data says "true" or "false"
restive otter
#

per second 60+ message ?

sullen nymph
#

minute, not second

restive otter
#

@sullen nymph const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL('', client); dbl.hasVoted(`message.author.id`).then(voted => { `Please vote for the bot to use this command` }) see where is mistake

#

i removed bot dbl token

sullen nymph
#

That's a discord.js question from here

#

Also...

#

`message.author.id`
That won't work

tawdry ferry
#

U hover over the dot @restive otter

#

O wow late response

#

I got bumbed up like 20 msgs

hasty lagoon
#

Hello!

gloomy fractal
#

This channel is for top.gg api support only.

strange wraith
#

how do I fix a 401 error, Not Authorized

#

this only happens when the dbl package is mentioned

haughty tundra
#

@strange wraith check if your DBL API token is correct.

fast mirage
#

guys my api is not posting the amount of guilds what can it be? I also don't get any errors on the console

gloomy fractal
#

Are you even using the top.gg api?

haughty tundra
#

You'll have to provide some extra information.
Eg code (no tokens pls)

strange wraith
#

@haughty tundra

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

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

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

haughty tundra
#

Sorry can't help with that, currenly I've only "mastered" python

#

Did you look at the docs?

fast mirage
#

Are you even using the top.gg api?
@gloomy fractal yes

gloomy fractal
#

@fast mirage Send your code without the token

haughty tundra
strange wraith
#

How do I know if the token is correct? I got the string of numbers from the URL, the code is directly from the docs

gloomy fractal
#

@strange wraith onst ?

#

In onst DBL = require("dblapi.js");

strange wraith
#

@gloomy fractal it says const I missed the c

fast mirage
#

@gloomy fractal ```py

import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging

class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""

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

# The decorator below will work only on discord.py 1.1.0+
# In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

@tasks.loop(minutes=30.0)
async def update_stats(self):
    """This function runs every 30 minutes to automatically update your server count"""
    logger.info('Attempting to post server count')
    try:
        await self.dblpy.post_guild_count()
        logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
    except Exception as e:
        logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

    # if you are not using the tasks extension, put the line below

    await asyncio.sleep(1800)

@commands.Cog.listener()
async def on_dbl_vote(self, data):
    logger.info('Received an upvote')
    print(data)

def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))

gloomy fractal
#

@strange wraith Where did you get your bot's token from?

strange wraith
#

The URL on the site, since it said top.gg token

haughty tundra
strange wraith
#

Where is that??

haughty tundra
strange wraith
#

ok

gloomy fractal
#

@fast mirage Looks like you just copied and pasted the code from the docs. Did you change anything that would need to do with your bot? Add your token and such? the example is to help you

haughty tundra
#

replace the YOURBOTID with ur bot id
Or go to my bots>edit>scrol down

strange wraith
#

Thanks

#

It works now

haughty tundra
#

@fast mirage did you fill in your credentials and did you load the COG ?

fast mirage
#

yes

haughty tundra
#

Weird, you said that it didn't raise any errors right?

fast mirage
#

yes no mistake

#

I even check after 30 minutes but I donโ€™t get anything

haughty tundra
#

I'm sorry but I'm unable to replicate this. :3

fast mirage
#
Task exception was never retrieved
future: <Task finished coro=<DBLClient.webhook() done, defined at /usr/local/lib/python3.7/dist-packages/dbl/client.py:417> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 5000): address already in use")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 436, in webhook
    await self._webserver.start()
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_runner.py", line 104, in start
    reuse_port=self._reuse_port)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1378, in create_server
    % (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
#

@gloomy fractal

haughty tundra
#

Read your error.

#

Another program is already running on port 5000

green mantle
#

I'd point out two things:

  1. the above what Arthur said
  2. you cannot use the API with your bot till it has been approved
fast mirage
#

Another program is already running on port 5000
@haughty tundra whats?

#

I only have a top.gg file running

sullen nymph
#

Then it might be running twice

haughty tundra
#

Another program/file is running on your localhost port.
As shivaco pointed out that probably because you're running it twice.
Looking at that you havn't received your developer role here I assume that your bot hasn't been approved to top.gg.
Therefore you can not use the top.gg API as ใƒใƒผใƒชใ•ใ‚“ (CF8) pointed out.

rotund smelt
#

So I'm having problem with the hasVoted. So it's returning false even when the user has voted. this is the code

console.log(message.author.id);
        dbl.hasVoted(`${message.author.id}`).then((v)=>{
            console.log(v)
            if(v) console.log('Nice')
        })
#

Nevermind I guess it just took 20minutes for it to register

orchid spire
#

I need help with setting up the API for my bot. How can i get started?

smoky plover
#

-servercount @orchid spire

abstract mothBOT
#

@orchid spire

To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.

last cedar
#

why am I getting the Oops! Error: 400 Bad Request even tho it doesnt specify more

vapid cape
#

bad request means you're posting invalid data

#

check how you're posting your server stats

strange wraith
#

is there a way to fetch how many total votes your bot has and put it into an embed?

sullen nymph
#

GET /bots if you're sending requests directly

strange wraith
#

@sullen nymph Could you give an example please? (for discord.js)

sullen nymph
#

Are you using dblapi.js?

strange wraith
#

Yes

#

along with discord.js

sullen nymph
strange wraith
#

Thank you

cold ledge
#

or did i break something stupidly again

manic sonnet
#

you could handle the async return value of fetch to check if there was an error or what response there was in general

fetch('...',{...})
  .then( response => {
    console.log('response code was: %s', response.code);
    return response.text();
  })
  .then( data => {
    console.log('response data was: %s', text);
  });
#

besides that if you're in an async function you might want to also await your fetch so that the function resolves after the fetch call has finished @cold ledge

cold ledge
#

@manic sonnet the function being async doesnt seem to affect it as server_count is being posted normally

#

only reason i need the function to be async is for the fetchClientValues everything else should be straight forward

manic sonnet
#

yea it's just if you're awaiting postStatus it will finish before fetch has actually finished

#

that's why I suggested also awaiting fetch

cold ledge
#

i can try but i highly doubt it would make any difference

manic sonnet
#

it will make a difference if you're depending on that changed state of your api call

#

and you are running a check or update after postStatus

cold ledge
#

no i dont do anything after that function

manic sonnet
#

well then it won't make a difference, but I recommend you to await it anyway since you will pull your hair out searching for that issue once you're depending on that async call

cold ledge
#

and the await didnt do anything

#

still saem issue

#

same*

#

im having the server count post fine but the shard count isnt being posted

manic sonnet
#

so the api is declining the shard_count value in your api call, but in that same call server_count will get picked up?

cold ledge
#

yes

#

ive tried manually setting the shard_count to a number and not getting the value from the client but it didn't work

#

okay i figured out the issue

manic sonnet
#

well then there's an issue with the API I guess

#

okay let me know please

cold ledge
#

fetchClientValues() will return an array

server_count will take that array add it up and the length of the array = shard count

seeing as my sharding manager handles the fetchClientValues() function per cluster rather than per shard the array was 1 element

#

so the api took the array length over shard_count

#

took me a while to notice in the documentation that it gets shards through server_count too

manic sonnet
#

well then good you got that fixed ๐Ÿ™‚

cold ledge
#

so yeah it was me just being stupid and not reading the docs properly

manic sonnet
#

๐Ÿ™ƒ

cold ledge
#

thanks anyway

manic sonnet
#

yw

restive otter
#

So with the dblapi.js...
How can i get the bot to console.log the person's tag that has voted for my bot?

#

that is a express and body-parser thing, you have to set up a webserver

#

and register it in your bots settings

#

Hmm but Timo aardappel said it's possible to get the votes without a webhook or a webhook port... @restive otter

#

Im not really fluent with the api, as long as i remember you have to set up a webserver

#

Hmm... Idk... Should i ping the timo aardappel to help?

#

i mean

#

you could

#

Hmm lemme see

#

@dense basalt can you help me with this situation?

gloomy fractal
#

@restive otter JavaScript?

restive otter
#

Yup

gloomy fractal
#

See the docs, itll help

restive otter
#

Hmm okie

#

@gloomy fractal wait idk much about that webhook stuff... What should i do about those?

gloomy fractal
#

Those are just examples

#

But they should be able to help you with what you want

restive otter
#

Hmm ik... But like webhook url and and webhook port should be the url my bot is getting hosted on abd it's port?

gloomy fractal
#

You said you dont want a webhook right

#

Just console log the tag?

restive otter
#

Yea... The tag of the user who voted

gloomy fractal
restive otter
#

Hmm... The receive vote update is the part but doesn't that require a webhook and a webhook port or something?

gloomy fractal
#

the voted event

#

I really don't want to spoonfood, want you to be able to look at the docs and get it yourself

restive otter
#

Wait that dbl event exists?

#

I didn't know that

gloomy fractal
#

uh i dont have a list but off the top of my head posted error ready vote

#

vote being the one youre looking for

restive otter
#

Oh ok... vote or voted?

#

Hmm i might look into that

gloomy fractal
#

Should be vote

#

It says webhook, but you should be able to just console.log it without needing a webhook

restive otter
#

Hmm ok

#

?

gloomy fractal
#

@restive otter didnt log anything at all?

restive otter
#

Nope

gloomy fractal
#

Did you vote for your bot?

restive otter
#

I asked my friend to do it

gloomy fractal
#

Did you restart your bot after applying the code

restive otter
#

Yup

gloomy fractal
#

Is the topgg token correct?

restive otter
#

Yup otherwise it wouldn't post the server count lol

sudden flare
#

@restive otter wrong indentation ?

restive otter
#

Wait what?

sudden flare
#

it looks like its indented a bit too much

gloomy fractal
#

Indentation has no affect on code really

restive otter
#

Hmm true

sudden flare
#

I see

#

well I have a question too but I'm waiting for this to be resolved

restive otter
#

I also tried with both vote and voted but both didn't work @gloomy fractal

gloomy fractal
#

Keep it vote, restart Iโ€™m gonna vote for your bot and tell me if it logs

vapid cape
#

the code is wrong

restive otter
#

What's the correct one... Tell me

vapid cape
#

you have dbl.on("vote"), should be dbl.webhook.on("vote"), you also need to add the webhook options to new DBL

#

if you want vote events

gloomy fractal
#

Isnโ€™t it possible without using webhooks to just console.log it?

restive otter
#

Hmm can't i do it without webhooks? Timo aardappel said i can tho @vapid cape

vapid cape
#

you cant receive vote events without webhooks, you can only fetch votes and check if users voted

sudden flare
#

you dont get vote events if you dont use the webhook

restive otter
#

Hmm so if it needs webhooks... Then how do those webhooks work... I'm not kinda familiar with using webhooks

vapid cape
#

first add the webhook options to new DBL, more specifically webhookPort and webhookAuth

#

like it shows in the example

sudden flare
restive otter
#

I mean ik that but what would be the webhook options?

sudden flare
#

read the docs please

restive otter
#

I did

#

Bruh

vapid cape
#

webhookAuth = what you put in your top.gg webhook authorization

#

webhookPort = depends on your hosting

sudden flare
#

you'd know that if you did

restive otter
#

Hmm i self-host it so what the port will be?

vapid cape
#

anything between 1024-65550

#

usually 3000 or 5000 is fine

#

you might need to portforward in your router

restive otter
#

Hmm how does that work lmao?

vapid cape
#

@restive otter first finish setting it up so you can test, then deal with the router if it doesnt work

#

in top.gg under webhook URL put http://YOUR.PUBLIC.IP.ADDRESS:WEBHOOKPORT/dblwebhook

restive otter
#

That dblwebhook after the slash doesn't need to be changed? @vapid cape

vapid cape
#

no, unless you set webhookPath in your webhook options

#

dblwebhook is the default

restive otter
#

Oh ok

#

@vapid cape in the authorization section... What should be there?

vapid cape
#

whatever you want, as long as its the same as in webhookAuth

restive otter
#

Hmm it's like a password right?

vapid cape
#

yes

restive otter
#

Oh ok

vapid cape
#

for example
Authorization: test123
webhookAuth: "test123"

restive otter
vapid cape
#

yes

#

add a dbl.webhook.on("ready") like in the example

#

to make sure its running

restive otter
#

Oh ok

severe iron
#

Any reason why I'd be getting an error about server_count being missing when trying to post my bot's server count? (the value of 'data' is the body I am sending)
https://i.inv.wtf/nXc7Bnvm.png

restive otter
#

Why 0.0.0.0 tho?

severe iron
#

0.0.0.0 == localhost/127.0.0.1

restive otter
#

Hmm lemme show you something

#

Cuz it doesn't log "Server count posted" or any error with both dbl.on and dbl.webhook.on...

vapid cape
#

no

#

posted and error are on dbl, not on dbl.webhook

#

dbl.webhook is only for ready and vote

#

@severe iron the value of data shouldnt be a string

#

but idk how you're posting it

restive otter
#

Hmm a post request?

severe iron
#
if 'json' in kwargs:
  headers['Content-Type'] = 'application/json'
  kwargs['data'] = json.dumps(
    kwargs.pop('json'),
    separators=(',', ':'),
    ensure_ascii=True
  )
``` this is where data comes from
#
async def post_guilds(self):
    route = Route(
        'POST',
        f'/bots/{self.bot.user.id}/stats'
    )
    await self.http.request(
        route,
        json={
            'server_count': len(self.bot.guilds)
        }
    )
``` and this is the actual code for posting it
restive otter
#

@vapid cape also just putting the url and choosing the POST option and clicking send gives this error:
Could not connect. Error code: 1007

vapid cape
#

then you need to check your firewall and your router's portforwarding

restive otter
#

Hmm what am i gonna do with those?

vapid cape
#

if the URL is correct, it should give unauthorized without the auth

#

do you know how to access your router?

restive otter
#

Ik

vapid cape
#

then access it, and look for port forwarding options

#

you need to set your dblwebhook port (5000) to your internal ip address (something like 192.168.0.10)

restive otter
#

Like 192.168.1.1?

vapid cape
#

or simply to unblock to all internal IPs

#

192.168.1.1 is to access the router

#

most likely

restive otter
#

Hmm oh

severe iron
#

figured out my issue, content type header has to be all lower case mmlul

knotty garnet
#

@severe iron actually, 0.0.0.0 means "listen to all"

#

Not only localhost

severe iron
#

yeah I meant it more like "it's similar to"

#

probably shouldn't have used = lol

tribal gate
#

Oop.

last cedar
#
const DBL = require("dblapi.js");
const dbl = new DBL("token", { webhookServer: server, webhookAuth: "password" }, client);
dbl.on("posted", () => {
    console.log("Server count posted!");
});

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

xD

#

yk i changed the auth

gloomy fractal
#

oh ok good

last cedar
#

i had to

gloomy fractal
#

lemme look for a sec

last cedar
#

no one will ever put password as their auth

#

unless they want to

#

hmm anyone help?

vapid cape
#

@last cedar make sure client is your correct client instance, the same one you login with. also make sure your dblapi.js is updated, latest version is 2.4.0

undone laurel
#

hi

#

how do i fix it?

#

Do I need to use api?

vapid cape
#

yes

vapid cape
#

?

willow spindle
wide sigil
#

what are widgets?

#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

When I do this, it automatically makes the server widget?

trail sigil
#

yeah

#

it will

sullen nymph
#

It doesn't exactly "make" a widget

trail sigil
#

it updates the info on the widget, doesn't it?

wide sigil
#
    def __init__(self, bot):
        self.bot = bot
        self.token = self.bot.DBL_TOKEN
        self.database = self.bot.get_cog('Database')
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully")

Does this look okay?

sullen nymph
#

Info is updated on API request to n URL

trail sigil
#

to get the widget, you use this link https://top.gg/api/widget/:ID.svg

sullen nymph
#

What exactly do you mean by "server widgets"

wide sigil
#

Just saw it in documentation

sullen nymph
#

autopost is to post your guild count to top.gg

wide sigil
#

Thats what I want

sullen nymph
#

That's not widgets redShrug

wide sigil
#

Does it happen immediately?

sour garden
#

using dbl lib to post server count? smh

sullen nymph
#

Should

wide sigil
#

Doesn't print though

sour garden
#

i just use standard python requests

wide sigil
sullen nymph
#

make sure you saved the code and wait 30 minutes to make sure it's working redShrug

wide sigil
#

ah alright

green mantle
#

i just use standard python requests
badddddddddddd

sullen nymph
green mantle
#

async + requests = F

wide sigil
#

does my bot's event get triggered immediately when someone upvotes?

#

This isn't working GWinfxThink

trail sigil
#

it is supposed to

wide sigil
#

My votes and guild aren't working

#

No error messages

#

And the cog is loaded

green mantle
#

are you using webhooks

wide sigil
#

Nope

green mantle
#

then there u go

wide sigil
#

But like I don't have a webserver or anything

green mantle
#

the only thing that is an 'event' is the vote webhook

#

if you're not using webhooks then you wont immediately get the notification

#

you would have to check via calling the api

wide sigil
#

Okay, how do i setup webhooks?

#

I haven't got a url

#

just my server's ip address

green mantle
#

its just ur public ip:port

wide sigil
#

I can use any port?

green mantle
#

yh

#

well

#

any open port

wide sigil
#

Okay, still doesn;t work

#

here is what i did

#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/vote', webhook_port=3004)
#

and in the dbl webhook url, I entered publicip/vote

sullen nymph
#

http://<ip>:<port><path>

wide sigil
#

oh forgot the http

#

also, when I ctrl+c mybot

#

oh wait thats because of my

#

one sec

#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/vote', webhook_port=3004)

@sullen nymph is this okay? do I need to specify the ip here too?

sullen nymph
#

Nah

wide sigil
#

and for some reason I only get the errors when I ctrl+c, maybe because they're loops @sullen nymph what does this mean?

sullen nymph
#

That's interesting

wide sigil
#

not solving the problem though

sullen nymph
#

The 403 is because you are hosting the bot on a bot that isn't approved

wide sigil
#

What do you mean not approved?

#

on dbl?

sullen nymph
#

Yes

wide sigil
#

but it is @shell nest

sullen nymph
#

In the top.gg cog's __init__ try to print self.dblpy.bot.user

wide sigil
#

oof

#

its None

#

am I supposed to be hosting a webserver or something?

sullen nymph
#

Right, it's not waiting until the user is cached

wide sigil
#

oh

#

so bot.wait until ready?

sullen nymph
#

attach the DBLClient to your bot object and use wait_until_ready in on_ready, output bot.dblpy.bot.user there

#

It should be waiting for the user to load before posting k3llyShrug

last cedar
#

@vapid cape i did use the right client, and its already updated to 2.4.0

wide sigil
#

also it just stopped my bot

#

like my bot doesnt come online anymore for some reason

sullen nymph
#

nekothinking That sounds like an issue with your code

wide sigil
#

hmm weird

#

but dbl still isnt working

last cedar
#

anyone help?

wide sigil
sullen nymph
wide sigil
#

hmm okay

#

omg

#

I think ti worked

#

gotta test votes tho

#

Okay, so my votes don't work

sullen nymph
#

Remember port in URL

wide sigil
#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/upvote', webhook_port=3004)
#

Ah

#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/upvote', webhook_port=3004)
finite hare
#

It's http://<ip>:<port><path>

sullen nymph
#

I suggest you don't expose your IP in a public server

finite hare
#

Oh yeah, that too

wide sigil
#

It's http://<ip>:<port><path>
@finite hare Thats what it is

green mantle
#

no

wide sigil
#

I suggest you don't expose your IP in a public server
@sullen nymph Yeah forgot to remove it this time. Thanks

green mantle
#

we just saw ur url

#

you did not have your port

wide sigil
#

oh okay port first

green mantle
#

thats..... not that

finite hare
#

Like that ^

sullen nymph
#

IPs

wide sigil
sullen nymph
#

Yes

wide sigil
#

Alright

finite hare
#

That's not my ip

wide sigil
#

Trying again

finite hare
#

That was a fake ip I made

#

Just as an example

sullen nymph
#

Next time just use 0.0.0.0

finite hare
#

Si senor

wide sigil
#

Still doesn't work ๐Ÿ‘€

finite hare
#

But yeah, I have the same problem with the vote thing

#

Doesn't work at all and I have followed the docs throughout

last cedar
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(
    "token", {
        webhookServer: server,
        webhookAuth: "password?"
    },
    client
);
const handleReady = message => {
    setInterval(() => {
        dbl.postStats(client.guilds.cache.size);
    }, 1800000);
}
client.on("ready", handleReady);
``` idk why im getting https://hastebin.com/ruporuvazu.js