#topgg-api

1 messages · Page 88 of 1

restive otter
#

@sullen nymph ??

sullen nymph
#

Replace username with points?

restive otter
#

ok

#

But it show the Mudae Pints

#

Points

#

Not my Bot

#

Bruh

lucid mesa
#

the bot has been approved btw

fiery pagoda
#

@lucid mesa it seems it hasn't been approved, I don't see it in this server.

green mantle
#

probably kicked if it has been approved

lucid mesa
#

it was approved by @open garden but when I DMed them they said they did add them

#

so it was kicked ?

open garden
#

Let me check]#

#

But #general would of been the discussion.

lucid mesa
#

right sorry, will be more careful next time

gloomy fractal
#

@restive otter where?

empty peak
restive otter
#

How can I apply that message to the channel when someone votes on my bot?

empty peak
#

@restive otter Remove that token picture asap

#

@restive otter Are you sharding yet or?

#

If not sharding and using DJS12, change client.channels to client.channels.cache

restive otter
#

The answer isnt this

tame bison
#

I don't know how to use dbl.webhook someone to help me?

restive otter
#

I have changed

tame bison
#

I've already been there and I don't understand it.

empty peak
#

@restive otter Have you supplied your URL in your DBL bot options on the site

restive otter
#

The moderator told me to do this, MY IP:3000/dblwebhook

#

@tame bison if someone will vote your bot its (logging or whatever you set) on vote event, and ready event is notifying to dblwebhook ready. (Sorry for bad grammer)

empty peak
#

@restive otter VPS or local machine? If local, you need to port forward 3000 to the specific machine

restive otter
#

yes

#

@empty peak I have the same problem i did everything correct but not working.

#

(Previously)

empty peak
#

Also, make sure you've got the protocol correct. HTTP or HTTPS

restive otter
#

http://vpsip:8000/dblwebhook true?

empty peak
#

VPS is different

sterile tapir
#

How is everyone

empty peak
gloomy fractal
#

-api @sterile tapir

abstract mothBOT
#

@sterile tapir

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

empty peak
#

For example:

    location /dblwebhook/ {
        proxy_pass https://127.0.0.1:3000;
    }
#

Boss! Maybe you'll know - DBLAPI library for JS accept shardingManager?

restive otter
#

Everything is very confused,

#

😔

gloomy fractal
#

Not 100% sure @empty peak
I’d wait for someone else

#

😄

restive otter
#

@restive otter Çözersen banada söyler misin?

#

@restive otter Yakında çözücem ama bunlar sayesinde değil, kendi kendime bunlardan bir beklentim yok

#

🥺

#

@restive otter Gerçekten öyle aynı şeyleri tekrar ettiriyor sanki

empty peak
#

@restive otter - It's not a simple copy-and-paste to setup DBL. If local machine, you'll need to:

  • Port forward 3000 (or whatever port) to your local machine.
  • Add http://yourIP:3000/dblwebhook to https://top.gg/bot/yourBotID/edit
  • Use new DBL( yourDBLToken, { webhookPort: 3000 }, bot )
#

Not 100% sure @empty peak
I’d wait for someone else
@gloomy fractal - Alright bro. I get no errors, but I don't know if the server count and stuff it has is just old

tame bison
#

@empty peak Thanks sensai

empty peak
#

Again, VPS is kinda different

tame bison
#

I use a vps

empty peak
#

Do you have any sort of webserver like a website running on it ATM?

tame bison
#

euhhhhhhhhhhhh

#

i suck at english

#

i don't understand

restive otter
#

sad

empty peak
#

VPS you'll likely need to configure the firewall to allow traffic through the correct port

#

iptables -I INPUT -p tcp --dport 3000 --syn -j ACCEPT

service iptables save

vapid cape
#

@empty peak not sure if someone answered already but no, the sharding manager is not a valid client

#

the only valid clients are Discord.Client and Eris.Client

empty peak
#

Shite. That would have made thing hella easier

#

So instead I use new DBL( process.env.DBL_TOKEN, bot ) in every shard?

vapid cape
#

yes, it does account for shards automatically if you do that

#

you just cant use webhooks like that

empty peak
#

Yeah, that's my issue

vapid cape
#

do it like this

#
if(client.shard.ids[0] === 0) {
  new DBL(token, {webhook options}, bot)
} else {
  new DBL(token, bot)
}
#

alternatively, you can create a webhook in your sharding manager

empty peak
#

Might have to just to send like a thank you for voting, for example

vapid cape
#

without passing a client parameter

#

then use broadcastEval to send

empty peak
#

I ended up not using the DBL library for the webhook at all because it doesn't support HTTPS

vapid cape
#

wdym it doesnt support https?

#

if you have https on your side, dbl should be able to send to it

empty peak
#

DBL can send to it, but the DBL JS library on NPM only uses HTTP

vapid cape
#

ah you mean the webhook server instance?

empty peak
#

Yeah

vapid cape
#

well traditionally node.js apps are made with an nginx layer for SSL

#

if you have an nginx reverse proxy with SSL, then it doesnt matter if node.js's server is http

#

you can also pass your own https server instance to dblapi using the webhookServer option

empty peak
vapid cape
#

if you have SSL on nginx, dont proxy it to another SSL

#

thats basically doing double the work

#

ideally it should be internet <-HTTPS-> nginx <-HTTP-> node.js

empty peak
#

Really? I didn't think you actually could pass to http, TBH

vapid cape
#

the only reason for going double SSL would be if your internal network is somehow public

#

and you need to hide the connection from other internal processes/machines

empty peak
#

So literally just change that proxy_pass https://127.0.0.1:3000; to proxy_pass http://127.0.0.1:3000;

vapid cape
#

yup

#

let me check my config

#

yup

#

thats basically doing SSL on both nginx and on node

#

which is a waste of resources

empty peak
#

Well God damn

#

THat coulda saved me some time

#

I've literally been doing that for years

restive otter
#

Hmm i have the vote webhooks behind cloudflare but how do i whitelist the ports for like, only dbl

#

Bots love to portscan my vps and attack any open port :/

#

Which rn are both of my 2 ports open for webhooks from dbl voting

vapid cape
#

bots portscan all vps's

#

theres no hiding from them

#

since dbl itself is also behind cloudflare, their ips are probably also dynamic

#

i dont think there is a way to accurately whitelist dbl's requests, except for using the authorization header, which is why it exists in the first place

empty peak
#

