#topgg-api

1 messages Β· Page 129 of 1

slow dust
#

has_voted or something

grim pewter
#

is a function or what

snow scroll
#

πŸ€”

hot axle
#

node-fetch takes a string as body

rapid kettle
#

try removing the .then() bits

hot axle
#

you gotta use JSON.stringify using node-fetch

rapid kettle
#

oh yea that too

snow scroll
#

Thank you, I have already done this with other requests, so it was also necessary here x)

sullen nymph
#

will be renamed to get_bot_votes in next version

grim pewter
#

alkr alr

grim pewter
#

what parameters do I use?

sullen nymph
#

I linked the docs though

#

You just use it on an DBLClient instance

balmy sleet
grim pewter
#
            server_count = len(self.bot.guilds)
            await self.dblpy.post_guild_count(server_count)```
#

you can put that in a loop

sullen nymph
#

again

grim pewter
#

and it can update

sullen nymph
#

We told you multiple times that you can't post server count with BDFD

#

surprise surprise using bot makers has its own restrictions

balmy sleet
sullen nymph
#

That's Python

grim pewter
#

^^

sullen nymph
#

See pins for the library

grim pewter
#

Also i figured out how to get the voters, thanks @sullen nymph

restive otter
#

hello hello

grim pewter
#

now i have to see if there is a built in discord.py checker i can use before commands are used

restive otter
#

wait sp can we use this api to detect if a specific upvoted?

icy thistle
#

How do I use web hooks to give someone a role if their voted for the server? When I try I get error saying it can only be used in external services

grim pewter
#

@icy thistle show your error and code

pliant oak
#

im very confused on this webhook thing, anyone got a tutorial or something like that to guide people through it?

grim pewter
#

yeah there isn't much info on top.gg except for the documentation lol

restive otter
#

how can you send a dummy vote

hot axle
#

use the "test" button on the webhooks page

restive otter
#

kk

#

im not using thier webhook system though

#

if im not wrong you can just do it with thier api.on("vote")

#

um it didn't really work out btw

#

nothing happened

#

can someone help me with the top-gg/sdk

#

im using the api for it and im trying to get my client to display a message when someone votes

#

is it possible if im using the api().on()

#

or does it only work with webhooks()

#

please @ me if you know the answer

echo lance
#

where is the api?

restive otter
sullen nymph
#

@restive otter you need to use the webhook

#

API is solely for API requests to top.gg

restive otter
#

oh ok then

sullen nymph
#

And it's a vote event in any case

#

To handle differences between test and actual requests is up to you AHoloSmile

restive otter
#

gotvha

#

gotcha*

pliant oak
#

how would i create a webhook link so that it sends it to my vps and then my bot file?

jolly veldt
#

a way so when user votes up your bot it gives them a role..

#

uh.

#

ping me if you know

hot axle
#

@jolly veldt use the top.gg webhooks to receive votes

jolly veldt
#

o k

jolly veldt
hot axle
#

nope

pliant oak
#

hey so, my webhook works, ive tested with postman, problem is that when i test it on top.gg's api it doesnt work

#
routes = web.RouteTableDef()



@routes.post('/webhook')
async def hello(request):
    print(await request.read())
    return web.Response(text='Successful!')

app = web.Application()
app.add_routes(routes)
web.run_app(app)






jaunty plank
pliant oak
#

no

#

network no

#

device no

#

not sure about the network

#

its a lightsail vps aws

jaunty plank
#

honestly then, not sure.

#

someone will be around at some point to help more.

worn geyser
#

Webhook for vote ?

grim pewter
#

is there a function i can call that checks if a specific user has voted in the last 12 hours?

#

nvm i found it on the docs

gilded orchid
#

how can total servers be seen on my bot page?

hearty lintel
#

@gilded orchid what language are you using?

gilded orchid
#

Node.js

gilded orchid
#

@hearty lintel

hearty lintel
gilded orchid
#

k

#

const ap = AutoPoster('topggtoken', client) // your discord.js or eris client

// optional
ap.on('posted', () => { // ran when succesfully posted
  console.log('Posted stats to top.gg')
})```

only this much at starting of my main file will post server count?
hearty lintel
#

you need to define client before it of course

gilded orchid
#

yes but thats it right?

hearty lintel
#

should be, try it

gilded orchid
#

Epic

#

i will try

gilded orchid
#

yes it worked thank u

rare wing
#

hello, how to auto give role to user who voted for my server on top.gg

#

after 12 hours i want to remove the role from the user and send dm to the user to vote again to get back the role

robust talon
#

hoe do i make it send a message when someone votes

#
from aiohttp import web
routes = web.RouteTableDef()



@routes.post('/webhook')
async def hello(request):
    print(await request.read())
    return web.Response(text='Successful!')

app = web.Application()
app.add_routes(routes)
web.run_app(app)
rain heart
#

Make sure that the user is on your server too

robust talon
rain heart
#

Just get a guild channel and let it send a message to it after a valid request came through the webhook

robust talon
#

and idk a single thing about this api

rain heart
#

Read the docs from dbd.js

robust talon
#

okay...

robust talon
rain heart
#

Read the webhooks section

robust talon
#

okay

rain heart
#

Or you could look at the pinned messages and use the top.gg sdk

robust talon
rain heart
#

For the servers one, you'll need to make your own webhook

#

The dsl webhooks scheme is on the pinned messages aswell

robust talon
#

okay

#

okay.. i kinda understand

restive otter
#

how can i test a vote?

#

i mean i forgot where is the test webhook is

coral lantern
#

Api

restive otter
#

Hey, How to make vote messages? Ping me

rain heart
#

and webhooks

pliant oak
#

hey so, my webhook works, ive tested with postman, problem is that when i test it on top.gg's api it doesnt work

restive otter
#

i dont get how to use this webhook thing

pliant oak
#
routes = web.RouteTableDef()



@routes.post('/webhook')
async def hello(request):
    print(await request.read())
    return web.Response(text='Successful!')

app = web.Application()
app.add_routes(routes)
web.run_app(app)






restive otter
#

i mean the vote notifs when someone voted webhook thing

rain heart
#

your webhook url

pliant oak
#

Yeah

proven atlas
#

How to put out translater?

pliant oak
#

