#topgg-api

1 messages Β· Page 87 of 1

vapid cape
#

i mean, if you're concerned about performance, just do them concurrently

ancient pawn
#

i mean its like sending two responses to a channel from a command

#

i imagine that they share a ratelimit so it will be twice as easy to ratelimit myself by making 2 calls lol

vapid cape
#

well, true, you can always cache the responses

#

the top.gg api rate limit is what? 60 per 60?

ancient pawn
#

idr

vapid cape
#

so just cache the responses for 30 seconds

#

or whatever

ancient pawn
#

i guess

vapid cape
#

and make them concurrently, so no double latency

sullen nymph
#

60/60s

ancient pawn
#

i havent rlly done concurrency in node before

#

is it just Promise.all

vapid cape
#

yeah, you do it using Promise.all

ancient pawn
#
    public async fetchTopGGBot (botId: string) {
      const responses = await Promise.all([this.fetchTopGGBotInfo(botId), this.fetchTopGGBotStats(botId)]);
      return {
        ...responses[0],
        ...responses[1]
      };
    }
#

crazy code

#

i rlly need to properly type the api response

ancient pawn
restive otter
#

How can I grab upvotes

stone bay
#

Hey there. Can anyone help on using the API? How does it work, what can I do with it?

#

If there's already a place that tells me that, could someone redirect me to there?

restive otter
#

for both of you

stone bay
#

Alright, thank you!

silk echo
#

guys, I want to know what I put in the "Url" in Webhooks tests

vapid cape
#

an address to a webserver to process the webhook

#

for example, the ip address and port where your program is running

#

or the project url if using glitch, heroku, replit, etc

silk echo
#

type: project_domain.glitch.me/ ?

vapid cape
#

yes

#

if you're using dblapi.js, then your url should be projectname.glitch.me/dblwebhook

silk echo
#

do I need to include "http (s)"?

vapid cape
#

should work with or without

silk echo
#

Okay

restive otter
#
   async def upvote(self, ctx):
        await self.bot.get_bot_upvotes(users)
        await ctx.send(users)```
#

How can I grab all users who upvoted the bot

#

I thought that would work

#

but I don't know what to define users as

#

oh

#

i'm sutoid

restive otter
#

how to use express and top.gg webhook at the same time

#

Hey how can y get the username of the voter like vote.user (index.js)

torpid nexus
#

Anyone can help with "filtering" the public_flags to show the badge of the user?

arctic arch
#

-api

abstract mothBOT
arctic arch
restive otter
#

it is so bad my bot was 3 minutes offline then the bot would be rejected and I should publish the bot again. The main thing is that I have to set everything up again

restive otter
#

I press the regenerate token button and it’s not showing the new token and the code is giving Error: 401 Unauthorized error

#

did you clicked save button?

#

Where is the safe button??

#

I can’t find it

sullen nymph
#

On your bot's Edit page

restive otter
#

oh

#

Nope still same thing

#

It is not giving me a new token

brittle spoke
restive otter
#

I try regen token in the api docs and the edit page still same thing

brittle spoke
#

try logging out of top.gg and logging in again

wild harbor
#

o*

restive otter
#

ok it works ty

grim hazel
#

hello, I have my webhook URL set to 0.0.0.0:5000/dblwebhook, although it does not seem to be working?

sullen nymph
#

Replace 0.0.0.0 with your public IP

vapid cape
#

where is your bot hosted?

grim hazel
#

google cloud

vapid cape
#

do what shivaco said, and you'll also need to allow port 5000 in your google firewall

grim hazel
#

oh okay

#

hello, i've tried what i was told. I had use the cloud's public ip, and also allowing port 5000 on the firewall, and it still seems to not be working

restive otter
#

how do I add server count to my dbl page?

knotty garnet
#

some mod please do -servercount

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.

lost skiff
#

Hello. For some reason, the webhook test button is not working. Here is my code.

const DBL = require('dblapi.js');

const config = require('./config.json');

const dbl = new DBL(config.dbl.token, {
    webhookPort: 5000,
    webhookAuth: 'password'
});

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

dbl.webhook.on('vote', vote => {
  console.log(vote);
  // Do what you need to do
});```
#

I have tried entering the webhook url with and without the port, and I've tried hosting the webhook server on both Glitch.me and Repl.it

#

I am not getting anything in the console.

grim hazel
#

for glitch, I think you can use glitchtitle.glitch.me URL

lost skiff
#

yeah, i did that

grim hazel
#

ohh, i guess were on the same boat now

lost skiff
#

for repl.it, its projectname.repl.co

grim hazel
#

well with that, i'm not using repl or glitch

#

but same thing, everything works fine. Just not the vote webhooks

#

Oh, for the glitch URL, did you include the ending /dblwebhook ?

restive otter
#

whats api key?

lost skiff
#

@grim hazel yes, i did

#

projectname.glitch.me:port/dblwebhook to be exact

restive otter
#

Remove port

#

just /dblwebhook

#

so, im using without port in url.

#

nvm

lost skiff
#

same thing with and without the port

#

nevermind.

#

@restive otter thanks

restive otter
#

worked?

lost skiff
#

yeah

restive otter
#

Error: 400 Bad Request trying to get my server count

#

is servercount suppposed to be defined?

hollow raptor
#

yes

#

with your guild size

grim hazel
#

Hello, does anyone have a solution for my case ?

restive otter
#

@grim hazel ?

grim hazel
#

Will try again!

restive otter
knotty garnet
#

seems to give no errors but wont post servercount
@restive otter is that even running? like, it'll only run after 1800 seconds

hollow raptor
#

bot.serverCount invalid

#

bot.guilds.size

balmy hamlet
#

ah yes bc literally using 0.0.0.0 will work

boreal flower
#

im confused, i was reading the docs for the API but im unsure how it will show the number of servers hes in, i have it getting and posting the stats i think??

vapid cape
#

you dont need to get, just post

#

if you use one of the official libraries, they will do it for you

boreal flower
#

i think ive used dblapi.js

solid wharf
#

@balmy hamlet 0.0.0.0 will try and map it to the external IP

#

You dont need to bind it to the external IP because its running locally and you can access it from the outside using a port

grim hazel
#

@hollow raptor Hey, i've followed the guidance page you had shown. It still does not work.. Same issue, the vote webhooks didn't show up
I've tried both 0.0.0.0 and my external ip for the URL, and it still reproduce the same issue

devout iris
#

Error: 401 Unauthorized ?

#

What's the error ?

knotty garnet
#

where are you getting that?

devout iris
#

console

knotty garnet
#

no, I mean

#

where? on the dbl's api endpoint?

devout iris
#

Idk,
functioned normally, but gave this error

knotty garnet
#

still, 401 can happen ANYWHERE, I need to know how you're getting that

devout iris
#

ok, wait wait

#

@knotty garnet I regenerated my token, and it worked :)

