#topgg-api

1 messages ยท Page 94 of 1

jaunty plank
#

i think you might need http://

sullen nymph
#

Yes

jaunty plank
#

then
http://pubip:port/dblwebhook

hasty heath
#

yeah that page refused to connect :P

sullen nymph
#

IP in my DMs

hasty heath
#

dm you the ip?

sullen nymph
#

Aye

jaunty plank
#

you need to port forward if this is on a home network.
if you have a firewall, you need to let it through there

wooden pewter
bitter terrace
#

It's /bots/BOT_ID/votes I believe @wooden pewter

wooden pewter
#

same error

bitter terrace
#

oh nvm. that's another endpoint.

wooden pewter
#

thats the same or not?

bitter terrace
#

I use .points

#

but .monthlyPoints should work too

wooden pewter
#

oh okey

bitter terrace
#

oh wait

#

console.log(totalVotes)

#

do this

#

and see what it logs

#

I think it's a Promise

#

and you need to do .then on that or await that

wooden pewter
#

yap its a promise

bitter terrace
#

yea ok

#
fetch(...).then(res => res.json()).then(json => {
  console.log(json.monthlyPoints);
});
#

try like this

wooden pewter
#

nah same problem ๐Ÿ˜…

#

but thx for your help

quick eagle
#

Opa

#

alguem me ajuda?

#

sobre comando sugestao?

sullen nymph
#

-api

abstract mothBOT
quick eagle
#

@sullen nymph me ajuddaaaaaaaaaaa

sullen nymph
#

This is a channel for help with top.gg API

quick eagle
#

que

tawny void
#

is there a way to test if the test button is actually working, i swear my route is setup correctly Thanky

spiral steeple
#

did you save before testing?

tawny void
#

yeh

spiral steeple
#

Use reqbin and manually post to your endpoint to see if it works then

tawny void
#

alright cheers

spiral steeple
#

gl

tawny void
#

reqbin worked lmao

#

im so confuzed

tawny void
#

so its just a normal post request and thats it?

median badger
#

mhm

random swallow
#

I'm using the Python library for DBL and it is not posting the server amount

median badger
#

any console errors

random swallow
#

None

median badger
#

code?

random swallow
#

I've just noticed a mistake, ignore my existance

tawny void
#

What's the normal troubleshooting process from here, just hit a wall post request works from reqbin and my machine but when i run the test on the edit page nothing happens.

obsidian steppe
#

What does the server count post thing default to

#

Like duration between them

tawny void
#

think its 30 mins

dusty roost
#

is it normal for it to randomly show the server count of a single shard on the top.gg website? sometimes it says the actual server count and other times it says the count of one shard

keen ermine
#

could you implement a post request to edit your bots data via api (like description, prefix, usw)

jaunty plank
#

Why do you need that?

#

If you need custom loading of things, use an iframe

keen ermine
#

i want to update my long description when my bot has an update

median badger
#

Then press edit bot

keen ermine
#

but i dont want to make a website to display the newest features, and also dont do this by myself

median badger
#

Don't think you can update it through an api

keen ermine
#

but y should i write this html myself when mmy bot can generate it?

median badger
#

Huh

keen ermine
#

Don't think you can update it through an api
@median badger
yeah i know, it was an suggestion for the api to implement this feature

median badger
#

Add it there

restive otter
#

How can I use DiscordBotListAPI for java to check if a user has voted

restive otter
#

thanks, got it working

limpid vale
#

how to get dbl token?

#

and do server count?

jaunty plank
#

the token is on the api page? or bot page?
im not really sure tbh

#

heres the docs for the api

#

o

#

heres where the api tokens are

limpid vale
#

ty

finite imp
#

hi, i keep getting the error Error: 401 Unauthorized

jaunty plank
#

double check you are using the right token

steel hawk
#

I keep getting a 403 error when trying to post bot stats

spiral steeple
#

are you posting to the right client id?

#

one token per one id

#

you cant post to another bot with a different one's token afaik

steel hawk
#

Yeah I'm posting to the right client id

jaunty plank
#

is the token right?

steel hawk
#

yup

#

What does a 403 error usually mean?

spiral steeple
#

Forbidden

jaunty plank
#

^

spiral steeple
#

which usually means the token is right, but wrong bot

#

Normally bad token is a 401

steel hawk
#

I got rate limited earlier for some reason

#

But idk if that has anything to do with this

spiral steeple
#

Oh are you still rate limited?

#

but usually that's a 429

steel hawk
#

Yeah

#

Do you think I'm maybe banned or somethin?

spiral steeple
#

might be a cloudflare rate limit

#

Cf may have temp ip banned

steel hawk
#

Wow

#

Damn

spiral steeple
#

You can try again tomorrow I suppose

steel hawk
#

So what now

#

Ok

#

Thanks

raw void
#

Where can I find my dbl token?

jaunty plank
#

Dbl tokens are given out once your bot has been approved

raw void
#

Oh sad

#

I need to wait ๐Ÿ™ƒ

jaunty plank
#

Here's the url tho once you are

restive otter
#

how would i have an event when someone votes on discord.py? im trying with on_dbl_vote() but i cant get it to do anything

vapid cape
#

did you configure your URL and Authorization in top.gg?

restive otter
#

i just did this self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

#

do i need the webhook for the event to work?

vapid cape
#

yes

restive otter
#

how would i do that?

vapid cape
#

where is your bot hosted?

restive otter
#

its running on my pc at the moment

vapid cape
#

are you doing to transfer it to a server anytime soon?

restive otter
#

i want to wrap up the bulk of development before i do

#

because its easier to develop if its running on my pc

vapid cape
#

