#topgg-api

1 messages · Page 150 of 1

night ingot
#

Also, the webhook path is whatever you set the webhook_path parameter to in your code

restive otter
#

how to set

night ingot
#

Do know python?

restive otter
#

yes a bit

night ingot
#

So then look at your code

#

and you'll find out

restive otter
#

oh so i just define a value for variable webhook_path

night ingot
#

You set it to a string, yes

restive otter
#

ah i c

night ingot
#

start it off with a slash too

#

e.g webhook_path="/dblwebhook"

restive otter
#

hmm

#

wait so its /https:?

#

no right?

#

only before the webhook path its /

night ingot
#

what?

restive otter
#

eg: http://<id>:5000/<webhook path>

night ingot
#

yes

#

that's how it's supposed to look

restive otter
#

but in the webhook path wut shld i actually put

night ingot
#

whatever you want your webhook path to be

#

see the example I gave

restive otter
#

it can be anything

#

as long its a str?

night ingot
#

Yes

#

that is how strings work

restive otter
#

so it can be like eg: http://<id>:5000/jonse

night ingot
#

Yes

restive otter
night ingot
#

of course don't set the webhook_path parameter to the full url, only the path

restive otter
night ingot
#

It doesn't have to be 5000, but it works

restive otter
#

oh

night ingot
#

as long as the port is open on your network and not in use by another app

restive otter
#

i c

#

okay the http://<id>:5000/jonse says site can't be reached

#

when i put in my browser

night ingot
#

Is the port open?

restive otter
#

how to know whether a port is open?

night ingot
#

Did you forward it in your router's settings?

restive otter
#

sry i am rlly knew to this

#

huh need to update my router too?

night ingot
#

Yes, that's why I told you to read into webhooks a bit more

restive otter
#

wow it sounds like a lot work man

night ingot
#

If you've never done anything network related before it's gonna be pretty hard, yes

restive otter
#

actually i remember doing smt with network

#

like i used a port id to hack a system and message the victim

#

its for a course

#

no one got hurt

#

just to be clear

#

but this was 2 years ago

#

so can't remember

restive otter
#

but i use /jonse

#

wut's wrong here

night ingot
#

show how you defined your path

restive otter
#

http://<id>:5000/jonse

night ingot
#

Yeah no, in your code

restive otter
#
def __init__(self, bot):
        self.bot = bot
        self.token = os.environ.get("dbltoken") 
        #self.dbl = dbl.DBLClient(self.bot, self.token, autopost=True) \
        dblid = os.environ.get("dblid") 
        #http://<your public ip>:<port>/<webhook path>
        url = f"http://{dblid}:5000"#/jonse
        #url = os.environ.get("dblurl")

        auth = os.environ.get("dblauth")
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path=url, webhook_auth=auth, webhook_port=5000)

    async def on_guild_post():

        print("Server count posted successfully")
        #channel = bot.get_channel(825627974720159774)
        #await channel.send("Server count posted successfully")

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("Received an upvote:", "\n", data, sep="")
        #print(data)
        channel = self.bot.get_channel(825627974720159774)
        await channel.send(data)
        user = data['user']
        embed = discord.Embed(description="New Vote! Voter: {}".format(user))
        await channel.send(embed=embed)
        
    @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."""
        #
        #try:
        print("Received a test upvote:", "\n", data, sep="")
        channel = self.bot.get_channel(825627974720159774)

          
        await channel.send("Received a test upvote:", "\n", data, sep="")
        #except:
          #await channel.send("Received a test upvote:", "\n", data, sep="")
          


rain heart
#

url = f"http://{dblid}:5000"#/jonse

night ingot
#

Well, I told you to not set the path to the full url

rain heart
#

only have the /jonse

#

path does not mean full url

night ingot
#

only the path, so url = '/jonse'

restive otter
#

oh

#

i understand

sullen nymph
#

Petition to rename path to route

restive otter
#

now

#

thqs

rain heart
#

might not be coding friendly

#

but helps people who don't read docs

sullen nymph
#

LMFAO that would be so worth it

night ingot
restive otter
#

hmm now i not getting any error

#

but's i am not getting the data

night ingot
#

You still need port 5000 to be open

rain heart
#

you see, my smartness, It's almost frightening

restive otter
#
def __init__(self, bot):
        self.bot = bot
        self.token = os.environ.get("dbltoken") 
        #self.dbl = dbl.DBLClient(self.bot, self.token, autopost=True)
        dblid = os.environ.get("dblid") 
        #http://<your public ip>:<port>/<webhook path>
        url = f"http://{dblid}:5000"#/jonse
        #url = os.environ.get("dblurl")

        auth = os.environ.get("dblauth")
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/jonse", webhook_auth=auth, webhook_port=5000)

    async def on_guild_post():

        print("Server count posted successfully")
        #channel = bot.get_channel(825627974720159774)
        #await channel.send("Server count posted successfully")

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("Received an upvote:", "\n", data, sep="")
        #print(data)
        channel = self.bot.get_channel(825627974720159774)
        await channel.send(data)
        user = data['user']
        embed = discord.Embed(description="New Vote! Voter: {}".format(user))
        await channel.send(embed=embed)
        
    @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."""
        #
        #try:
        print("Received a test upvote:", "\n", data, sep="")
        channel = self.bot.get_channel(825627974720159774)

          
        await channel.send("Received a test upvote:", "\n", data, sep="")
        #except:
          #await channel.send("Received a test upvote:", "\n", data, sep="")
          
night ingot
#

just make all variable names extremely overinformative, big brain

night ingot
#

oh, you just didn't remove the vairable

#

nevermind

restive otter
#