@vapid cape - Going back to this:

then use broadcastEval to send
Now, if I'd like to send the message to the person voting, broadcasting this.users.fetch( ID ).then( user => user.send( 'Thanks!' ) ) would send it to him/her 5x if I have 5 shards

vapid cape
#

yes

#

if(this.shard.ids[0] === 0) { this.users.fetch(id).then(user => user.send()) }

#

i guess its easier to just setup the webhook in shard 0 in the first place

empty peak
#

Oh, I was just gonna manager.shards.random( ).eval( )

vapid cape
#

well, you could also do that

#

but if the same user votes multiple times, might as well only cache him in one shard, instead of having multiple copies on random shards lmao

empty peak
#

Ah true

viral solar
#

how to get the URL? pls

visual moss
#

whats the poststats limit

#

autoposter is 15m minimum but I can do 60calls per minute to API, cant I just post stats every 5minutes then

austere river
#

Do many people use the DBL Java Library?

restive otter
#

Yes, like i do/did

austere river
#

It uses both Gson and Json?

restive otter
#

I mean you don't really get JSON out of it because it parses itself afaik

austere river
#

Yeah

foggy bramble
#

I use heroku

median badger
#

if you have a webhook you put its url in

hearty crystal
#

ıit gives this output and the server count stays at N/A

tired ivy
#

dbl.postStats(client.guilds.size);

#

@hearty crystal

hearty crystal
#

Thanks

hearty crystal
#

now it gives Promise { <rejected> TypeError: Cannot read property 'size' of undefined

spiral steeple
#

because it's client.guilds.cache on v12

hearty crystal
#

no ı use 11.5.2

spiral steeple
#

then it should be fine

#

let me see

#

Yeah, that should work

#

you're sure you aren't on v12?

hearty crystal
foggy bramble
charred inlet
#

gimme <@&364144633451773953> <@&304313580025544704> and <@&265158261945270273> plz

gloomy fractal
#

Can you not

#

-atmods @charred inlet

abstract mothBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
burnt trellis
#

Begging for mod.

dense compass
#

....

charred inlet
#

?

open garden
#

Woah

dense grail
#

lmao

rough crater
#

wow

gloomy fractal
#

Like let's not ping the roles and / or beg for moderator

#

-faq 12

abstract mothBOT
charred inlet
#

ok

open garden
#

The flood into this chat 😂

rough crater
#

mods got crazy when they got a ping

sullen nymph
#

-api

abstract mothBOT
restive otter
#

Can someone help me with upvote webhook

sullen nymph
#

-ask2ask

abstract mothBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

restive otter
#

How is that ask to ask why

#

just ask it

#

I legit did

sullen nymph
#

What exactly do you not understand

restive otter
#

Can someone help me with upvote webhook
well what doesnt work? what exactly are you not understanding

#

I asked for help, I didn’t say can someone help@me, my question was for@someone to help/link me to somewhere, to help me with upvoting webhook

#

Ask2ask headass

#

well now we wont help you angeryBOYE

#

I asked a simple question, lmao

wispy lynx
#

Is there something wrong with how I'm using the python lib

class MyBot(commands.Bot):
    def __init__(self):
        self.dblpy = dbl.DBLClient(
            self,
            self._alt_auth[1],
            autopost=True,
            webhook_path='/dblwebhook',
            webhook_auth='some super cool dbl password',
            webhook_port=3583
        )
    async def on_dbl_vote(self, data):
        ...

Will this automatically manage the webhook too, or do I need to setup a webhook server too?

#

Also, it doesn't seem to be autoposting my count

sullen nymph
#

It'll run if you set at least webhook port

#

Don't forget the cog listener decorator

wispy lynx
#

It's right inside my main bot class

#

Does it need the listener decorator?

sullen nymph
#

Oops

#

I believe not

rugged trail
#

is {client.guilds.cache} shown how many guild is the bot on or it shown how many member in it because i had an error saying this

restive otter
#

@rugged trail client.guilds.cache.size

rugged trail
#

Thanks !

empty peak
#

Would be dope if the votes endpoint also returned timestamps

restive otter
green mantle
#

You could just do your own with webhooks

restive otter
#

that also works GWowoHehe

empty peak
#

You could just do your own with webhooks
@green mantle - You could, but if for whatever reason your webhook is down, even for maintenance, you don't lose any and is easy to back-track and prevent duplicates. Even webhooks should be provided with a timestamp

viral solar
#
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
does anyone know why he is not answering?
vapid cape
#

did you setup your webhook properly?

viral solar
#

I think so

vapid cape
#

show your webhook options and your top.gg options

viral solar
#

can I send a link to the print?

vapid cape
#

yes

viral solar
vapid cape
#

and your webhook options?

#

in your DBL code

viral solar
#

and your webhook options?
@vapid cape
where would that be?

vapid cape
#

in your code

#

where you define dbl = new DBL()

viral solar
vapid cape
#

and your config.webhookAuth is "top123" right?

viral solar
#

yes

vapid cape
#

where is your bot hosted?

viral solar
#

vps

vapid cape
#

do you have SSL enabled?

#

if not, change https to http

#

also, check if your vps requires opening ports in the firewall

#

some vps's like google compute engine, require you to allow the port in your admin panel

viral solar
#

also, check if your vps requires opening ports in the firewall
@vapid cape
it's already open

vapid cape
#

well then, change it to http and try again

#

if it still doesnt work, test it with reqbin

foggy bramble
austere river
#

Don't send token you fool

#

Delete & regenerate

foggy bramble
#

I changed few letters in between

austere river
#

Does it not output anything?

#

The bottom of the page has another example

foggy bramble
#

It just says webhook running at 0.0.0:5000/dblwebhook

native elm
#

Hi

restive otter
#

Hey hey GWnekomakiWaveBOYE

#

though this is for the topgg api, so try in offtopic again

opal schooner
#

If my bot is sharded do I still just create the dbl object in my bot entry file? Or do I move it to my sharding manager?

vapid cape
#

@opal schooner depends on the library, in dblapi.js you can add to the entry file as long as you dont use webhooks

opal schooner
#

Okay it will count shards and sum the guild counts?

vapid cape
#

yes

restive otter
#

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

TypeError: Cannot read property 'on' of undefined
I am copying the documentation
i have defined dbl with my token

vapid cape
#

webhook is not defined if you dont specify a webhook port or a webhook server

violet field
#

-p chamkeele chooze

#

!p chamkeele chuze

sullen nymph
#

-botcommands @violet field

abstract mothBOT
#

@violet field

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

misty mica
#

My bot is not posting server count

empty peak
#

@misty mica - Show where you init DBL

misty mica
#

nvm I fixed it

#

Thank you though

restive otter
#

@Muffin

restive otter
#

ey

#

the api its bugged?

#

i think thats just glitch bugging out

#

when i delete the code of post server count the bot turn on

vapid cape
#

you probably did something wrong

#

show your code

elfin bolt
#

i think here is a problem

sullen nymph
#

Try removing the port from the URL

vapid cape
#

and change port to 3000

elfin bolt
#

i tried but nothing chaneged

#

3000 is already in use 0w0

vapid cape
#

then add your existing server

#

change webhookPort:5000 to webhookServer:server

elfin bolt
#

ok

#

no response in the console just "server count posted"

vapid cape
#

did you remove the port from the url?

#

and saved?

elfin bolt
#

wait pls

#

no response too

restive otter
#

dont put any port

#

to url

elfin bolt
#

ok i already removed it

restive otter
#

Tried?

elfin bolt
#

yp

#

no response in console 0w0

restive otter
#

add webhookServer: server

#

to your dbl code

elfin bolt
#

i added them

vapid cape
viral solar
#

mine is equal

elfin bolt
#

me too

#

i have a same problem

vast geyser
#

Ow

#

İm mobile

#

:(

daring panther
#

So the C# api does not throw an error if it couldn't be initialised. It just throws a NullReferenceError if subfunctions are referenced.
Is there a possibility to check whether it was able to correctly initialise?

south ferry
#

null check

restive otter
#

ok i need help getting my webhooks to work

#

it's setup i just need help making sure requests work and stuff ?

#

what am i putting as the request

jade shuttle
#

When it comes to webhooks, you don't send the request to a server. Instead the other service (top.gg in this case) sends the request to your server. Basically reverse of other http requests you send.
In order to implement top.gg webhooks, you need a web server which listens for the request from top.gg (preferably authenticated with the auth string).
I have no idea what language/library you're using so can't say how exactly to implement it.
@restive otter

restive otter
#

right yes that's what i meant

javascript. the ready event fires for the webhook and i have the vote event setup

#

i'm just not sure how to get the request to actually go to through to me

#

so i believe all i need help with is the webhook options and how to make sure i can receive them @jade shuttle

jade shuttle
#

Did you deploy the code?

restive otter
#

what

jade shuttle
#

Did you deploy the web server on your vps?

#

You need to add the webhook in your bot's settings

restive otter
#

yes under the Webhook options ?

jade shuttle
#

Yeah

#

That's where you add it

restive otter
#

yes that's the part i need help with

#

the URL part specifically

#

because i can't get it to go through

jade shuttle
#

What url are you entering?

restive otter
#

nothing is now right now i cleared it a minute ago

#

what should i be putting

jade shuttle
#

The url should be formatted like this
http://yourIP:port/endpoint/

restive otter
#

k sec

jade shuttle
#

From the example:

dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); });
#

