#topgg-api

1 messages · Page 122 of 1

fading knoll
raven latch
#

If you guys haven't know, "api" is known as "fire" in Indonesian language

prime python
#

hi are there any websites/docs about how to use the api and what i need to set up?

slow dust
#

the test button worked... just once tho... i cant make it do it again.. is there a problem with the api or is it just me?

rain heart
rain heart
young haven
#

is it possible to use the API with heroku?

tribal sky
#

hey how do i test the vote func

#

python lib

#
@commands.Cog.listener()
async def on_dbl_test(data):
        print(data)```
young haven
#

can someone tell me, if i can use the voting API by heroku?

uncut kelp
#

discord.js
hello how dbl token works in my code?
i put token in config.json

{
"dbltoken": "my_token"
}

and in my index.js

const DBL = require("dblapi.js");
const config = require("./config.json");
client.dbl = new DBL(config.dbltoken);

and i try to set command

module.exports = {
    name: "check",
    aliases: ['check'],
    run: async (client, message, dbl) => {

        dbl.hasVoted(message.author.id).then(c => {
            if(c) {
                message.channel.send('yes voted')
            } else {
                message.channel.send('not yet')
            }
        })
    }
}

why dbl is not function?
is possible if i used second bot to test my bot in top gg?
with put top.gg token into second bot?

knotty garnet
pale fulcrum
#

wait

knotty garnet
#

dbl ain't a command, you can't handle it like one

pale fulcrum
#

thats a webhook

uncut kelp
#

i need to enable command when someone has vote

pale fulcrum
#

its best to setup a db and use that

#

but you can query the api

knotty garnet
#

api has a ceiling tho

pale fulcrum
#

also if that is a command where is the message?

uncut kelp
#

i don't need message, cause there just console.log

#

i'm use command handler and event

knotty garnet
#

the issue is that you're handling dbl as if it were a command

#

it's not

#

you aren't supposed to create a command file for it

#

you're supposed to start it during bot startup sequence

uncut kelp
#

so, how to check when people has vote with command?

knotty garnet
#

use dbl to query for votes
OR
create a webserver to handle top.gg requests

uncut kelp
#

i don't understand

#

is that issue?

#

because i need to test my code have error or not

knotty garnet
#

no, you can't use top.gg api without the token anyway

#

it is supposed to be in ur code

#

well, not exactly in the code because that'd be a leak

#

the issue is how you're using top.gg api

#

you're creating a command file and treating it like a command

#

read the docs for some examples

uncut kelp
knotty garnet
#

no

#

you query for votes using dbl api

civic crow
#

I'm using dblapi.js but I don't know how to create a webhook, can someone help me?

hot axle
#

check the docs

uncut kelp
uncut kelp
knotty garnet
#

read the docs

uncut kelp
knotty garnet
#

if you follow the docs it'll work

uncut kelp
#

what is query?

knotty garnet
#

your 👏 structure 👏 is 👏 wrong

#

if you don't fix the way you're handling dbl api you won't get anywhere

barren apex
#

Rank api?

#

Pls

knotty garnet
#

rank?

barren apex
#

Rank card

slow dust
#

dbl.postStats(
where is it posted?

#

to the bot page?

tribal sky
#

heu can someone please help me

#

im using the python api

#
@commands.Cog.listener()
    async def on_dbl_test(self,data):
        print(data)```
#

when i click on the test button in topgg it doesnt print any data on my console

#

im tryin to execute a func when user has voted on topgg

civic crow
#
const app = express();
const server = http.createServer(app);

let api = new top(
    "token",
    { webhookPort: 5000, webhookAuth: "password", webhookServer: server },
    client
);
api.webhook.on("ready", (hook) => {
    console.log(`Webhook running with path ${hook.path}, http://${hook.hostname}:${hook.port}${hook.path}`);
});
api.webhook.on("vote", (vote) => {
    console.log(`User with ID ${vote.user} just voted!`);
});
server.listen(5000, () => {
    console.log("Listening");
});```
#
Listening```
#

The vote event is not working, what should I do?

slow dust
#

the webhook url from website is pointed to http://urdomain/dblwebhook?

civic crow
#

What if you don't have a domain?

slow dust
#

0.0.0.0 is local host.. that means point it to where the code is running

hot axle
#

you mean 127.0.0.1

acoustic dove
#

no its not

hot axle
#

or localhost

acoustic dove
#

0.0.0.0 is all

#

ips

slow dust
#

ipv6

#

if u are on a local machine

civic crow
#

server.address("localhost");

#

I have a host

slow dust
civic crow
#

How can I change the hostname

rapid kettle
#

uhhh

#

it’s the servers IP

#

http://serverIP:port/path

civic crow
#

Yes but now it's just 0.0.0.0

#

So how should I chnage it

restive otter
#

Can any one tell how to add server count in bot dashboard

rapid kettle
#

0.0.0.0 is a placeholder @civic crow

#

just means that it’s listening on all IP addresses

civic crow
#

Alright, so that should be good

#

Why is my vote listener not working then?

hot axle
restive otter
#

How

#

There is some steps @hot axle

hot axle
#

well its not that hard

#

i forgot what the endpoint was tho

restive otter
#

Tell me in dm

hot axle
#

hold on a sec

restive otter
#

Ok

hot axle
#

got it

restive otter
#

Tell

hot axle
#

/api/bots/bot-id/stats

#

you make a post request there

restive otter
#

Send me ss where

hot axle
#

with data in json format like this

{
   "server_count": 69 // your server count
}
#

you know what a post request is?

restive otter
#

No

hot axle
#

well search it up

#

it's kinda simple

civic crow
restive otter
#

@hot axle you tell me please