see the ```self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/jonse", webhook_auth=auth, webhook_port=5000)

restive otter
night ingot
#

Well your code has nothing to do with actually opening the port

restive otter
#

for this

#

in the webhook url i put http://<id>:5000

night ingot
#

5000 still needs to be open brother

restive otter
#

so to open i have to go to my router?

sullen nymph
#

Your router and firewall on your PC

night ingot
#

Look up port forwarding for the router

restive otter
#

hmmm

#

so where do i go for router

#

network?

night ingot
#

Did you look up port forwarding?

restive otter
#

as in did i look up port forwarding in the setting search bar or in google

#

anyways no for both

night ingot
#

No, look up like research

#

find out how to do it yourself

restive otter
#

mmm

#

ah nvm i do this another time i go college and taking cybersecurity, networking is rlly not my thing i am going to ask my friend for help on this

#

anyways thq u @night ingot

night ingot
#

Also, that screenshot shows your gmail address, just a heads up

spice helm
steep karma
#

kinda confused

#

how do i make a webhook to send votes to discord

#

can someone send me a guide?

rain heart
#

you cannot send votes through a discord webhook

steep karma
#

damn

pastel light
#

For some reason, my bots server count page says 4 servers when its in 100+, why is that? ive even regenned my token thinking maybe that was an issue but it still hasnt updated, i did this over 24h ago

rain heart
#

are you posting your server count properly?

pastel light
#

Unless it was updated recently; its been working for months. but just a couple of days ago it stopped

#
import dbl
class events(commands.Cog):
    def __init__(self, bot, *args, **kwargs):
        self.token = 'My Token'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully")```
acoustic lark
#

To check if my cogs are loading I will need to add a cog listner right?

#

here

#

@frail rapidss.coglistner
def setup(bot):
bot.add_cog(TopGG(bot))
print("cog loaded")

or is the @frail rapidss.coglistner

#

wrong

#

Sorry for the @

#

I mean @ commands.cog.listener

#

Or is this API okay

trail magnet
#

anyone have code for the server top.gg server count i can use for discord bot maker?

next pendant
#

Still having issues with the webhooks sending multiple responses

#
108.162.... - - [23/Apr/2021:12:37:29 +0000] "POST /api/votepathhere HTTP/1.1" 504 183 "-" "Top.gg Webhook/1.0.0"
172.68....- - [23/Apr/2021:12:37:32 +0000] "POST /api/votepathhere HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
162.158.... - - [23/Apr/2021:12:37:33 +0000] "POST /api/votepathhere HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
108.162... - - [23/Apr/2021:12:37:33 +0000] "POST /api/vvotepathhere HTTP/1.1" 200 24 "-" "Top.gg 
#

this is for 1 person who voted

#

this all started after the webhooks were updated about a month ago

#

it happens randomly

#

Iv'e used the same code for the past year and never had any issues

#

it's responding from different IP's and I responding with 200 as was told but it's still not resolved

pastel light
#

How do i use the webhooks? like, for voting can i just put a webhook to a channel in my server? or is it for something else

rain heart
#

are you closing the connection afterwards?

#

otherwise it will still retry

trail magnet
#

anyone have code for the server top.gg server count i can use for discord bot maker? the progam instad of actual coding lol

next pendant
#

maybe a few times a day if that

#

most the votes are fine

rain heart
#

I'd suggest making sure then

spice helm
cold root
#

then what?

acoustic lark
#

Are there any things you need to enable to get your discord bot server count or is it just this:

prime sequoia
#

there a good node lib for this?

rain heart
#

read pins

prime sequoia
#

oh cool ty

wheat cipher
#

You got it working already?

restive otter
wheat cipher
restive otter
acoustic lark
restive otter
#

Why not ? @acoustic lark

acoustic lark
#

Not sure

#

I will look again

#

Still not working

#

I will look for errors on my PC when I am on it

topaz kraken
acoustic lark
#

In webhooks I think

topaz kraken
#

huh

#

oh

mellow peak
#

Yep in Webhooks tab in your bot

#

@rain heart Yop
So i try to use your lib for webhooks, but i got this from my console, How you fix it ? I don't receive tests from Top.gg btw

rain heart
#

What IP are you using on top.gg? Make sure the Authorization is correct

#

It is not the 0:0:0:..

spark raven
#

so now i get <Response [400]> what does this mean?

rain heart
#

And have you added a listener aswell?

mellow peak
#

I create a listener, i authorize the connection in my firewall, and my Authorization is correct

rain heart
#

Add Options.Ignore_Authorization and Options.Ignore_Validation at the last parameters

#

Of the listener

spark raven
# spark raven so now i get `<Response [400]>` what does this mean?

code py if message.content.startswith('e!gif'): print (message.author.id) r = requests.get(f'http://top.gg/api//bots/830771134177083393/check?userid={message.author.id}', headers={'Authorization' : os.getenv('TOPGGTOKEN')}) print (r) if any(word in r for word in voted): gifid = ''.join([str(e) for e in message.content.split('e!gif')]) await message.channel.send(f'https://cdn.discordapp.com/emojis/{gifid}.gif?v=1')

mellow peak
#

i will try

spark raven
#

oooh

rain heart
#

Remove the second /

spark raven
#

i did and still got the 400 error

rain heart
#

Re-check the docs then

spark raven
#

i did and i am still confused

rain heart
#

have you tried making a manual request using just the url and a random user ID?

night ingot
#

Try userId with a capital I instead, at the end of your url

rain heart
#

your userid parameter is wrong

#

yeah

spark raven
#

rly?

night ingot
#

It's case-sensitive, yes

spark raven
#

oooh

night ingot
#

if you enter the url in your browser, it will tell you what's wrong

spark raven
#

can someone give me an animated gif?

#

like send one for the test?

rain heart
#

one sec lol

mellow peak
#

@rain heart I try but same problem, started under 0:0:0:0:0:0:0:0 and no test received :/

rain heart
#

@spark raven

rain heart
#

it should say something like "Listening under" etc

spark raven
#

oh now it says error 200

#

wtf?

mellow peak
rain heart
#

because of the parameter being wrong then

#

http://ip:port/BotWebhook would be your webhook

#

otherwise DM me the url and I'll try to make a test request

rain heart
#

it is case sensitive like Spaxter said