I copied directly from post

rain heart
#

did you also change it?

pliant oak
#

Wdym

rain heart
#

your webhook should be http://yourserverip:port/webhook in your case

#

replace yourserverip:port with the corresponding server ip and port

pliant oak
#

Yeah

rain heart
#

server ip being the ip your bot is hosted on

pliant oak
#

I did

rain heart
#

it cannot be https

#

did you save it aswell?

pliant oak
#

No I was testing

#

Using the test button

rain heart
#

You need to save it before being able to use the test button

pliant oak
#

Oh

restive otter
pliant oak
#

Mk thanks

rain heart
#

not bot key

#

read the documentation for your corresponding library

#

and the pinned messages here

pliant oak
restive otter
#

I have read the docs. How Can i use my dbl api Key top make Vote Message

rain heart
#

if you have read the docs, you should know how to use it correctly

restive otter
#

In which category Can i read this.

#

@rain heart

rain heart
#

for your corresponding language

restive otter
#

Okay thx

pliant oak
#

@rain heart i tried http:ip:port/webhook, what i used on postman and it still didnt send

rain heart
#

http://

pliant oak
#

o

rain heart
#

for example http://111.222.231.12:5000/webhook would be correct

pliant oak
#

it worked

#

thanks

#

yeah

wraith raptor
#
import dbl
import discord
from discord.ext import commands, tasks
import logging


class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = '*CENSORED*'
        self.dblpy = dbl.DBLClient(self.bot, self.token)
    
    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

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

Why is this code not working?

bold inlet
#

hmm

frail quartz
#

Why is there an error on

jaunty plank
#

you need to initialize dbl with an auth and a port.

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

Already exist

jaunty plank
#

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

frail quartz
#

What is the password

jaunty plank
#

you can make it any string, its your choice

frail quartz
#

I use this

jaunty plank
#

you need to add the webhook stuff, otherwise it never creates the .webhook.on stuff.

frail quartz
#

I don't need it in webhook I want to send a message to a member

jaunty plank
#

if you dont want a webhook, then why are you using it in your code?

frail quartz
#

Yes, you are right. I did not notice this

#

Thanks @jaunty plank

wraith raptor
#

I have read the docs and I am trying to post server count. @shut flume

restive otter
#

hi how do i setup the vote notifications?

#

with the webhooks

rain heart
restive otter
#

doesnt really help me

#

oh wow its dead here

bold inlet
#

i know

#

:7

wraith raptor
#

Why is this code not posting my bots server count?

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


class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = '*CENSORED*'
        self.dblpy = dbl.DBLClient(self.bot, self.token)
    
    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

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

please provide some error and quit sending your message over and over again

restive otter
#

alright so i found out how to use it

#

but

#

what is webhookAuth

rain heart
#

the authorization for your webhook request

restive otter
#

like what should i put in there

#

confusion

rain heart
#

it should be the same you enter on your bot page settings

#

it verifies that the webhook request is coming from top.gg

restive otter
#

ah

#

thankks!

#

so for example, i put in "hi" (example lmao) in the verification thing on the bot page

#

and after that the same thing in "webhookAuth"

#

"hi"

rain heart
#

yes

restive otter
#

ok, thanks

rain heart
#

that would tell your webhook "oh, this request is indeed coming from top.gg, i can use it"

#

if it is not "hi", then it would say "oh this is not from top.gg, i should not use this"

restive otter
#

in a string, right?

rain heart
#

Yes

restive otter
#

thanks for explaining that!

restive otter
#

@rain heart alo, i need your help again (sowwy!)

#

so basically everything works fine, it says that the webhook is ready, etc
well if someone votes the webhook wont send the vote messsage

rain heart
#

did you press save aswell? is the url format correct?

#

http://serverip:port/webhookcontext

#

replacing serverip with your servers ip, port for obviously port and webhookcontext with ending url you entered in webhookPath iirc

restive otter
#

anyone knows how to check if someone voted for your bot in .py library

#

hello dbd.js do you have api?

#

to vote

rain heart
#

dbd.js does not have a top.gg api, but since it is js aswell, i assume looking through the pins doesn't hurt

restive otter
restive otter
#

πŸ™‚

rain heart
restive otter
#

So can't I do it from dbd.js? @rain heart

rain heart
#

You could, if you could CheckThePins

languid violet
#

Where do I get a token? I have searched google and haven't been successful

rain heart
wraith raptor
storm linden
#

i want someone help me how to add youtube search api in my code

rain heart
#

Wrong channel

wraith raptor
#

3.9

languid violet
#

Sorry, wrong channel

#

whats the lowest i can update my bots servers?

trail sigil
#

hello?

rain heart
#

hi

trail sigil
#

ghost ping, im not crazy zoomeyes

warm bloom
#

Do someone know a good api that gives you random picture link? Such as Shiro api etc...

#

Plz mention I'm going to sleep πŸ˜…πŸ’€πŸ’€

hearty lintel
#

and this is not the channel to go to ask in #development maybe

restive otter
#

How do I check when someone voted on my bot, and who. Im using the need to know that, how to use api and get auth if needed

severe viper
#

Whats the top.gg API for votes?

hot axle
#

that package is deprecated

queen current
#

do you have any idea how to get the DBL token?

#

how?

#

ohh

#

ok tysm

#

will it take some time to come on the web?

#

nvm

#

it works ty

severe viper
#

Any example for code?

#

Doesn’t give me a api package or npm

#

node js

#

h?

uncut kelp
#

anyone know i have to allow port in my ubuntu vps, but still cannot access from webhooks?

warm bloom
ebon igloo
#

how do i send a message into a discord channel when someone votes for the bot via webhook

restive otter
#

@ebon igloo I’m not sure if this will help ! But it does have something related to do with wat ye want

ebon igloo
#

ty ill look at it in the morning

restive otter
#

Np

green roost
#

Any updates on when the python sdk will fix the http request issues on 3.9?
Also if I make a PR would it be accepted?

rain heart
#

Both depend on the corresponding library dev

sullen nymph
green roost
#

Aight cool thank you!

sullen nymph
ancient bone
#

Hello. I want my bot to detect users who voted from top.gg. Although I do everything as on the documents, nothing happens when someone votes. I think I entered the webhook part on the site incorrectly. What should I get into that part?