civic crow
#
Listening```
#

still doesnt work

hot axle
#

cuz its on your local machine

#

(i suppose)

civic crow
#

It's on my host

hot axle
#

you mean in your local host?

#

or in a web host

civic crow
#

No I bought a host online

#

yes

hot axle
#

oh k

#

um

#

make sure you can make requests to the server

#

add something like a test route that responds with anything

#

and check if you can access it

civic crow
#

I asked my host

#

He says I can

#

@hot axle

hot axle
#

hmm

#

you have registered the enpoint and stuff right?

civic crow
#

What do you mean?

hot axle
#

like

#

thats where you register the endpoint url

civic crow
#

Well, I used the test button too

#

so, yes

hot axle
#

but that's not the actual endpoint

#

you have to put your domain name

civic crow
#

Ohhh

#

wait

#

O my goodness haha that was it

#

thanks dude

hot axle
#

no prob

golden scroll
#

Idk why but I set this for webhook and I don't get any response with test button

young haven
#

can someone tell me, if i can use the voting API by heroku?

hot axle
#

yea

#

i use it too

young haven
hot axle
#

your application's url

#

with the webhook path

golden scroll
hot axle
#

hm

#

the route has a post method right?

golden scroll
#

I think so, Flask (python) has it

#

Ok now I get it working, But in test Authorization is None 🤔 , To be exact nothing is sent 🤦

#

Even I voted and nothing is sent by webhook it is completely empty

stiff breach
#

the example code is not working :[

stiff breach
#

who did the api

#

fuck

golden scroll
#

<@&304313580025544704> ??

rapid kettle
#

@rough crater here

stiff breach
#

<@&304313580025544704>

rapid kettle
#

bruh

stiff breach
#

thanks :)

fresh plover
#

-atmods @stiff breach @golden scroll

abstract mothBOT
#

@stiff breach @golden scroll

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.
stiff breach
#

it was an emergency

fresh plover
#

no it was not

stiff breach
#

he tried to raid

rapid kettle
#

was it?

#

i say one mod could handle that

stiff breach
#

its like a bug

#

he tried to rad

fresh plover
#

no, they didnt. dont ping the mod role for something like that

stiff breach
#

we squashed him

#

ok

silent quail
#

P!PLAY go the kid laroi

stiff breach
#

x)

#

also

#

you know how python api is working?

#

i dont have any responses in events

#

my program is listening on the port 5000 (tcp)

#

but nothing appears

golden scroll
#

I guess find why 🙂 @stiff breach

stiff breach
#

tell me

golden scroll
#

I looked in the source and find out if you press test button it calls on_dbl_test instead of on_dbl_vote

stiff breach
#

yes

#

but i have on_dbl_test

golden scroll
stiff breach
#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:")
golden scroll
#

That was my problem lol

stiff breach
#

:(

golden scroll
#

Did you set the link in webhooks?

stiff breach
#
        self.dblpy = dbl.DBLClient(self.bot, 
                                    self.token,
                                    webhook_path="/dblwebhook", 
                                    webhook_auth='mypasswd', 
                                    webhook_port=5000)```
golden scroll
#

What is your hosting?

stiff breach
#

??

golden scroll
#

Where are you hosting the bot?

stiff breach
#

private server

#

i cant tell the name

#

its hard to explain

golden scroll
#

There should be IP to be called

#

I use a private hosting too so I know what you are saying

left egret
#

😐

golden scroll
#

Found the IP and Port which is open and set it in the webhooks page

#

For example you have 123.123.123.123 as ip and 25564 as port
then first set port in your code to 25564 and then the endpoint url in webhooks page to http://123.123.123.123:25564/dblwebhook

#

The auth field is also need to match with your auth in code

stiff breach
#

thanks

#

im going to try

#

OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use

#

the is literally my program which is using the port

#

or that

#
future: <Task finished coro=<DBLClient._webhook() done, defined at /usr/local/lib/python3.7/dist-packages/dbl/client.py:436> exception=ValueError('path should be started with / or be empty')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 453, in _webhook
    app.router.add_post(self.webhook_path, vote_handler)
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1167, in add_post
    return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1094, in add_route
    resource = self.add_resource(path, name=name)
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_urldispatcher.py", line 1071, in add_resource
    raise ValueError("path should be started with / or be empty")
ValueError: path should be started with / or be empty
#

@golden scroll

golden scroll
stiff breach
#

hmmmm

#

how can i find it quickly

#

x)

golden scroll
#

Or maybe the host doesn't gave you the port

stiff breach
#

it is open

#

i can ping it

golden scroll
#

Is your host type Pterodactyl

stiff breach
#

no no

#

lol

#

its just a debian server

golden scroll
#

ping it?

stiff breach
#

ping -p {port} {ip}

#

linux gang gang

golden scroll
#

oh

#

I never used linux

stiff breach
#

no prob

#

lol

#

but look the second error

golden scroll
#

Btw you just need to check for ports

stiff breach
#

and sometimes when i am testing the webhook

#

no errors

#

it is random

golden scroll
#

This line

stiff breach
golden scroll
#

What is this

webhook_path="http://ip:5000/dblwebhook"

Change it to just /dblwebhook

#

No ip and port is needed here

young haven
# hot axle your application's url

at=error code=H14 desc="No web processes running" method=POST path="/" host=myapp.herokuapp.com request_id=af148f57-32c1-4780-ab2e-98185607ac34 fwd="165.xx.xx.xx" dyno= connect= service= status=503 bytes= protocol=https

golden scroll
young haven
stiff breach
#

i dont understand

#

webhook url?

#

aaah

golden scroll
#

What is your bot Client ID?

stiff breach
#

498580306773934081

golden scroll
#