This should log a url

#

Replace the hostname with your vps's ip

restive otter
#

clicking test doesn't show anything

jade shuttle
#

What url did you enter?

restive otter
#

ip being the ip

jade shuttle
#

Did you save?

restive otter
#

ye

jade shuttle
#

Is your server responding properly?

restive otter
#

wym

jade shuttle
#

Can you try POSTing to your url

restive otter
#

ye

jade shuttle
#

Same payload as what you expect

restive otter
#

Could Not Connect error code 1007

spiral steeple
#

Looks like a cf error code

restive otter
#

what's that mean

spiral steeple
#

Idk if that's exactly it

#

I wouldnt know for sure though

restive otter
#

uhh hm

#

ok i curl posted and got Timed Out

jade shuttle
#

It means you can't connect to your server

#

Your firewall is probably blocking it

#

Open the port in your firewall

restive otter
#

how do i do that uhh

silent pilot
#

I’m having trouble with the python API.

#

I think there is an issue

golden steeple
#

dbl token is the same as the api key right?

rocky bough
#

yes

bitter crag
#

My console shows: Error: 429 Too many requests

willow spindle
#

you are being ratelimited

sinful edge
#

hey

#

i need to make the bot show the server count

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.

sinful edge
#

do i get the code in the channel python there ?

#

i mean in my code

restive otter
#
const dbl = new DBL(api_token, { webhookPort: 5000, webhookAuth: 'password' });

I am using Heroku, so what i have put at the webhookPort

#

??

placid peak
#

process.env.PORT probably?

#

(gets the port from env file)

restive otter
#

Any one can help me what is this

frank grove
#

Are there any plans to add more endpoints to the api in the future?

Such as an endpoint to get votes by each user this month? So bot owners can give out rewards each month to users who voted most

sullen nymph
#

-api @restive otter

abstract mothBOT
#

@restive otter

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

restive otter
#

Ok sorry

restive otter
frank grove
#

Thanks, I'll take a look ThumbsUp

kind fog
#

Any one can help me what is this
@restive otter your token has been leaked in a public github repository and regenerated

lavish elm
#

I have a little question, I don't test it myself because I haven't published my bot yet

restive otter
#

you're not able to interact with dbls api until your bot was actually submitted and approved

lavish elm
#

Can I have two instances using the same DLB key? One from the bot's code (to auto-post bot's stats), and one from my webserver to host the votes webhook?

restive otter
#

yeah probably

#

as long as you're making sure you're not hitting the ratelimiting

lavish elm
#

I would try it and see if I had my bot listed :p

#

Thanks tho man, appreciate it

lavish elm
#

There is no way to setup a sandbox environment to test votes right?

jade shuttle
#

Webhooks don't require your API key

#

What do you mean?

austere river
#

Faka you can test vote webhooks, use the test button ¯\_(ツ)_/¯

spark sphinx
#

is there a way to find the total votes im js

#

in*

restive otter
#

@spark sphinx

viral solar
#

http://<ip>:5000/dblwebhook
ip = my address public ip
right?

restive otter
viral solar
#

http://<ip>:5000/dblwebhook
ip = my address public ip
right?
because mine is not working

#

and I don't know what to do anymore

restive otter
#

read the docs, thats the only thing i can tell you rn

viral solar
#

I've read the documents, that's why I'm here in need of help

empty peak
#