rain heart
#

http://yourserverip:port/webhookPath

ancient bone
#

Still not working. @rain heart

#

Would you like me to post the code.

rain heart
#

I probably have no clue about your programming language, i can only tell you to test it with postman for example

ancient bone
#

Oh, thank u.

serene bloom
#
import dbl
import discord
from discord.ext import commands

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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'here my dbl 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")


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

why don`t work ??

green roost
#

Well the function isn't getting called.

#

You need to decorate it with commands.Cog.listener()

#

Also this appears to be an extension so you don't need to define client here.

#

And your setup function takes bot as a param but uses the defined client from the global scope.

#

Which isn't even a running instance, and shouldn't even exist.

serene bloom
#

now ?

green roost
#

Still haven't decorated the function that does the print

#

You've decorated the setup

#

Have you worked with cogs before lol

serene bloom
green roost
#

There's examples in dpy's docs if you want to have a look

serene bloom
#

i use functions only i don`t know this cogs

green roost
#

Well TopGG in your code is a cog

serene bloom
#

what cog do ? same function or what?

green roost
#

Go to dpy's documentation page and search for label: extensions

green roost
#

And this is outside the scope of this channel.

serene bloom
#

ok thank you

#
import dbl
import discord
from discord.ext import commands

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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'here my dbl 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")


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

it must work now or what?
@green roost

green roost
#

No

#

I'd suggest you read the documentation of discord.py and join their support server for further questions like this. This is not related to the top.gg API and therefore irrelevant to this channel.

serene bloom
#

thank you for your time

dense copper
#

dblapi.js has been depreciated?

green roost
#

I believe so yes

dense copper
#

then what wrapper is good after dblapi.js

green roost
wraith raptor
fast agate
wraith raptor
#

Aww

#

When will it be?

restive otter
#

hi how do i use api with ts bot with a class instead of the = new Discord client

sullen nymph
# wraith raptor Aww

Keep an eye on the docs and this channel. I'll post a small message here when I release a full-on release

restive otter
#

This expression is not constructable.
Type 'typeof DBLAPI' has no construct signatures.

wraith raptor
#

Ok, Can you ping me?

restive otter
#

Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.

#

the package has a problem :///

sullen nymph
#

I'll try not to forget to πŸ˜‚

sullen nymph
restive otter
#

dblapi.js

sullen nymph
#

Yeah

#

No

#

See pinned messages in this channel

restive otter
#

oh

plush ore
#

yeah speaking to the team right now to see if we can get the js page updated

restive otter
#

ok

quasi mountain
#

I've stopped in here a few times recently about the weekend multipler always giving the weekend reward. I verified that the voting is working correctly. Single vote for week day and double vote for weekend. Is anyone using the multipler with Python and if so are you using an if statement or some condition to check if its the weekend for the actual reward?

jaunty plank
#

The python lib has a property called isweekend, its on the docs. It might also be sent with the vote webhook.

#

You can just if statement the property.

quasi mountain
#

Gotcha ya. Im going to look over this link real quick. Thank you very much

#
@bot.command()
async def is_weekend(ctx):
    await ctx.send(bool(dblpy.get_weekend_status()))β€Š```
#

That just returned true

#

So a webhook must be used?

jaunty plank
#

I forget what timezone the site uses, its still weekend in some places.

quasi mountain
#

get_weekend_status()[source]


 Gets weekend status from top.gg.
 Returns:    weekend status – The boolean value of weekend status.
 Return type:    bool```
#

Hmm even though I tested the actual vote and its only counting as 1? I verified and it counted as 2 yesterday

#

Nvm I think we got it working!

jaunty plank
#

Oh pog.

sullen nymph
#

How did it...

#

what

#

oh

#

you used bool on an async function without awaiting it

jaunty plank
#

Yay shiv to save the day

sullen nymph
#

I pronounce you officially murdered

jaunty plank
#

That's what I was about to mention, but the docs didn't mention its async

quasi mountain
#

Well i was only helping the dev but he didn't realize it was a async

#

Yes that's exactly what he said lol

#

Thank you for your help:)

sullen nymph
#

Ah

#

top.gg considers Friday 00:00 to Sunday 23:59 UTC a weekend so you can technically check that yourself without an API request if you want

hot island
#

I need help, when i try testing the webhook on the site it gives a 400 error in the developer console

fair escarp
#

Hey, the roles reward for voting don't work on my serv

jaunty plank
fair escarp
#

yes @jaunty plank

jaunty plank
#

Did you fill in the reward role on your servers edit page?

fair escarp
#

err yes

hot island
#

aand vote rewards dont work as expected

fair escarp
#

and I've checked, the DSL's role got all the perms and it's higher than the voter's role

fair escarp
#

so ?

jaunty plank
narrow zodiac
#

Is it possible to use the api to post your bots own server count on your own server?

jaunty plank
narrow zodiac
#

So if it is possible to get the bots server count via one simple javascript file

jaunty plank
#

i dont know why you would need the api for that either, you can just get that from your bots process too.

narrow zodiac
#

But the bot already posts this online so if it is possible to get that in the same way the top.gg gets it

jaunty plank
#

pretty sure its going to be more complicated than just using the data you have already, but yeah, you could make an api request.
you will only be able to get it 60 times a minute max(api ratelimit) so caching would be a good idea. youll also want to do this server side not client side.

#

minute not second lol

narrow zodiac
#

My bot is not that popular so I just want to request it once. But do you have docs for that?

jaunty plank
narrow zodiac
#

Thanks

vague scroll
#

Does the on-vote webhook require https?

rain heart
#

You can only use http

hot rock
#

anyone can help me?

rain heart
hot rock
#

im using dbd.js language and they was able to make a vote

#

so