And set webhook url to http://ip:5000/dblwebhook

stiff breach
#

and in my code

#

webhook_auth

golden scroll
#

Second field

stiff breach
#
        self.dblpy = dbl.DBLClient(self.bot, 
                                    self.token,
                                    webhook_path="/dblwebhook", 
                                    webhook_auth='p', 
                                    webhook_port=5000)```
golden scroll
#

Exactly what you have in second field

#

If auth is the p in the second field you should get a response

stiff breach
#

p = password

#

its other password

#

wtf

#

OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use

#

but

#

few seconds

#

=

#

5 seconds

#

69 seconds

#

but i think

golden scroll
#

Don't you have a second port?

stiff breach
#

that the real error

#

OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use

golden scroll
stiff breach
#

the site is on another server

#

lol

restive otter
#

Hi

stiff breach
#

but yes

#

it uses port 5000

restive otter
#

top.gg no longer makes post requests for upvotes???

rapid kettle
#

They do

restive otter
#

it's all get request on my side for a week

#

both for server and bot upvotes

#

and that makes it return 405

#

I asked this a week ago too but no one really responded

#

please help

stiff breach
#

@golden scroll

#

its half work

#

:(

sullen nymph
#

Any other requests to that endpoint can be ignored

restive otter
#

but top.gg is making me get requests

#

I waited for a week

#

if it was something temporary

#

and apparently it's only me who is experiencing this

prisma path
#

How can I define the bot's library for top.gg

tepid imp
#

the server counter appears immediately after configuration. Do I have to wait?

pure junco
#

Could I used a discord webhook to get when someone votes?

hot axle
#

nope

#

the formats are different

pure junco
#

So what could I use?

hot axle
#

you can use a server that receives the request

#

and forms the payload to send to the discord webhook

pure junco
#

Could I use local host?

hot axle
#

unless you wanna keep your pc running 24/7, nope

pure junco
#

I have a VPS

restive otter
#

Can I ask about dblpy here?

restive otter
#
    @tasks.loop(minutes=30.0)
    async def update_stats(self):        
        try:
            await self.dblpy.post_guild_count(shard_count=2)
            await self.dblpy.post_guild_count()
        except Exception as e:
            await self.bot.get_channel(self.logs_channel_id).send('||<@&789112955501412377>|| Failed to post server count\n{}: {}'.format(type(e).__name__, e))

I keep getting 401 Unautorized access.

rain heart
#

your token is most lkely wrong maybe

spring otter
#

if you are using a development bot (not the same id as the top.gg bot), you wouldn't be authorized to it @restive otter

#

other issue may be the token being wrong

hot axle
#

a

spring otter
#

b?

tribal sky
#

hey im still getting this error when i test webhook in topgg
can someone pls help me

rain heart
#

make sure your url works

#

through postman for example

tribal sky
#

huh?

#

how do i do that

proven sapphire
#

@rain heart Hey, i just wanted to know what authorization link it is asking for like that of a bot or...

spring otter
#

is it req.headers.user for the user id for the webhook? YooThink

#

I voted and the user was undefined

#

oh I guess it wouldn't be passed as a header

#

now that I think about it

regal harbor
#

is req.body.user

spring otter
#

is it just passed as query string

#

oh

#

ty

final oxide
#

Hi

solid cliff
#

Hi

restive otter
#

sa

dense compass
#

Not the channel to chat in. Read the channel topic. Thanks

restive otter
#

I guess it's a bug, today is not Saturday or Sunday but it gives 2 votes

#

(api gives)

true owl
#

merhabalar

#

dbl tokeni nedir

#

nerden alırım bunu

restive otter
#

My bots kısmından.

true owl
#

webhook password nedir orası boşmu kalcak

restive otter
true owl
#

sitede webhookla kanalda vote verenleri duyurma diye bişe var

#

orda password diyorda

restive otter
#

Vote duyurcaksan botunun Edit sayfasına gel ve en aşagıda Webhook ile ilgil 2 şey var

#

İkincisi şifre yani webhookAuth

true owl
#

hee onu benmi seçiyom

restive otter
#

Evet

true owl
#

eyw reisler

restive otter
#

IP kısmınada bot ipsini

#

yada bot urlsi

#

örn:
0.0.0.0:PORT(3000 gibi)

true owl
#

hmm

#

reis bişe sorabilirmiyim ayp değilse

restive otter
#

Sor

true owl
#

sen bu kdr şeyi biliyonda bot developer olmamana şaşdım yan hesabınmı bu

restive otter
#

Bu kanalda zaten gereken yada api bilgileri sitede var

#

Hello

#

Bu arada bence @top-gg/sdk yi kullan

#

dblapi.js artık güncellenmiyor

true owl
#

hmm

restive otter
#

Pinlerde nasıl kullanılcağı yazıyor

true owl
#

komutlarda vote isteğini nasıl yapcam onu anlamadım

restive otter
#

tam bilmiyorum aynı mı değil mi eski dblapi.js ile

true owl
#

blm

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

Eğer aynısa buna benzer bişey olması lazım

#

id kısmına da böle mesaj sahibi geliyor

#

if voted dan sonrada komutun

true owl
#

hmm

#

reis port olayını çözemedim

restive otter
#

nerden hostluyorsun botunu

#

yani nerde botun çalışıyor

true owl
#

glitch

restive otter
#

glitchen bence hostlama ama genede yardım etcem

true owl
#

knk para yok xD

#

vds parası olsa

restive otter
#

başka yerlerde var

true owl
#

hmm

#

nere var

restive otter
#

ama dosyaların gizli değil

true owl
#

knk ben burda komut sınırına geldim orda o sınır varmı ordada

restive otter
#

komut sınırı waitWhat

true owl
#

vallah bende bilmiyom öyle dediler

#

yeni eklediklerim olmuyo

restive otter
#

öle bişey yok ama neyse

#

express sunucusu kurman lazım

#

npm i express ile

true owl
#

var ztn

restive otter
#

o zaman pinlere bak

#

ve top gg sdk yi indir

#

@top-gg/sdk adı

true owl
#

hmmm

#

94 komutum varmış botta çok galiba

restive otter
#

94 komut hashflushed

true owl
#

çoğu gifli komik komutlar

left egret
#

@restive otter @true owl Keep this channel English only

slow dust
#

i need subtitles

restive otter
#

Is that any Turk

#

@restive otter can you help me please

willow spindle
#

dont ask to ask

dry fiber
#

sucks to suck

final bone
#

How do I connect to the top.gg api?

steep skiff
#

In top.gg, some bots have a server count, how do i add it

restive otter
steep skiff
#

@restive otter

restive otter
#

ah

#

idk

steep skiff
restive otter
covert sapphire
#

I'm using the dblpy library and i keep getting this error


Command raised an exception: TypeError: object Lock can't be used in 'await' expression
sullen nymph
#

Downgrade to Python versions below 3.9

covert sapphire
#

i'm below 3.9

#

oh wait nvm

versed ferry
#

How do i make vote only commands for top.gg python?

stiff breach
#

Hell

#

o

#

i have a problem

#

my webhook is now working

#

but server count is not work

versed ferry
#

@stiff breach do you have member intents on for your application and also installed into your code?

stiff breach
#

yes

versed ferry
#

Then idk... i have the same problem but i feel like it will come later on

stiff breach
#

yesterday my server counting was working

#

but not the webhook

#

and today

#

my server count is not working

#

but the webhooks are working

versed ferry
#

Same, i use python

stiff breach
#

we're forgotten

#

:(

vapid sapphire
#

I would try to help if I knew python

tribal sky
#

hey so im using python lib and the test func aint workin

#

it doesnt print anythin on console

#

but now when i click on test on browser i get this error

#

@signal hawk

signal hawk
#

i dont know the api and i dont know python

#

please dont ping people for help

#

wait for someone who knows to help you

median river
#

Hi, so i am using the structure as shown on the java script library but when someone votes for my bot it does not log it.

pale fulcrum
#

do you have the webhook setup?

median river
#

Yes

#

It is setup correctly i think

restive otter
#

@median river Are you using new one or dblapi.js?

median river
#

dblapi.js

restive otter
#

use @top-gg/sdk

median river
#

For what

restive otter
#

thats new library

dusky spoke
#

it is a library ...

restive otter
#

for js

dusky spoke
#

^

median river
#

Oh so change it instead of dblapi.js to @waxen widget-gg/sdk?

restive otter
#

yes

#

if you want to use it look at pins

median river
#

O ok thanks

restive otter
#

!D deza-vu

#

!play D Deza-vu

restive otter
#

please help I still face the same issue why no one is trying to help me out??????

#

why is top.gg making get requests instead of post ^ above sent using Test Webhook button

#

it makes get request and returns 405

dusk hound
#

uh it must be your code, considering a 405 request means method not accepted.

#

@restive otter

restive otter
#

I know it returns 405 because it only accepts POST

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


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

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

can i fix this with this command

slow dust
#

??

silent pivot
#

ok

frank estuary
#

How can i connect my website to top.gg?

hot axle
#

wdym by connecting your website?

next kite
#

In which channel dank memer is there?

jaunty plank
#

i dont think dank memer is in this server.

pale fulcrum
copper tundra
#

whats the code for python to make my bot status show online instead of N/A?

fast agate
#

@copper tundra

copper tundra
#

oh i thought the guy above said there is just code i can add

fast agate
#

the code is inside of this link

copper tundra
#

ok. how do i install dbl

fast agate
#

python? or nodejs?

copper tundra
#

py

fast agate
#

first of all

#

if u use python 3.9 or +

#

u can not use dbl

copper tundra
#

3.8 i believe.

#

not 3.9 because nothing worked if i had that lol

fast agate
copper tundra
#

yea

fast agate
#

next

#

use this

restive otter
#

pip install dblpy

fast agate
copper tundra
#

sec

fast agate
#

Them I have this, works

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

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

    async def on_guild_post():
        print("Server count posted successfully")



client.add_cog(TopGG(client)) 
copper tundra
restive otter
#

I am bad at py, dont ask me.

copper tundra
fast agate
copper tundra
#

im there

#

and added the code to a cog

fast agate
#

okok

copper tundra
#

sec

#

wait where is the token?

fast agate
#

on bots...

copper tundra
#

oop

#

got it

fast agate
#

my bots

copper tundra
#

ye

#

got it

fast agate
#

ok ok

#

then u must patle it on the code

#

where?

copper tundra
#

in the self.token

#

i put that token thihngy

fast agate
#

Them I have this, works
class TopGG(command.Cog):
"""Handles interactions with the top.gg API"""

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

async def on_guild_post():
    print("Server count posted successfully")

client.add_cog(TopGG(client))

#

xd

copper tundra
#

what do i put for the webhook path and auth

fast agate
#

I mean I only use server count

fast agate
copper tundra
#

ok, how would i do that webhook part. I want everything lol

fast agate
#

I don use webhook, I think just use top.gg api code for webhook

#

u ask about N/A

#

I just show u

#

how to change it... not webhook

copper tundra
#

i found the Webhook_auth

#

now im trying to figure out the dblwebhook part

#

yea i got an error

fast agate
copper tundra
#

yea

#

but

fast agate
#

and works I dont know more

copper tundra
#

i want both

fast agate
#

hmmm ok just try to mixed both

copper tundra
#

yea

#

but i think its the webhook part it doesnt like

fast agate
#

read the docs I dont know :((

green wharf
#

what would be the simplest way for my bot to request an array of all userids who voted in the last 12 hrs?

jaunty plank
#

the bots/id/votes endpoint will get the last 1000 votes, youd have to figure out from there.
other endpoints might be able to have that data.
https://top.gg/api/docs#bots

green wharf
#

alright thanks

#

i came up with a different solution since that didnt seem as feasible

delicate vector
#

How can I create an embed and give the member who upvoted my server a role?

restive otter
#

How would I make it post my bots server count with discord.js ?

#

i have the token and everything

#

nvm

#

its cool

stiff breach
#
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 457, in _webhook
    await self._webserver.start()
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_runner.py", line 104, in start
    reuse_port=self._reuse_port)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1378, in create_server
    % (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
#

Hey, how to hide this error

rapid kettle
#

that’s not something you should hide?

#

to fix it you should stop binding to the same port

gleaming basalt
#

I clicked on this channel because I was interesed
but now I only see top tier super cyber hacking shit

rapid kettle
#

bro it’s coding

tidal moon
#

Matthew you know what I am gonna say again

stiff breach
#

:|

rapid kettle
rapid kettle
stiff breach
#

thats why i wanna hide that

#

x)

cursive steppe
#

Is it possible to use dblapi npm to get server voting information?

#

Like whenever someone will vote for the server, it'll get triggered?

sullen nymph
#

The library doesn't run the listener twice at any point

cursive steppe
#

This doesn't works for some reason and i want to know why

restive otter
#

Use the new library for js

#

look at pins

pine heart
cursive steppe
#

Oh

#

Ty bro

tribal sky
#

hey so im using python lib and the test func aint workin
it doesnt print anythin on console
but now when i click on test on browser i get this error

#

can someone pls help me with this

#

have been askin for 2-3 days now

restive otter
#

@tribal sky what are you hosting your bot on

tribal sky
#

local host

#

for now

restive otter
#

make sure your router isn't blocking the port you've set

tribal sky
#

cuz im setting up voting rewards

tribal sky
restive otter
#

I don't know, it depends on your router config

#

in general, all ports are blocked except the ones used for incoming and outgoing traffic

#

so port 3000, the default, will probably be blocked

tribal sky
#

hmm

tribal sky
restive otter
#

You'll have to go into your router settings

#

can't help you with that

tribal sky
#

welp ok

tribal sky
#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'eyJhbE'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",wehook_auth = "xjgl")  # Autopost will post your guild count every 30 minutes

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

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

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

alr so this is my code

#

and iit doesnt print data when i test the webhook

#

and there are no errors

#

can someone pls help me

sullen nymph
#

wehook_auth

#

congrats

tribal sky
#

oop-

#

well it still doesnt print anythin

viral ermine
#

Hello, I'm trying to send a message by a webhook when someone vote for my bot, but I don't understand what is "Authorization" field... Can someone help me please ? Thank you in advance

#

||mention me if you can help me||

hot axle
#

@viral ermine it's like a password you can use to verify that requests are coming from top.gg

#

can be pretty much anything as long as its secure

viral ermine
#

ok thank you, but it's automatic ?

hot axle
#

i think you can set the authorization on the dbl libraries so yes

wet sun
#

Hi, Does anyone know how to connect the top.gg site to discord so the bot can count if you vote for the bot there and thus give rewards etc? (in python)

restive otter
#

guys i use discord.js and quick.db and i would like to check if user has voted in the last 12 hours to give him an item

#

how can i do that using the api?

jaunty plank
restive otter
#

i'll check thanks!

#

can i replace the hasVoted id thing with like message.author you think?

jaunty plank
#

users objects in djs have the .id property

restive otter
#

i dont understand but ok i'll try what i know

#

thanks

jaunty plank
restive otter
#

ok

wet sun
#

What about using this is python? @jaunty plank

jaunty plank
#

I dont know the python lib, however the docs for the py lib are really decent from the looks, lemme find them for you

wet sun
#

Thanks

jaunty plank
#

note that you cannot use the bot specific api until you have an approved bot.

wet sun
#

How does a bot get approved?

jaunty plank
wet sun
#

or what r the requiments

jaunty plank
restive otter
#

@jaunty plank i tried the thing you gave me but it doesn't work...

#

i just wanna check if user voted then execute something

jaunty plank
#

what did you try?

restive otter
#

and if not then else

#
if(api.hasVoted(message.author)) {
        message.reply("vote")
      } else {
        message.reply("didn't vote")
      }```