#

Thank u

knotty garnet
#

πŸ‘

astral kayak
#

does anyone know how to add servercount for bot in site

knotty garnet
#

some mod please do -servercount

astral kayak
#

i mean show it in top,gg

#

my bot server infos says N/A

lucid basin
#

is there a way to tell if someone upvoted my bot?

knotty garnet
#

@lucid basin @astral kayak using the top.gg api

lucid basin
#

how do you use it?

knotty garnet
astral kayak
#

oh thank so much

lucid basin
#

is the latest version v0.3.3?

knotty garnet
#

idk, the libs listed there are up-to-date

lucid basin
#

i suck at documentation \

balmy hamlet
#

@solid wharf I meant, some random dude literally tried to use 0.0.0.0:5000 on TOP.GG's webhook url

knotty garnet
#

that was late af

solid wharf
#

@balmy hamlet oh lmaoo

#

Yeah thats for internal use

#

LOL

sullen nymph
#

-api

abstract mothBOT
wet zenith
#

where are the error/status codes listed

#

im getting a 403 status code 1006 error code

#

no idea what it means lol

wet zenith
#

msa n da pra entende oq eu fiz de errado

#

o token ta errado? eu acho q n

#

ta certo

knotty garnet
#

mostra codigo

azure pollen
#

are webhooks having a moment or the api in general rn?

vapid cape
#

when this happens, the api throws a 403 with an "error code 1006" in the body

wet zenith
#

i solved it already

gloomy fractal
#

@azure pollen Sorry for the late response, but i have not seen any issues. Is it working fine for you now?

restive otter
#

-bot

jolly hornet
#

-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

grim hazel
blazing condor
#

What does api actually mean ?

#

And how do I get my bot online ? I’ve added it to my server

hearty pagoda
#

application programming interface

balmy hamlet
#

@blazing condor bots are pieces of software that run on a machine

#

you need to learn 1 programming lang and then make a bot

#

easy

opal schooner
#

all I need to have server count populate is to instantiate the dbl object with my token and bot client yeah?

#

and it will populate eventually?

#

I don't need to call any methods?

opal schooner
#

cos client.guilds.size is deprecated in discord.js 12

gloomy fractal
#

You can still use v12 to post the server count

#

just change client.guilds to like

#

client.guilds.cache.size iirc

#

i dont use djs but youd use the docs

opal schooner
#

yeah the docs don't mention the cache collection having a size property

#

but apparently it does

#

regardless I shouldn't need to manually post my server count right?

#

as long as the dbl object exists

opal schooner
#

cos it's been like 4 hours now and my server count has straight up not populated

#

but I've spoken to other people on discord.js 12 and all they have is the standard

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

so I guess I just needs to wait?

opal schooner
#

if someone who works on the API sees this please @ me

#

I've got two other bots I've never had this issue with and the only difference is the discord.js version I'm running

clever spindle
#

-help

primal musk
#

@opal schooner
Have you pushed the server count to DBL?

opal schooner
#

no, I haven't had to do that in the past though, afaik the dbl object auto pushes it - at least it does on my other bots

primal musk
#

Well try pushing the server count

#

Manually

opal schooner
#

yeah i guess i'm gonna have to at some stage soon if it doesn't resolve

#

v weird though

opal schooner
#

show your code

restive otter
#

o

opal schooner
#

@restive otter is it in that order?

sullen nymph
#

dbl should be your DBL client constructor

#

not the module

opal schooner
#

also that

#

@sullen nymph my DBL client should automatically push my server count yeah?

sullen nymph
#

If you provide your d.js/Eris client, it should

opal schooner
#

yeah

#

it's been like 7 hours and it hasn't populated

sullen nymph
#

Try posting manually catshrug

opal schooner
#

yeah okay

verbal sluice
#

How do i give people the voted role on my server when they vote for my bot?

#

Wdym

sullen nymph
#

dblpy has in-built webhook support for top.gg

verbal sluice
#

@sullen nymph Where do I go?

sullen nymph
dusky tangle
#

would

if voted=1:

work

strange palm
#

Hey, I am a bit confused about the stat autoposting. If I provide the client to the constructor, do I still need to set a webhook up? (working with Discord.js)

dusky tangle
#

as i know webhook

#

but not 100% sure

sullen nymph
#

Providing client for the constructor is for stats autoposting, the webhook is for receiving votes

restive otter
#

remove :3000

gloomy fractal
#

@opal schooner try console.logging something with it posts your count

#
 console.log('Server count posted')
})```
#

Also log on error so Incase it fails you get an error to work with

 console.log(`Oops! ${e}`);
})```
floral raft
#

is dbl api dead?

#

cos i get 401 error

#

Oops! Error: 401 Unauthorized

#

for the past two days

balmy hamlet
spiral steeple
#

401 means wrong token

#

A server error is 5xx

golden adder
#

Working with webhook πŸ‘€ all my votes are posted to my server no problem

winter spade
#

How does the JS api wrapper work with sharding?

#

I believe it just posts the servers of the current shard

#

also can you use the dbl.hasVoted() like this?

const voted = await dbl.hasVoted(message.author.id);
if (voted) console.log("Voted.");
vapid cape
#

yes and yes (i think)

winter spade
#

Sometimes the website says 900 servers and then other times it says 7.3k servers lol

restive otter
#