http://<ip>:5000/dblwebhook
ip = my address public ip
right?
@viral solar - Make sure you've port-forwarded 5000 to that machine

misty lantern
#

n!yardım

restive otter
#

i have a question

#

dont ask to ask

abstract mothBOT
#

@misty lantern

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

restive otter
#

my bot is in i think 15 servers and on top.gg says N/A do i have to do something for it to correctly display?

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.

restive otter
#

what is the api link to see the amount of servers my bot is in?

frigid basin
#

read the message

restive otter
#

yea sorry i put the wrong question. My bot is in like 30+ servers and the API says 1 server.

#

And i have no idea why that could be

topaz verge
restive otter
#

a dumb question regarding the dblapi.js lib, does it support sharding? cuz postStatus uses this.client.guilds and that only contains the list of guilds for the current shard, i think

spiral steeple
#

No it wont add up every guild on every shard all it seems to do is add the shard count

restive otter
arctic arch
#

d.js v12 uses internal sharding by default which means client.guilds.cache contains all the guilds from all shards

#

and it detects external sharding too, posting the shard id as well causing the total calculation to be handled on our side

restive otter
#

oo nice one, thanks

empty peak
#

d.js v12 uses internal sharding by default which means client.guilds.cache contains all the guilds from all shards
@arctic arch - I'm sure that's not true

spiral steeple
#

it is, or at least was

empty peak
#

client.guilds.cache will contain the cached guilds of that shard

arctic arch
#

and all guilds get cached on startup unless you're doing something horribly wrong

empty peak
#

That's correct, they do. But bot.guilds.cache will only contain the guilds on that shard, not all shards

#

I just tested it

arctic arch
#

I suggest you read up on the new sharding then

empty peak
#

Unless you're talking about a change on master that I'm not aware of

arctic arch
#

obviously if you're still using the old sharding manager its the old external sharding which my second message addresses

empty peak
#

I'm using V12

#

Bot currently in nearly 300 guilds. I force it onto 2 shards:
bot.guilds.cache.size -> 143 - Shard 0
bot.guilds.cache.size -> 155 - Shard 1

#

If it contained all of them, get( ) would likely have to be async

#

Otherwise, client.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'') would return 4x the correct value if you had 4 shards...

#

And it would entirely defeat the purpose of sharding

arctic arch
#

you're still talking about the traditional sharding manager...

empty peak
#

The sharding manager in V12

arctic arch
#

and it detects external sharding too, posting the shard id as well causing the total calculation to be handled on our side

#

there are two methods of sharding in v12

#

the internal sharding does not use broadcastEval or fetchClientValues

empty peak
#

How do you specify the internal sharding? I've not seen it

arctic arch
#

add shards option in clientoptions

#

and thats all you need

empty peak
#

So shards: 'auto', you mean?

arctic arch
#

if that is what you wish

empty peak
#

Seriously - so V12 allows you to get rid of all the...

const manager = new ShardingManager( ... );
```...shit?
arctic arch
#

yes

vapid cape
#

there are advantages and disadvantages to both methods, but yes

#

traditional sharding lets you make use of multiple cpus

#

internal sharding uses a single cpu

#

but internal sharding is much easier to use, and uses less memory

arctic arch
#

I wonder if they'll ever internally account for that

vapid cape
#

only if they make it shard across worker processes

#

i think some custom frameworks and sharders do that

arctic arch
#

if they kept the cache in one place and then communicated with eachother behind the scenes

#

or would that be a bad idea

#

but basically worker shards with all the work invisibly done behind the scenes

vapid cape
#

depends

#

if you want to handle events on the main process, and have the workers receive data from discord, then you'll have a lot of data going through ipc

#

it should work, but not sure about performance

#

also stuff like voice would be very hard to make it work like that

violet spoke
#

Hey

#

my server count is frozen

knotty garnet
#

Have you tried ctrl + F5 on the bot's page?

#

Maybe it's the cache that's not showing live numbers

violet spoke
#

k

violet spoke
#

it hasn't updated yet

#

@knotty garnet

knotty garnet
#

Then idk, see if someone here use the dbl python lib

woeful dune
#

hey! i get a 401 Unauthorized then getting https://top.gg/api/users/USERID with my bot, but, then i run the exact url in my browser, it works... what's going on?

rocky bough
#

because you are logged in in your browser

#

your bot needs an authentication key in order to access the API

woeful dune
#

because you are logged in in your browser

your bot needs an authentication key in order to access the API
@rocky bough no, i tried with reqbin and in tor, still working

rocky bough
#

it shouldn't

#

are you sure you're not logged in in topgg?

woeful dune
#

and it doesn't says that you need apikey in the docs

rocky bough
#

you do

woeful dune
#

are you sure you're not logged in in topgg?
@rocky bough yes i'm sure

rocky bough
#

literally on the first topic

#

hmm

#

well maybe find a moderator

woeful dune
#

ho, now it doesn't work anymore, that's wierd

#

that's wierd 🤨

sullen nymph
#

@violet spoke listener decorator on on_guild_post

#

And make sure you're loading the cog properly

stray sluice
#

i need a help

#
  async def upvoted(self, id):
    async with aiohttp.ClientSession() as session:
      async with session.get(f'{self.base_url}{self.client.user.id}/votes', headers={'Authorization': self.dbltoken}) as resp:
        data = await resp.json()
    for user in data:
      if id == int(user['id']):
        return True
    return False``` so this is to check if the user has voted or not , i wanna know when does the list resets , like one of my friends used a command but it didnt ask him to vote , guess his Id was on the upvote lists, how long does it take the list to refresh so it will ask again to vote
#

ping me if you have the answer and thanks

sullen nymph
#

@stray sluice 12 hours

stray sluice
#

@sullen nymph sometimes it takes time?? like there may be a difference of one or two hours?

sullen nymph
#

Yeah, there can be quite a significant delay

#

I suggest you use webhooks

stray sluice
#

may i get some help with that

#

like any examples or something

sullen nymph
restive otter
#

Do i have to postStats or it will do automaticly

teal lava
#

not again Pete

empty peak
#

@restive otter - If you passed your client to new DBL( ), it's automatic.

restive otter
#

ok

#

but a little bit late :))

restive otter
#

!ping

#

!ping

arctic arch
#

-botcommands

abstract mothBOT
#

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

arctic arch
#

-api

abstract mothBOT
arctic arch
#

@restive otter

storm surge
#

how do i make my bot site show server count? i have no idea what im doing