#
 name: "$alwaysExecute",
 code: ` 
 $title[VOTE;https://top.gg/servers/$guildID/vote]
 $description[Thanks for voting this server up $username remember to revote in 12 hours!!]
 $footer[You can vote by clicking on title!]
 $addTimestamp
 $color[$getServerVar[Color]]
 $onlyForRoles[$getServerVar[voteroleid];]`

 });```
#

idk how worked lol

restive otter
#

please @ me

rain heart
restive otter
rain heart
#

No you need to read the docs

restive otter
#

i did, and im still lost.

restive otter
short frigate
#

just add your bots top.gg api token to it

dusky tide
#

Hi

knotty plover
#

sooo here it;s necesary just to install npm dbl and after to put this script in my bot with my bot api key (token)?

long grotto
#

Hey, I'm trying to make it so I can vote lock commands.

I've got all this down but I am confused

import discord
from discord.ext import commands
import dbl


def has_voted():
    async def predicate(ctx):
        check = await ctx.bot.dblpy.get_user_vote(ctx.author.id)
        if check:
            return True
        else:
            e = discord.Embed(title="", description="This command is vote locked. to use this command, please [vote here](https://top.gg/bot/758073269961359392/vote)")
            await ctx.send(embed=e)
            return False
    return commands.check(predicate)

AutoShardedBot has no attribute dbl, how can I specify this to work properly? Thanks!
kinda braindead rn so yeah-

restive otter
#

instantiate the DBLClient and assign it as a bot attribute, then you can use it in that way

#

though, you shouldn't do that, better cache the votes rather than making requests each check

long grotto
#

wdym assign it as a bot attribute?

Like self.bot = DBLClient or smnthn?
im deadass braindead rn

restive otter
#

DBLClient alone is a class, not an object. So instantiate it

long grotto
#

so a def init somewhat?

restive otter
#

huh? Do you know how to instantiate an object?

long grotto
#

not at all, never have done one.

#

if i have i must be braindead rn

restive otter
#

it's just as simple as calling the class as how you would do with a function, it'll call the __init__ automatically, so you shouldn't care about that

#

how are you making a bot without instantiating the bot itself then christmasthink

long grotto
#

OH that.

#

ight, thanks

restive otter
#

πŸ‘ don't forget to cache votes though

dusky tide
#

Hi

restive otter
#

what are the needs for on_bdl_vote to works?

restive otter
#

bruh i am gonna ask if a webhook is needed

#

since it appeas it doesn’t work in my code

#

then webhook is needed?

#

hm

#

i tested it but it doesn’t appear to work

#

nope

#

i will see

copper tundra
#

anyone know why my api isnt working

#

nvm i got it

jade creek
#

how to using top-gg/sdk webhook with multiple shard bot

violet panther
willow spindle
#

token should be a string

restive otter
#

?spiele hallo

balmy tundra
#

Is there an api for when someone votes a server?

loud jewel
#

Yes

balmy tundra
#

Is there a doc for it?

loud jewel
#

yes

balmy tundra
#

All I see is API when someone votes the bot

loud jewel
balmy tundra
loud jewel
rain heart
#

if you need the json schema, see pinned messages

topaz verge
#

i wnat the api link information

#

the page in the site

#

yep

#

thanks

junior sage
#

Can someone give me a very basic run down on how to make a automatic claiming reward for when someone votes for my bot and DM's them saying that they did vote

rain heart
#

read this to get started, though remember that the bot needs to share a server with the user in order to send the dm

#

and the user having dms enabled

boreal mist
#

How do I make 5000 port available to my server ip? I've tried the method that involves the firewal

#

Could you tell me how?

tepid carbon
#

How do you make it so the user would have to vote to gain access to certain commands

#

Thanks

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

Where it has the ID, is that the Bot's ID or should I put the members ID?

rain heart
#

the users id

#

yes

#

the user you wish to check if they voted

tepid carbon
#

Okay thanks

junior sage
rain heart
#

If you installed the wrapper, yes it should work

tepid carbon
#

How do I add an else to it?

#
dbl.hasVoted(message.author.id).then(voted => {
    client.commands.get('command_name').run(client, message, args)
})

That's the code but it's not even an if statement

rain heart
#

voted is a boolean

#
if (voted) {
// user has voted
} else {
// has not voted
}
#

in a nutshell

junior sage
rain heart
#

pinned messages

junior sage
#

This channel?

tepid carbon
rain heart
marble raptor
#

How to use this API in python?

#

Sorry if it's basic, but am new to all this api and stuff

dusky tide
#

Hey

marble raptor
dusky tide
#

Add me please

marble raptor
#

?

vocal robin
#
Error: postStats requires 1 argument
``` I get this error
#

I pass one argument lol, happening since I am using discord.js-light

uncut granite
#

Hewo, where do I put the webhook in the API?

jaunty plank
#

the url?

uncut granite
#

yes

jaunty plank
#

it goes in your bots edit page, webhook section

uncut granite
#

OOOHHH

#

Where you put your vps ip?

jaunty plank
#

the url will probably look something like this
http://VPSIPHERE:PORTHERE/dblwebhook

civic edge
#

has anyone made a webhook for top.gg to a discord channel ?

uncut granite
#

nope

#

im trying that

civic edge
#

if you have any success please let me know

civic edge
#

?

civic edge
#

I want to do it exclusively on

#

discord

rain heart
#

made both guild and bot webhooks with my own java library Kek

civic edge
#

its dead simple with a programming language KEKW i want to do it like it is on github, simple

rain heart
#

then follow the tutorial mentioned there

civic edge
#

here ?

rain heart
#

the one on github, or read the pins on how to make webhooks for it

civic edge
#

I did the exact same thing for top.gg but it doesn't send me any message

rain heart
#

you need to add your webhook url to your top.gg bot page settings

uncut granite
#

where?

rain heart
#

on your bot page settings under webhooks

uncut granite
jaunty plank
#

http://ip:port/path

rain heart
#

replace ip:port/path with the corresponding server ip your bot is posted on, the port your webhook is on and the webhook path you've entered

uncut granite
#

Im getting a error

#

HTTP request

#

badd HTTP request

hot axle
#

well you probably messed up something in your request

uncut granite
#

so im using a vps that has a domain name as ip, thats also works?

jaunty plank
#

yep

uncut granite
#

aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

willow sphinx
#

no and this is not the right place to ask this

oak orbit
#

I need help

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 do I find my dbl token and what's this webhookAuth: 'password'

rain heart
#

webhookAuth is the key thst identifies top.gg on your webhook

oak orbit
rain heart
#

Create it yourself

oak orbit
#

the password

rain heart
#

Name it whatever you want

oak orbit
#

oh ok