ayo, I have a single microservice for posting stats to DBL. ```js
dbl.postStats(stats.guilds, 0, stats.shards.length)

vapid cape
#

if you say shards.length is lets say 10

#

and you always post from shard 0

#

it will never receive a count from other shards

#

and will probably only display a 10th of your servers

#

so setting id to 0 on all shards will only work if you set length to 1 in all shards

#

which is basically the same as just sending the count without any shard information

floral raft
#

do you know how to make it so that when someone votes for my bot they get x coins

opal schooner
#

@restive otter shardcount and shard are optional parameters

#

@gloomy fractal I am logging both of those events - when I run the dbl object on my test application it posts fine

#

as soon as i run it on production

#

nothing happens

#

this is so bizarre

#

and as a result it now says my servercount is 1 lmao

opal schooner
#

yoooo WTF

#

so I have my npm install logs from yesterday

#

all fine

#

i just checked npm list

#

dbl api package not there =\

#

but require not throwing error either

#

reinstalled package

#

all working

#

😐 😐 😐 😐 😐

civic flower
#

how to check if someone voted for ur bot on dbl (discord.js)

#

ping me if you know how

ebon pivot
#

Why is botblock blocked from using the api?

restive otter
civic flower
#

huh

restive otter
#

ta poiola :v

half frost
#

Which part of the API controls how DBL fetches the Bot's status? Example: [Online/Offline], etc

signal hawk
#

if the bot is in this server

half frost
#

@signal hawk im so confused >w< how is my bot not in this server if its on DBL? GWchinaRankoPout

signal hawk
#

it might have gotten kicked, you can search your bot's ID in mod-log

half frost
#

@signal hawk oof you're right, so I just reapply after I fix the issue right?

signal hawk
#

if it wasnt "deleted" and it was just kicked you can fix the issue then dm a mod to have it readded to the server

half frost
#

I would ask you but I'd feel bad since you already helped me right now GWchinaAqua7

#

So I'll probably ask a different mod~ thank you~

upper nebula
#

I am trying to use the API to get the last votes, however it keeps returning [Object object]. I am using snekfetch for it.

#
const snekfetch = require('snekfetch');
const key = config.secrets.dblkey;

snekfetch.get(`https://discordbots.org/api/bots/${bot.user.id}/votes`)
        .set('Authorization', key)
        .end((err, response) => {
        
    const embed = new Discord.RichEmbed()
    .setColor('#000080')
    .setDescription(`${response}`)
    .setTimestamp();
    
          message.channel.send(embed);
        });
}};```
gilded dawn
#

@upper nebula because response returns a object

upper nebula
#

Ya I got that

gilded dawn
#

so do response.data.

#

whatever part you want to get

#

if your unsure what part your wanting to get do console.log response.data

gaunt dust
#

can someone tell me how to get the api key

#

i need it for my bot

sullen nymph
gaunt dust
#

thnx

#

so i have to wait till its aproved

#

not a problem

open agate
#

Where is my dbl token ? how i find

restive otter
#

in docs

restive otter
#

Can someone help me regarding api

echo salmon
#

Just ask your question

restive otter
#

I am trying to do webhook service with my bot who vote my bot that must post at support guild but it showing port and password what is that

#

@echo salmon

echo salmon
#

The webhook service is essentially a little server thats sending data forwards and backwards to DBL, the port is the port number your service should operate out of, for example, http operates on 80, you can choose any port number you want, just ensure its open to the internet

#

password is the "authorization" section you set on your edit page

#

it can be anything you want, you probably want to generate a long random string for this

restive otter
#

Authorization mean my bot api key?

echo salmon
#

Nope

#

The section on the edit page that says

restive otter
#

Then

echo salmon
#

Authorization

restive otter
#

Let ma check

#

Me*

broken flicker
#

can someone tell me how to get the api key

#

i need it for my bot

echo salmon
sinful heart
arctic arch
river musk
#

Hello, I'm trying to post the BOT's stats, but it gives me this error:

UnhandledPromiseRejectionWarning: Error: 401 Unauthorized```

My code: ```js
const DBL = require('dblapi.js');
const dbl = new DBL(config.dbl.token, client);
dbl.postStats(client.guilds.cache.size);```
vapid cape
#

make sure your token is correct

restive otter
#

hello my bot is not posting server count Oops! Error: 400 Bad Request i am regenerated token but don't working

#

what npm package are you using?

#

if its discordjs

#

discord.js

#

v12

#

dblapi.js

#
const DBL = require("dblapi.js");
const dbl = new DBL('my token', client);
// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

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

my code is here @restive otter

#

you gotta wait for someone who actually uses discordjs, i use javacord, just wanted to make sure you're using the official npm package

#

yes

vapid cape
#

@restive otter whats your dblapi.js version?

restive otter
#

wait

#

"dblapi.js": "2.3.0",

#

updated 2.4.0

vapid cape
#

yes, you need 2.4

restive otter
#

fixed thx @vapid cape

broken flicker
#

can someone tell me how to get the api key

hollow raptor
#

your bot need to be in DBL first to get api key

restive otter
#

discord js v11

#

and VPS

#

Unauthorized means you entered a wrong api key

#

@restive otter

#

i have enter the good

#

what dblapi.js version?

#

and i have regenerate and after i have change my key

#

i'd say print your api key after the on error and check if thats the same one

#

ok

#

though dont send the results in here ofc GWahreeSure

#

2.4.0

#

dblapi

#

and the apikey check you put in the on error is the same?

#

nothing

#

just the error

#

but

#

when

#

i vote

#

the vote

#

is in my log

#

0 error

#

juste my unauthorized

#

then you probably have nothing on that variable

#

go through your code and check if your apikey gets used correctly

#

look

#

before implant my bot on my vps

#

it working without problem and error

daring panther
#

I am developing in C# and ran into a problem with the api.
This is in my ReadyAsync:

AuthDiscordBotListApi AuthDBApi = new AuthDiscordBotListApi(_client.CurrentUser.Id, Environment.GetEnvironmentVariable("DBO_TOKEN"));

            _ = Task.Run(async () => {
                IDblSelfBot DB_Bot = await AuthDBApi.GetMeAsync();
                await DB_Bot.UpdateStatsAsync(_client.Guilds.Count);
                await Task.Delay(1000 * 60 * 10);
            });

But 4th line throws a NullReferenceException. What am I doing wrong?

restive otter
#

DBO_TOKEN just asking, is that maybe misspelled?

#

so have you an idea Hope ?

vapid cape
#

@restive otter you dont need 2 DBLs

daring panther
#

Nope. I checked that ^^

restive otter
#

sure @vapid cape ?

#

before it worked perfect

#

and now no

vapid cape
#

new DBL("token",{webhookPort:port,webhookAuth:auth},bot)

restive otter
#

ok

#

and now it's unauthorized

#

like before

#

@vapid cape

vapid cape
#

regen it again

restive otter
#

ok

#

it's good

#

but

#

why i have regen it 1 time

#

and it not worked ?

vapid cape
#

Β―_(ツ)_/Β―

tiny compass
#

I'm trying to establish a webhook connection for the dbl upvotes and I currently only have the example from the dbl docs. Am I suppose to change the webhook_path to something else?

#

I'm running this on a vps so would my webhook_path be ip:port/dblwebhook

sullen nymph
#

http://

tiny compass
#

is that it?

#

I mean like other than changing the webhook_path would I be able to get upvote events

#

or are there other things I have to do other than the code I have right now

tiny compass
#

because the upvote event is not triggering when I upvote or test

safe pewter
#

How can I get the ID of some user that vote in the site (using python)

wide herald
#

why is my bot saying incorrect login details when I literally copy and pasted it

#

it won't let me log in

restive otter
#

log into what?

wide herald
#

my discord bot

#

using the bot token

#

"Incorrect login details were provided"

restive otter
#

client.login(TOKEN)

#

are you doing it like this?

wide herald
#

lmao yeah

#

Error: Incorrect login details were provided.

#

keeps happening with only one of my apps, everything else is fine

restive otter
#

are you sure you are putting in the right token

wide herald
#

yes

#

literally 100%

restive otter
#

the only problem is the token than

wide herald
#

my token keeps switching every time I refresh

#

wtf

#

on the developer portal

restive otter
#

are you regenerating it?

wide herald
#

no

restive otter
#

does anyone else have access to the bot?

wide herald
#

no

restive otter
#

never heard of this problem