#

i'm new to code

#

i don't even know if this is normal

#

or if it works

jaunty plank
#

you need to use the id, not the author

restive otter
#

how?

jaunty plank
#

.id on the user object

#

yes

restive otter
jaunty plank
#

yeah

wet sun
#

@jaunty plank Im wondering if your bot should be completley operational before submitting it to top.gg

restive otter
#

mine wasn't

#

and they accepted it

#

but now it is

wet sun
#

hm

#

My intention is to release my bot as a Beta first

#

im not sure if thats ok tho

restive otter
#

that's what i did actually

wet sun
#

in terms of verification

jaunty plank
#

this is a public listing service, if you dont think the bot is in a completely functional state you shouldnt release it

restive otter
#

i think...

#

mine was but i didn't put all the commands i wanted in it

#

but all of them were working

wet sun
#

the bot i intend to release will have pvp and trading and such however will lack adventuring

restive otter
#

sick

wet sun
#

adventuring would come some time after the inital release

#

is that ok?

jaunty plank
#

you can list bots before they are "finished" its just not really reccomended, since your bot could end up joining thousands of servers in a few days from release

wet sun
#

Hm i see

#

@restive otter Whats your bot about

restive otter
#

moderation, economy and memes

wet sun
#

sounds fun

restive otter
#