your home network will likely require you to port forward your modem/router for webhooks to work

#

most hosting solutions dont require that

restive otter
#

if thats the case then i think i cant even do it because my stupid isp uses DS-lite

#

so no ipv4

vapid cape
#

yeah so you might wanna hold it off until you get it hosted

restive otter
#

i can just get it hosted now since the vote thing is one of the last major things i wanted to add anyways

#

what would be a good place to host?

vapid cape
restive otter
#

ok ill have a look

vapid cape
restive otter
#

thanks

restive otter
#

ok im hosting my bot on vultr

#

how do i configure a webhook now

vapid cape
#

check the webhook example of dblpy

#

then head over to your top.gg bot's edit page

#

scroll down to the webhooks section

restive otter
#

ok

#

i already have the code from the example in my bot

#

what do i put in url and authorization?

vapid cape
#

url should look like this

#

http://YOUR.VPS.IP.ADDRESS:WEBHOOKPORT/WEBHOOKPATH

restive otter
#

ok

#

i did that

vapid cape
#

port and path are what you define in webhook_port and webhook_path in dblpy

restive otter
#

yeah i already figured that

vapid cape
#

Authorization should be the same as in webhook_auth in dblpy

restive otter
#

i also did that

#

is this the correct syntax fir the test?

    async def on_dbl_test(self, data):
        print("TEST")
        print(data)```
vapid cape
#

i believe so

sullen nymph
#

Yes

vapid cape
#

also make sure to press the save button before testing in the top.gg page

restive otter
#

ah i didnt do that

#

how long should it take to do the test?

sullen nymph
#

from a few milliseconds to minutes

restive otter
#

ah it worked

#

thanks a lot

wooden dove
#
await bot_list.post_guild_count(len(bot.guilds))
await bot_list.post_guild_count(shard_count=len(bot.latencies))
#

any way of doing this in one line?

#

pycharm reckons shard_count is an unexpected argument when i try

sullen nymph
#

ayaya let's open the docs, shall we?

wooden dove
#

I have done this

#

unless I missed something

sullen nymph
#

post_guild_count accesses the given bot's property guilds and calls len() on it

#

The first argument in the function is actually the shard count

wooden dove
#

so I just need await bot_list.post_guild_count(shard_count=len(bot.latencies)), and the guild count is done automatically?

sullen nymph
#

Yeah

wooden dove
#

great

#

thank you

frigid basin
#

python: on one bot the api works fine, on the second bot it says "no module named dbl"

sullen nymph
#

Define "second bot"

#

Is the module installed locally as a folder in the bot's folder?

#

Are you using virtual environment?

late spade
#

Hello! ๐Ÿ˜ƒ
Can someone give me a little bit of information about DBL webhooks?
I would really appreciate it ๐Ÿ˜„

frigid basin
#

both bots are in the same folder, that might be causing some issues

frigid basin
#

this is all it says import dbl ModuleNotFoundError: No module named 'dbl'

next pendant
#

is the webhook delayed today or something?

#

or just me?

#

DM's are coming after a few mins

jaunty plank
#

Yeah they are

willow spindle
#

not API related

jaunty depot
#

Your bot is trying to access "client" before client even gets defined

willow spindle
jaunty depot
#

And yea^^

#

Put that below where client gets defined

jaunty plank
#

Your client needs to be defined first

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

Dbl needs to be initialized first.

restive otter
#

for some reason the API is missing some votes, or has delayed votes.. or literally doesnt send any vote webhooks at all.. did the api or package update recently?

rapid kettle
#

can I just, use a discord webhook for my top.gg webhook, i suspect not, but can I?

sullen nymph
#

You need a webserver and make it post to a Discord webhook

#

top.gg doesn't support Discord webhooks

rapid kettle
#

thought that

restive otter
sullen nymph
#

-api

abstract mothBOT
sullen nymph
#

-wrongserver

abstract mothBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

restive otter
#

oh sorry lol

#

thanks tho

ocean fiber
#

Hi

halcyon plank
#

-help

#

-ajuda

restive otter
#

I Need a API?

light talon
#

@restive otter for what

restive otter
#

My Bot

#

DBL Api For Discord.JS Bots

light talon
#

use that

restive otter
#

Thanks Pal

light talon
#

np

jaunty plank
#

You dont get a token until your verified.

light talon
#

yes

molten galleon
#

Is there some method to get vote count?

#

in JS, dblapi.js

rocky bough
#

the object has vote count (monthly too)

molten galleon
#

oh ty

twin matrix
#

how to use webhooks?

#

nvm

#
const DBL = require('dblapi.js');
const dbl = new DBL(DBL_API_KEY, { webhookPort: 5000, webhookAuth: '123'});

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

will this work?

#

if a user votes

jagged sky
#

any alternative app to accept webhook request on my local host

#

i am currently using ngrok

#

but it stops after 7 hours

median badger
#

Express?

jagged sky
#

flask

#

python

green mantle
#

@jagged sky you know the dblpy module does that for you right?

jagged sky
#

@green mantle no?

#

how do u recieve webhooks?

green mantle
jagged sky
#

i have read that

green mantle
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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

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

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

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```
jagged sky
#

to accept webhook u need to specify a url

green mantle
#

yes...

#

thats how webhooks work

jagged sky
#

which url

green mantle
#

one you make up lmao

jagged sky
#

yes.

green mantle
#

it makes a endpoint

jagged sky
#

to accept webhook on my localhost

#

i need to use ngrok or localtunnel

green mantle
#

๐Ÿค” no? what?

jagged sky
#

how do u do it?

green mantle
#

what are you actually trying todo

#

listen for votes?

jagged sky
#

yes

green mantle
#