#

make a new app?

wide herald
#

it already happened once to me

restive otter
#

thats odd

fierce fern
#

Oi

balmy hamlet
#

it's not a problem

#

that's intentional behavior

#

every token you see there works

#

those tokens only stop working when you regenerate it

#

and it shouldn't cause any problems

#

@wide herald @restive otter

restive otter
#

There is only 1 token valid at a time

#

You cant have multiple tokens

lyric tulip
#

Why should I set interval when posting the server count?

wide herald
#

supposedly I was rate limited

#

so there aren't any bots in 100 servers? I don't get it

restive otter
#

Wot?

restive otter
#

Why is it taking so long to post sever count

#

The code isnt running for some reason cuz i have done a console log statement whenever it starts

#

module.exports = {
    init(client){
        let stats = new DBL('my token here', client)
        client.logger.info("Started Top.GG Webhook")
        setInterval(async function(){
            let guilds: number[] = await client.shard!.fetchClientValues('guilds.cache.size')
            let bot_guilds: number = guilds.reduce((prev, guildCount) => prev + guildCount, 0)
            stats.postStats(bot_guilds);
        }, 60000*10);
    }

}
#

Well you see I'm on mobile and mobile formatting is ass

#

So I'm having a hard time reading

#

Pls take your time

#

I am already frustrated cuz of this not working

#

πŸ™ƒ

gloomy fractal
#

You cant run anything till your bot is approved

restive otter
#

^

#

My frnd's bot is approved

#

We both work on it together

#

Are you editing the right file?....

#

i have made a seperate file called topgg.ts for this

#

Then the whole code above in that file

#

But somehow the code isnt running

#

Its not logging started webhook

#

Shouldn't it be un your on.ready event.....

#

If you make it in a separate file

#

It wont run unless you call it

#

ok it runs now but its not showing the server count on website

#

Your bot page?

#

Yes

#

do i need to run the code from the same token of the bot thats approved

#

I am talking about the bot token

#

Cuz i am running the code rn on beta bot

#

Pretty sure lol

#

its still not working

#

ran from the og bot token but still i cant see server count on my bot's page

#

Well this is where my knowledge ends on top.gg api

#

Sorry this is all I can help you with

#

Where are the moderators

#

There is noone to help

#

Prob lurking

hollow edge
#

If it's a problem with the site itself it's out of our control.

restive otter
#

If it's a problem with the site itself it's out of our control.
@hollow edge how much time will it take

#

Never know

nocturne jay
#

Well, if it's out of their control, then how would they know how long it would take to fix it

#

Either way, I'm pretty sure it's nothing to do with the site. My bot is updating server count jsut fine

restive otter
#

Its their website

#

@nocturne jay can you pls share the code ?

#

Or can you check mine

nocturne jay
#

My code is in python

#

not JS

restive otter
#

Oh shit

green mantle
#

@nocturne jay whats your issue

broken flicker
#

can someone tell me how to get the api key

hollow raptor
nocturne jay
#

@green mantle What do you mean?

green mantle
#

idek anymore

nocturne jay
#

lmfao

river musk
#

Hello, I've posted a code here yesterday, that postStats returns unauthorized. I've tried updating dblapi.js to the newest version, but it doesn't work. My code is here:

//DBL - Vote Webhook
const DBL = require('dblapi.js');
const PORT = process.env.PORT || 3000;
const dbl = new DBL(config.dbl.token, { webhookPort: PORT, webhookAuth: config.dbl.password }, client);

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

dbl.webhook.on('vote', vote => {
    require("./voted.js").run(client, vote.user);
});

client.on('ready', () => {
    dbl.postStats(client.guilds.cache.size);
});```
The webhook works fine, but postStats doesn't work.
#

My BOT is hosted on Heroku.

#

I've tried to run BOT on my local network, but it still returned unauthorized.

median badger
#

have you used the correct token

restive otter
#

How do I print the number of online members to my bot ? can someone help

sullen nymph
#

-api

abstract mothBOT
river musk
knotty garnet
#

are you sure that's the right website?

serene laurel
#

fixed

restive otter
#

what exactly is the issue?

#

what language/library?

#

is your version up to date?

#

is there any error in the console?

serene laurel
#

nope

waxen nexus
#

Huh I was getting 401 unauthorized too

#

But the error just fixed itself

serene laurel
#

i am not even getting any error -_-

sullen nymph
#

Do you provide client and use postStats at the same time

waxen nexus
#

yeah that's unnecessary

restive otter
#

Hello, I found the same module as dblapi.js with exactly the same code as dblapi.js (since it's a fork) it's normal ? Do you agree it ?

vapid cape
#

people are free to fork stuff on github as long as they follow the original library's license

safe pewter
#

hey, how can I get the ID of some user that voted (using python)

restive otter
willow ruin
#

Does webhook to https work as well as to http?

#

I have changed webhook url just now and can't get it in bot.

#

Can api work with self-signed certificate?

restive otter
#

it should

willow ruin
#

But it doesn't

#

Switched back to http and can receive webhooks again.

#

Can someone confirm working webhook to https?

warm elk
#

I am trying to add my server to the discord servers website but every time I try, it says there's an error

restive otter
#

^

#

Same.

#

the function of checking if the user voted for the API bot only recognizes if the user voted once and after that it returns a value of "true" every time or resets whenever the user needs to vote?

#

Example:
I now vote for the bot and use the command to check if I voted. If it recognizes that I voted, it returns the value true. After the 12 hours that the user can vote again, he returns a value false or does it always return true?

warm elk
#

what

safe pewter
#

DBL token is my bot token?

sullen nymph
safe pewter
#

its the api key?

#
import dbl
import discord
from discord.ext import commands

import asyncio
import logging

class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = 'my dbl token'
        self.dblpy = dbl.DBLClient(self.bot, self.token)

    async def update_stats(self):
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info(f'Posted server count ({self.dblpy.guild_count()})')
        except Exception as e:
            logger.exception(f'Failed to post server count\n{type(e).__name__}: {e}')

        await asyncio.sleep(10)

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```
whats wrong with my code
#

Wasn't the message "Posted server count x" to appear every 10 sec?

sullen nymph
#

You're not calling update_stats anywhere

safe pewter
#

ah

willow ruin
#

<@&304313580025544704> Can I send request for API developers to include support of https webhooks with self-signed certificates?

sullen nymph
#

-atmods

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.
willow ruin
#

Sorry, didn't know that

rough crater
#

You don't need to ping Moderators for that.

arctic arch
#

certificates will have to be signed by a CA

#

that is just how the internet is built

gaunt steeple
#

@willow ruin please tell me why in 2020 you feel the need to use a self signed cert.

#

use cloudflares free ssl, or certbot and letsencrypt. no excuse.

willow ruin
#

To establish ssl connection for webhooks

arctic arch
#

what Brain said

gaunt steeple
#