all-in-one i would call it

wet sun
#

mines about anime chaarcters

restive otter
#

yeah pretty fun

#

nice

wet sun
#

ye

#

just been a heachache to code

#

been at it since march

restive otter
#

same lol

wet sun
#

lol nice

restive otter
#

wanna dm i wanna try your bot

wet sun
#

yeah sure

#

its nowhere near done

restive otter
#

@jaunty plank still doesn't work i added .id

jaunty plank
#

whats the error/problem?

restive otter
#

it just doesn't care and send vote anyway

#
if(api.hasVoted(message.author.id)) {
        message.reply("vote")
      } else {
        message.reply("didn't vote")
      }```
#

my code

#

if voted supposed to send vote

#

and if not then didn't vote

jaunty plank
#

and this is in a command?

restive otter
#

yes

woeful mesa
#

Hi
How do I send a DM message when someone votes
Using @ top-gg / sdk

#
const user = client.users.get(req.vote.user); // This will get the User Object from the Client#users Collection
     if(user) { // This checks if the Bot knows who the User is.
         user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
     }

I tried this not working

hot axle
#

its client.users.fetch(req.vote.user)

#

(It returns a promise btw)

woeful mesa
#
const user = client.users.fetch(req.vote.user); // This will get the User Object from the Client#users Collection
     if(user) { // This checks if the Bot knows who the User is.
         user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
     }

like this ?

#
TypeError: user.send is not a function
pine heart
#

it's a promise

#

u gotta await it

rapid kettle
#

await client.users.fetch ^^

#

@woeful mesa

woeful mesa
#
app.post('/dblwebhook', webhook.middleware(), (req, res) => {

no async ?

#

@rapid kettle
@pine heart

rapid kettle
#

make it async then ??

pine heart
#

yeah then put kt

#

it*

rapid kettle
#

async (req, res)

pine heart
#

pinging me for that was kinda useless tbh

woeful mesa
#

It works,
No Ping emoji_58
mattthew
Togira
thank you

tribal sky
#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'eyJhbE'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",webhook_auth = "xjgl")  # Autopost will post your guild count every 30 minutes

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

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

def setup(bot):
    bot.add_cog(TopGG(bot))```