then use the dblpy module...

jagged sky
green mantle
#

the webhook path is what goes on the end

jagged sky
#

webhook_path='/dblwebhook'

green mantle
#

yes

#

that makes it

jagged sky
#

how do u make webhook path

green mantle
#

http://your.ip.here.yes:port/dblwebhook

jagged sky
#

have u done it with ur bot?

green mantle
#

yes...

jagged sky
#

itll work with ip?

green mantle
#

yes?

jagged sky
#

alright lemme check

green mantle
#

your public ip

jagged sky
#

i specified my public ip with port and tested it. not working

green mantle
#

have you actually set it on dbl...

jagged sky
#
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token my' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_path='http://blah blah/dblwebhook',webhook_port=port here) # Autopost will post your guild count every 30 minutes
  
    async def on_guild_post():
        print("Server count posted successfully")

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)
        user = data["user"]
        mem = self.bot.get_user(user)
        await mem.send("Test")
        
#

my port could be closed . lemme check

green mantle
#

you dont put the url as the webhook path

#

just leave it as /dblwebhook

jagged sky
#

thnx

#

i have opened port via windows firewall. am still not recieving. what could be the error

green mantle
#

webhook_path='http://blah blah/dblwebhook' that

jagged sky
#

chnaged that

green mantle
#

have you set it on dbl

jagged sky
#

yes

green mantle
#

and set the auth

jagged sky
#

i am doing without auth

#

i dont think its needed just to test

green mantle
#

do you have on_dbl_test

jagged sky
#

no wait

#

oh!

green mantle
#

you're using the test button yes?

jagged sky
#

yes

green mantle
#

then you need that event for that to fire

jagged sky
#

i see lol thanks again