vapid cape
restive otter
#

dbl.postStats EhU?

storm surge
#

@vapid cape where do i put it? im so confused

vapid cape
#

what language are you using?

storm surge
#

for my bot?

vapid cape
#

yes

storm surge
vapid cape
#

did you check the Tools section?

storm surge
#

on the docs?

vapid cape
#

there is a library for py

#

yes

storm surge
#

no let me check

#

if my bot is running via repl.it do i put dblpy in the requirements file?

vapid cape
#

i dont use repl so idk

storm surge
#

oh ok

vapid cape
storm surge
#

kk

solid wharf
#

Anyone seen this before? Can someone on the dev team or website team let me know what I'm doing? Maybe something is breaking my widgets?

vapid cape
#

did you put your widget somewhere where its accessed too frequently?

vagrant barn
#

Saw above about there being two options fornsharding in discord.js 12, the version I'm using ias the whole shard manager file that then loads up the not file..

Where can I find an example of the other version?

vapid cape
#

you just set that in your client options

#

set it to "auto" to use the recommended number of shards, or define the shards yourself

violet spoke
#

My server count is frozen

#

can someone help me?

void pawn
jagged pine
#

bot page --> edit --> scroll down

signal hawk
#

You'll be able to see that once you have an approved bot.

void pawn
#

Oh

#

Ok

#

Thanks @signal hawk

signal hawk
#

yw

void pawn
#

Thanks @jagged pine

scenic remnant
#

what do we do to webhooks on discord what do they even do

knotty garnet
#

You what?

#

Discord webhooks are a way to broadcast messages or send messages with custom username and avatar

scenic remnant
#

@knotty garnet thats what i mean

frigid basin
#

how can I check if someone has voted in discord.py?

hallow timber
#

Let me look for you

#

There is a bot @stuck moon

#

@frigid basin ^^

#

O wait never mind

#

What am I thinking

#

idk about that

frigid basin
#

I meant as in making a vote lock command, if thats possible in discord.py

hallow timber
#

I do discord.js so idk

#

I can look for you

frigid basin
#

I tried looking in the api section but I couldn't really find anything

restive otter
#

Hello

#

My bot is displayed as 600 servers on your site, but the bot is on 200 servers. Would it be a problem?

rough crater
#

Hey

#

You are using js, right?

restive otter
#

Yes

calm briar
#

shows 561 for me

restive otter
#

A figure between 550 and 600 appears

rough crater
#

Alright, try doing.

little harbor
#

view your page on a different browser
nevermind, my bad, i thought your problem was that it was showing the wrong number just to you

restive otter
#

Okey 1 sec

rough crater
#

Try using dbl.postStats(client.guilds.size);

restive otter
#

Same

#

Wait

#

okey

#

no difference

rough crater
#

It shows for me 200 servers.

restive otter
rough crater
#

weird

restive otter
#

very weird

#

@rough crater

rough crater
#

I'm thinking.

restive otter
rough crater
#

uhhh

#

what

restive otter
#

I think I should renew api token

rough crater
#
client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size);
    }, 1800000);
});
#

Try this

restive otter
#

1 sec

#

same

#

Could it be a problem because I'm using Shard?

rough crater
#

Oh you are sharding?

restive otter
#

Yes

rough crater
#

That's the problem

restive otter
#

I think it has fixed!

rough crater
#

Alright

restive otter
#

Yes!

#

Thanks <3

rough crater
#

cool

hearty crystal
#

How can I check.if user is voted or not

restive otter
#

see the docs

hearty crystal
#

İ checked but i want to trigger the action when user is not voted

restive otter
#

again, refer to the docs

#

they explain everything needed

hollow temple
#

Hello, I look at my bot in Discord Bot List and typing N/A on my bot. I added a code to bot.js but still the same

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

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

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

did you change the "Your top.gg token" to your topgg token?

hollow temple
#

I forgot :D

balmy hamlet
#

lmfao

hollow temple
restive otter
#

show us the code with censoring your token

hollow temple
#

@restive otter

restive otter
#

censoring 100

#

can you send it with using codeblocks?

#

also, do any errors appear?

hollow temple
#

no error appears

#

can you send it with using codeblocks?
I do not understand ?

restive otter
#

delete

#

Thats not i meant

sullen nymph
#

Code, not token

#

Also regenerate it immediately

hollow temple
#

I censored with the character -

restive otter
#

sigh

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

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

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

code ^^

restive otter
#

well you need to obviously post your server count

sullen nymph
#

Do you create a new client just for dblapi.js

#

Or do you use an already existing one

hollow temple
#

i just created

#

I changed the code a bit but still the same

const Discorddbl = require("discord.js");
const clientdbl = new Discorddbl.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('mytoken', clientdbl);

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

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

read the methods

hollow temple
#

I already got the code from there

#