alr so this is my code
and iit doesnt print data when i test the webhook
and there are no errors
can someone pls help me
tribal sky
#

ive been askin for 5 days now...

#

can someone please help me

sullen nymph
#

What URL and Authorization field value did you set on the website

nocturne magnet
#

Hey does the python lib work on 3.9?

sullen nymph
#

Nah

vocal silo
#

How can I test a vote ?

woven hound
#

Hiii

acoustic granite
#

wym?

woven hound
#

How many people are here

acoustic granite
#

oh

#

not many by the looks of it

woven hound
#

Where are u from

acoustic granite
#

UK

woven hound
#

Ur a girl or boy

acoustic granite
#

why does it matter?

woven hound
#

Just asking

#

Btw I am a girl

acoustic granite
#

girl

woven hound
#

Christmas is coming I am soo excited

vocal silo
#

excuse me, this is the api chat, please talk in #general

acoustic granite
#

Same dblSmile

woven hound
#

But in our country we don't celebrate Christmas

acoustic granite
woven hound
#

I mean some of the people celebrate it not all

#

Oh ok

#

Can u saythat does general means its my first time here and I am a quite dumb

#

Anyone here

acoustic granite
#

General is just for talking.

vocal silo
#

How can I test the votes ? Because I dont want to wait for 12hours every time

rose yarrow
#

Testing webhooks?

#

Isnt there a test webhook button

vocal silo
#

hmm idk

#
@bot.event
async def on_dbl_vote(data):
    c.execute(f'''INSERT INTO vote VALUES ('{data.user}', NULL)''')
    user_result = bot.fetch_user(data.user)
    embed = discord.Embed(description = 'Vote', color = 0x00ff99)
    embed.add_field(name = f'User has voted and recieved a reward!', value = '[Vote Discord Empire at top.gg](myboturl)')
    embed.set_author(name = user_result, icon_url = user_result.avatar_url)
    channel = await bot.fetch_channel(790163457358037012)
    webhook.send(embed=embed, username = bot.user.name, avatar_url = bot.user.avatar_url)```I made this code now
#

How can I test it ?

rose yarrow
#

Did u add the webhook ur here

#

And did all of that

vocal silo
#

The webhook is saved in my bots code

rose yarrow
#

Url*

#

i mean

#

Like not the discord webhook url

vocal silo
#

what do you mean then ?

rose yarrow
#

I mean to where dbl will post to when some one votes

vocal silo
#

What do I have to setup to authorization ?

rose yarrow
#

I think u have to run a webserver ur self

vocal silo
#

ah

rose yarrow
#

Well i mean i use js

#

So i am saying it the way i did

#

So maybe there is a other way

#

Lile using flask to create a webserver

vocal silo
#

Okay the whole code does not work

main prairie
#

hey, I'm trying to set up voting rewards for when my bot (hopefully) gets accepted, and I just have a quick question:
I have this code:

    client.events.get('vote').execute(vote.user, client)
    console.log(`User with ID ${vote.user} just voted!`);
});```