#
    async def on_dbl_test(self, data):
        print("TEST works")
        print(data)```
#

still not workingpeepocomputersad

green mantle
#

try it with auth

jagged sky
#

thanks @green mantle

#

it worked with auth

proven shore
#

bb'help

restive otter
#

Suggestion:
Make api return a success message if request succeeds in updating stats for bots.

#

Currently sends {}

arctic arch
#

it responds with status 200 OK

restive otter
#

Right.. I forgot to check that

acoustic bone
#
const DBL = require('dblapi.js');
let token = `sd.sa.sfd-fds`;
const dbl = new 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);
    console.log(`User with ID ${vote.user} just voted!`);
});
#

the above code is logging "Webhook running"

#

but does not log votes

jaunty plank
#

did you update your webhook on the top.gg to use the right url @acoustic bone ?

acoustic bone
#

@jaunty plank i'm not entirely sure how webhooks work, what would i need to put in there?

jaunty plank
#

your webhook url

#

http://theip:port/wehookpath

acoustic bone
#

whats the ip tho

#

my public ip? the local ip of what im hosting it on?

trail sigil
#

the public ip of the device with this code on it

acoustic bone
#

okay

#

where do i set that?

trail sigil
#

so go to your bot page

#

and click 'edit'

#

and scroll down a little to the 'webhook' section

#

http://theip:port/wehookpath
just pop this into the url section

acoustic bone
#

i can't find the webhook section

trail sigil
#

click 'edit'

acoustic bone
#

does that mean i need to open port 5000 on my router?

trail sigil
#

yup

acoustic bone
#

is there any other way to listen for votes?

trail sigil
#

nope

acoustic bone
#

okay, and then what do I put in the bot code

#

so it starts the webhook on my ip

trail sigil
#

the thing you have currently is fine

acoustic bone
#
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'password' });
#

okay

trail sigil
#

include the listeners too, so you can easily see in the console what is happening

acoustic bone
#

ya i already have that

acoustic bone
#

@trail sigil wait how do I do that

trail sigil
#

set the url?

acoustic bone
#

include the listeners too, so you can easily see in the console what is happening

trail sigil
#

that is just the dbl.webhook.on bits

acoustic bone
#

ah

#

nothing came through ๐Ÿ˜ฆ

#

ohh i didnt put the token in :p

trail sigil
#

lol

#

also in the url section, change the bit after the / to /dblwebhook instead

acoustic bone
#

ya okay

#

@trail sigil like that?

trail sigil
#

yup

#

ensure ur using ur public ip too and that the port is fully open

#

(you can check this by using a port checker website)

acoustic bone
#

ya okay

#

@trail sigil i pressed test and nothing is logging

trail sigil
#

are you certain the ports are open?

#

and have you set the authorisation field?

acoustic bone
#

auth field?

#

oh ya its set

#

its weird cause when i open port check the port it says its closed

trail sigil
#

well the port is closed then

jagged sky
#

Port checks sometimes always say its closed

acoustic bone
#

ya

#

i have another port open for sure I use for a minecraft server

#

but port checks it as closed

jagged sky
#

What are you running it on?

acoustic bone
#

my local PC

#

it is binded to the correct local ip

jaunty plank
#

iirc, port will appear closed if nothing is running on that ip

jagged sky
#

Make sure you allow the port through firewall

jaunty plank
#

so make sure your bot is running when checking

acoustic bone
#

ah yes mcafee might be being a bitch

#

i should probably check that

trail sigil
#

mcafee blocks ports

acoustic bone
#

ya just found the firewall settings

#

ill open up 5000

restive otter
#

I'm getting this error while trying to use the API

acoustic bone
#

you put the right token in?

#

and you're not API banned? ๐Ÿ˜›

restive otter
#

Not sure why i'd be banned, never used it before

#

Is this correct

#

that's what it says on the webpage

jaunty plank
#

nice token leak

#

๐Ÿค”

trail sigil
#

lol

restive otter
#

that's not the token lmao

trail sigil
#

thats ur bot id

restive otter
#

that's the bot's id

jaunty plank
#

ah

restive otter
#

am i supposed to put the secret token there?

trail sigil
#

ok that was intentional?

#

yeah

restive otter
#

oh the docs were unclear about that

#

you guys aren't just messign with me right

trail sigil
#

lol no

restive otter
#

ok thanks

trail sigil
#

you put your DBL token

jaunty plank
#

docs look real clear to me

#

๐Ÿค”

trail sigil
#

not ur discord token btw

restive otter
#

i don't know what it is

jaunty plank
#

^ token page

restive otter
#

AH i see

jaunty plank
#

should be a command

restive otter
#

Thanks guys I'd have never figured that one out

acoustic bone
#

yesss it worked!!!

#

woooo

trail sigil
#

nice

restive otter
#

it's actually in 89 servers i was just running the code on my beta bot

jaunty plank
#

you should have a check for that

trail sigil
#

@wintry pollen no, nobody is trading accounts here

wintry pollen
#

Fuck

shadow hound
#

pogey

frozen jolt
#

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

const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

dbl.webhook.on('ready', hook => {
console.log(Webhook running with path ${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});

app.get('/', (req, res) => {
// ...
});

server.listen(5000, () => {
console.log('Listening');

#

is the app.get('/', (req,res) => { }) needed for getting who votes

dire sentinel
#

How exactly can I setup webhooks inside of my python bot?

#

I created a channel webhook for my support server and gave that link, but I am not sure what is the right way to do it

frozen jolt
#

okay so i did everything and it's not doing anything when people voet

vapid cape
#

@dire sentinel top.gg webhooks are not compatible with discord webhooks. you need to setup a webserver to receive top.gg webhooks, either using one of the official top.gg libraries, or setup a webserver yourself. the URL field in your top.gg page should point to the server where your bot/webserver is hosted, either a project url, website or hosting IP address

#

@frozen jolt what did you put in your top.gg URL and Authorization? does "listening" show up in your terminal/console?

frozen jolt
#

yes it does

dire sentinel
#

So I just put my server's ip address in there and I'm good?

frozen jolt
#

also what do u mean by top.gg URL and Authorization

vapid cape
#

in your bot's edit page

#

scroll down to the webhooks section

#

@dire sentinel server's ip address and port, and the path, depending on your configuration. are you using dblpy?

dire sentinel
#

Yes I am

frozen jolt
#

https://top.gg/bot/:ID/edit is this what i put there

#

what goes in bot

#

id as in bot's id or top gg id

vapid cape
#

then your url should look like this http://SERVER.IP.ADDRESS.HERE:WEBHOOK_PORTHERE/WEBHOOK_PATHHERE @dire sentinel

frozen jolt
#

me or him?

#

ah

dire sentinel
#

Which port should I use for the webhook port

vapid cape
#

the one you chose in your dblpy configuration

#

commonly used ports are 3000 and 5000

#

@frozen jolt go to your top.gg bot's edit page

#

where you input your description, etc

frozen jolt
#

yeah i am there

vapid cape
#

scroll down

dire sentinel
#

Huh, I didn't choose a port anywhere

frozen jolt
#

yes i see the webhook

#

what is the url

vapid cape
#

@dire sentinel check the dblpy webhook example

#

@frozen jolt where is your bot hosted

frozen jolt
#

i c

#

ok

vapid cape
#

then the url should be your repl.it proeject name

#

and not sure if replit allows port 5000, does it?

frozen jolt
#

uh

vapid cape
#

i think you have to use port 3000, and use your project url directly

frozen jolt
#

it does

#

since it console logged through 5000

vapid cape
#

well try it then

frozen jolt
#

what is Authorization?

vapid cape
#

what you write in webhookAuth

frozen jolt
#

ok

dire sentinel
#

Ok what exactly is the webhook path?

sullen nymph
#

the thingy after ip:port in URL

dire sentinel
#

Yea how do I find it tho

vapid cape
#

default path in dblapi.js is /dblwebhook

#

so in repl.it, your full url should be https://PROJECTNAME.ACCOUNTNAME.repl.run/dblwebhook

#

or something like that, not much familiar with repl.it

dire sentinel
#

So I have to open the port that I selected on my server right?

vapid cape
#

the dblpy webhook example already shows you a path, you can change it if you want, or keep it the same

#

depends on your hosting

#

most vps providers have ports open by default

#

some require setting them in a firewall

dire sentinel
#

Alright I believe I have to open it manually for mine

frozen jolt
#

@frozen jolt where is your bot hosted
@vapid cape https://kaneki--p025.repl.co is where i am hosting i had a friend vote for it and it didn't work

#

i mean i used that link for url on the top gg website

vapid cape
#

"your bot is alive"

#

does that come from your app.get("/") code?

frozen jolt
#

no

#

that's for keeping bot online through pinging service

#

i don't know what i am doing anymore Catcry

vapid cape
#

is that string somewhere in your code tho?

#

show the code that contains it

frozen jolt
#

ok

dire sentinel
#

This is proper formatting right?

vapid cape
#

ip:port

#

not ip/:port

dire sentinel
#

Yea for some reason discord added that slash

#

But yea

#

It still doesn't work

vapid cape
#

did you press the save button

dire sentinel
#

Yea

frozen jolt
#

server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
server = express();

dire sentinel
#

I opened an HTTP port

#

On my server

vapid cape
#

http is port 80

dire sentinel
#

Yea

vapid cape
#

you used port 80 in your webhook_port?

dire sentinel
#

Yep

vapid cape
#

port 80 is a privileged port, only works if your bot is running as admin

dire sentinel
#

Oh

#

Well this is an http request right?

#

Can I open TCP requests at port 5000 and get it to work?

vapid cape
#

@frozen jolt is that the same server thats listening on port 5000?

frozen jolt
#

no

vapid cape
#

@dire sentinel yes

frozen jolt
#

do i have to call that for this?

vapid cape
#

@frozen jolt you have to use the same server for everything

#

with the same port

frozen jolt
#

can't i call 2 of them

vapid cape
#

if it allows multiple ports

#

but the project url only uses one

#

if it allows using more than one port, then the other port will not be accessible through the normal url

frozen jolt
#

i see

#

dbl.webhook.on('ready', hook => {
console.log(Webhook running with path ${hook.path});
});
this is working

#

and i am doing
app.listen(5000, () => {
console.log('App (dbl): Listening');
});

#

the other one as 3000 port

dire sentinel
#

I allowed TCP requests on 5000 but the test still doesn't go through

#

I am on AWS

#

And I am using the DNS url

#

should I use the IPv4?

vapid cape
#

@frozen jolt chose one port, either 3000 or 5000, and put everything on it

frozen jolt
#

ok

vapid cape
#

@dire sentinel are you using the on_dbl_test event? afaik dblpy has a separate event for testing

dire sentinel
#
    async def on_dbl_test(self, data):
        print(data)```