spark raven
#
(f'http://top.gg/api/bots/830771134177083393/check?userId={message.author.id}', headers={'Authorization' : os.getenv('TOPGGTOKEN')})```
rain heart
#

works now

#

see

spark raven
#

still no tho... still error 200

rain heart
#

200 means success

mellow peak
rain heart
mellow peak
#

Yup

sullen nymph
#

what the fuck is voted in that snippet

rain heart
#

where

rain heart
#

no clue HYPERKEK

spark raven
sullen nymph
#

if any(word in r for word in voted):

spark raven
#

yeah

rain heart
#

checking any word in your response what

#

confusion

sullen nymph
#

What does it even check is my question

spark raven
#

meaning voted would be 1 if they have voted

sullen nymph
#

Yeah how do you define voted

#

And why are you using the in operator in the first place

spark raven
spark raven
sullen nymph
#

But like

#

why the fuck are you using it on the response

#

what does it check

spark raven
#

if the response has 1 in it, it allows the emoji to go through

sullen nymph
#

I hope you do realize that you could just do r.json()['voted']

#

instead of whatever the fuck that isn't working

#

because

spark raven
#

ok

#

but wait - how do i tell if they have voted or not using that?

sullen nymph
#

Are you okay

#

As the API documentation suggests, you receive a response in JSON format

spark raven
#

...fuck me

sullen nymph
#

r.json() where r is your response attempts to convert the response text into a dictionary

spark raven
#

lol

#

i not smrt

sullen nymph
#

then from that you get the voted field which contains either 1 or 0

#

Oh and yeah

#

in with requests.models.Response objects doesn't work as you think it does :)

#

You either do directly r.text for checking the text or x in r.json() to check if a dict key is returned in the response

spark raven
#

ok

restive otter
sullen nymph
#

No. All you need is the guilds intent

restive otter
#

Ohok

restive otter
sullen nymph
#

I don't remember. It's probably better to make sure it is enabled explicitly

restive otter
#

Oh ok

#

Ty

prisma turtle
#

Hi, I have a question. If we want to make a webhook. Can we make a flask webserver

#

?

sullen nymph
#

Yes but you will have to make sure you can run your discord.py bot alongside with it

#

If you want to run them together, you can run your aiohttp webserver as a cog

prisma turtle
#

Ok thanks! ^^

restive otter
#

ignore the slash after my-ip

#

its some discord formatting error

#

my-ip:port/dblwebhook is what i meant

rain heart
#

/dblwebhook would be your path

restive otter
#

ah ok

#

but yeah as i read the pins and experienced myself

#

they dont seem to work currently

austere swallow
#

is your webhook server running behind a firewall or router?

chilly spire
#

Hey so I'm getting the unauthorized error when trying to use the DBL API
My token is correct, but it still tells me unauthorized.
I'm trying to use get_user_vote() and get_bot_upvotes() and it's telling me unauthorized
This surely isn't because I defined DBLClient in multiple cogs, is it?

austere swallow
#

you have to make sure your DBLClient has a token/has the right token

#

the token is not your bot token, but the one found on top.gg bot page

chilly spire
#

Yes I have that and it is correct

#

I'm loading the token from a .env, and it was working fine yesterday

chilly spire
#

I used to define webhook but there isn't a need

austere swallow
#

you might want to check if your token was regenerated

#

@sullen nymph send halp

chilly spire
#

I just regenerated it

#

The token matches

sullen nymph
#

I was going to eat

#

ping me with all the info or wait until I'm done

sullen nymph
#

dblpy gets bot.user.id for both of those endpoints

chilly spire
#

dbl.DBLClient from the dbl package with matching DBL API tokens

sullen nymph
#

bot client as in your commands.Bot instance

chilly spire
#

yeah

#
client = commands.Bot(command_prefix=prefixes, intents=discord.Intents.all())
dblc = dbl.DBLClient(client, dbltoken)```
#

dbltoken is a string retrieved from a loaded .env

frail shale
#

does returning a 404 status code and 20x status code the same ?

#

to top.gg when receiving webhooks

rain heart
#

Yeah

#

It only retries when it receives a 5xx or the connection times out

frail shale
#

and i will just return 404, easy

chilly spire
#

I did

sullen nymph
#

Try again XGWkekwlaugh

dull plaza
#

Is this JavaScript or I’m wrong

chilly spire
#

Python

dull plaza
#

Yeah I’m wrong

sullen nymph
#

Are you sure you are copying the entirety of it?

rare epoch
#

someone tell me meme api

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

restive otter
#

https://docs.top.gg adresinde komuta oy zorunluluğu getirmeyi bulamadım nasıl yapabilrim sadece 1 tane komuta uyguluycam

Top.gg documentation

Welcome to Top.gg

cold root
cold root
restive otter
#

yeah totally

wheat cipher
#

Its not discord.webhook if you have top.gg sdk

#
const express = require('express') const { Webhook } = require(`@top-gg/sdk`) const app = express() const wh = new Webhook('webhookauth123')

wheat cipher
#

Then wh = is your webhok

cold root
#

o

#

So I just replace

hard smelt
#

!play

cold root
#

do I put token there?

#

where it says autho

#

webhootauth

rain heart
#

authorization is what you want to use to authorize requests

#

not your bot token or top.gg token

#

something you create yourself

cold root
#

so webhooks token...

rain heart
#

something you create yourself, yes

wheat cipher
#

You go to your bot page, click on edit, click on webhook

#

At the url you doo http://host ip /url with port>/dblwebhook

#

Authorization you just place a password or a token that you make yourself.

cold root
#

o

#

O

#

that

#

ok.

#

sorry I was dumb

wheat cipher
#

That token goes into the wh = new Webhook('token in here')

#

🙂

tired minnow
#

Any plans on updating the API for Java?

rain heart
#

Still waiting for that aswell, the maintainer of that library hasn't worked on it whatsoever since 2019

#

Thought about taking it over, though I doubt my current Java knowledge might be worth it

#

If you know someone who'd love to take over, feel free to DM Veld ThumbsUp

tired minnow
#

I don't think my Java knowledge will be any good either. Perhaps I could look at the current source code and tinker around with it

sour sequoia
#

where can i get the top.gg token for my bot?

rain heart
rain heart
#

I'd love to give it a try

sour sequoia
#

its not there

rain heart
#

it is there

tired minnow
rain heart
tired minnow
rain heart
#

It should work with JDA aswell, it was just tested with Javacord

tired minnow
#

Thanks a lot! This will help me immensely :)

rain heart
#

also kinda made the listeners the way Javacord would make it, but should definitely work even without any Discord library

fickle tapir
#

-networth

rain heart
#

you're in the wrong server

tired minnow
rain heart
#

?

#

There aren't docs

#

wait there are nvm

tired minnow
#

@rain heart in your LoggersBro example bot, is there a reason why you set your port to 6969? Sorry for all these questions

rain heart
#

Nah just used that port

#

Can be any port

tired minnow
#

Thanks!