:(

restive otter
#

read the methods

#

scroll down and read the methods

sullen nymph
#

Providing a client to DBL constructor is fine

hollow temple
#

pfff still couldn't do :(

restive otter
#

are you even trying?

dapper crown
#

I looked at the https://top.gg/api/docs#bots site to make a server counter, but I don't know how to do it in html. Thanks in advance ^^

restive otter
#

what language?

dapper crown
#

HTML only

restive otter
dapper crown
#

So I generate the token, what do I do next?

restive otter
#

@empty peak Hello 🙂

#

do yo can help me?

#

anyone can help me?

restive otter
#

read what the error says

empty peak
#

You're not going to get a response by requesting it in a browser. It requires auth

restive otter
#

Hey for count the total number of members like a member count but for all server i need to fetchUsers ? sorry i'm new with the v12

spare mulch
#

discord.py dblpy issue where whenever I create a DBLClient object I get this issue: Unclosed client session

#

Error message:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f422607e880>
spare mulch
#

Anyone .-.

keen saddle
#

Is it possible to send http requests directly as the language I use isn't available on the docs?

sullen nymph
#

I don't see how it's not possible :p

keen saddle
#

I also know that I require to have a bot in here.

sullen nymph
#

@spare mulch Are you sure it happens when you declare DBLClient?

keen saddle
#

Alright. I'll have to look into their "docs" to see for endpoints.

spare mulch
#

Yes I commented everything else out shivaco

sullen nymph
spare mulch
#

Latest for both, let me go look for numbers

#

dblpy 0.3.4

#

@sullen nymph What was the aiohttp version used to develop the library

sullen nymph
#

I'll get back to you when I'm free
My local aiohttp version is 3.6.2

spare mulch
#

Same :\

sullen nymph
#

I'll play around with it a bit later

spare mulch
#

K, thanks

spare mulch
#

Hey @keen saddle If you need the required headers and payload dm me, I figured them out

#

For posting*

keen saddle
#

Alright, Will be a while yet, Still need to code my bot.

restive otter
#

How do I know if someone has voted and give them a role?

echo salmon
#

Use webhooks

hollow tree
#

hello
i have been having an issue with the dblapi.js library since yesterday. when i try to use the hasVoted method to get if a user has voted or not, it now throws this error: SyntaxError: Unexpected token < in JSON at position 0. any help would be appreciated!

spiral steeple
#

That looks like some internal fuck ups... judging by the fact that it's a < leads me to believe the api returned html for whatever reason.

#

are you parsing it yourself? also you should show some code.

hollow tree
#

no i'm not parsing it myself, i'm just using the built-in hasVored method from the dblapi.js library

spiral steeple
#

I'm not sure why that would error like that unless it's an actual api error and returned html for some reason

#

I don't have a bot on top.gg anymore either so I can't really help further

hollow tree
#

i see, thanks for the help though!

frigid basin
#

how does one also show the shards with discord.py or is that meant to be automatic with the server count

upbeat agate
#

is it able to make my bot announces on a room when it gets a vote ?

spare mulch
#

Yes

#

webhooks are your answer my friend @upbeat agate

upbeat agate
#

oh okay where do i put the webhook link ?

spare mulch
#

depends on alot of factors

#

first of all what language are you using

upbeat agate
#

i use js

spare mulch
#

I can't really help you then, google how to use webhooks w/ js

upbeat agate
#

oh okay

#

thank you for your help

spare mulch
#

yup

#

I much prefer python over js

uncut hinge
#

does anyone know why this error spams my console ? :

(node:29836) UnhandledPromiseRejectionWarning: Error: 503 Backend fetch failed
    at IncomingMessage.<anonymous> (/home/discord/imaginarium-bot/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:333:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:29836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 82)
#

pls ping me i don't read every messages ^^

vapid cape
#

503 is a server problem

#

it happens when top.gg has issues

uncut hinge
#

oh okey

#

is there anyway to prevent the module from spamming this ?

vapid cape
#

it shouldnt be spamming

#

unless you're also spamming api requests

#

like posting server stats on guild add

uncut hinge
#

hum i'm posting the server stats like every 5 minutes

vapid cape
#

is it spamming more than once every 5 minutes?

uncut hinge
#

yep

#

like ~10S i would say

vapid cape
#

did you put it in your ready event?

uncut hinge
#

if i press enter a few times it appears

#

uh yes

vapid cape
#

is it an interval?

uncut hinge
#

i think i made an interval

#

yep

#

setInterval(function() {})

vapid cape
#

the ready event may fire multiple times if your bot disconnects and reconnects

#

so it will create multiple intervals

uncut hinge
#

hm

#

weird

vapid cape
#

you can change it to .once("ready")

#

to guarantee the ready event only fires once

slim mauve
#

Can someone explain me how do I put the number of guilds my bot is in?

trail sigil
#

what language?

slim mauve
#

JavaScript

trail sigil
slim mauve
#

Thxs

trail sigil
#

there are examples there which you can pretty much copy and paste

#

just remember to use your token and choose the correct port

spare mulch
#

@slim mauve If that fails I know all the request headers and body required to update it

lone viper
#

Hi everyone hope all is well. Looking for a translator

spare mulch
#

Google translate

lone viper
#

Smoggle if possible

#

Isnt there a bot for it ?

spare mulch
#

what you want a bot @lone viper

lone viper
#

Yes if possible

spare mulch
#

this channel is for development (and for the most part discord)

lone viper
#

I looked up translator for discord and it sent me here

spare mulch
#

Well this is a development channel, go ask in #general

lone viper
#

Ok thank u

restive otter
#

Hi

dusty fulcrum
#

is there any other way to get the voting feedback other than webhooks? my bots aren't accessible from the outside 🤔

spare mulch
#

?

dusty fulcrum
#

voting feedback? as in if someone voted for your bot on top.gg?

#

i've only seen docs on webhooks but i can't do webhooks with my bots

spare mulch
#

my bots aren't accessible from the outside
What do you mean by this

dusty fulcrum
#

that the server they're on doesn't have a static IP and my firewall is closed as well

spare mulch
#

Ohh

#

I'm pretty sure you can retreive the past 1,000 voters from the api

dusty fulcrum
#

oh that'd be neat.

spare mulch
#

Lemme find it

dusty fulcrum
#

oh lol, missed that line. thank you

forest summit
#

and this

wheat geyser
#

I'm using dblpy, how am I able to get my API token? I can't seem to find where to get it

sullen nymph
wheat geyser
#

ty

wispy epoch
#

Hey

autumn lance
sullen nymph
#

-api

abstract mothBOT
obsidian delta
#

My error sending the message, sorry

restive otter
#

My bot shows about 200 servers on the site, but my bot is on +690 servers. I think this is an API problem. How can I solve it?

sullen nymph
#

-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
#

@autumn lance that is a bug with top.gg that they havent solved yet. you can fix it by navigating to top.gg first, then you'll see some cloudflare loading thing, then after the page loads, you can go back to the docs page and it will work

autumn lance
#

Ok

restive otter
#

How can I show all servers on site in a bot with a shard?
const DBL = require("dblapi.js");
const dbl = new DBL('my token (dbl)', client);
client.on('ready', async() => {
setInterval(() => {
client.shard.fetchClientValues('guilds.size').then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0));
})
}, 900000);
});
I'm using this but not working

vapid cape
#

if you're using the sharding manager you dont need to postStats

#

it will do it automatically

restive otter
#

Ha, okey

potent tide
elfin bolt
sullen nymph
#

CSS

oblique osprey
#

TR

#

Türklwr Varmı

elfin bolt
#

iknow but how?

sullen nymph
#

style tag in long description

rugged sierra
#

@potent tide webhooks are meant for receiving votes, so dbl will post to that webhook on a new vote.
its not meant for channels iirc

#

you usually have your own webserver receiving those post requests

restive otter
next zodiac
#

Legit, tried disable adblock.. still same, could it be a browser issue or?

next zodiac
#

ohhh ok

boreal flower
#