#

That is the code I have

#

So yes

frozen jolt
#

for the sake of testing, can one of your vote for my bot

dire sentinel
#

There is a test event

#

Where you can just click the test button on the edit page to test ur webhook

frozen jolt
#

oh

#

it's not workig

dire sentinel
#

Same this is tuff times

frozen jolt
vapid cape
#

try using reqbin to send yourself a request

#

both of you

frozen jolt
#

but we aren't that bright

vapid cape
#

@frozen jolt did you fix your server?

#

right now not even / works

frozen jolt
#

i think

dire sentinel
#

Paste the webhook URL in there?

frozen jolt
#

so is
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
imporatnt and needed?

vapid cape
#

show your full code

#

@dire sentinel yes, and make a POST request to it

dire sentinel
#

And keep the US option?

vapid cape
#

doesnt matter

dire sentinel
#

Operation Timeout

vapid cape
#

that means either blocked in firewall or server not found

dire sentinel
#

Ok let me mess with my server settings

frozen jolt
#

going through webport without any experience or knowledge was a bad idea afterall

dire sentinel
#

I dont know but maybe the webhook path is wrong?

frozen jolt
#

thanks tim for helping hopefully i can figure it out thx tho

dire sentinel
#

Like idk what else could be the problem

#

Yea, thanks for helping Tim

frozen jolt
#

is yours in js or python

dire sentinel
#

Py

frozen jolt
dire sentinel
#

๐Ÿ˜ข

vapid cape
#

well, if you guys show your code maybe something else can be done about it

dire sentinel
#

Do you want me to show where I initiate the DBL client?

vapid cape
#

in your case, i'd need to see the entire http/server/express/dbl code

frozen jolt
sullen nymph
#

DBL token

frozen jolt
#

it's half

#

not all of it is therre

dire sentinel
frozen jolt
#

site can't be reached

#

๐Ÿ˜ณ

dire sentinel
#

That's not a real site

#

Its the webhook url

frozen jolt
#

o lol

sullen nymph
#

it's still not reachable

willow spindle
dire sentinel
#

well i replaced the ip address

#

thats prob why

#

with ipv4.here

sullen nymph
#

toss me the full URL in DMs

frozen jolt
#

is this guy trustable

dire sentinel
#

Im scared lol

frozen jolt
#

lol

dire sentinel
#

Can u tell me what im supposed to see

sullen nymph
#

I'll just be sending test requests until it works and DMing you what I get

dire sentinel
#

Sounds like a DDOS

#

lmao

#

But its not working

#

I cant reach it either

sullen nymph
#

i wouldn't be doing it rapidly

dire sentinel
#

With the IP address there

#

What page is it supposed to take me to?

vapid cape
#

@frozen jolt your url seems to be working lol

frozen jolt
#

i am confused

sullen nymph
#

If you visit the page in browser you'd be getting code 405 saying "method not allowed"

dire sentinel
#

Oh, it just says The connection has timed out

sullen nymph
#

something wrong with the URL

vapid cape
#

@frozen jolt show what you put in your URL and Authorization

frozen jolt
vapid cape
#

https://kaneki--p025.repl.co/dblwebhook

#

thats the correct one

frozen jolt
#

okay sorry and thank u

#

it worked awesome

dire sentinel
#

Lucky

vapid cape
#

you're on amazon aws right?

#

not lightsail

dire sentinel
#

Yea

vapid cape
#

did you configure security groups in your amazon admin panel?

dire sentinel
#

Yep

#

I changed the inbound rules to allow a Custom TCP request on Port 5000

vapid cape
#

show your dblpy code