tired minnow
#

@rain heart anything I could be doing wrong here? Nothing is coming through my bot

final Webhook wb = new WebhookBuilder().addBotListener("BotWebhook", new BotWebhookHandler(),
    "TOKEN").setPort(8199).build();
        
try {
    wb.start();
    System.out.println("Voter webhook successfully started.");
} catch (IOException e) {
    System.out.println("Voter webhook unsuccessful.");
}```
rain heart
#

What's token

tired minnow
#

Isn't that the long string generated via top.gg

rain heart
#

No

#

It's the authorization you create yourself

tired minnow
#

Wait what

#

What's the purpose of the long string token then?

rain heart
#

Authorization, to authorize the webhook requests

#

Any request not matching the Authorization will not fire the Webhook

tired minnow
#

So I create my own authorization token and put it in where I have "TOKEN"?

#

You're talking about the settings in the webhooks section right?

rain heart
#

You can set it to whatever you want, like "MyWebhookCode" or "NobodyIsGoingToKnowThis"

#

Yes i am

tired minnow
rain heart
#

The addBotListener

#

Correct

#

That has to be the same as the String you have with "TOKEN"

tired minnow
#

Okay, and what am I supposed to do with the long generated token?

#

Where does that come in

rain heart
#

That's only for interacting with top.ggs api

#

Doesn't have to do with webhooks

#

Such as with the Java-SDK

tired minnow
#

If I want my bot to recognize when people vote and get their snowflake ID, I would need to use that right?

rain heart
#

You can use getVoteData on the event of the webhook to get everything the webhook sent

#

Like the User ID, Bot ID etc

tired minnow
#

Oh I get it now

#

Alright, thank you

rain heart
#

The webhook library doesn't touch the top.gg api at all, it just parses what is sent to the webhook and fires the event if the data is valid and is authorized

tired minnow
#

Can the authorization token have special characters

rain heart
#

Ofc

#

Anything that can be used in a String

tired minnow
#

I'm not quite sure what I'm doing wrong. I've fired the Test vote multiple times but nothing seems to be coming in on my end.

#

Do I need to have a webhook URL?

olive goblet
#

hi

rain heart
#

Make sure it isn't https or 0.0.0.0 or localhost

tired minnow
rain heart
#

You can't use discord webhooks there

olive goblet
#

yo whats a easy way to gain members

#

in server

#

i really want lots of memners

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

tired minnow
rain heart
#

Your selfhosted one can't be https as it is using a different port

#

And https is only for actual webservers

tired minnow
#

I travel around a lot so it would mean I have to change the URL all the time. Is there any other method for the webhooks

rain heart
#

There's not, no

#

Unless you want just logs, which you can do with either Vote Tracker or a different bot

#

But if you want to reward users on your bot, there's no other way

night matrix
#

Thanks - somehow missed the answer for this. Anyone know what timezone it's in?

tired minnow
hushed reef
#

@sullen nymph i've got an error stack for you, having issues with API guild submissions.

Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "D:\Work\Coding\Coding\GitHub\Transword\Transword.py", line 118, in on_ready
    await transword.API.post_guild_count()
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\client.py", line 160, in post_guild_count
    await self.http.post_guild_count(guild_count, shard_count, shard_id)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\http.py", line 168, in post_guild_count
    await self.request('POST', '/bots/stats', json=payload)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\http.py", line 93, in request
    async with rate_limiter:  # this works but doesn't 'save' over restart.
  File "<string>", line 6, in __aenter__
TypeError: object Lock can't be used in 'await' expression
sullen nymph
hushed reef
#

reee

#

recommended fix?

sullen nymph
#

You can scrap the ratelimiter module and locally add the one I have on the GitHub repo

sullen nymph
#

It should be on the sdk repo

#

And I'm sure you know how to delete a package

hushed reef
#

yes 😂

#

just couldn't find it

sullen nymph
hushed reef
#

@sullen nymph LETSFUCKINGGOOOOOO

#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "D:\Work\Coding\Coding\GitHub\Transword\Transword.py", line 118, in on_ready
    await transword.API.post_guild_count(
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\client.py", line 160, in post_guild_count
    await self.http.post_guild_count(guild_count, shard_count, shard_id)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\http.py", line 168, in post_guild_count
    await self.request('POST', '/bots/stats', json=payload)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\http.py", line 105, in request
    kwargs['data'] = to_json(kwargs.pop('json'))
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\site-packages\dbl\http.py", line 222, in to_json
    return json.dumps(obj, separators=(',', ':'), ensure_ascii=True)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 234, in dumps
    return cls(
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "C:\Users\17046\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type method is not JSON serializable
#

we're upgrading!

#

Looks like TopPY really hates fucking 3.9 KEKW

sullen nymph
#

... what

#

XGWkekwlaugh ok yeah

cursive coyote
#

-api

static kayak
#

I host my bot on heroku, so how would my bot webhook look like?

#

anyone?

rain heart
thorny fractal
#

alr how do i add my number of servers in my bot thatll be shown in top.gg

rain heart
#

-servercount

abstract mothBOT
restive otter
#

-bots

#

:)

#

@Proulex

#

Breh

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

teal matrix
#

-bots

abstract mothBOT
restive otter
#

it's showing SPOOPY 😅 in image

#

see this

rain heart
#

that's intentional

modern lagoon
#

how to setup webhook?

rain heart
#

also the bot has to be approved before using widgets

rain heart
restive otter
modern lagoon
#

Getting Started
Start by setting up your webhook URL in the edit form of your bot on this site, it can be found at https://top.gg/bot/:your-bot-id/webhooks. Once you've entered the URL you want the webhook to be sent to, you're all set! If you need help setting up webhooks inside of your bot** don't be afraid to ask in our discord server in the #topgg-api channel.**

rain heart
modern lagoon
rain heart
#

read pins then

restive otter
#

it's easy you do by yourself

rain heart
restive otter
#

see this link

#

put .svg in last

modern lagoon
rain heart
modern lagoon
rain heart
#

ofc widgets are broken sigh

restive otter
#

Oh

#

so i am just asking that

rain heart
#

Yeah widgets seem to be broken for your bot

#

@restive otter could you try again

spark raven
#

ok I don't want to be a baby, but can someone who uses python please send me your code to see if someone has voted using API? i have been trying for so long so can someone please help me?

restive otter
rain heart
#

thank @craggy sentinel

restive otter
#

i known you have not fixed but thx to owner

#

😅

#

and team

spark raven
#

tysm!

spice helm
#

Np :D

velvet dune
#

Hi

#

I am not getting tickets from voting karuta

#

It is telling try again

rain heart
#

-wrongserver @velvet dune

abstract mothBOT
#

@velvet dune

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

velvet dune
#

Ok

storm abyss
#

how do i use my api

#

?

acoustic lark
#

How do you make announcements when ppl upvote ur bot?

#

Are there python docs 4 it

acoustic lark
#

ty

spice helm
#

That's assuming you don't have a VPS or anything like a server exposed to the internet, i have an alternative guide if you do

acoustic lark
#

Nah I do not have a VPS

spice helm
#

Ok, then just use that guide for now

pure vigil
#

i did this script to send a message when a member vote for my bot

spice helm
#

I don't think you should post your token

acoustic lark
#

no

rain heart
#

Reset your token

pure vigil
#

sorry

#

ok

steel bolt
pure vigil
#

i copy paste

#
import discord
from discord.ext import commands, tasks
import requests
import aiohttp
from aiohttp import web
import logging
import dbl
from config.config import la_couleur, lien_vote


class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""
    def __init__(self, bot):
        self.bot = bot
        self.token = "my token"

        self.dblpy = dbl.DBLClient(self.bot,
                                   self.token,
                                   autopost=True,
                                   webhook_path="/dblwebhook",
                                   webhook_auth='password',
                                   webhook_port=5000)

    async def webserver(self):
        async def handler(request):
            return web.Response(text="Hello, world")

        app = web.Application()
        app.router.add_get('/dblwebhook', handler)
        runner = web.AppRunner(app)
        await runner.setup()
        self.site = web.TCPSite(runner, '0.1.4.8', 5000)
        await self.bot.wait_until_ready()
        await self.site.start()

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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        vote_data = data
        voter = await self.bot.fetch_user(vote_data['user'])
        channel = self.bot.get_channel(824737862779273230)
        em = discord.Embed(title=f"[Nouveaux vote]({lien_vote})", colour=la_couleur, description=f"{voter} ({voter.mention}) vient juste de voter !")
        em.set_footer(text="Vous pouvez voter toutes 12 heures !")
        await channel.send(embed=em)
        logger.info("Received an upvote")
        print(data)



def setup(bot):
    global logger
    logger = logging.getLogger("bot")
    bot.add_cog(TopGG(bot))
    top = TopGG(bot)
    bot.loop.create_task(top.webserver())```