rain heart
#

As long as you also enter it on your bot page settings

oak orbit
#

@rain heart ?

rain heart
#

Yes

oak orbit
#

sry for the ping btw

oak orbit
rain heart
#

Try testing it out if you're unsure

keen sleet
#

Is the DBL webhook down for anyone else? It could just be something on my end; however, my bot stopped receiving updates πŸ€”

hot axle
rain heart
#

Works perfectly for me

#

Both server and bots

keen sleet
#

Interesting. Must be something on my end. Thanks for testing that!

#

Hmm... perhaps. I'll check it. Thanks!

#

It shouldn't have, but it's always good to check.

#

I'm hosting it from a VPS

rain heart
#

Test it with a simple http request from your end

#

Through postman for example

keen sleet
#

Good point. Funny enough, I don't send any response back πŸ˜„

#

But, I guess, if it errors out ... I'll know.

civic edge
#

webhook doesnt work when I test it.

I have created a hook for my announcement channel and copy-pasted it to Webhook URL in top.gg of my discord bot.

But it does not display anything

hot axle
#

discord webhooks don't work with top.gg webhooks

keen sleet
rain heart
#

KEKW pain

keen sleet
#

That's a rip, lmao

#

I have a fully automated pipeline .. so it got shipped πŸ˜„

rain heart
#

This is why you shouldn't push to master before testing locally

restive otter
rain heart
#

Pins

keen sleet
restive otter
#

soo there isnt?

keen sleet
#

I should have an environment condition have disable it when testing.

civic edge
hot axle
#

you have to write your own server to receive the webhook requests and fire the discord webhooks

civic edge
hot axle
#

um it's not poor decision making but ok

civic edge
hot axle
#

i mean writing a basic server isn't that hard

rain heart
hot axle
#

and making two separate webhooks would be really difficult to manage

civic edge
#

I know that I can make is easily, the point is to not have one more thing running, it's ok though it would just an extra nice thing to have

hot axle
#

aight ima head out

keen sleet
restive otter
#

where's i can find the password, i just only found the token

jolly veldt
#

js code for webhook lol

flint widget
#

anyone knows

#

whats the link

#

for submitting bot

#

ty!

#

not found idk why

#

eh

#

okay

#

where is it in site

#

I dont find it in site

#

ty

#

lmao

civic edge
restive otter
#

can i get help? guildmemberadd dont working for me

brittle spoke
violet panther
#

And the 1066 is the port?

willow spindle
#

yes

violet panther
#

Ok, thanks

restive otter
#

hi

#

im here to ask about how i can get votes in channel ex : when someone votes it sends in channel

uncut granite
restive otter
uncut granite
#

Then how ^^"

restive otter
uncut granite
green roost
#

Path can be anything. You can just leave it as the default (/dblwebhook)

#

On the webhooks tab on the website, you pass in the webhook URL as http://your_ip:port/path

atomic turret
#

What is api

night kayak
thorn umbra
#

can anyone help me how to do vote command but when u vote it gives reward

#

how to do it

hot axle
#

set up a webhook server

thorn umbra
#

i dont know

#

how to do it

thorn umbra
hot axle
#

check the docs for dblpy

thorn umbra
hot axle
#

well it has an example so ig you can use that

thorn umbra
hot axle
#

well idk python so thats all i can do

#

ima head out

thorn umbra
#

ok

#

bruh

#

no one?

#

but how?

#

seriously

#

no

#

i searched

hot axle
#

just use the python library KEKW

thorn umbra
#

hmm

sullen nymph
thorn umbra
#

on cogs

sullen nymph
#

Just initialize the DBLClient with webhook args and the webhook will activate itself automatically

thorn umbra
#

but idk how to convert cmds

sullen nymph
#

(P.S. will be changed in v1.0.0)

#

What are you trying to convert there

#

You just do bot.dblpy = DBLClient(...) and then use the events

thorn umbra
#

main file

thorn umbra
sullen nymph
#

rtfd

#

Actually hold on I updated them for 1.0.0

#