dire sentinel
#
    def __init__(self, client):
        self.client = client
        # Declare DBL client
        self.dbl_token = 'TOKEN'
        self.dbl = dbl.DBLClient(self.client, self.dbl_token, webhook_path='/dblwebhook', webhook_auth='PASSWORD',
                                   webhook_port=5000)```
vapid cape
#

and you tested http://IP.ADDRESS:5000/dblwebhook

#

in reqbin?

dire sentinel
#

Yep

#

I sent the link I tested above I believe

vapid cape
#

i mean

#

you're not supposed to use all of that

#

should be http://xxx.xxx.xxx.xxx:5000/dblwebhook

dire sentinel
#

I tried that too, but I'll try again

#

Yea just the IP doesn't work either

vapid cape
#

is your ec2 windows or linux?

dire sentinel
#

windows

vapid cape
#

ah thats why

#

you need to open ports in the windows firewall too

dire sentinel
#

Oh

#

I dont need to restart or anything when I open it right?

#

I turned off the firewall and still see nothing

vapid cape
#

idk

#

i dont use python, nor windows server, nor amazon ec2 lmao

dire sentinel
#

Oh lol

#

No problem, thanks for ur help thus far

vapid cape
#

reqbin still shows operation timed out?

dire sentinel
#

Yea

vapid cape
#

try creating a barebones webserver to see if it works

#

like if you were to host your own website

dire sentinel
#

No idea how to do that

#

HOLY CRAP

#

BRUH
BRUH

#

I pressed ctrl-C on command prompt at some point so it paused all statements from printing to the console

#

๐Ÿคฆโ€โ™‚๏ธ

#

Now I see the requests

#

Thank you @vapid cape

#

Ur a god

vapid cape
#

lmao

dire sentinel
#

Actually I discovered that I didn't actually press ctrl-C but everytime a request is sent it stops the bot from working

#

sigh a new issue for me to solve

jolly hornet
#

-api @robust summit

abstract mothBOT
#

@robust summit

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

willow spindle
#

@left egret ^

jolly hornet
#

is it an ad?

#

i figured it was

left egret
#

-b @robust summit Trying to sell cracked web scripts in #topgg-api

abstract mothBOT
#

dblMod Banned `ษฎใ€ŽTRใ€DaXer#7587 (@robust summit)

jolly hornet
#

thank eri

left egret
#

โค๏ธ

knotty garnet
#

-b [MENTION] Trying to sell cracked web scripts in #topgg-api
Ok, what the actual fuck?

opaque jetty
#

what happened?

shadow hound
#

F

gaunt steeple
#

imagine paying for web scripts

#

i dont remember the last thing i used that wasnt open source and i had to pay for... oh wait, it was invision power board in like 2001

#

or was it vbulletin, one or the other ๐Ÿ˜„

delicate anchor
#

My bot 115 server but dbl 91 shows

shut belfry
#

Are you updating the info?

delicate anchor
#

yes

#

nothing improved

frozen ore
#

@delicate anchor

delicate anchor
#

@frozen ore yes

vapid cape
#

show code

green mantle
#

oh yeah

#

speaking of the api

#

why am i getting unauthorized when posting count when both the tokens are correct and it was working a couple days ago without issue ๐Ÿค”

sullen nymph
#

Tried regenerating yet

green mantle
#

mhmm

sullen nymph
#

toss me the token

true talon
#

post shards

green mantle
#

i really cba todo that

restive otter
#

how do I get the amount of votes with the API in Java, please ping if you have the answer

jaunty plank
#

Api docs

solid wharf
#

Hey guys, it appears that my API server is no longer responding to DBL, I have had the same code for a very long time now and nothing has changed, it's stopped responding entirely. DBL is not sending me anything at all, can someone assist me?

#

Is everything just backed up atm?

steady oyster
#

ip peluwang kedua

candid kelp
#

can someone help me setup the api for python

sullen nymph
#

what's your code like

candid kelp
#

wdym

sullen nymph
#

have you tried using dblpy or are you just asking for overall help because you have absolutely no clue what you are supposed to do?

candid kelp
#

no i installed dblpy

#

with pip

#

and looked at the docs

#

but when i tried it didnt work

sullen nymph
#

what does your code look like

candid kelp
#

1 sec

#

here so

sullen nymph
#

why do I recognize that auth from somewhere

carmine forum
#

bruh

#

me

#

@candid kelp delete it u leaked my pass

candid kelp
#

where

carmine forum
#

gotta go reset that now

candid kelp
#

its put in red

#

mate

jaunty plank
#

your going to have to regen anyway

carmine forum
#

no idiot

sullen nymph
#

The webhook_auth

candid kelp
#

oh

#

i see

sullen nymph
#

and yeah the token as well

candid kelp
#

yeah i put a little red over it

sullen nymph
#

Anyway, I assume the URL and authorization stuff is handled on the website part?

#

You censored the most insignificant thing out of the whole token I believe

candid kelp
#

nice to know but i dont feel like someone is going out of their way to get a bot

#

that is pretty small

sullen nymph
#

Sorry to surprise you...

candid kelp
#

so wdym with website

sullen nymph
#

Anyhow, have you made sure your port is properly open and forwarded in router settings?

#

The bot's Edit page

candid kelp
#

oh yes

#

but i dont self host

#

i use google cloud

carmine forum
#

i've tried it on google cloud aswell, i've opened port 5000

#

still nada

#

ive set ingress and egress rules

sullen nymph
#

Tried using reqbin to send requests to the machine yourself?

carmine forum
#

not sure what reqbin is

#

but should I try posteman?

sullen nymph
#

eh works too

carmine forum
#

alr

#

im getting connection timeout

sullen nymph
#

well, port not open ๐Ÿ™ƒ

#

or wrong URL

carmine forum
#

oof

#

http or https?

sullen nymph
#

http

carmine forum
#

alr

green mantle
#

@sullen nymph I Thinks you should add the extra params to allow for ssl ๐Ÿค”

sullen nymph
#

reverse proxy gang

#

also do you think many users will be able to use it

#

if it supports SSL because I cba to search the docs

sleek rampart
#

@restive otter

restive otter
#

@sleek rampart yes?

sleek rampart
#

Lmao

restive otter
#

?

sleek rampart
#

@restive otter what are u coding?

restive otter
#

online shop

sleek rampart
#

Nice

#

Is it hard

#

?

rough crater
#