So i did this script to send a message when a member vote for the bot
#

but it's not working

#

and there is not error

#

in my terminal

acoustic lark
#

Can I use a discord webhook as my webhook???

rain heart
#

No

acoustic lark
#

what type

spice helm
acoustic lark
#

Okay

spice helm
#

You can put it into that site and then forward it to a discord webhook, that's what i use to do

acoustic lark
#

kk

#

ty

spice helm
acoustic lark
#

HTTP request right

spice helm
pure vigil
#

ok

spice helm
#

Sorry, i've not used the SDK that much so i don't know much about that

pure vigil
#

what is sdk ?

spice helm
#

Software development kit, the thing you're using for webhooks

pure vigil
#

ok

#

np

restive otter
#

Your webserver method is redundant as passing this would set the webhook automatically; those 2 are conflicting. Also, why are you instantiating 2 different cog objects?

sullen nymph
#

You know, I'm not surprised that the way the webhook works in v0.4 managed to cause this to happen

restive otter
#

So when is v1 rolling out lol

acoustic lark
#

this one right? @spice helm

#

Is there anything wrong with this?

#

Not working no errors tho

steep karma
#
const webhook = new Topgg.Webhook("your webhook auth")

wat does it mean by webhook auth?

#

and where can i get it

rain heart
#

authorization you create yourself

#

has to be the same on your bot page settings and code

#

see docs

restive otter
acoustic lark
#

wdym by that

steep karma
#

what ever i put in this field

rain heart
#

yes

steep karma
#

ight thanks

rain heart
#

you create it yourself, it authorizes your requests

steep karma
#

k

rain heart
restive otter
# acoustic lark wdym by that

Instance methods should have a parameter that takes the instance of the class, which by convention named self. So, add it. Though, it should've posted the stats to the API despite this lacks of self parameter, it just won't print it.

spice helm
acoustic lark
#

Okay ty

acoustic lark
spice helm
#

If you want to log them too, yes, add it to your bot

acoustic lark
#

So it works without that?

#

As in to post up voters

spice helm
#

Yes, but you'll have to code something to save the voter info if thats what you want

acoustic lark
#

Okay thanks

#

How do I run it?

#

As in 24/7 @spice helm

spice helm
#

Yes, it will need to be active at any point someone could upvote

acoustic lark
#

But how to a start the program, I can only find run once

spice helm
#

Should be a little switch you can click into on

acoustic lark
#

this right

spice helm
#

Yeah

#

Does it send everything when you test it?

acoustic lark
#

yeah

spice helm
#

Alright, thats all working then :)

acoustic lark
spice helm
#

Np :D

acoustic lark
#

Is there a way I can @ the user who upvotes my bot?

#

As in ID or USERNAME or something like that

night ingot
#

<@user id> as a string should work

#

or fetch the member and use <Member>.mention

spice helm
#

Yeah, that'll work, just use the 1.id variable from integromat

#

Wait no

#

It might be something else, i used that webhook for discordbotlist aswell im getting confused, just check the docs for whatever is a user id

chilly spire
#

Hey, I need some help with the webhooks

#

I'm running my bot on a Raspberry Pi, and I'm very new to webhooks

#

My Bot's Top.gg webhook URL is in the format http://MY-IP:PORT

#

It doesn't work

#

going to that web address leaves a 404, and going to that web address /dblwebhook returns a 405

#

It doesn't work and I'm new and confused

#

so any help would be appreciated!

#

:D

rain heart
#

You cannot make get requests

#

Get is referring to going to the website in your browser

chilly spire
#

yeah but the Top.gg POST test doesn't work either

rain heart
#

Then your url is wrong or faulty

#

Posting code could help

#

Postingn your approach could help