webhook_port is the port the webhook will run on (type int)
webhook_path can stay '/dblwebhook'
webhook_auth is a password your webhook will use to authenticate requests to confirm that they are coming from top.gg (must be the same as Authorization field on the bot's Edit page in Webhooks section)

thorn umbra
#

i dont get it

sullen nymph
#

Example:

bot = commands.Bot(...)
dblpy_token = "top.gg token if needed, could leave this empty"
bot.dblpy = dbl.DBLClient(bot, dblpy_token, webhook_path="/dblwebhook", webhook_auth="password", webhook_port=5000)

The code above will generate a webhook on the following URL: http://your.machine's.public.IP:5000/dblwebhook

#

In order to actually use the webhook, you'll have to own an approved bot on the website

thorn umbra
#

oh im getting reviewed

thorn umbra
sullen nymph
#

yes

thorn umbra
#

ok

sullen nymph
#

Any reference to bot, pretty much

thorn umbra
#

k

thorn umbra
sullen nymph
#

I don't understand what you mean

thorn umbra
#

how will i get the url

sullen nymph
#

I gave you the format

thorn umbra
#

yes how will i get that

sullen nymph
#

Your machine's public IP address?

thorn umbra
#

if i run the code will i get the url

thorn umbra
sullen nymph
#

Do you use a VPS?

thorn umbra
#

no

sullen nymph
#

You host locally?

thorn umbra
#

yea

sullen nymph
#

Use your repl.co URL with /dblwebhook at the end

#

Set webhook_port to 8080

silk reef
#

hm is there a way to get the time a user can vote again? me using py btw

rain heart
#

12 hours from the point of voting

#

you need to track that yourself

silk reef
#

oh oof

#

that sucks

restive otter
#

Anyonne had Fennec for free

rain heart
#

wrong channel

restive otter
#

Wher is the real chanel

rain heart
thorn umbra
rain heart
#

track that yourself is what dankmemer does

#

If you want to get the exact time a user can vote again, you need to do that yourself

#

Because top.gg's api only allows checking for votes, not when they can revote

uncut granite
#

somehow i still get this:

aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

uncut granite
#

and how do i do that?

manic rune
#

How can I show how many servers my bot is on

sinful knoll
#

@uncut granite What language?

uncut granite
#

Python

sinful knoll
#

Alright

#

Requests or aiohttp?

uncut granite
#

aiohttp

sinful knoll
#

Here's your code lol:

@client.event
async def on_guild_join(guild):
    data = {"server_count":len(client.guilds)}
    auth = {"Authorization":"Top.GG API Token"}
    async with aiohttp.ClientSession() as cs:
        async with cs.post('https://top.gg/api/bots/botid/stats',headers=auth,data=data) as r:
            json_obj = await r.json()

If you use bot instead of client, replace client with bot. Replace botid with your bots ID, and Top.GG API Token with your API key.

manic rune
#

Where do we write the api?

sinful knoll
#

@uncut granite

sinful knoll
manic rune
#

Where to add the api?

sinful knoll
#

What do you mean?

#

Like where are the docs?

#

How do you write the code?

uncut granite
#

wait whut

manic rune
#

πŸ€¦β€β™€οΈ

#

where do i put the code

sinful knoll
#

@uncut granite That's the code if you're using Discord.py

#

Basically whenever you join a server, it'll send a POST request to Top.gg

#

@manic rune In your bots code, run it whenever you join a server.

uncut granite
#

interesting

dense compass
#

I can't put my bot on vds. Is there any helper production?

lucid kindle
#

how i make a discord bot

#

To die.?

hot axle
#

process.exit(1)

restive otter
sonic mango
#

i think .svg isn't supported

restive otter
#

if you click the url it will pop up

#

it just doesnt work in html

hearty lintel
#
<a href="https://top.gg/bot/771932435449249862">
    <img src=" https://top.gg/api/widget/servers/771932435449249862.svg" alt="[name]" />
</a>```
restive otter
hearty lintel
hot island
#

Ok im new to all this webhook stuff

paper escarp
#

Hello

hot island
#

i made a webhook (i think) using @top-gg/sdk and like copy pasted the vote stuff

#

does myip:port/dblwebhook work as a webhook link and can i use it on sites besides top.gg

restive otter
hearty lintel
#

yeah

restive otter
#

ok

low kayak
#

Hello! I am having a little trouble in implementing the vote feature on my discord bot. I tried to do it yesterday, but it won't even log the event or an error message when I voted with a test account. Help will be much appreciated πŸ™‚

#
    db.add(`apples_${vote.user}`, 1);
    db.add(`eggs_${vote.user}`, 1);
    let voteembed = new Discord.MessageEmbed()
    .setTitle(`New Vote from Top.gg!`)
    .setDescription(`${vote.user.tag} Just voted!`)
    .setThumbnail(`${vote.user.avatarURL()}`)
    .setTimestamp()
    bot.channels.cache.get('channel-id').send(voteembed)
    console.log(`User with ID ${vote.user} just voted!`);

});
#

(btw this is discord.js)

rain heart
low kayak
#

Is there a way to have something similar to that in the bot though?

rain heart
#

voting events, no

#

webhooks is the only way

#

you could check if a user voted manually, by using the same method, but reading the proper usage on the docs

low kayak
#

Alrighty

restive otter
#

When will the status tracking problem be resolved? My bot is online but in top.gg offline xd

rain heart
#

when the api gets updated i assume

restive otter
willow spindle
#

the body in DBL's request to my webserver is undefined. Any reason πŸ€”

#

@hearty lintel you may know

hearty lintel
#

are you using the library or your own thing?

willow spindle
#

own thing

hearty lintel
#

are you using a body parser

willow spindle
#

no

hearty lintel
#

you need a json body parser

willow spindle
hearty lintel
#

sure

#

you can also just use the library where it's built into the express middleware

willow spindle
#

thanks

true owl
#

at IncomingMessage.<anonymous> (C:\Users\Dell\Desktop\MasaΓΌstΓΌ\kodlar\denemebot\node_modules\dblapi.js\src\index.js:118:25)

#

what is this

sullen nymph
#

Very unhelpful traceback, need more details

true owl
#
(node:1548) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (C:\Users\Dell\Desktop\MasaΓΌstΓΌ\kodlar\denemebot\node_modules\dblapi.js\src\index.js:118:25)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1548) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, 
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1548) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

@sullen nymph

sullen nymph
#

Error 401: Unauthorized

#

Means your token is incorrect

true owl
#

hmmm

#

thx

willow spindle
#

also dblapi.js is deprecated

hot island
#

ew dblapi

prisma coyote
#

.,

jaunty steppe
#

what's the difference between mod, webMod and admin in the user object?

#

also supporter refers to if the user has premium right?

rain heart
#

admin is website admin ofc
webmod is website mod (though mod and webmod are the same thing iirc)
supporter is premium i assume

#

test it on me because i do have premium

jaunty steppe
#
{
    "discriminator": "0001",
    "avatar": "a_c11a553ea1b8ec378b234469b7c45949",
    "id": "669452973755072524",
    "username": "Aurel",
    "defAvatar": "322c936a8c8be1b803cd94861bdfa868",
    "bio": "Bot-Reviewer",
    "color": "#002270",
    "admin": false,
    "webMod": false,
    "mod": false,
    "certifiedDev": false,
    "supporter": false,
    "social": {}
}
rain heart
#

not sure what supporter is then

jaunty steppe
#

interesting

#

well, I'll figure it out as I go

rain heart
#

well the docs only say "supporter status"

#

but no clue what it is referring to

jaunty steppe
#

docs good

#

also certified dev is in relation to if the user has a certified (the old program) bot, correct?

rain heart
#

yes

jaunty steppe
#

alr cool

#

tyvm

rain heart
#

that's something you can test on 212530298259374080 (@bold fulcrum)

jaunty steppe
#

it appears so yeah

#

is there a list of outputs that can be given by the lib attribute of a bot?

#

I want to make an enum but need to know the values

rain heart
#

the lib attribute is deprecated, no need to implement it

#

as bots can no longer set their library

jaunty steppe
#

fair

#

yeah I just noticed that

#

Wait is the longdesc attr optional?

#

I thought bots had to have a long description?

rain heart
#

hm? where

jaunty steppe
#

I assume the ? means optional/nullable

rain heart
#

yeah not sure about that one

jaunty plank
#

Little late, but yes, in documentation ? After a return or variable name means nullable.

jaunty steppe
#

retry-after integer Indicates how long the timeout period is/when you will be able to send requests again
this is in seconds right? or milliseconds?

#

I should probably just look at how the SDKs handle it

rain heart
#

in Seconds

jaunty steppe
#

ok thank you

jaunty steppe
#

Does the API discriminate foreign api clients?

#

or are they just treated the same

rain heart
#

not sure what you're referring to with foreign api clients

jaunty steppe
#

non-official

rain heart
#

Nah it allows every request with valid authorization

#

doesn't matter what client

jaunty steppe
#

alr cool ty

unreal spruce
#

*help

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

this not work anymore?

grim pewter
#

😦

atomic turret
#

Idk

grim pewter
#

I wouldn't think you would know because you don't have the bot developer role

grim pewter
#

I'm talking about the topgg API, I wouldn't expect you out of all people to know how to use it

willow spindle
#

is it new endpoint

green roost
restive otter
#

hello, i am getting a bad request with the top.gg webhook

#

everytime i test the weebhook

willow spindle
#

show code

restive otter
#

just a second

#
import sys, datetime, json, re
from discord import Webhook, RequestsWebhookAdapter, Embed, Color
from flask import Flask, request, abort, jsonify
from pymongo import MongoClient
import os

with open("settings.json") as settings:
    data = json.load(settings)
    webhook_password = data['webhook_password']
    discord_webhook = data['discord_webhook_url']
    if discord_webhook != "":
        webhook_id = int(re.search(r"\d+", discord_webhook).group())
        webhook_token = re.search(r"(?!.*\/)+(.*)", discord_webhook).group()


mongo = MongoClient()
app = Flask(__name__)

@app.route("/")
def index():
    return "<h1>Bot is running</h1>"

@app.route('/test', methods=['GET', 'POST'])
def test():
    return jsonify(dict(request.headers))

@app.route('/dblwebhook', methods=['POST'])
def webhook():
    sys.stdout.flush()
    if request.headers.get('Authorization') == webhook_password:
        user_id = request.json.get('user')
        bot_id = request.json.get('bot') # ID of the bot that was upvoted 
        request_type = request.json.get('type')
        weekend_status = request.json.get('isWeekend')
        now = datetime.datetime.utcnow()
        mongo.voters.vote.insert_one({
            'type': request_type,
            'user': user_id,
            'bot': bot_id,
            'weekend': weekend_status,
            'time': now
            })
        if discord_webhook != "":
            embed_title = "Test" if request_type == 'test' else 'New upvote!'
            embed = Embed(title=embed_title, description=f"**Upvoter: <@{user_id}>** ({user_id})\n**Upvoted bot:** <@{bot_id}> ({bot_id})", timestamp=datetime.datetime.utcnow(), color=Color.green())
            webhook = Webhook.partial(webhook_id, webhook_token, adapter=RequestsWebhookAdapter())
            webhook.send(embed=embed)
        return '', 200
    else:
        abort(400)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=1129)
    mongo.close()
sullen nymph
#

Oh hey that's my example

restive otter
#

oh lol

#

so can you help me setting this up?

sullen nymph
#

Anyhoo, what line does the error occur on?

restive otter
#

idk tbh, its a bunch of unknown error, comes as bad request everytime i test the webhook

#

i will show an image

sullen nymph
#

Sure

restive otter
sullen nymph
#

what da fak

restive otter
#

ikr i couldn’t figure out whats the issue

sullen nymph
#

How are you sending the requests and are you using the Test feature on top.gg?

restive otter
#

yes, and im sending the requests through my hoster’s url

sullen nymph
#

Huh

restive otter
#

hmm

#

@sullen nymph sorry lol, its my hoster’s issue not anything else.

sullen nymph
#

Ah

still dust
covert lark
#

Using the node-sdk can you check if it is authenticated?

jaunty steppe
rugged patio
#

hi

#

i try voted webhook

#

but always say port 0.0.0.0

jaunty plank
#

The old lib always says 0.0.0.0

rugged patio
#

hmm how to fix it?

#

ok

#

i try

#

npm i dblapi.js

jaunty plank
#

That's the old lib

rugged patio
#

2.4.1

jaunty plank
#

Check pins

rugged patio
#

riight?

jaunty plank
#

Dblapi.js is the old lib

rugged patio
#

ok what i need

jaunty plank
#

Check pins

rugged patio
#

i dont know big english

#

only i writiing

#

@waxen widgetgg-auth

#

turkish

#

npm i @waxen widgetgg/sdk

#

i write it

hot axle
#

oh boy, top is getting so many pings KEKW

rugged patio
#

yes this is webhook?

restive otter
#

I don't understand what this means
The last sentence
What is the HTTP header and all that

jaunty plank
#

What programming language is your bot in?

restive otter
jaunty plank
#

You can use the auto poster library so you don't have to worry about that.

#

In the autoposter section

restive otter
#

ok

rain heart
#

@feral palm

#

not your bot token

feral palm
#

@rain heart

#

I already read it but I didn't understand almost

leaden crow
#

a

restive otter
#

@jaunty plank how do i start is it same as bot?

jaunty plank
#

If you make it in the same language and set it up the same yeah

restive otter
#

thanks Iam using js ill take ur help :D

rain heart
#

wrong channel

#

also @jolly hornet

#

see above, might be interesting

jolly hornet
#

@charred ridge Could you DM me

brittle quail
#

Good! Could someone help me how to get data from a webhook for the top.gg api?

I saw that to get votes, a webhook with password, username and port is used. Someone help me?

placid mountain
#

how do you post shard count?

rain heart
rain heart
charred ridge
#

Sorry for the spam but it was for a report

rain heart
#

yes, dm @jolly hornet

quasi mountain
#

Is it possible to have votes for the and for the associated support server to be tied together

#

or will votes always be seperate

rain heart
#

they will always be seperate

#

If you're referring to a bot and associated support server for example

quasi mountain
#

yes specifically the associated support server

#

I feel like having users vote twice is alot to ask for

#

lol

rain heart
#

most likely not going to be a thing, as both are seperate things

quasi mountain
#

I feel like having users vote twice is alot to ask for

#

sorry that message didnt go through earlier

#

ok gotcha

white jackal
#

hey im new in this api-thing..is there a way to listen for votes without any webooks?

hot axle
#

nope

#

well, you could check every now and then for the users who voted for your bot, and check for any new users

#

but i'm pretty sure that's api abuse

white jackal
#

oh ok

lucid crescent
#

Is this channel for the discord api

rain heart
#

No

#

Oh yes

lucid crescent
#

Ok

rain heart
#

Yes

lucid crescent
#

Ah

#

Ok

#

Thanks

white jackal
#

what?

rain heart
#

Or no wait

lucid crescent
#

Bruh

rain heart
#

Yeah i misread, this channel is for top.gg api

lucid crescent
#

Ok

#

Thanks πŸ™‚

#

Can u tell me where i can ask questions for d.py

#

When/if i need to

rain heart
pine heart
#

it has 18 members wow

gentle echo
#

huh

steel willow
#

lmao

shadow hound
sullen nymph
#

Lmfao you what

upbeat imp
rain heart
upbeat imp
#

They have tht there too

#

It’s like a mothership for python

rain heart
upbeat imp
#

I’ll accept that mute then Β―_(ツ)_/Β―

shy apex
#

hehe

gusty quartz
#

having trouble saving my webhook

#

on the webpage

sullen nymph
#

Can't save it until your bot is approved

gusty quartz
#

ahk

placid mountain
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)```
is this supposed to work regardless of if u have the webhook stuff setup? i do have the dbl client setup in the same class though
green roost
restive otter
#

tbh it doesn't really matter if it's in different class as long as it's the same bot instance.

placid mountain
sullen nymph
#

Ya da lee da doo

green roost
#

I'd rather you didn't, keep it in this channel since it is topical

sullen nymph
#

Read the docssss

#

To keep it short, webhook_port must be a port the webhook will run on, the rest is optional

#

webhook_path is the route to use, a string that comes after the IP and port in URL (must start with /)

#

webhook_auth is the Authorization key to use for confirming that requests are indeed coming from top.gg, basically a password

dense copper
#

help top.gg webhook not working for me

#

port is open

#

but still not working

ionic quiver
#

How to create webhook

dire imp
#

when i used the test webhook button in topgg api website i got a response on my bot's server's console
"POST /dblwebhook HTTP/1.1" 404 -

#

is this the desired response im supposed to get?

sullen nymph
#

ye posh coont fahken rite arse

#

In normal English: show your code

dire imp
#

code i wrote? ok

#
import dbl
import discord
from discord.ext import commands, tasks
from os import getenv

class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = getenv('TOKEN2')
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='https://HandCricketBotDiscord.samirmishra127.repl.co/dblwebhook', webhook_auth=getenv('password'), webhook_port=8000)

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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
      print("Received an upvote!")
      print(data)

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