in fact, cloudflare free ssl is as close to zero effort as you can get, you just turn it on in settings and its sorted, free ssl.

#

not just that but it will hide the ip of your hosting, too

arctic arch
#

I think there's

gaunt steeple
#

interesting, not seen that site, i'll keep it in mind for next time πŸ˜„

#

oh and something else to note, google actively penalises non-ssl sites now, its hard coded into chrome to be an asshole to plaintext http sites and treat them like the security risk they are... just sayin'

arctic arch
#

unrelated to webhooks tho

gaunt steeple
#

true that

willow ruin
#

Webhooks just sends plain json w/o any info that can be leaked, why I have to use CA, there are no security reasons, isn't it?

gaunt steeple
#

if thats the case, why use https at all?

willow ruin
#

To cipher the channel

gaunt steeple
#

you must be concerned about the security of that data or you wouldnt even consider a self signed cert?

willow ruin
#

connection channel

gaunt steeple
#

enabling ssl on everything is just good internet hygene, its like brushing your teeth twice a day, or washing your armpits.

#

by that i mean proper ssl

#

πŸ™‚

arctic arch
#

even if you dont have security concerns, dont half-ass ssl

gaunt steeple
#

there is one actual use for self signed certs, and im surprised nobody has asked for it already: its possible to authenticate via a self signed certs sha-256 hash, which is something i do as secure authentication on an api i wrote, this isnt something you were asking for.

arctic arch
#

its more confusing why you're even suggesting self signed in that case

gaunt steeple
#

but that example above can be so convoluted, its probably better to go oauth2. off topic, lets drop that subject πŸ™‚

#

"dont half ass it" about sums it all up tbh

willow ruin
#

Webhooks I used before in other API work fine with self-signed. It's first time I encounter such issue πŸ™‚

echo salmon
#

Not really sure why they would be fussy about self signed but not enforce https

safe pewter
#

DBL token is the api key ?

#

or my app token

willow spindle
#

api key