chilly spire
#
self.dbl = dbl.DBLClient(self.client, dbltoken, autopost=True, webhook_path='/dblwebhook', webhook_auth='69420', webhook_port=5000)```
jaunty plank
chilly spire
#

Just tried two different IPs, neither of which worked

#

I tried the one that I can use for things like SSH, and I used one I got when i curled canhazip.com

jaunty plank
#

did you port forward? zero chance it will ever work without portforwarding.

chilly spire
jaunty plank
#

sure. routers have firewalls, any incoming request is blocked unless you tell your router to accept requests on that port, and where to send the request to.
ie port forwarding, forwarding the port to a specific device.

chilly spire
#

ah

jaunty plank
chilly spire
#

alright
Will I have to restart the router or anything after port forwarding?

jaunty plank
#

depends on the router.

chilly spire
#

We have an old TredNet one, so I would assume so

viral solar
#

Can someone help me? I'm trying to make the webhook work on vps but I'm not getting it

jaunty plank
#

Have you filled in the webhook url and auth on the website?

viral solar
#

yes

#

I'm using like this:
Webhook URL = http://my.server.ip:80/dblwebhook
Authorization: ...

#

in this model I meant

night ingot
#

You can't use port 80 for webhooks

viral solar
#

it would be 5000 right? I already tried too

night ingot
#

It would be whatever you set it to in your code

viral solar
#

in my code I did not define any port because there is nothing written there in the libraries

night ingot
#

There should definitely be a port definition somewhere in the code

#

what library are you using?

viral solar
#
const express = require('express')
const { Webhook } = require(`@top-gg/sdk`)

const app = express()
const wh = new Webhook('webhookauth')

app.post('/dblwebhook', wh.listener(vote => {
  console.log(vote.user)
}))

app.listen(80)
#

in js

rain heart
#

use a different port than 80

night ingot
#

in your app.listen you set port 80, yes

viral solar
viral solar
rain heart
#

what is the address you've entered on your bot page url

#

it has to be in your case http://serverip:5000/dblwebhook

#

it cannot be 0.0.0.0 or localhost or 127.0.0.1

viral solar
chilly spire
dawn solar
#

What do you do if you are locally hosting?

#

I put my ipv4 address in place of serverip but nothing happens when anyone votes

viral solar
viral solar
night ingot
#

You need to use the public ip address, not the machine's local one

dawn solar
#

I used a website to look it up

night ingot
#

And make sure the port you're using is open

dawn solar
#

I have set up port forwarding in my router for it

night ingot
#

check if it's open on here

restive otter
#

How can we know if someone votes our bot?

night ingot
#

You can check if someone has voted through the API. Or use webhooks to know exactly when someone votes

dawn solar
viral solar
restive otter
#

Full spelling mistakes lol

#

@viral solar ty

viral solar
acoustic lark
untold cliff
#

i have problem with api

#

don't show up

#
  ^

ReferenceError: ap is not defined
    at Client.<anonymous> (C:\Users\jakem\Desktop\EvalZero-main\index.js:63:3)
    at Client.emit (node:events:369:20)```
restive otter
#

maybe app?

untold cliff
restive otter
#

I need help also
how can i make vote system?

#
const Topgg = require(`@top-gg/sdk`)

const api = new Topgg.Api("MY TOKEN CAN't SHOW ")
api.getVotes()

it retunes nothing

untold cliff
#

@restive otter do i need this too topgg-autoposter

restive otter
#

you can do manually

untold cliff
#

and how can i know if it work

restive otter
# untold cliff and how can i know if it work
const Topgg = require(`@top-gg/sdk`)
const api = new Topgg.Api("Your Top.gg TOKEN Here ")

setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size
})
}, 1800000)
#

use this and see your top.gg bot page

untold cliff
#

what is this shardId: client.shard.ids[0], // if you're sharding
shardCount: client.options.shardCount

restive otter
#

i think

#

if your bot is in too many server and you using sharding

#

like 5k or 10k servers

#

😅

untold cliff
#

don't show

restive otter
#

you should have to run this with your bot bot code

untold cliff
#

do

restive otter
#

do?

untold cliff
restive otter
#

put your token 😅

untold cliff
#

I remove so i can take the photo

restive otter
#

oh

#

but it works for me 😅

untold cliff
#

did i do it righ

restive otter
#
setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size
})
}, 1800000)

TRY only this much

#

🤔

untold cliff
#

ok

#

N/A stall same

restive otter
#

🤔 then why it works for me? Oh God what happening?

untold cliff
#

I didn't getting any error

restive otter
untold cliff
#

"@top-gg/sdk": "^3.1.1",

#

it wired

#

is the api working for anyone

#

should i restall it

#

@restive otter

#

i am still have problem with it #

steel bolt
#

hello, I using heroku for host my bot, and Idk how to to detect when a person votes with this

#

how to get the ip ?

#

actually my code

const { Webhook }= require("@top-gg/sdk");
const topgg = new Webhook('Auth-test');

const express = require("express")
const app = express()

app.post("/dblwebhook", topgg.listener (vote => {
  console.log(vote.user)
  client.channels.cache.get('815356140375638057').send(`${vote.user} vote !`)
}))