i have rewards for when someone votes for the bot but for some reason the value i want it to add to doesnt get added to?, im not sure whether ive missed something or done something wrong.

restive otter
#

and use await

#

@boreal flower ^

boreal flower
#

ah okay, ty

restive otter
#

Türk olan arkadaşlar top.gg'ye attığım bot tahminen ne zaman onaylanır?

median badger
#

oh god that name

#

nice google

icy sinew
#

@restive otter Aga bu yetkililere kalırsak botunun eklediğine şükret sen

#

Benim botumu denerken komutu yanlış kullanmış bot hatalı diye laf ediyo aq

restive otter
#

@left egret

quaint bramble
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
#

where do i go to set the "password" / webhookauth on top.gg?

vapid cape
#

the password is anything you want

#

as long as its the same thing on both

quaint bramble
#

@vapid cape i dont see where the password is on top.gg

vapid cape
#

Authorization

#

right after webhook URL

#

in your bot's edit page

quaint bramble
#

i see

#

thanks alot!

left egret
#

@icy sinew

1 - Bu kanal ingilizce sadece ve türkçe’ye hiçbir şekilde izin verilmiyor - Türkçe için sadece #memes-and-media
2 - Küfür/Argoları kendine sakla, ilk ve son uyarı
3 - Ret ile ilgili sorun varsa modlara ulaş, detay eklemeyip modların arkasından böyle boş boş konuşma.

Ty.

icy sinew
#

@left egret The official who checked my bot has used the @dense grail command incorrectly, refused my bot considering it to be an error, but it is completely the admin fault.

left egret
#

k

icy sinew
#

sorry

bitter moon
#

How I can get the votes of my bot?

spare mulch
#

read the docs

#

Detecting votes has its own section

willow spindle
#

this is not related with top.gg API @gentle urchin

gentle urchin
#

Sorry I was thinking of the wrong api

willow spindle
tacit wren
#

willow spindle
#

@tacit wren can you stop this?

left egret
#

Thanks

wild mirage
#

@left egret ily

jagged mantle
#

My bot just got approved and I can't find my dbl token and only a api key is the api key a token

radiant peak
#

Heya, I have created a webhook for the channel where a upvote should be posted an copied the link into the field, how to go on?

willow spindle
jagged mantle
#

the token isnt there only a api key

lucid stirrup
#

Prehaps the api key is the token 👀

jagged mantle
#

You tried that last night. and you broke the bot

lucid stirrup
#

u prob pasted in wrong

jagged mantle
#

I hate to say it but you were right, and i think u mean we not me lol

azure gyro
#

after the server count is posted, and is displaying on the bot's page, there's any way to remove it?

lucid stirrup
#

I'd asume you'd just remove the servercount code

azure gyro
#

yeah, i tried that, idk if takes a while to remove it from the page or if i have to do something else

lucid stirrup
#

Me and my friends bot just got added so uh in all honesty i dont know

azure gyro
#

np, thanks anyway

jagged mantle
#

if ive already put my token in do i still need to put it in this?

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

or do i remove the const dbl new dbl token

vapid cape
#

this is for webhooks, if you only want to post server count, you dont need this

jagged mantle
#

I have a server count but I want vote updates as well

radiant peak
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)

I just voted for my Bot but didnt got anything printed, how long does it normally take?

sullen nymph
#

should be instant

#

Make sure you set your URL and webhook settings up properly

radiant peak
#
import dbl
import discord
from discord.ext import commands


class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = '..................'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)

def setup(bot):
    bot.add_cog(TopGG(bot))
```I have this in my cog @sullen nymph did I forgot anything?
sullen nymph
#

I suggest you still don't post your tokens, even if some part of them is censored

#

You are not actually setting the webhook up

radiant peak
#

oh I found

#

okay ill try again

#
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000, autopost=True)```
can I still use autopost with a webhook? and are `webhook_path` and `webhook_port` the same? i have to change the auth ik this
sullen nymph
#

Port is the port in the URL

#

Auth is the password you create

#

They can't be the same

radiant peak
#

yeah okay

#

and path is still the same?

sullen nymph
#

Can leave the same or remove it, the default value is /dblwebhook anyway :p

radiant peak
#

okay

#

ty 🙂

#

i'm so lost with this lmao

#

Port is the port in the URL
@sullen nymph do u mean the webhook url?

sullen nymph
#

The URL you enter on top.gg. In other words, yeah

radiant peak
#

can I send the webhook url to ask you for the port in my case?

sullen nymph
#

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

radiant peak
#

ahhh

#

so it isnt actually the wh url

sullen nymph
#

It's the URL to your webhook

#

That's Discord webhook

#

Also don't post such URLs in public channels either please

radiant peak
#

okay wont do anymore

sullen nymph
#

make sure you re-create the webhook you just posted if it's in use

radiant peak
#

yeah

sullen nymph
#

Anyway, you sent a Discord webhook URL

#

a webhook is just a script running in background waiting for requests

radiant peak
#

and dont use the from discord

sullen nymph
#

http://<ip>:<port><webhook_path>
You use this as the template for your URL, yes

radiant peak
#

okay now I get it

#

hopefully i can go on without stupid problems

coral copper
#

uh guys whats this for?

torn lily
#

Sending log to the channel determined when the bot is voted

#

How to make?

willow spindle
torn lily
#

@willow spindle I donr understand this webhook

radiant peak
#
import dbl
import discord
from discord.ext import commands


class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = '...' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)

def setup(bot):
    bot.add_cog(TopGG(bot))
```So do I need a webhook for the upvote event?
sullen nymph
#

Yup

radiant peak
#

okay

#

and ```py
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

sullen nymph
#

Yup

radiant peak
#

okay

#

and there's actually no way to use an upvote event without a webhook

#

because a friend said he's doing without

sullen nymph
#

what nekothinking

radiant peak
#

well it isnt the upvote event but its the last 10 upvotes

green mantle
#

last 1000

radiant peak
#

yeah but he only uses the last 10

#

so for this i dont need a webhook, do I?

radiant peak
#

is it bad for the connection when I dont close before restart my code?

restive otter
#

How can we send a message via webhook when someone votes?

tough stream
#

Is there a way to do use dblpy without await/async?

#

e.g. can i still use aioclient.get(url, data=payload, headers=headers) to get the vote of a user from the api?

willow spindle
#

just ask your question @restive otter

paper dune
#

hey, im doing this super simple POST request, but getting error 400?