-api

abstract mothBOT
sleek rampart
#

oop

jaunty plank
#

also, probably shouldnt tag random people

slim mauve
#

I made this code for my bot that sends a DM saying thanks to people that votes, why it doesnโ€™t works?

dire sentinel
#

A webhook is only needed when you have 1000+ votes right?

restive otter
#

@slim mauve

#

what version of discord.js do you use

jaunty plank
#

@dire sentinel webhooks allow DBL to send you data when a vote is received, rather than you not knowing until you request.
This saves you sending wasteful requests to the API asking if a user voted, or requesting all the users that have voted.
Overall, it saves processing power for you, and DBL.

slim mauve
#

@restive otter 11

restive otter
#

@slim mauve

#

does it log?

#

with console.log?

slim mauve
#

Nop @restive otter

#

Anything

restive otter
#

Is it just me or the vote webhook is lagging? I got tons of complains from my botโ€™s players saying they waited hours for it to finally update.

dense shale
#

usually it can take up to 30 minutes

queen storm
#

Hey, I don't understand how the BiConsumer is working (in Java), how can I do a method like this :

    private DiscordBotListAPI api = bot.getDiscordBotAPI();
    public boolean hasVoted(String id){
        //here
    }
queen lotus
#
    const dbl = new DBL(config.dbl, bot);

    dbl.on('vote', vote => {
        console.log(vote);
    })

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

Not working someone know why?

vapid cape
#

dbl doesnt have a vote event

queen lotus
#

so i need to use like this

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

?

vapid cape
#

yes

#

and you need to configure your webhook

#

in the website as well

queen lotus
#

ok thx

queen lotus
#

url of webhook?

#

Authorization webhookAuth?

jaunty plank
#

@queen lotus
http://ip:port/webhookpath

#

Ip is your bots public ip

#

Port and webhook path you set

#

In the program

queen lotus
#

i have to create http server?

vapid cape
#

where is your bot hosted?

queen lotus
#

GalaxyGate

vapid cape
#

then yes, you need a webserver but dblapi.js does it for you

#

check the webhook example for dblapi.js

queen lotus
#

all of this just for check who voted to my bot?

vapid cape
#

yes

queen lotus
#

oh

vapid cape
#

when you set a webhook port, dbl.webhook is created and dbl.webhook contains a small webserver inside it that handles everything for you

queen lotus
#

ok

runic trail
#

hey i tried out the webhook feature from the dblapi.js module and when i test it (i specified the port and the ip of my vps) nothing logs ?

#

i don't know what is wrong

jaunty plank
#

Votes can take 30 minutes to be sent via the webhook

runic trail
#

30 mins ?

#

whut

vapid cape
#

they should be instant most of the time

#

unless the api is having issues

jaunty plank
#

The servers have been quite slow recently

runic trail
#

i think i know why

limpid vale
#

i done make webhook

runic trail
#

lmfao im kinda dumb

limpid vale
#

how to use it?

#

i dont give the URL?

jaunty plank
#

On the website you need to give the url

limpid vale
#

how to see webhook port?

#

i just made it in my server

restive otter
#

is there any way to use the weekend endpoint without a token?

limpid vale
#

see that

runic trail
#

omg finally

#

my webhook is working

#

<_<

limpid vale
#

@runic trail how to use?

jaunty plank
#

@limpid vale thats not the way top.gg webhooks work.
Its not a discord webhook

limpid vale
#

then?

jaunty plank
#

Its a webhook you make in your bot

runic trail
#

lmao

#

it worked once

#

and it doesnt work anymore

limpid vale
#

how to i know the port?

jaunty plank
#

You set the port

#

In the code in your bot

limpid vale
#

where?

runic trail
#

ohh goddamn

#

learn how to code and then ask questions

#

lmfao

limpid vale
#

just explain to me

#

i dont know anything about webhook

jaunty plank
#

Look at the docs

limpid vale
#

gimme the link

jaunty plank
#

๐Ÿค”

runic trail
#

docs

#

oh yes finally

limpid vale
#

how to see port wtf

restive otter
#

@limpid vale Please research webhooks before trying to use one

vapid cape
#

where is your bot hosted @limpid vale

ripe thicket
#

How often should a bot update its server count

jaunty plank
#

the default is 30 minutes iirc

ripe thicket
#

Thanks

rotund lake
#

How do i post the server count?

jaunty plank
#

what library?

rotund lake
#

discord.js

jaunty plank
rotund lake
#

And how do i post it now?

#

Like if i try it it says postStats requires 1 argument

#

as an argument i put client.guilds.size

#

@jaunty plank can you help me?

jaunty plank
#

you actually dont need to use postStats

#

the library already does it

rotund lake
#

Does it have an automatic interval?

jaunty plank
rotund lake
#

const DBL = require("dblapi.js");
const dbl = new DBL('Token', Client);

#

I got this

#

Because the other two i already have in there

sterile cape
#

Hello

#

How can I add my bot to top.gg website?

jaunty plank
#

it updates every 30 minutes, should be updated on startup aswell @rotund lake

rotund lake
#

no it didn't

jaunty plank
rotund lake
#

no it didn't
@jaunty plank it should say so then

jaunty plank
#

you can use these events to check if it posts/errors

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

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

Yeah i have them

jaunty plank
#

no errors?

rotund lake
#

But they wont show in the console

#

No errors, nothing

jaunty plank
#

hmm

#

its supposed to post on startup ^

#

try giving it some time, otherwise im unsure tbh

rotund lake
#

okay

#

But it has nothing to do with my const's?