app.listen(80)```
spice helm
untold cliff
#

@spice helm can you help me

spice helm
#

I'll see what i can do

untold cliff
spice helm
#

Idk much about node, but do you get an error?

untold cliff
#

@spice helm i am try show on top.gg how many server my bot in

spice helm
#

Hmm, how many shards do you have?

untold cliff
#

32

spice helm
#

Ok, right, it says its posting every 30 minutes, maybe its waiting 30 minutes before it first posts?

#

Try bringing it down to 30 seconds maybe? Then it should maybe give an error or post it, just don't forget to reset it afterwards, i've made that mistake lol

untold cliff
#

not work

spice helm
#

Nothing? No error? Did you put the token back in?

untold cliff
#

```const Topgg = require(@top-gg/sdk`)
const api = new Topgg.Api("Your Top.gg TOKEN Here ")

setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size
})
}, 1800000)
(edited)
[20:06]

#

i did this

#

i Don't get any error

#

do u i need add token in api .js

#

@restive otter

restive otter
#

nop

#

its to fine other user data

#

or bot 😅

untold cliff
#

i have follow all the step

#

why it won't work for me

untold cliff
#

do i need to have an authorization header with your token

night ingot
#

You can't post your server count without providing your dbl token, no

untold cliff
#

@night ingot i have put my token where it tell me add it when save and restart and iit won't show up

#

it still won't show up

#

i have try again it won't show up

untold cliff
#

Did I code right @night ingot

night ingot
#

I don't do js, unfortunately

untold cliff
#

Ok do u who dose kno

#

W

#

‘’’const Topgg = require('@top-gg/sdk')

const api = new Topgg.Api(‘token’)
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size,
})’’’

}, 1800000) // post every 30 minutes

#

That got in my code

shadow hull
#

owo ping

brittle spoke
#

if you are having trouble, its best to use the auto poster then

viral solar
#

I'm still trying to make the automatic voting system, but it doesn't answer the test on top.gg, so I decided to put:
const webhook = new Topgg.Webhook ('...')
console.log (webhook)

#

then he replies:
Webhook {
authorization: '...',
options: {error: [Function: error]}
}

chilly spire
#

When setting up port forwarding for the Top.gg webhook, which application name should it be?

#

Ping me if anyone has an answer :)

jaunty plank
chilly spire
#

thanks

#

So, I enabled port forwarding on my router and my bot still isn't receiving the webhook test

#

This is what my rule looks like on my router

#

the IP address is the address of my Pi

#

Application name is HTTP and Computer Name is also my Pi

#

That's the only thing I've done with my router

#

and my definition of the DBL API is this

self.dbl = dbl.DBLClient(self.client, dbltoken, autopost=True, webhook_path='/dblwebhook', webhook_auth='69420', webhook_port=5000)```
#

and the webhook URL in the bot dashboard is this

http://RASPBERRYPIIP:5000/dblwebhook```
#

Any help would be appreciated!

jaunty plank
# chilly spire

so theres two ip's.
an internal ip, looks something like 192.168././(or 10.0.0.*) and an external ip, which has just random numbers.
when port forwarding you want to use the internal ip, not the external.
the url needs to be the external ip, the one you got from the website.

chilly spire
#

The URL for top.gg has to be external?

jaunty plank
#

yes.

chilly spire
#

Still not working

jaunty plank
#

your auth in your code and on the site is the same?

chilly spire
#

indeed

jaunty plank
#

please dont spam

chilly spire
#

they are both "69420"

jaunty plank
#

this is a support channel, do you need anything?

chilly spire
#

nothing you need to worry about

#

I wasn't talking to you for that

chilly spire
jaunty plank
#

I really am not sure what else to try tbh.

chilly spire
#

The documentation gives the IP for the DBL webhook, but I'm not sure where to put that

#

Would I need to add it as a firewall rule?

jaunty plank
#

oh like to attach to an ip?

#

oh, good point. do you have ufw or iptables on your pi?

chilly spire
#

not sure

#

let me check

jaunty plank
#

i forget if pi's come with a system firewall by default.

chilly spire
#

ufw

#

I have both

jaunty plank
#

yeah youll have to allow port 5000 through

#

you have both enabled?

chilly spire
#

both are present

#

not sure if they're enabled

jaunty plank
#

ufw status

#

i forget iptables status's command

chilly spire
#

UFW's status is active and port 5000 is active for ipv4 and ipv6

#

Would I need to add it as a firewall rule in my router?

#

oh wait, would I have to allow 5000/dblwebhook?

#

or just 5000

jaunty plank
#

just 5000

#

its port specific

chilly spire
#

well then yeah it's enabled on my Pi

jaunty plank
#

so it says
5000 allow anywhere on a line when you do ufw status?

chilly spire
#

yeah

jaunty plank
#

do you mind dming me the exact url you are putting on the website?

chilly spire
#

sure

noble light
#

Hey how can I use discord webhook

jaunty plank
molten bramble
#

Is it fine to not get a reward after voting the bot?

#

@everyone

night ingot
proper sapphire
#

sorry

night ingot
noble light
#

My code is not working

night ingot
#

Is port 5000 open on your network? Are you using the right url on your webhooks page?

#

Also, you can't use Discord webhooks for this

night ingot
#

You don't check for the right port. You pick one that isn't in use, and open it through port forwarding

crystal cloak
#

If my bot reaches 100 servers or more, does it stop working until it got verified or what happens then?

night ingot
#

Not related to the api channel, but when your bot reaches 75 servers you can apply for verification, until then it will be limited to 100 servers

crystal cloak
#

ok thx

noble light
#

I m not able to check votes please help

#

How can I make vote tracker

noble light
rain heart
#

Use a different port then 4head

#

Use 8000, more common for webhooks

lethal walrus
#

how can i invite the bot in my server

rain heart
#

Which bot

sleek tiger
#

Annenuzi sikebilir miyim

#

Huh?

#

Yes or no

restive otter
#

is there a api for bot dev in java not jda idk why it is not working well

#

hm ok

#

i toad this channel call api so my thing was a api so i did sorry for mistake

cerulean heath
#

Excuse me but can we use top.gg webhooks if our bot is hosted on heroku?

willow spindle
#

yeah

cerulean heath
willow spindle
#

there is special herokuapp link for each heroku project iirc

cerulean heath
wide nexus
#

I am trying to use repl for my bot so I gave my repl webserver link to the webhook and it's hosting in 5000 port

#

But it's now working

#

The data is not printing after I vote

#

so the Vote trigger is not working

rain heart
#

Test vote is triggered through the on dbl test

#

An actual vote through on_dbl_vote

night ingot
# wide nexus

Pretty sure you need to provide the port here as well

rain heart
#

Yeah port is needed to enable the actual webhook

wide nexus
wide nexus
rain heart
#

Change https to http

#

As https only works for ssl requests, using a port doesn't work there

bold totem
neon portal
#

Does anyone know how to do dm user?

rain heart
#

@bold totem please change your nickname and avatar in the next 10 minutes

#

As you're impersonating staff

#

@bold totem last warning, otherwise you will be removed from this server

hushed reef
#

gamer too busy with roblox

rain heart
#

Understandable sadcry back to api topic

brittle spoke
#
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('Your Top.gg Token', client)

ap.on('posted', () => {
  console.log('Posted stats to Top.gg!')
})```
#

there you go

swift venture
night ingot
#

You need to put a capital I in userId

swift venture
#

bruh

#

ok ty

sullen nymph
#

api/ not api//

crystal cloak
#

Is there a way to see why the bot got ratelimited?

sullen nymph
#

Investigating your code

crystal cloak
#

I mean on which server

#

Somebody is spamming

sullen nymph
#

There's no direct way

#

Have command cooldowns or log every request you send

crystal cloak
#

Does your bot send messages if the user is on cooldown?

night ingot
#

Only if you code it that way, you can just make it ignore the user if they're on cooldown aswell

crystal cloak
night ingot
#

I'd probably make it so that it tells the user that they're on cooldown once, and then ignores them until it's over

acoustic lark
#

Does any1 know how to make this @ the user who upvotes my bot?

#

For webhooks

rain heart
#

<@userid>

acoustic lark
#

I have done this but it is still not working

acoustic lark
rain heart
#

Shrug I have no clue at all what that is supposed to be

night ingot
acoustic lark
#

{ "<@user id>" : "<1.name>", "content" : "Thanks for upvoting CheerBot", "avatar_url": } This is it if I copy and paste might be more clear than screen shot

night ingot
#

Where are you getting that data from?

rain heart
#

still no clue what that is supposed to represent

acoustic lark
night ingot
#

Are you sure? That looks nothing like the data Top.gg gives you

rain heart
acoustic lark
#

Oh no sorry I am using integromat for the webhook and HTTP requests

#

But I am using integromat for the webhook and HTTP requests

rain heart
#

Still no clue what that data is you're getting, probably ask the user who recommended it to you

acoustic lark
#

kk

#

Well a user gave me a tut for it

#

I will re read it

rain heart
#

-api @timid hawk

abstract mothBOT
#

@timid hawk

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

acoustic lark
#

I think I know now I will test it now

#

Sorry how do I @ the user is it <@username>?

rain heart
#

<@userid>

acoustic lark
#

ty

#

Will testing the webhook still @ someone

upbeat hare
#

Hello, do you know how our bot server count does not display on top.gg ? So far it's N/A

jaunty plank
upbeat hare
#

Thanks FTS_coeur

upbeat hare
jaunty plank
viral solar
#

a question has a problem if the input type is RDP and not HTTP?

jaunty plank
viral solar
#

I understand, because I am not able to open a port in http that is not 80

#

and when I test in the canyouseeme it gives error

jaunty plank
#

You can use any port.

upbeat hare
jaunty plank
jaunty plank
#

With code

#

What language do you use?

viral solar
upbeat hare
#

Okay it's good dbl.postStats

jaunty plank
viral solar
jaunty plank
#

Yep that works

viral solar
#

did not work

solid crest
#

i need voting rewards but not on vote of my bot, i mean for the server
for the bot i have a cog, but i want it for a server specifically too
but cant find smth about server in the docs

queen geyser
#

{user}

spice helm
#

Hey @acoustic lark, you ok?

acoustic lark
#

Yeah Just that Idk how to make it @ the user

spice helm
#

Have you tried the angle brackets and at sign?

acoustic lark
#

Does it need to be in the content part?

green mantle
spice helm
#

Yes

acoustic lark
#

should this be okay

restive otter
#

Is there a python library that handle server votes?

#

Lol

sullen nymph
acoustic lark
#

bruh stop tryna self add in the API channel lmfao

spice helm
acoustic lark
#

ik the web site is not in but it does not make a difference

sullen nymph
#

TIAS

acoustic lark
#

as in not passing it though like this "<@userid>"?

sullen nymph
#

as in "Try It And See"

spice helm
#

When you click, you should see a pop up window with some variables, replace userid with that variable

acoustic lark
acoustic lark
spice helm
#

Thats it

acoustic lark
#

It works but It is my userID @spice helm

jaunty plank
#

are you the one voting?

acoustic lark
#

It is a test

#

Test vote

jaunty plank
#

then its going to be your id

acoustic lark
#

yeah but it is not my username

jaunty plank
#

your missing @ and >

#

@acoustic lark
is what it should be programmatically.

#

if you copy paste that into chat, itll tag you

acoustic lark
#

Okay thanks @jaunty plank and @spice helm

spice helm
#

Ah nice :D

ember karma
#

hello

#

I would receive tweets to my discord channel

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

rain heart
#

@ember karma

solid crest
#

i need voting rewards but not on vote of my bot, i mean for the server
for the bot i have a cog, but i want it for a server specifically too
but cant find smth about server in the docs

supple river
#

why does the .NET lib not support posting for one shard's shard counts...

#

this is mildly infuriating- i only have options to post total server count, total server count with shard count, and shard id + shard count + array of all server counts

#

when would the 3rd ever be useful??? the array could be aggregated and sent with the 2nd

#

am i missing something or is this just poor design?

#

ideally, i'd like to post with body params server_count (as a number, not an array), shard_id, and shard_count

rain heart
#

You're better off doing http requests than using the Library if you need these features

#

as the library hasn't been updated for a year and a few months

supple river
#

the code base looks pretty sub par as it is

restive otter
#

whats a port i can use

#
self.site = web.TCPSite(runner, '1.1.1.1', 8080)
#

i used 0.0.0.0 8080 for keep_alive

#

Wait can I use topgg api for my bot to send messages or nah?

restive otter
#

gotta import dbl

#

Yes ik

#

But after that can we do that?

#

You make requests to Discord API to send messages, not TopGG API.

#

Yes ty

#

Wait. So is it possible, for me to make a discord.py bot which posts a message everytime somebody votes for my server ?

wide nexus
#

@restive otter You have to stop the flask or any other web hosting things

wide nexus
#

Yaa

restive otter
#

if i have repl it hacker plan

#

then i dont need keep_alive

wide nexus
#

So I make a differect repl

restive otter
#

that right

wide nexus
restive otter
#

oh

#

thanks

wide nexus
#

Just delete the keep_alive

restive otter
#

ya

wide nexus
restive otter
#

now it prints 404 not found

restive otter
# wide nexus np
class TopGG(Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = os.environ.get("TOPGG_KEY")
        self.auth = os.environ.get("TOPGG_AUTH")
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
        self.update_stats_channel = self.bot.get_channel(828347053331185704)
        self.update_stats.start()
#

this correct?

#

webhook url inside topgg is set to

wide nexus
#

just use