safe pewter
#
[18/May/2020 19:41:47] INFO - logging in using static token
[18/May/2020 19:41:49] INFO - Created websocket connected to wss://gateway.discord.gg?encoding=json&v=6&compress=zlib-stream
[18/May/2020 19:41:49] INFO - Shard ID None has sent the IDENTIFY payload.
[18/May/2020 19:41:50] INFO - Shard ID None has connected to Gateway: ["gateway-prd-main-grd7",{"micros":597,"calls":["discord-sessions-prd-1-18",{"micros":5876,"calls":["start_session",{"micros":1243,"calls":["api-prd-main-us-east1-24nh",{"micros":106,"calls":["get_user",{"micros":618},"add_authorized_ip",{"micros":321},"get_guilds",{"micros":496},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":108,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 460ecf6hf8d).
[18/May/2020 19:41:54] WARNING - GUILD_MEMBER_UPDATE referencing an unknown member ID: 365068686624. Discarding.
[18/May/2020 19:42:00] INFO - Processed a chunk for 694 members in guild ID 32569919442849.
[18/May/2020 19:42:00] INFO - Processed a chunk for 329 members in guild ID 40810499538250.
[18/May/2020 19:42:00] INFO - Processed a chunk for 477 members in guild ID 48164773608320.```
can someone explain to me what exactly he is doing here
#

and why this didn't work


    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)```
I used it and someone voted in my bot, and dont show the print in my terminal
restive otter
#

thats just your bot connecting to the gateway

#

and why the second one works idk

safe pewter
#

2 questions I need, how do I get the bot's total votes, and how do I get the ID of the user who just voted..

#

can someone using this system in python help me?

tribal pumice
#

I was also trying to figure out how to detect when someone votes for my bot I'm using discord.py

opal schooner
#

yo are webhooks not working?

safe pewter
#

i'm not using webhooks

opal schooner
#

nvm

#

got it working

violet spoke
#

oof

#

@tribal pumice Your bot has to be approved first

tribal pumice
#

Alright thanks for the information

rigid dust
#

-atmods

#

-help

brisk saffron
#

hey, i have a question. in the api docs, for the votes the exemple is dbl.webhook.on(........ But how can I define webhook ? Or do I have to replace it with something else ?

brisk saffron
#

is « webhook » a const with an url « top.gg/bot/ID/vote » ? (btw i use discordjs)

restive otter
brisk saffron
#

thanks

#

btw what does « shard count » mean ?

restive otter
#

where can i apply

#

to approve my bot

#

Add your bot on the site

brisk saffron
#

How to configure the webhook? I mean, what URL should I enter ? An URL to the server where the bot is hosted ? Where exactly? Thanks.

restive otter
#

Read the docs

brisk saffron
#

Well, I did, but if we’re talking about the same docs, I don’t really see what I should be reading.

#

The docs about the Webhook doesn’t seem to be very complete

#

WAIT

restive otter
#

They are

#

Complete

brisk saffron
#

yes, ok, then i am a complete noob

#

but it isn’t very precise : they just talk about β€˜the url when you want the webhook to be sent to

#

can anyone give me an example of webhook url?

restive otter
#
const dbl = new DBL(client.util.api.dbl, 
client);
dbl.getBot(client.util.id.client).then(async data => { await home.channels.cache.get(client.util.id.total_vote).setName(`Total Upvotes: ${data.points}`).catch(error => client.send.processes(error)); await home.channels.cache.get(client.util.id.month_vote).setName(`Monthly Upvotes: ${data.monthlyPoints}`).catch(error => client.send.processes(error));
#

Here is some of the code from my bot

#

It's for getting votes

spark sphinx
#

kyu

brisk saffron
#

thanks A LOT πŸ‘

spark sphinx
#

oi its for how many upvotes where done

brisk saffron
#

oh yes you’re right

restive otter
#

Figure out the rest

#

Too much to type

brisk saffron
#

you typed this? on mobile ?

spark sphinx
#

i wanted to know how would i reward if it was upvoted qwq

restive otter
#

Well once you know a user voted

#

You can give them a reward

#

Read the rest of the docs

brisk saffron
#

i’ll read again

spark sphinx
#

same

brisk saffron
#

but could you tell us how to get the webhook url pls? i still haven’t understood

spark sphinx
#
dbl.hasVoted("95579865788456960").then(voted => { if (voted) console.log("Tonkku has voted!!!") });

whats dis one for owo

restive otter
#

Checks if a user has voted

brisk saffron
#

strange i didn’t read the same thing

#

that’s what i thought

#

i found this:

restive otter
#

@brisk saffron

#

dblapi.js

#

That's a nodule

brisk saffron
#
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

yes?

restive otter
#

Module*

#

Yiu can use that

brisk saffron
#

I installed it

true talon
#

dbl webhook is a different thing tho

restive otter
#

Oh wait wrong tag

#

Oops

brisk saffron
#

what dyou mean?

true talon
#

you cant use dbl.hasvoted & dbl webhook on('voted'...) at the same time. dbl webhook is getting data when someone votes, while normal dbl askes if X has voted

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

do i need to add anything in this
true talon
#

iirc

brisk saffron
#

uh yes i’ve understood that

true talon
#

to this line no

brisk saffron
#

but how is dbl.webhook defined?

true talon
#

read above

brisk saffron
#

oh my god IM SO DUMB

true talon
#

smh

brisk saffron
#

i spent 20 minutes trying to figure out why it didn’t work and the answer was 2 lines above

#

well, I apologize for having said that the docs weren’t complete

#

but it still doesn’t explains what url i have to enter in /bot/id/edit...

#

any answer?

true talon
#

show

#

what url are you talking about

brisk saffron
#

the on i have to enter in my bot’s edit page

true talon
#

if you want to enter a url, it's for the dbl webhook

brisk saffron
#

yes

#

but what url?

true talon
#

you have to enter smth like https://[YOURIP]:[PORT]/dblwebhook

brisk saffron
#

pooh

#

ooh*

#

thanks

#

i got it

true talon
#

if you dont know your ip coz ur using glitch, simply entyer [projectname].glitch.me instead of [YOURIP]

spark sphinx
#

what does that test button do in that section?

#

you have to enter smth like https://[YOURIP]:[PORT]/dblwebhook
and what port do i give if its glitch?

sullen nymph
#

if you dont know your ip coz ur using glitch, simply entyer [projectname].glitch.me instead of [YOURIP]

#

Port excluded

spark sphinx
#

port

#

ok

#

thn what do i give in

sullen nymph
#

Port is 3000

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

does this work or need to be webhook?
sullen nymph
#

dbl.webhook.on

spark sphinx
#

ok

willow ruin
#

Not really sure why they would be fussy about self signed but not enforce https
@echo salmon Exactly, if self-signed is not allowed, why plain http is allowed. And vice versa, if http is allowed, why self-signed is restricted.

echo salmon
#

Β―\_(ツ)_/Β―

brisk saffron
#

what are the methods of vote in dbl.webhook.on('vote', vote => { });? And is vote.user and object or a snowflake of the user ID? (i'm asking this because there is no intellisense and I haven't found anything in the docs on top.gg)

#

I have found this on github:

/**
* Event that fires when the webhook has received a vote.
* @event DBLWehook#vote
* @param {string} bot Id of the bot that was voted for.
* @param {string} user Id of the user that voted.
* @param {boolean} isWeekend Whether the weekend multiplier is in effect, meaning users votes count as two.
* @param {object} [query] The possible querystring parameters from the vote page.
*/```
but there isn't the names.
#

is this vote.user ?

/**
* @param {string} user Id of the user that voted.
*/```
vapid cape
#

yes

#

vote.user is the user id

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

does this work or need to be webhook?

@spark sphinx What is the npm name

#

i think dblapi.js

restive otter
#

you can simply use express

#

and listen to post requests

safe pewter
#

someone that use python can help me using on_dbl_vote.. this didn't work

austere river
#

try channel search

safe pewter
#

i will try using webhooks

#

exactly what was supposed to be my webhook_path ='/dblwebhook'

#

and webhook_auth='my password'

#

i'm hosting my bot in heroku

spark sphinx
#

@mental echo yes

vapid cape
#

@safe pewter webhook_path = the page component of your webhook url
webhook_auth = the auth headers of your webhook url

#

for hosting in heroku, your full webhook url will be PROJECTNAME.herokuapp.com/dblwebhook (or whatever you set in your webhook_path)

#

your webhook_port should be whatever heroku allows you to use, usually port 3000

#

sumarizing:
in your program: webhook_port=3000, webhook_auth="whatever", webhook_path="mypath"
in top.gg: URL: MYPROJECTNAME.herokuapp.com/mypath Authorization: whatever

safe pewter
#

and how can I use on_dbl_test, just vote in my bot even when him was already voted ?

vapid cape
#

last time i checked, dblpy had a separate event for that

#

test instead of vote

#

so yeah, when you press the test button in top.gg you should receive a on_dbl_test event

safe pewter
#

url i need to put the url of the webhook, and what I put in authorization?

vapid cape
#

Authorization = whatever you put in your webhook_auth

#

URL = your heroku url plus whatever you put in your webhook_path

safe pewter
#

heroku url ?

vapid cape
#

yes your herokuapp url

#

like i showed

safe pewter
#

I need to put https:// in path?

vapid cape
#

its optional

safe pewter
#

its the same as herokuapp url?

vapid cape
#

thats your heroku url

#

your webhook_path is only /dblwebhook

safe pewter
#

just "/dblwebhook"

vapid cape
#

yes

safe pewter
#

ok

#

how can I check my webhook_port

vapid cape
#

heroku uses 3000 by default i believe

#

they should also have an environment variable for it

#

idk how you access env variables in python, should be a PORT env variable

safe pewter
#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("got event!")
        print(data)
        logger.info('Received an xx')

well, I clicked in the test and nothing happen

vapid cape
#

dm me your heroku project name

sick mirage
#

someone who will help my FIveM is set in Japanese I tried reinstal again it is the same

vapid cape
#

@safe pewter is your bot online?

safe pewter
#

yes

vapid cape
#

i get application error when i try to access it

brisk saffron
#

hey. I host my bot on an ovh server, and i've set the webhook on its IP. But I have a problem with the server : when I listen to dbl.webhook.on('ready'..., it works but it says the hostname is 0.0.0.0... why?

vapid cape
#

dblapi.js does not do ip discovery, it doesnt know whats your real ip address

#

it just shows 0.0.0.0 as a place holder

#

its your responsibility to provide the correct ip

brisk saffron
#

so it's normal if hook.hostname doesn't work?

vapid cape
#

yes, it will always return 0.0.0.0

#

its hardcoded like that

brisk saffron
#

ok. thanks πŸ‘

#

If I didn't make any error in the code and in the url i gave to top.gg, then where could I have made one?

vapid cape
#

in your code or in your top.gg lol

oblique basin
#

oh no

#

heroku

hollow owl
#

guys what is webhookAuth? how can i get?

sullen nymph
#

You create one yourself

hollow owl
#

where can I create it?

vapid cape
#

in your code

sullen nymph
#

It's a password you decide

hollow owl
sullen nymph
#

Yup

#

And same thing you put in your code

hollow owl
#

webhookServer is my server id rigth?

vapid cape
#

no

#

webhookServer is a custom webserver if you have one, like express.js

#

otherwise leave it empty and use webhookPort instead

hollow owl
#

i dont hve

empty peak
#

Hey guys.

So now that I have a token, I add the following to each shard?
new DBL( token, bot )

vapid cape
#

sure

jaunty steppe
#

Is it possible to get a list of bots, but sorted by guild count instead of votes?

#

Ah

#

sorts querey

sullen nymph
#

-api

abstract mothBOT
grim lagoon
#

hey, I am trying to check if a user has voted and I keep getting 401 Unauthorized I have checked if the token and everything is correct, when a user votes it receives that okay but checking if a user is voted is the issue. any ideas?

#

when using .hasVoted() is the issue

unborn oyster
#

I cannot seem to print the vote data when a user votes. but i can view the upvotes with the dblpy.get_bot_upvotes() How do you use on_dbl_vote Because this is my listener @commands.Cog.listener() async def on_dbl_vote(self, data): channel = await self.bot.fetch_channel(<my channel id>) await channel.send(data) print(data)
but whenever i vote no data gets printed or sent to the channel.

sullen nymph
#

What's the URL you set on top.gg?

unborn oyster
#

oh so you do have to use a webhook.

#

ok in webhook_path what do i put?

sullen nymph
#

webhook_path is the thing right after port and IP in URL

brisk saffron
#

what does this mean?
(node:11434) UnhandledPromiseRejectionWarning: Error: postStats requires 1 argument

#

it seems like it comes from here

  setInterval(() => {
    dbl.postStats(client.guilds.size);
}, 1800000);
brittle spoke
#

@brisk saffron is that the JacaScript one

#

Java

#

ffs

#

I cant type

#

f;knfporeog

#

my brain is dead

brisk saffron
#

my condenlences...

brittle spoke
#

so what version are you on

#

v11 or 12

#

also thanks

waxen meadow
green mantle
#

you make it

waxen meadow
#

i dont understand

green mantle
waxen meadow
#

oh

brittle spoke
#

I dont get what the Webhook does on top.gg

restive otter
#

Me neither

#

Don't need to implement it anyway, my bot is useless GWseremePeepoHappy

waxen meadow
#

how about URL?

vapid cape
#

where is your bot hosted?

waxen meadow
#

glitch

vapid cape
#

PROJECTNAME.glitch.me/dblwebhook

waxen meadow
#

oh

#

okay

#

thanks

vapid cape
#

and your webhookPort should be process.env.PORT

#

webhookPort: process.env.PORT

waxen meadow
#

      throw er; // Unhandled 'error' event

      ^

Error: listen EADDRINUSE :::3000```
#

what is that

brittle spoke
#

@vapid cape ur an expert. What does the Webhook on dbl do

restive otter
#
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!`);
  let embed = new discord.RichEmbed()
  .setTitle(`User Voted!`)
  .setDescription(`User: <@${vote.user}> just voted!`)
  .setFooter(`Your vote helped us!`)
  client.channels.get("711903042810937344").send(embed)
});```
This isnt working, what might be the error here?
brittle spoke
#

It should show the error

waxen meadow
#

yay its work

#

thank you, Tim

vapid cape
#

@brittle spoke top.gg's webhooks are the way top.gg sends voting events to you when someone votes for your bot

brittle spoke
#

Ah ok

vapid cape
#

@restive otter does the console.log not work either?

#

does the "webhook running at ..." work?

restive otter
#

@vapid cape nope

#
const dbl = new DBL("I've put my token here", { webhookPort: 5000, webhookAuth: 'password' });```

this is my config
spiral steeple
#

You can stream if you're a bot dev, also wrong channel

junior tusk
#

@restive otter add your client as argument to that function

#

I guess that's needed to receive votes, although the token already specifies from what client to get the votes

restive otter
#

@junior tusk?

junior tusk
#
const dbl = new DBL("I've put my token here", { webhookPort: 5000, webhookAuth: 'password' }, client);```
@restive otter like this, or do `bot` instead of client. Just whatever your `new Discord.Client()` is called
restive otter
#

ok

gloomy fractal
#

-api @nocturne fjord @restive otter

abstract mothBOT
#

@nocturne fjord @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

sly cloak
#

I did not understand too much the configuration of the webhook could I have help please thanks

vapid cape
#

which part do you need help with?

sly cloak
#

for create a link of webhook @vapid cape

#

I didn't really understand what I had to write.

vapid cape
#

for receiving webhooks you have to create a webserver

#

in top.gg you will put the URL of your webserver

#

the official libraries, such as dblapi.js will create a webserver for you

#

the URL depends on where your bot is hosted

#

if at home, or in a vps, the URL will be your ip address and port

#

if using heroku/glitch/repl, the URL will be your project url

#

top.gg webhooks are not discord webhooks

regal sphinx
#

I have this problem if anyone can help me. So say I have bot 1 with token xxxx and bot 2 with token yyyyy. Both have the exact same code that try’s to get the owner ID of the discord which is me. But bot 1 will successfully grab that ID but bot 2 will say that β€œcannot read property id of null. Why is this?

spiral steeple
#

One has you cached

#

The other does not

#

Use the ownerID property instead of owner.id

#

Thw owner property is nullable

#

The ownerID property is not

solar drum
#

The api isnt updating my bot guild count anymore for the past 2 days, how can i fix this?

narrow coral
#

I know that this is answered in docs somewhere, but I can't find it.
Do I need to use the dblapi to make my bot show up as "online" at top.gg?

true talon
#

No

wispy epoch
#

Hello people

restive otter
#

hello

brisk saffron
#

hey! my bot is linked to top.gg (the server count works very well), but the test button doesn't work. any idea why?

vapid cape
#

did you configure your webhook settings properly?

spring ore
#

How can I set server count on top.gg for my bot?

vapid cape
brisk saffron
#

holy crap did I just put my token on this channel

#

ffff****cccckkk

#

@vapid cape well, here is my code again without the token js const dbl = new DBL('super confidential token here', { webhookPort: 5000, webhookAuth: 'password' }, client);

#

and in top.gg, I put http://IP:5000/dblwebhook with the right password

#

but the tests aren't detected

#

even if it's linked

vapid cape
#

where is your bot hosted?

brisk saffron
#

an ovh server

vapid cape
#

have you checked if it has some kind of firewall in its admin panel?

#

some hosts have a firewall that needs to be configured to allow port 5000

#

otherwise try making a POST request to yourself with https://reqbin.com

brisk saffron
#

nice idea, I'll do this

vapid cape
#

if you get unauthorized, the url is working

#

otherwise, the url is inaccessible or blocked

brisk saffron
#

thanks! then I guess it's the firewall

#

it worked πŸ‘

jagged trout
#

@restive otter might be because JDA isn't initialized when you post your stats. try JDABuilder[...].build().awaitReady().
(ping me if you reply)

lucid mesa
#

@narrow coral did you solve the status problem ?

narrow coral
#

@lucid mesa Nope. My bot is still waiting for approval, so that's probably why.

lucid mesa
#

My bot is approved but its still saying N/A

#

@rough crater can you help me please

rough crater
#

Hey

#

Wassup?

lucid mesa
#

My bot status isn't showing in top.gg

rough crater
#

You mean the server count?

lucid mesa
#

And the widget says offline even tho its not

#

The sever count is also "undefined "

rough crater
#

You want to know how to put your server count on top.gg?

restive otter
#

btw your bot wasn't even added in here after approval i think GWossuKannaSip

lucid mesa
#

I already put the widgets on the github page but they don't work

rough crater
#

Hmm.

lucid mesa
#

Oh it has to be in the server ?

rough crater
#

The bot has to be in this server

#

For widgets to work. (I think)

lucid mesa
#

Is it removed if it says "@ invalid-user" in the logs ?

restive otter
#

Yep, for the bot to show up as "online" on a widget, the bot has to be on the server

lucid mesa
#

Why was it removed if it got approved then?

restive otter
#

I think the Moderator who approved it forgot to add it in here

lucid mesa
#

Oh I see

#

I'll try DMing them

#

Thanks

empty peak
#

API docs specify a ratelimit of 60 per minute. I'm assuming that also relates to .hasVoted( )? So we should probably cache votes we receive via webhook on our end?

#

Because if I, with every command, check if a user has voted and get 100 commands a minute, I've just blocked myself for an hour

sullen nymph
#

Yeah, it's recommended to use webhooks generally

empty peak
#

The example doesn't really support DJS' sharding manager, as once the first shard is launched, the addr is already in use

spiral steeple
#

that's because it doesnt

#

and it isn't intended to.

#

I would just have a database, make my own webserver, run it 24/7 and adding the votes to the database so it works while your bot is off if it errors or something

#

then just from the bot connect to the database as well

empty peak
#

Was thinking that's what I'll need to do. Cheers dude

#

@spiral steeple - If I wanted to do something like "Thanks for voting!", would it not work to use a webhook on the first shard?

spiral steeple
#

Like dming them?

empty peak
#

Yeah

spiral steeple
#

I mean you could, not sure if discerning that the current shard's id is 0 like that works though

empty peak
#

With DJS, you can assign shard IDs - so should be safe, I think?

gaunt dust
#

Can anyone recommend me a website to make a discord.js warn system like mee6 and duniya

#

And

#

My bot is having problem connecting to my mongodb database it shows the error EREFFUSED

#

or something like that

median badger
#

Idk read the docs and make one

golden adder
brisk saffron
#

Hey. In the docs, i've found how to get the 1000 last votes, but is there any method to get the number of votes please? Thank you

restive otter
#

What's the vote api's ip adress so i can whitelist it through my vps's firewall?

#

I dont like opening a port to the entire internet basically

ancient pawn
#

you wont get the ip because the api goes through cf

restive otter
#

Oh ye but why doesnt the api work the ports are open..

vapid cape
#

test it with reqbin

silent pilot
#

Auto post 0n python isnt working

green mantle
#

whats your code

cedar otter
#

can anyone help me create a challonge bot

#

ping me if you can please

sullen nymph
#

-api @cedar otter

abstract mothBOT
#

@cedar 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

cedar otter
#

oop

brisk saffron
#

Hey. In the docs, i've found how to get the 1000 last votes, but is there any method to get the number of votes please? Thank you in advance

restive otter
#

hi

#

can someone please help me with autopost server count in topgg

#

please

#

ping me if you can

sullen nymph
#

-ask2ask @restive otter

abstract mothBOT
#

@restive otter

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.

sullen nymph
#

@brisk saffron an array is returned so you could use something similar to .length

restive otter
#

i did ask?

brisk saffron
#

so the value won't be over 1000? @sullen nymph

restive otter
#

can someone please help me with autopost server count in topgg

#

im new to this

sullen nymph
#

The length won't be over a thousand, you'll have to use webhooks for that :p

#

@restive otter What exactly do you need help? Posting your bot's server count on top.gg?

brisk saffron
#

what do you mean? I'll have to make my own count system based of the webhooks' events?

restive otter
#

ys

sullen nymph
#

You need a top.gg token which is available once you own an approved bot

restive otter
#

i have that

sullen nymph
#

what do you mean? I'll have to make my own count system based of the webhooks' events?
@brisk saffron :p https://top.gg/api/docs#votes

brisk saffron
#

πŸ‘Œ

restive otter
#

You need a top.gg token which is available once you own an approved bot
@sullen nymph then?

sullen nymph
#

-servercount @restive otter

abstract mothBOT
#

@restive otter

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
#

uh?

#

it doesnt seem to help

#

what exactly should i do?

#

@sullen nymph

sullen nymph
#

You could use an official library or send your bot's server count yourself

#

How are you declaring DBLClient

restive otter
#

You could use an official library or send your bot's server count yourself
@sullen nymph idk how

brisk saffron
#

Why is that weekend right now ? Votes count twice and the API says it's weekend. Is this an error?

sullen nymph
#

Friday-Sunday

restive otter
#

can someone please help?

brisk saffron
#

wwooow but that's great xD one day more in the weekend it's the best idea i've ever heard

sullen nymph
#

you're not initializing a webhook though

#

@restive otter What's the library you use for your bot

restive otter
#

discordpy

sullen nymph
#

You can use dblpy and refer to the official documentation

restive otter
#

wait @spring otter you use the same lib right

sullen nymph
#

webhook_path is an endpoint

#

aka whatever after ip:port

restive otter
#

can you help me with this

sullen nymph
#

As long as the URL you enter on top.gg is correct and your port is open, it should work

#

nekothinking There should always be a URL

brisk saffron
#

is there any reason why my bot has 50 votes but the API says there's only one?

#

i'm using .getVotes()

#

and I have one more question: why does all the docs links seem dead?

restive otter
#

@brisk saffron cache and no they're not

brisk saffron
#

how to clear the cache? and how could there have cache if I never used the method before?

sullen nymph
#

What does your DBLClient look like currently

green mantle
#

do you actually have it as `http://ip:port/dblwebhook

#

well by default thats what it is

sullen nymph
#

Edit webhook_path to your needs, just make sure it starts with /

#

It only accepts POST

#

Send me the URL in DMs

restive otter
#

@spring otter where did ya host the vps ??

#

if u with vls

#

vps

restive otter
#

How i can get VOte value with dblapi.js

sullen nymph
#

.getBot

restive otter
#

authorization is your choice you can set whatever you want

#

and, i don't know URL in vps sorry.

restive otter
#

@sullen nymph ok .getBot

#

but how -___-

sullen nymph
#

Did you read the docs yet

restive otter
#

yes

#

but only for query

#

they doesnt say about structure

#

i mean example

sullen nymph
restive otter
#

wait

#

yes

sullen nymph
#

That's the JSON returned

restive otter
#

oh

#

OH

sullen nymph
#

Just access the points key

restive otter
#

ok

viral solar
#

how can i get the URL? using local host

restive otter
#
            console.log(bots.results.map(results => results.username));

output :

[ 'Mudae' ]
#

nice

#

Why