require('dotenv-flow').config();
const fetch = require('node-fetch');

const body = JSON.stringify({
    server_count: this.client.shard.fetchClientValues('guilds.cache.size')
});

fetch(`https://top.gg/api/bots/${this.client.user.id}/stats`, {
    method: 'POST',
    headers: {
        'Authorization': process.env.TOPGGTOKEN,
        'Content-Type': 'application/json'
    },
    body: body
});
#

now i made the same post requests on postman posting the server_count and shard_count params and that seemed to work

#

im off for the night, but any insight on this would be great! (i'm having similar issues on other listing sites and i've exhausted all options that i think would work + everything i searched here pertains to the dblapi.js npm package which isn't that helpful here)

radiant granite
#

.

#

.

#

.

median badger
#

dont dot post smh

#

if you need help just say @radiant granite

clear kayak
#

Does the DBL module on python allow you to feed the guild_count yourself ?

green mantle
#

Why should it?

clear kayak
#

When you separate the shards over different instances it will get the guilds on that specific instance

def guild_count(self):
        """Gets the guild count from the Client/Bot object"""
        return len(self.bot.guilds)```
clear kayak
#

I'll just adjust it to my needs.

sullen nymph
#

been thinking about rewriting that for a while tbh

green mantle
#

tbh when splitting on multiple instances i just have a master control that does the posting

#

the nodes communicate to it anyway so just send each cluster's guild count to the master then master sends.

sullen nymph
#

It'd be easier to split stats posting and consistency imo thinkW

clear kayak
#

Sure

#

Done.

topaz verge
#

OKe

olive arrow
restive otter
#

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}`);
})``` @jaunty depot so i just add this to my code?
#

also sorry for double pin

#

ping

jaunty depot
#

no you don't

#

those are optional as it says

#

deep into the doc and you'll find postStats()

#

that's what you need

restive otter
#

im so

#

confused

grave sundial
#
bot.dbl = new DBL(process.env.DBLTOKEN, { webhookServer: server, /*webhookPort: 5000,*/ webhookAuth: process.env.DBLKEY }, bot);
bot.dbl.webhook.on('ready', hook => { 
  console.log(`📯 Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
bot.dbl.on('posted', () => {
  console.log(`🎀 Server count updated and posted!`);
});
bot.dbl.webhook.on('vote', vote => {
  console.log(`💎 User with ID ${vote.user} just voted!`);
});```
actual webhook: https://hastebin.com/ewaheducut.js
#

votes dont go through my webhook

#

the ready event doesn't seem to trigger

#

it used to i think before i updated to version 12

#

i changed all v12 methods

#

the posted event works but none of the others do

true talon
#

are you sure the port 5000 is open

grave sundial
#

i had that commented out before and it still worked

true talon
#

try uncomment it and use port 3000

grave sundial
#

will do

#

should the webhook ready event trigger when i restart my bot?

true talon
#

yes

grave sundial
#

didnt get it

true talon
#

what's your host

grave sundial
#

glitch lol

#

i plan to upgrade in time

true talon
#

well

grave sundial
#

but thats all i can do right now

true talon
#

i dont help glitch users

#

sorry

#

(use process.env.PORT as port btw)

grave sundial
#

thanks, i defined a listener at the top of my code as that

#
let listener = app.listen(process.env.PORT);```
#

so it's a glitch issue not top.gg api?

#

the webhook doesn't start at all like it used to

viral solar
#

what would be "520 origin error"?

#

appeared on the console

rugged sierra
#

The origin server returned an empty, unknown, or unexplained response to Cloudflare
just dbl fucking up

blazing basin
#

If a cluster of 3 shards needs to report its guild count for those shards, does it have to make 3 requests?

vapid cape
#

not necessarily, it can be done both ways

blazing basin
#

how

#

i mean, from what i understand, if you pass an array of shards it has to be all of them

vapid cape
#

you can make 3 requests with server_count, shard_id and shard_count

#

or you can make 1 request with an array of guild counts on shards

blazing basin
#

right but

#

if i pass shards

#

there's 6 shards

#

and i pass 3

#

how will the API know what to do with that

#

how will it tell apart me posting shards 0, 1, and 2 from 3, 4, and 5

vapid cape
#

not sure, i think its all or one by one

#

you have 6 shards divided in 2 processes of 3 shards each?

blazing basin
#

yes

vapid cape
#

do you have ipc between them?

blazing basin
#

no

vapid cape
#

then i guess you have to send them one by one

blazing basin
#

ree

#

where can i make api suggestions

vapid cape
#

github i guess

#

why no ipc tho

blazing basin
#

cause i don't need it

#

it's a stateless bot

vapid cape
#

ah alright

manic harbor
#

im following the docs and my id is being given and stuff

#

dbl.hasVoted("id").then(voted => {
    if (voted) {
    msg.channel.send("You upvoted the bot! GGs")
    }else if(!voted) {
        msg.channel.send("Upvote the bot ")

    }
}); 

Yet im always being given the 2nd option, Am I missing something?

jolly hornet
#

are you checking "id" with quotes?

gentle pewter
#

Xdddd

manic harbor
#

no?

#

my id is being given, its just I didnt place it in there. .hasVoted("328600107022942210")

manic harbor
#

nvm, i just realized what the problem was

restive otter
#

How can I make it to where if a person didn't upvote the bot, it can give an error but if they did, the command will execute? (In discord.py)

restive otter
#

Tf is {message} {expired}

#

It’s not updating my server count

fallen basin
lethal iris
#

maybe body is null

#

@fallen basin

#

I had the same problem

fallen basin
#

yeah it tries to log body but there is nothing

willow spindle
vapid cape
#

if you're using express, you need the body-parser middleware to access body

fallen basin
#

oof okay

edgy merlin
#

Im sorry im stupid and had the code comented 🤦‍♂️

willow spindle
#

lol

radiant peak
#

is it right that there is no way to use the on_vote event in dblpy without a webhook?

olive arrow
#

I assume so because it is an event

radiant peak
#

okay

olive arrow
#

The webhook is the listener

radiant peak
#

yeah

olive arrow
#

When it receives the event it triggers the on_event

restive otter
#

How can I make it to where if a person didn't upvote the bot, it can give an error but if they did, the command will execute? (In discord.py)

vagrant zenith
radiant peak
#

so when I use a webhook for the upvote event I wont get a api timeout if i get to many votes in a hour right?