const { Client, Collection } = require("discord.js");
const { RichEmbed } = require("discord.js");
const randomPuppy = require("random-puppy");
const Discord = require('discord.js');
const { config } = require("dotenv");
const fs = require("fs");

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

oh actually wait

jaunty plank
#

๐Ÿค”

rotund lake
#

OHHH

#

I am stupid

#

Sorry

#

I had the wrong client at the end of the last const

#

Yeah now it works

jaunty plank
#

perfect

rotund lake
#

Thanks anyways

wary ember
#

whats the ratelimit on status changes?

knotty garnet
#

Rule of thumb is once per 2 min

ruby light
#

I can't seem to find a way to receive the vote

#

Webhook example

const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote);
  // Do what you need to do
});

already tried this

shadow valley
#

ั€ัˆ ะฟะณะฝั‹

#

hi guys

#

i gay

little otter
#

is there a github example with this on it

weak sandal
#

has someone a Java script for a fn item shop command?

willow spindle
#

what

restive otter
peak patrol
#

@sullen nymph

sullen nymph
#

Fetching bot data, votes being an example

peak patrol
#

oh

restive otter
#

.

trail sigil
#

-dotpost

abstract mothBOT
#

Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam.
If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.

green mantle
#

@sullen nymph So fun fact

sullen nymph
#

huh

green mantle
#

webhooks being either slow or not going through

river musk
#

Hello, how can I post server count? I always get 401 error. I even tried to downgrade the version of the discord.js, but it still doesn't work. I have the newest version of dblapi.js. The token is 100% valid, it does work without the postStats method.

My code (for v11.3.2):

const config = require("./config.json");
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(config.dbl.token, { webhookPort: 3000, webhookAuth: config.dbl.password });

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

client.on("ready", () => dbl.postStats(client.guilds.size));

client.login(config.token);```

Error:

(node:11884) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.<anonymous> (C:\Users\BramboraSK\Desktop\post\node_modules\dblapi.js\src\index.js:118:25)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1218:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)```

restive otter
#

Regen your dbl token

river musk
#

ok thanks, working now

river musk
#

The webhook is suddenly extremely slow, is it just me?

#

It took few minutes to actually get request

jaunty plank
#

Its been pretty slow

#

Took around 10 minutes to get tests

inner tapir
#

same

frozen jolt
#

is the api being slow? i have it send message when someoen votes and it takes very long and sometimes it's instant

rapid kettle
#

Yes, API is currently slow

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

how can i know what i need to write webhookAuth

jaunty plank
#

auth is the password you set @scarlet river

#

you set it in your program

#

and then set it to the same thing on your bot edit page

half abyss
#

ลŸuan ne yapmam lazฤฑm oy vermenin aรงฤฑlmasฤฑ iรงim

restive otter
#

is adding a role to all the members in a server (besides bots) abusing the api?

vapid cape
#

kinda, but it should be fine if you do it gradually

#

(wrong channel btw)

restive otter
#

ah okay

#

and sorry lmao

restive otter
#

Recently its only been letting me add bots to a limit of 4 server but i have perms in more than 10 servers what going on

sullen nymph
#

Why

#

Anyway

#

-api

abstract mothBOT
restive otter
#

This is help

sly violet
restive otter
#

I need help

sly violet
#

this is for the top.gg api only

#

wrong place

restive otter
#

Where do i go then

rapid kettle
#

WITH OFFICIAL TOP.GG
Anyways, anyone know how I would go about making a webhook

restive otter
#

Whats a websocket

sly violet
restive otter
#

Webhook

rapid kettle
#

webhook*

sullen nymph
#

A webserver library in your language

sly violet
#

oh

rapid kettle
#

alr, ill get to work

restive otter
#

So my question dont get answers

#

Ok.......

sly violet
#

correct

sullen nymph
#

Hello, the tag said this is a channel for help with top.gg API. Your question is more fit for #general

restive otter
#

Ok

vapid mango
#

In which language do you program the website?

jaunty plank
#

What

restive otter
#

@vapid mango do you have under 3 iq

wooden pewter
#

Hey i have a question to the top.gg api, how can i count votes of a specific user

vapid cape
#

there is no specific way to do that, you can use getVotes to obtain the last 1000 votes, and then count the users, or you can use webhooks to receive votes in real time, and store them

restive otter
#

What coding language does top.gg use

#

ping me

restive otter
#

Wat

#

Being on dnd is api abuse

#

Lmaoaoaoa

dim shell
#

Then about almost half of the bot here will be deleted :|

nova summit
#

This is stupe, if the bot can do it it's not api abuse lmao

sullen nymph
#

-api

abstract mothBOT
wispy vale
#

is there a way to use events without having to set up a webhook and all of that?

#

cause ive been trying to use the on_dbl_vote event, but saw that you need a webhook or somn like that

willow spindle
#

No

#

You have to setup webhook

wispy vale
#

oh ๐Ÿ˜”

#

ok then, thanks ๐Ÿ˜Ž

jaunty plank
#

It takes like 5 minutes to setup a webhook with the official libraries.

modern canyon
#

on the dbl api, how do I check if a user has voted in the last x time, or their total votes

willow spindle
#

you can't use api before your bot is approved

modern canyon
#

okay. thanks

midnight fractal
#

Hey

forest jay
#

Is the api down ?

restive otter
#

At dbl.webhook.on('vote', vote => { it gives an error saying: Cannot read property 'on' of undefined, what am I doing wrong?

vapid cape
#

dbl.webhook only exists if you define a port or a server in your webhook options

restive otter
#

const dbl = new DBL(topGGAuth.Auth, { wehookPort: 5000, webhookAuth: topGGAuth.webAuth }); Which I did

shy jay
#

moocow

vapid cape
#

show your full code then