And I just want to make sure that vote.user returns the voter ID (I assume it does, since the console.log mentions and ID, and that's copy pasted from the documentation)
#

(feel free to ping me when you reply)

rapid kettle
#

@main prairie it does.

main prairie
#

👌 ty

restive otter
#

How can I setup webhook to discord?

rocky bough
#

what programming language?

restive otter
#

No, I mean through the website

hot axle
#

you have to set up an endpoint

restive otter
#

Oh Okay

#

Thanks

lone willow
#

how do i setup a webhook for votes?

sullen nymph
#

You daft motherless cunts

#

In other words, let's get this straight

lone willow
#

woah lmfao

sullen nymph
#

Okay so

#

@restive otter you need to point the URL to your webserver and not use Discord webhooks

sullen nymph
#

If yours doesn't because you're special, then you can set up a webserver yourself cia whatever framework there is for your programming language

rapid kettle
hot axle
sullen nymph
#

Yeah, see @top-gg/sdk on npm rhen

#

refer to pins in this channel as documentation

lone willow
#

aight

hot axle
#

dblapi.js was deprecated or something i think

sullen nymph
#

Yeah

next flame
rapid kettle
#

you dont use a discord webhook

outer lodge
#

How do I create a webhook so when a person votes for bot it appears on discord?

jaunty plank
#

Or make your own webhook receiver

restive otter
#
dbl.on('vote', vote => {
client.channels.cache.get(id).send(msg)
});
#

Can I do something like this, I don't wanna use webhooks

willow spindle
#

there no vote event on dbl

#

it is dbl.webhook

restive otter
#

how do i set the lib for my wiget

signal hawk
#

^ answered in support

near ridge
#

In my widget it does not show the number of servers, how can I solve it?

naive dove
#

Hey i need help setting up the webhooks for voting data

rapid kettle
#

ok so

#

what language?

naive dove
#

python

rapid kettle
#

sorry, can't help you there.

naive dove
rapid kettle
#

http://serverIP:webhookPort/webhookPath

naive dove
#

OMG

#

THANK U SOOOO MUCH ❤️

#

IT FINALLY WORKS

#

UR A GOD! ❤️

restive otter
#

anyone can help me? i am trying to use the dblapi.js to add to the user money and send to a specific channel a message, but when i test, nothing happens

acoustic dove
dapper bobcat
#

This doesn't seem to be working - no error, just nothing....

const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')

app.post('/dblwebhook', webhook.middleware(), (req,res) => {
   
    console.log(req.vote.user)
})```

I'm guessing that it's because I don't link the package with my bot - how do I do that? I'm following the examples on https://www.npmjs.com/package/@top-gg/sdk
formal prism
#

Uhh help

#

How to make a command so that only people who vote can use the command

slow dust
restive otter
#

I want to add server count in bot dashboard help

#

@slow dust

dapper bobcat
#

you dont need to ping

dapper bobcat
slow dust
restive otter
#

Ok

slow dust
#

give it sometime

formal prism
#

Wow thank you! But iam still disnt understand :(

#

Is there any youtuber that explain this api

dapper bobcat
slow dust
#

js for node js

dapper bobcat
#

bc there are three, top.gg, top-gg/sdk, and dblapi.js

slow dust
#

dblapi.js if u are using nodejs
its the easiest in the docs tbh.. for me.. and im a python programmer 🤷‍♂️

dapper bobcat
#

@slow dust

slow dust
#

yeah it's funny but that works

dapper copper
#

@slow dust they released a new one

slow dust
#

they did?? where?

dapper copper
#

@dapper bobcat ^^

slow dust
#

why isn't it on the docs then.. anyways I'll take a look later.. kinda in the middle of something.. thanks @dapper copper

dapper copper
dapper bobcat
#

uhm

#

i had trouble with that one

formal prism
#

What do i fill??

#

What url

restive otter
#

ServerIP:PORT/webhookURL

#

woops

formal prism
restive otter
#

like your bots website

formal prism
#

Looks like I don't have any website??

#

Sorry i didn't get it😅

restive otter
#

ah

restive otter
dapper bobcat
#

This doesn't seem to be working - no error, just nothing....

const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')

app.post('/dblwebhook', webhook.middleware(), (req,res) => {
   
    console.log(req.vote.user)
})```

I'm guessing that it's because I don't link the package with my bot - how do I do that? I'm following the examples on https://www.npmjs.com/package/@top-gg/sdk
dapper bobcat
#

i have

jaunty plank
#

where are you hosting this code?

dapper bobcat
#

on a host

jaunty plank
#

theres several types of hosts, the next troubleshooting steps depends on what it is.

dapper bobcat
#

well, I have the server IP, then the port all sorted

#

but if you need to know, I use a host that uses Pterodactyl Software

jaunty plank
#

well, youll probably want to talk to your host then about hosting a web service

#

as pterodactyl is for game services, not bots or web services(like webhooks)

formal prism
#

How to webhook in heroku

#

What do i fill

rugged patio
#

hi

#

i have a question

restive otter
#

@rugged patio its not a discord webhook

uncut kelp
#

hello, why this didn't works?

// index.js
const DBL = require("dblapi.js");
const config = require("./config.json");
client.dbl = new DBL(config.dbl_token);

// vote.js
    module.exports = {
        name: "rewards",
        aliases: ['reward'],
        run: async (client, message) => {
if (client.dbl.hasVoted(message.author.id)) {
// give poin
} else {
return
}
}
}
restive otter
#

use new library for js

#

look at pins

uncut kelp
restive otter
#

yea

uncut kelp
#

i try, thanks

#

can i uninstall dblapi.js ?

restive otter
#

Yea

dapper bobcat
#
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')

app.post('/dblwebhook', webhook.middleware(), (req,res) => {
       console.log('We have arrived.')
    console.log(req.vote.user)
})

app.listen(<port number>, () => {
  console.log('Listening');
});```

Why doesn't it work? I don't get any errors, the webhook just isn't triggered.
uncut kelp
dapper bobcat
uncut kelp
#

i need to install topgg-autoposter too?

meager harness
#

Old one is not maintained so you can only use autoposter

sullen nymph
#

@top-gg/sdk is for the API and is maintained

#

topgg-autoposter isn't needed if you don't want a package to automatically post your server count

uncut kelp
#

why didn't works in my code

#

i put in command

const config = require('@root/config')
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api(config.dbl_token)

    module.exports = {
        name: "check",
        aliases: ['check'],
        run: async (client, message) => {
        if (api.hasVoted(message.author.id)) {
            message.channel.send('voted')
        } else {
            message.channel.send('not yet')
        }

still didn't works

willow spindle
#

why are you defining api as global property

uncut kelp
mortal ore
#

can someone tell me how to use the dbl event listeners like on_dbl_vote in python? I tried a lot but they dont seem to work

main prairie
#

hey, I'm getting an "unsupported client" error when I try to use the top.gg autoposter... This is my code:


const ap = AutoPoster(topggtoken, client)```

"client" is actually my bot client, it's not a different name and topggtoken is the token pulled from another file
#

the only thing is my client has extra stuff, like client.command properties, could they be causing the issue?

#

please ping when you reply 🙂

uncut kelp
#

i really don't understand

restive otter
#

what is the dbl api package name ?

rapid kettle
#

for which language @restive otter

restive otter
#

discord.js

rapid kettle
#

.... that’s a library. it’s @top-gg/sdk

slow cedar
#

MY BOT NOT SHOWING HOW MANY SERVER IT ADDED ON

dapper ruin
#

My bot uses shards, but with the "posted" event it just puts the server count from shard 0, how do I make the bot put the count of all servers?

tribal sky
#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'eyJhbE'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=1024,webhook_path = "/dbl",webhook_auth = "xjgl")  # Autopost will post your guild count every 30 minutes

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

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

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

alr so this is my code
and iit doesnt print data when i test the webhook
and there are no errors
can someone pls help me
#

Wud really appreciate if someone cud explain why this happens

silent pilot
#

🙂

#

incorrect token

tribal sky
#

Also someone had told me before that it's due to my router cuz it blocks the port so what port shud I give if I'm hosting it on a vps

tribal sky
silent pilot
#

ahhh ok

mortal ore
#

@tribal sky same happens with me

#

i m not able to use the events

#

idk y

dapper ruin
restive otter
#

Anyone can help me? I use shard in my bot and I want to use webhook, but I am receiving the EADDRINUSE error.

pine heart
rapid kettle
hot axle
#

Cock.js

bright raven
hot axle
#

read the docs

#

its literally there

bright raven
#

what do I have to enter? @hot axle

hot axle
#

top - your server address

#

bottom - an authorization to validate requests

bright raven
#

thx

#

which server address @hot axle

#

😦

hot axle
#

read the documentation

#

you have to set up a server to receive webhooks

bright raven
#

I have but I don't know which server address

hot axle
#

the ip of your server

#

or domain of you have one

bright raven
#

Oh whatever :/

hearty lintel
#

@main prairie hey are you still having issues?

main prairie
#

yeah @hearty lintel , but I've now ran into something else I need to solve 1st lol... if you know the issue I wouldn't mind some help tho

hearty lintel
#

is it to do with the autoposter or sdk?

main prairie
#

the autoposter says it the client is unsupported

hearty lintel
#

can you post your client defining code?

main prairie
#

sure gimme a sec

nocturne magnet
#

The api works on python 3.9 right

main prairie
#
client.once('ready', () => {
    console.log('Index.js is ready!');
    client.user.setActivity(`${prefix}help | ${prefix}invite`, {type: 'PLAYING'})

    const AutoPoster = require('topgg-autoposter')
    AutoPoster(topggtoken, client)
});```

There's a client.login further down in the code as well, that part all works fine
hearty lintel
#

where are you requiring discord.js?

main prairie
#

oh a couple of lines above

hearty lintel
#

show that please

main prairie
#

👌

nocturne magnet
#

What’s iirc

main prairie
#
const Discord = require('discord.js');
const { prefix, token, qazwsxID, topggtoken } = require('./index.json');
const Sequelize = require('sequelize');```
acoustic sierra
#

Hi, i have a question, ¿The webhook is a richpresence or a integration in my discord server?

hearty lintel
#

if i remember correctly

main prairie
#

that's just above the const client = ... part

hearty lintel
#

right

#

hm

main prairie
#

the only thing I've edited out is all the DB defining (I know it's poorly done, but I really can't see how it'll affect the client bearing in mind it's not mentionned in that part)

hearty lintel
#

yeah its fine im lookin into what could be causing the issue

#

if you take it out the ready event does it fix it?

main prairie
#

no, that's how it was at 1st, and I thought maybe putting it in would work (actually wait for the client to be ready)

hearty lintel
#

it should do that on it's own, but you can do it either way, alright

#

gimme a sec

main prairie
#

what's weird is it worked fine yesterday, and I added the vote reward code (didn't modify the autoposter part at all), and it all stopped working... and now even without the vote part it still doesn't work

#

could adding properties to the client change anything? I have a client.commands property for dynamic command handling

hearty lintel
#

no it definitely shouldn't

#

we work with the cached instance of discord.js to see if your client is an instance of it

#

im testing it right now

main prairie
#

okay

#

thanks for all the help btw!

hearty lintel
#

np

#

hm

#

what version of the package are you on?

#

and/or try and install the latest and see what happens

main prairie
#

well I set it up yesterday, lemme check what version it's using

#

1.1.3 I think

hearty lintel
#

alright one moment

main prairie
#

if you find anything can you ping me please, I'm going back to sorting some other stuff out