#

Is this okay lol

sullen nymph
#

right

#

webhook_path="/dblwebhook" and try again

dire imp
#

I got an error when i set webhook_path to "/dblwebhook"

sullen nymph
#

what's the error

dire imp
#
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f34d80f5580>
Task exception was never retrieved
future: <Task finished name='Task-115' coro=<DBLClient._webhook() done, defined at /opt/virtualenvs/python3/lib/python3.8/site-packages/dbl/client.py:436> exception=ValueError('path should be started with / or be empty')>
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/dbl/client.py", line 453, in _webhook
    app.router.add_post(self.webhook_path, vote_handler)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1094, in add_post
    return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1034, in add_route
    resource = self.add_resource(path, name=name)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1014, in add_resource
    raise ValueError("path should be started with / or be empty")
ValueError: path should be started with / or be empty```
sullen nymph
#

eh

#

You probably set it to dblwebhook accidentally when running

dire imp
#

nope it was /dblwebook

#

actually if i dont use webhook am i on a disadvantage?

sullen nymph
#

You can't use on_dbl_vote

dire imp
#

okay i dont want on_dbl_vote but i want to query the votes list

sullen nymph
#

Then DBLClient.get_bot_upvotes and remove the webhook

dire imp
#

ok!!

#

@sullen nymph It works!! ty!

sullen nymph
#

πŸ‘

dire imp
#

just curious how recent votes the function will return and is there a ratelimit on the function?

sullen nymph
#

Well, the returned list consists of last 1000 votes regardless of whether they are valid now or not

#

As for the ratelimit, dblpy limits you to 59 requests per 60 seconds

dire imp
#

oh okay then i need not to worry ty.

restive hull
little matrix
#

how to create the webhook, what to put in URL

#

and auth

rain heart
#

again, you need to make your own webhook using express for example, no current top.gg library (for js at least) supports server webhooks

dire imp
#

If we do not fill out the webhook url field will it be not possible to use on_dbl_vote() event reference?

rain heart
#

no

#

how are you going to receive vote events if you have no way of knowing if you received one or not

dire imp
#

Ah ok.

restive otter
#

can i get the userID of a user that voted?

hot axle
#

yeah, the webhook has that

restive otter
hot axle
#

id

restive otter
#

Okay, thanks

river kestrel
#

Hello I have a problem with the java library for the api, can someone help ? java.lang.NoClassDefFoundError: org/discordbots/api/client/DiscordBotListAPI$Builder The error only occurs with JARs

rain heart
#

@river kestrel you need to add the api to your maven/gradle dependencies

#

Re-check the docs

restive otter
#

How to create a webhook?

rain heart
#

do you use maven or gradle for your libraries?

river kestrel
#

        <dependency>
            <groupId>org.discordbots</groupId>
            <artifactId>DBL-Java-Library</artifactId>
            <version>2.0.1</version>
        </dependency>
river kestrel
#

maven

#

and it works when I launch it

#

from intelij

#

but not when I build the artifact

#

and launch the jar

rain heart
#

you need to build your project with the library too, you need to implement it inside of your application

restive otter
#

how do i get one?

river kestrel
rain heart
#

as i'm not using maven, i can't really tell you how, but you need to compile the library aswell

#

it just adds the jar inside your application, not the actual source

river kestrel
rain heart
#

Open the built artifact with winrar and check if you see the source from the top.gg library

river kestrel
rain heart
#

Just check the folder tree if it contains org.discordbots.api.client.DiscordBotListAPI

river kestrel