#topgg-api

1 messages ยท Page 18 of 1

vital anvil
#

dont worry it's skill issue on my part instead

novel laurel
quasi gate
pearl cliff
#

The API is still not back?

#

Another question related to sharding, do I need to make any changes to my top.gg code?

quasi gate
#

@vital anvil no?

vital anvil
#

not yet

vital anvil
cold cairn
#

anything we can do to get the stats onto the site?

#

i see some bots having relatively active stats so they must be doing something

cold cairn
latent dune
#

Damn still error code 500 gets thrown

cold cairn
#

and 405 on /bots/stats

quasi gate
#

@cold cairn Api down

novel yoke
#

Seems like only topgg autoposter is experiencing issues , webhooks which are coming from votes are perfectly working

jaunty plank
#

the posting api isnt working

vital anvil
#

bunch of API issues should be resolved! not all, but majority

signal hawk
#

Please let us know if something specific isn't working still H_pray

dapper copper
#

/api/bots with working again, many thanks ๐Ÿ˜„

stone escarp
#

I did check individual user vote and it returned true even though i didn't vote in the last 12 hours. I did vote in the last 24 hours though. I didn't change anything and this was working before for years think. Do i need to update anything? (I tried with the api module and using fetch)

storm sapphire
#

API still not working?

quasi gate
jaunty plank
quasi gate
#

@jaunty plank

vital anvil
#

atleast it is no longer 405 :)

quasi gate
#

right, i wait

vital anvil
#

thank you

#

sorry your issue wasn't resolved yet

quasi gate
#

I told you what you should do, restart the machine and that's it.

vital anvil
#

all of them?

quasi gate
#

or del all :)

#

DROP DATABASE

vital anvil
#

machines have restarted around 24 times in the last day

dry mantle
#

if you delete the end point there won't be a 500 error anymore

quasi gate
dry mantle
#

ez fix KEKW

vital anvil
#

i will get back to u tonight

quasi gate
quasi gate
gusty locust
#

i dont think u should be restarting that often broski

vital anvil
#

how many times do you restart your bot

gusty locust
#

LOL

quasi gate
vital anvil
#

oh very cool

#

its ok I'm slowly going through all issues

quasi gate
#

100 times if my free host no cooperate

gusty locust
#

stan veld

vital anvil
#

your issue will come

#

wow lucky

jaunty plank
vital anvil
#

my host rips me off so much they want to call me on monday sadge_business

quasi gate
gusty locust
#

ez token burning speedrun impossible challenge

vital anvil
#

just automate refresh token

jaunty plank
#

its a process manager

quasi gate
#

yesterday I discovered that they are shards

quasi gate
#

?

#

ok no

jaunty plank
#

Not really, it keeps your bot online even if it crashes.

Or when you restart the server it auto starts.

quasi gate
#

how i add this in a free host with 1 GB to Cpu an 512 MB

#

XD

jaunty plank
#

vps?

quasi gate
#

no

#

i am poor

#

(argentina)

quasi gate
#

PM2

jaunty plank
#

If its not a vps I dont think you can use a process manager.

quasi gate
#

fck

#

search in google vps free 100% real for my verified discord bot partner please help i am poor

jaunty plank
#

oracle does too

quasi gate
#

requires CC

#

fck

restive otter
#

Error code that is returned recently changed

dry mantle
#

oh you recently have been having 500?

#

i've had the error code 500 for a good bit of time

quasi gate
#

/bots/ endpoints with issues @restive otter @dry mantle

quasi gate
#

uh

#

1 hour later

olive plume
#

Hii

jaunty plank
gaunt jungle
#

hey is the api slow?

vital anvil
#

sorry i had to move on to a more pressing issue, afterwards I'll finish the API work

pearl cliff
novel laurel
gritty hemlock
#

Are there any updates on the status of the api?

plain hamlet
#

Still waiting for ...

vital anvil
#

PI_salute we pushed more fixes yesterday but i slept afterwards

quasi gate
#

@gritty hemlock 405 Method Not Allowed relatively Fixed but 500 Internal server error No

rancid token
#

$top

dry mantle
#

has /<botid>/stats been fixed cuz i haven't seen any error from it in about 8-9 hours

cold cairn
#

the sdk libaries running all on /bots/stats without the bot_id component so i think this is most important to fix

#

still 405 for me

dry mantle
#

ig it just stopped trying to update for me then for some reasons but won't complain lol

#

also there's other bugs that are more important to fix

#

a fancy guild count isn't really important imo

vital anvil
#

It's fixed, but not deployed

vital anvil
#

should be deployed now

quasi gate
vital anvil
#

?

quasi gate
#

(stats send to topgg)

#

no error

#

:))))

dry mantle
#

yep works

vital anvil
#

lets goo

#

about time

dry mantle
#

it updated after i refreshed data

vital anvil
#

amazing

#

glad to see it

quasi gate
#

promote to ultra mega giga chad @vital anvil

#

nicece

vestal wasp
#

topgg before veld: it's weekend, we don't care

quasi gate
vestal wasp
#

between veld

dry mantle
vestal wasp
#

it sounds that way you want it to sound

hearty pagoda
#

Can I get the last time a user voted from the api

rose briar
#

the problem is everytime we post server count we have to click on refreshed data or it wont update. its a bug.

dry mantle
#

nah it just takes time to refresh most likely

neat pawn
#

Good morning everyone, apologize but I've got an odd issue coming from the get_user_vote method. Being given a type_error (<class 'TypeError'>, TypeError('string indices must be integers'), <traceback object at 0x7f4851584cc0>)
Any ideas what might be causing this?

runic creek
vestal wasp
vestal wasp
neat pawn
#

According to this code in the DBLClient class provided by topggpy:
` async def get_user_vote(self, user_id: int) -> bool:
"""Gets information about a user's vote for your bot on Top.gg.

    Args:
        user_id (int)
            ID of the user.

    Returns:
        :obj:`bool`: Info about the user's vote.

    Raises:
        :obj:`~.errors.ClientException`
            If default_bot_id isn't provided when constructing the client.
        :obj:`~.errors.ClientStateException`
            If the client has been closed.
    """
    if not self.default_bot_id:
        raise errors.ClientException(
            "you must set default_bot_id when constructing the client."
        )

    await self._ensure_session()
    data = await self.http.get_user_vote(self.default_bot_id, user_id)
    return bool(data["voted"])`

It should be providing me with a boolean?

#

This was working fine just a couple days ago

hearty pagoda
hearty pagoda
gaunt jungle
#
    "voted": 1
}```
neat pawn
vital anvil
worldly sapphire
#

Is there documentation for vote rewards?

vital anvil
worldly sapphire
#

Thanks

neat pawn
#

Looks like for me it's returning a string:
'{"voted":0}'
Which could be why the Library method is no longer working?

gaunt jungle
rose briar
still cradle
#

what i do here

#

can someone help msetup webhooks plz

rose briar
still cradle
maiden pumice
#

whats going on with this vote stuff.... i get { voted: 0 } no matter what

gaunt jungle
#

i use this one

#

oh nvm is the same im dumb ๐Ÿ’€

vital anvil
maiden pumice
vital anvil
#

it means im deploying a fix for u rn

#

probably the reason why it stopped

#

being deployed now.

#

the problem was kinda stupid

restive otter
#

Yay you fixed the stats posting ๐Ÿ˜

maiden pumice
vital anvil
#

@maiden pumice it's already fixed :)

woven coral
#

yippeeeee

#

you forgot to notify me veld lmao but thanks! ayaka_pray

night jungle
#

can anyone know what could be the issue

gusty locust
woven coral
#

@vital anvil does avatar return the full avatar URL now instead of just the avatar hash?

vital anvil
#

we no longer store hashes, only urls

woven coral
mighty shuttle
#

Did break our site :^)

vital anvil
#

yea i kinda forgot

#

sorry

woven coral
#

is avatar nullable or not?

vital anvil
#

it is not nullable

woven coral
#

thank you

vital anvil
#

we will give you top.gg fallback avatar

#

if there is no icon

woven coral
#

why not something like this?

vital anvil
#

infra is built for not just discord

woven coral
#

i see i see

#

thank you

#

does this apply to user avatars as well?

#

like /bots/{id}/votes

#

and will its extension be GIF if possible?

#

@vital anvil

vital anvil
#

I don't think so

woven coral
#

oh okay

woven coral
mighty shuttle
#

eh we dont link that anywhere

#

Do we even provide that?

woven coral
#

but it will break most bots that use the api

#

double url moment

mighty shuttle
#

Is that our api?

woven coral
woven coral
mighty shuttle
#

ah

vital anvil
#

thank you for updating the sdks

woven coral
#

if possible i'll make a pull request to the other sdks as well

woven coral
vital anvil
#

no plans

woven coral
#

thank you

vestal wasp
#

vanity back when:(

woven coral
#

well that would also mean bringing back top.gg bot verification

rose sierra
#

what is this new 'entity' about?

#

its the same as the bot ID, so what is it for

latent trench
#

Hi,
Is there a public API key, as I am currently working on a bot list and I am trying to get bot data from topGG to my bot list, the user has to press a "Find" bot that they will find the data from topGG on my list too

vestal wasp
#

another - now abondened botlist - let bot devs put their own topgg token into a field to fetch bot data (idk if that was client side or not though)

#

though kinda silly to ask on top.gg how to "scrape" data for a competitor

woven coral
#

having a bot listed, or becoming a library developer in which you would get your API token for testing your SDKs

latent trench
#

i have a bot on topgg

runic creek
#

Even if you had a token, it still has rate limits. Giving people the ability to click a button that would send requests to top.gg is not a very good idea

vestal wasp
#

cache

#
  • rate limit the user
woven coral
runic creek
#

Yes, but you would have one token for the entire bot list

#

Lots of users, lots of bots, one token (assuming of course that anyone would use this bot list at all)

woven coral
#

@vital anvil is donatebotguildid going away any time soon?

vital anvil
#

the api won't change anymore after this

#

next change will be api/v1

steady steeple
vital anvil
steady steeple
#

okay thanks ๐Ÿ™‚

silk tree
#

Hello everyone, I tried to update my guild count with the tiny C# program below, basically copied from the docs for the dotnet library
The variable me appears to be set correctly, but when executing the UpdateStatsAsync method it returns a 400 Bad Request.
Anyone happen to have any idea what I could try to fix this?

    static async Task  Main(string[] args)
    {
        AuthDiscordBotListApi dblApi = new AuthDiscordBotListApi(BOTID, TOKEN);
        IDblSelfBot me = await dblApi.GetMeAsync();
        
        await me.UpdateStatsAsync(50000);
    }
vital anvil
#

we decommissioned the api route which gets your own user because it wasn't really used for anything since you can use any api url without your own ID anyways

woven coral
glacial moat
#

i'm trying to find info about issues resolved, for what i read bot stats updates has been resolved but i still have problems: since yesterday seems like the bot is sending the stats, but i don't see them updated (now shows 0) in the bot page

silk tree
vital anvil
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

glacial moat
silk tree
#

Java library last updated 3 years ago, let's see whether that works pepowot

scarlet cobalt
#

One message removed from a suspended account.

woven coral
#

im sure you do

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vital anvil
#

loool

woven coral
#

it worked in the python sdk but not this one lmao

silk tree
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

silk tree
#

I mean it's been broken for probably several months, and I figured out how to make Java work for myself, so I don't think it is particularly urgent

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

woven coral
#

@vital anvil posting server count where the server count is 0 doesn't work

#

possibly because of truthiness(?)

#

from the server's end

#

so it doesn't recognize the server_count property

vital anvil
#

oh we dont allow 0 yea

vestal wasp
#

wouldn't see this as a huge issue

woven coral
#

as i could get confusing

vital anvil
#

the error message should be

#

server_count cannot be lower than 1 and higher than 999,999,999

#

something like that

woven coral
#

yup

scarlet cobalt
vital anvil
#

rewrite made breaking changes to the api

#

see pinned message

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vital anvil
#

yeah

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vital anvil
#

i dont really know tears

#

what's the difference between entity and bot

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vestal wasp
#

add on bot

#

imo

scarlet cobalt
#

One message removed from a suspended account.

vital anvil
#

u cant review a user

#

so yea

vestal wasp
#

entity sounds like it could also be a user (if the user API wasn't removed)

vital anvil
#

bot it is

scarlet cobalt
silent perch
#
[Uncaught Exception]: Error: 404 Not Found
    at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:61:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.execute (/home/container/src/Events/Guild/MessageCreate.js:119:29) uncaughtException

umm guys?
this is really messing my commands that are vote locked up for users
T_T

silent perch
#

mm

jaunty plank
#

i assume that means yes?

silent perch
#

whats the error tho it was perfectly workin

silent perch
jaunty plank
#

When its a user who has voted it returns true right?

its only users who dont exist it gives a 404 on.

silent perch
#

wait a min

#

uhm before it would jus tell em to create account no? by jus telling them to vote

jaunty plank
#

The API has been updated, now it returns an error when a user has never used Top.gg.

I'd suggest placing your hasVoted in a function, something like this

import Topgg from "@top-gg/sdk"
const topgg = new Topgg.Api("HIDDEN")

async function checkVote(id) {
    try {
        const voted = await topgg.hasVoted(id);
        return voted; // Return true if voted
    } catch (err) {
        if (err.message === "404 Not Found") {
            return false; // Return false for 404 error
        } else {
            throw err; // Throw error for any other error
        }
    }
}
silent perch
#

ah

jaunty plank
#

All this does is handle the 404 error. Since the user doesn't exist(404 means it doesnt exist) they couldnt have voted.

silent perch
#

ah so it jus tell em to vote anyway ryt?

jaunty plank
#

Yeah

silent perch
woven coral
#

that's not mentioned in the pinned message but it would most likely break many bots

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tranquil steppe
#

@keen belfry You'd need something like this

app.post("/dblwebhook", new Topgg.Webhook(config.TopggToken).listener(async vote => {
        console.log('Vote received:', vote);```
tranquil steppe
keen belfry
# tranquil steppe <@925817620341620797> You'd need something like this ```js app.post("/dblwebhook...
    const Topgg = require("@top-gg/sdk");
    const express = require("express");
    const app = express();
    const webhook = new Topgg.Webhook(process.env.TOPGG_WEBHOOK_AUTH);
    app.post(
      "/topgg-webhook",
      webhook.listener((vote) => {
        // vote will be your vote object, e.g
        console.log(vote.user); // 395526710101278721 < user who voted\

        // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
      })
    );
    app.listen(process.env.PORT);
#

this is what i have

tranquil steppe
#

give me a moment

misty belfry
#

Hi

tranquil steppe
#
const Topgg = require("@top-gg/sdk");
const express = require("express");
const app = express();
const webhook = new Topgg.Webhook(process.env.TOPGG_WEBHOOK_AUTH);

app.use(express.json());

app.post("/topgg-webhook", (req, res, next) => {
  const authHeader = req.headers.authorization;

  if (!authHeader || authHeader !== `Bearer ${process.env.TOPGG_WEBHOOK_AUTH}`) {
    return res.status(403).send("Forbidden");
  }

  next();
}, webhook.listener((vote) => {
  console.log(vote.user);
}));

app.listen(80);
keen belfry
#

replaced

tranquil steppe
#

Let me know, although It may not work with your environment

#

Where's my thank you skull_crying

misty belfry
tranquil steppe
misty belfry
#

ah okey thank you.

tranquil steppe
#

No problem ; )

tranquil steppe
#

Yeah it worked?

keen belfry
#

nope

#

nothing was logged

tranquil steppe
keen belfry
#

thats the Schema

restive otter
# keen belfry
if (!authHeader || authHeader !== `Bearer ${process.env.TOPGG_WEBHOOK_AUTH}`) {
    return res.status(403).send("Forbidden");
  }
tranquil steppe
#

lmfao

restive otter
#

Doesn't look like your authorization header looks like Bearer .... Just remove the Bearer part from the check

tranquil steppe
#

Sometimes I just....

silent perch
pastel veldt
#

i'm getting this error when checking for user votes:

#

i'm using the topgg python library

restive otter
restive otter
woven coral
#

@vital anvil hey veld, is donatebotguildid nullable?

#

because it's not in the documentation

woven coral
vital anvil
#

yes its always empty

woven coral
#

so it's deprecated

vital anvil
#

yes

pastel veldt
restive otter
#

make the requests yourself, without the library

steep snow
#
WARNING:discord.gateway:Can't keep up, shard ID None websocket is 45.8s behind.
WARNING:cogs.levelling.levelling:Error checking vote status for XP multiplier: Cannot connect to host top.gg:443 ssl:default [None]```
untold sparrow
woven coral
#

@vital anvil any idea?

autumn cipher
#

Is there any way that we can check if the code is working without voting on top.gg?
as we can only vote once in 12 hours?

restive otter
autumn cipher
restive otter
#

you need to give the right url w/ port if needed

autumn cipher
restive otter
#

yeah that's not how it works

autumn cipher
#

I want to implement in the code that after xyz time they have to vote the bot to work again

vestal wasp
#

its to send a webhook to your own server (code)

restive otter
#

you need to setup your web server with your code and then listen for webhooks

#

then with your web server you can executed a discord webhook

#

but top.gg (still) doesn't support directly setting discord webhooks

vestal wasp
#

at this point idk why it doesn't, it's just a if Strings.contains(webhook_url, 'https://discord.com/api")

autumn cipher
restive otter
#

yeah what i also wrote some time ago x)

autumn cipher
woven coral
vital anvil
woven coral
#

alright

vital anvil
#

I can look into it soon but prioritizing the data migration

woven coral
#

@signal hawk can you add this

signal hawk
#

could you spell out the issue for us non technical folks

woven coral
#

add top.gg/api/bots/{id}/votes to the list in #support pins

signal hawk
#

thats a user id correct

woven coral
signal hawk
#

oh

#

kk pog_thumbsup

woven coral
#

@signal hawk sorry

signal hawk
#

edited pog_thumbsup

#

im not super familiar with the api sorry

#

i'll need to get better at that

woven coral
orchid sundial
#

quick question does updating the python library break on_dbl_voteand on_dbl_test events? Cause I'm not receiving either anymore SSJLua

zenith geyser
#

can i know why topgg api is used for?

runic creek
zenith geyser
runic creek
#

The API works on the principle that you send a request to top.gg and top.gg sends you a response (you can't do this too often). Webhooks only work in one direction, i.e. top.gg sends information to you that someone voted for your bot

zenith geyser
runic creek
#

No, webhooks are only used to receive information that someone voted for your bot

zenith geyser
#

Ohhhhh

#

So what will be used for that

zenith geyser
#

@runic creek

jaunty plank
#

Top.gg analytics don't have an api endpoint. If that's what you're asking for

shell crest
#

Am I the only one getting this error all the damn time? Like, several times a second?

shell crest
#

TopConnect.getVotes()

#

I've never had to insert any arguments, and it's not asking for any

jaunty plank
#

I'll take a look at the sdk

#

Hey, the SDK needs to be updated, I'll look to update the SDK soon.

steady steeple
#

Hey,

when testing a vote webhook we dont seem to be getting the isWeekend property, has this been removed?

jaunty plank
steady steeple
#

ah okay, but it still exists for "real" votes?

jaunty plank
#

as far as I'm aware, yes

steady steeple
#

alright cool, thank you

jaunty plank
#

None of my webhooks use it, but I'd expect someone would have reported it missing by now.

scarlet snow
#

Is there a review POST ? would be nice, reward users for leaving reviews haha.

#

if there isnt it should be implemented but without also sending the number of stars given, to prevent devs from only rewarding 5 star reviews.

runic creek
#

There is no point in adding something that is also against the guidelines

jaunty plank
#

oh nynu said that, sorry

#

๐Ÿ‘€

wise spruce
#

Probably because people tend to give a biased reviews when there's a reward

vestal wasp
#

I mean it's fairly common on trust pilot

zenith geyser
#

Hello can i Get a sample code for webhook or api key for topgg

jaunty plank
jaunty plank
#

depends on the programming language

sly abyss
#

can anyone give me the code

#

like !vote bot will check if the person has voted yet, if not, the bot will ask to vote

#

If the vote is finished, the bot will say that this user has voted successfully.

jaunty plank
jaunty plank
#

v13 nodejs is really outdated, I don't think the library supports that far back.

brave frost
#

Hi, small question, where can I find my bots api key? Just canโ€™t figure it out ๐Ÿ˜…

jaunty plank
runic plover
#

Hello

sly abyss
raven plume
#

when will reviews api come out?

jaunty plank
scarlet cobalt
#

One message removed from a suspended account.

sly abyss
#

@jaunty plank help me

jaunty plank
#

sup?

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

jaunty plank
#

I just saw the bibbidi bobbidi boo yah

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sly abyss
#

please give me the code where the remaining time is displayed to vote again

restive otter
#

unless you use a webhook, you need a web server and database, to keep track of who voted when, not possible

woven coral
#

@vital anvil

so uhm /bots returns the same results no matter your query?

i've tried the following queries:

  • /bots
  • /bots?search=
  • /bots?search=Luca
  • /bots?search%3DLuca
  • /bots?search=username%3A%20Luca
  • /bots?search%3Dusername%3A%20Luca

and they all return the same results -- like mudae always being in the first search result -- as if i didn't enter any query

#

total here is 44,109 so it matched with every bot listed on Top.gg

woven coral
vital anvil
#

This is like before this update even

woven coral
#

yup

#

i thought it was already fixed considering #support pins listed it as fixed

#

maybe @signal hawk?

signal hawk
woven coral
old barn
polar laurel
#

Im trying to send my current # of servers over to top.gg My console logs sucessfull. But nothing shows


async def update_topgg_stats(self):
        if not topgg_token:
            logging.warning("TOPGG_TOKEN not found, skipping Top.gg stats update.")
            return
        headers = {"Authorization": topgg_token}
        payload = {"server_count": len(self.guilds)}
        async with aiohttp.ClientSession() as session:
            async with session.post(f"https://top.gg/api/bots/{self.user.id}/stats", json=payload, headers=headers) as resp:
                if resp.status == 200:
                    logging.info("Successfully updated Top.gg stats.")
                else:
                    logging.error(f"Failed to update Top.gg stats: {resp.status}")
    def __init__(self):
        super().__init__(command_prefix=commands.when_mentioned, help_command=None, intents=discord.Intents.default())
        self.start_time = None
        self.status_channels = {}
        self.blacklisted = set()```
#

Nvm im blind

woven coral
#

@jaunty plank i could make a pull request to the sdk to make this return false if u want

#

so this fix is not needed anymore

jaunty plank
#

or have its own unique status or something

woven coral
#

i mean, they technically would have never voted even if they don't have a top.gg account, no?

jaunty plank
#

Yeah, so they might not understand what it means to vote and bot devs can use this to send them more indepth info

woven coral
jaunty plank
#

At least thats what I'd use it for

woven coral
#

imo i feel like most bot devs only care about the boolean

jaunty plank
#

I think a seperate state for new users and existing users is a good thing

#

Its an SDK, I think the raw information should be passed. But others could have different opinions.

#

I cant type, I'm trying ^-^

woven coral
#

my sdks are not that raw haha

jaunty plank
#

tbh the only sdk we have is the js one, everything else is more library focused.

#

I'm not really against patching it in, I just like it and I think its a feature not a bug.

#

Devs have to implement error handling anyway themselves.

#

(503 errors)

jaunty plank
#

I might be wrong, but for example the python lib has some error handling built in right?

#

I havent looked at the github for topggpy for so long

woven coral
#

depends on your definition of error handling tho

jaunty plank
woven coral
#

what's implemented

jaunty plank
#

Error handling

woven coral
#

it just represents any exception coming from the Python SDK

jaunty plank
#

I was refering to the comment I linked to ^-^

#

Line 46

woven coral
#

what makes this different from the node sdk?

jaunty plank
#

The node sdk has no intention of handling any errors iirc

woven coral
#

after looking at the code i can somewhat understand

#

though it does handle invalid inputs, it doesn't handle any request errors

jaunty plank
#

I'm not against it, it just seems weird to implement error handling when you have to implment it yourself anyway.

#

I think the docs need to be updated, not the actual code.

woven coral
#

fairs

woven coral
#

just custom exceptions for different types of exceptions which is passed down to the user

#

maybe just slight error handling for ratelimits and 404 sometimes

jaunty plank
#

๐Ÿ‘€ did you add handling of the 404's to yours?

#

oh derp

#

๐Ÿ‘€ so you return null on 404?

#

I dont know py

hidden citrus
#

Hello guys, anyone can help boost my server members?

woven coral
#

it returns 404 as None in endpoints that i feel deserve it

#

for has_voted, treat_404_as_none is False

#

because i dont think im doing an Optional bool type

woven coral
#

and remove that 404 check

#

you know what maybe i should wawa_huh_confused

woven coral
#

would make the sdk more consistent with other sdks

opal solar
#

Guys, my POST requests to the /stats route time out. Anyone else with this issue?

lapis dew
#

guys why its access denied

lapis dew
#

@woven coral have u fixed the api with python?
cuz im using py too

honest quail
#

Hey Guys! We're using the @top-gg/sdk nodejs package... but sometimes is returning 503 error, it's okay?

#

The error is from api obviously

woven coral
#

and what does the vote command do?

lapis dew
#

instead of request

#

and installed topggapi

uneven moss
#

Hi, guys. For the second day I have been trying to make this API work, apparently I am very stupid. I don't want to use any webhooks or anything more complicated, I just want to get api data on the people who voted for my bot, why is it so difficult to do in this api, I have already connected the Api warframe to the bot and there, given the more extensive version of the information, it was easier for me to work with it, but here I need not so much, but nothing works.

Can someone help me a little to figure out why this code does not return voices, I checked the ID and TOKEN of the bot several times, everything is correct. It returns the status of 200 but there is no content, although my bot already has 5 votes (2 of them recently)

import requests

api_key = "TOPGGTOKENBOT"
url = f"https://top.gg/api/bots/IDMYBOT/votes"

headers = {"Authorization": api_key}

try:
    response = requests.get(url, headers=headers)
    response.raise_for_status()
except requests.exceptions.RequestException as e:
    print(f"Error in request: {e}")
else:
    print("Status code:", response.status_code)
    print("Content:", response.json())
woven coral
#

@vital anvil hey veld, i'm not sure if this is a bug or not, but whenever i send a request to top.gg/api/bots/{id} (which worked) and then send a request to top.gg/api/bots, it gives a 500?

#

but if i send a request to top.gg/api/bots without the prior request, it worked

vital anvil
#

someone is ddosing the site lol

woven coral
#

nice

#

๐Ÿ˜Ž

#

i thought the site already has proper ddos prevention measures? wawa_huh_confused

vital anvil
#

ye

#

theres plenty of ways to ddos

jaunty plank
#

sounds like fun

woven coral
formal saffron
#

500 errors are coming back beeg_yoshi

woven coral
#

@vital anvil https://top.gg/api/bots/{id}/stats returns the same result no matter the ID argument, is this intentional?

#

(your bot's stats)

woven coral
#

try https://top.gg/api/bots/stats

#

then https://top.gg/api/bots/1234567/stats

#

then https://top.gg/api/bots/1/stats

#

same thing

#

it redirects to ur bot

vital anvil
#

hmm

#

it shouldn't

woven coral
vital anvil
#

to be fair tho

#

it should throw a forbidden on other stats

#

so it doesnt matter too much

woven coral
#

yeah

#

berry said this tho

#

i'm not sure if it's possible

vital anvil
#

no, its not allowed by the API

woven coral
#

alright

hearty lintel
#

๐Ÿ˜”

halcyon apex
hybrid acorn
#

Hello is it possible to get the last timestamp of user having voted with API ?

vital anvil
#

but you've never been able to retrieve other people's stats out of the getgo?

hearty lintel
vital anvil
#

n

#

getStats(id) is useless

#

we support both api endpoints for legacy support

tulip mist
#

Will the type be "vote" when someone vote?

dim kettle
icy laurel
#

Check if user has voted in s_djs v14

const {
  EmbedBuilder,
  MessageFlags,
  ActionRowBuilder,
  ButtonBuilder,
  ButtonStyle,
} = require("discord.js");
const axios = require("axios");
const apiToken = require("../config.js").topGG;
module.exports = {
  voteCheck: async function (interaction) {
    try {
      const userId = interaction.user.id;
      const response = await axios.get(
        `https://top.gg/api/bots/BOT_ID/check?userId=${userId}`,
        {
          headers: {
            Authorization: apiToken,
          },
        }
      );
      if (response.data.voted < 1) {
        const voteLink = "https://top.gg/bot/BOT_ID/vote";
        const embed = new EmbedBuilder()
          .setColor(0x00ffff)
          .setDescription("### Vote if you want to use this command.");

          const row = new ActionRowBuilder().addComponents(
          new ButtonBuilder()
            .setLabel("Vote for me")
            .setURL(voteLink)
            .setEmoji("๐Ÿ”—")
            .setStyle(ButtonStyle.Link)
        );
       interaction.reply({
          embeds: [embed],
          components: [row],
          flags: MessageFlags.Ephemeral,
        });
        return false;
      } else {
        return true;
      }
    } catch (e) {
      return true;
    }
  },

};

Just use the function like this :

      const vote = await voteCheck(interaction);
      if (vote !== true) {
        console.log("Bouta get a vote");
        return; // just return since the function has already replied, no need to add anything here
      
    }
normal cradle
runic creek
#

No, this code only checks if the person executing the command has voted

normal cradle
#

@runic creek bro is there a way to create a code that automatically check the current voters ?

normal cradle
#

prodia user ๐Ÿ˜‚

tulip pulsar
runic creek
tulip pulsar
#

Prodia api not fixed

normal cradle
tulip pulsar
#

@normal cradle bro can you help me in bot in a problem?

normal cradle
normal cradle
runic creek
tulip pulsar
normal cradle
restive otter
normal cradle
icy laurel
normal cradle
#

that's the problem

icy laurel
normal cradle
#

ok

normal cradle
#

itz in the first lines of code with fetch js module

restive otter
#

no point in hiding a bot id

#

you get an error 404 so the endpoint is not valid

#

everything can be traced back and seems valid besides the bot id, which may be wrong

#

note that if the users corresponding to the ids never used top.gg it will return a 404 error

#

considering you're using an LLM for your code, the ids you're checking are just random and do not correspond to a user, hence the 404 response

restive otter
#

and for when you check for the last 12h votes with the /votes endpoint, hard to see what's wrong if you don't share the logs related to that

junior flare
#

Doesn't 404 meant they never voted before?

jaunty plank
#

Its if they never logged in I think

#

I'm not entirely sure though

icy laurel
#

so

#

lets brake it down

#

u want to check every user who has voted ?

jaunty plank
#

You'll probably be best off using webhooks for that

normal cradle
#

sigma do u know python right !? i m coding this now in python and not node js

icy laurel
jaunty plank
#

not great

icy laurel
jaunty plank
#

most people get ratelimited pretty quickly when doing stuff like this

icy laurel
jaunty plank
#

You'll want a decent caching system in place at the very least.

#

On the /votes endpoint i think it was around that, but veld may have changed it in the update

#

I havent messed with the API since then

restive otter
#

the issue would come quite a lot if you have lots of votes

#

considering the result it 100 and paginated

#

you'd have to make multiple requests to get all votes if you have over 100 votes

jaunty plank
#

You also wont have any info on when the votes expire, so you'll have to recheck often

restive otter
#

better off using webhooks from the start

normal cradle
icy laurel
#
const axios = require("axios");
const { ChalkAdvanced } = require("chalk-advanced");
const apiToken = require("../config.js").topGG;
function delay(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
module.exports = {
    voteUsers: async function (abot) {
        try {
            console.log("Checking for votes...");
            const users = new Set();
            await Promise.all(abot.guilds.cache.map(async (guild) => {
                try {
                    await guild.members.fetch(); 
                    guild.members.cache.forEach(member => {
                        users.add(member.user.id);
                    });
                } catch (err) {
                    return console.log(ChalkAdvanced.red(`Failed to fetch members for guild ${guild.id}:`));
                }
                console.log(users);
            }));
            for (const userId of users) {
                try {
                    const response = await axios.get(
                        `https://top.gg/api/bots/1121344235807977474/check?userId=${userId}`,
                        {
                            headers: { Authorization: apiToken }
                        }
                    );

                    if (response.data.voted < 1) {
                        console.log(ChalkAdvanced.yellow(`User ${userId} has not voted`));
                    } else {
                        console.log(ChalkAdvanced.green(`User ${userId} has voted`));
                    }
                } catch (err) {
                    console.error(`Error fetching vote status for user ${userId}:`);
                }
                await delay(3000); 
            }
        } catch (e) {
            return console.log(ChalkAdvanced.red("Unexpected error:"));
            
        }
    }
};
#

use it in a ready event

#

make sure to run

npm i ChalkAdvanced axios
#

also make sure the bot has GuildMembers intent

#

@normal cradle

normal cradle
#

sorry i am back !

#

okay lemme test it with bot credentials

#

@icy laurel thank you bro !! but i want it to gets the voters's discord users id !!

log :

etc...
Bot Name: Nova-47
Monthly Votes: 11
Total Votes: 11
Server Count: Not available```
normal cradle
#

it got total votes !! not discord id of all users who votes !!

icy laurel
#

dont "!" me

normal cradle
#

thanks bro ! i edited the code and
Starting Top.gg vote checker...
Checking votes for bot ID: 1339242638892601405
Fetching guild members...
Successfully fetched members from guild test-guild
Found 2 unique users across all guilds
Checking vote status for user 123456789...
Error fetching vote status for user 123456789: Request failed with status code 404
Status: 404, Data: {"message":"User not found."}
Checking vote status for user 987654321...
Error fetching vote status for user 987654321: Request failed with status code 404
Status: 404, Data: {"message":"User not found."}
=== Vote Check Summary ===
Voted Users: 0
Non-Voted Users: 0
Errors: 2

total votes = 11 and it checked for 2 which they don't exists

icy laurel
normal cradle
solar crow
#

My bot just got verified i was wondering how do i make it so when someone vote the bot knows

#

Is there a guide?

jaunty plank
#

You'll want to use webhooks.

solar crow
#

I think i got dis part nvm

pure scaffold
livid moat
#

Do you know where to get an api token?

signal harness
livid moat
#

Okay thanks !!!

jaunty plank
#

Your bot will need to be approved first

livid moat
#

Yes im waiting

rose spade
#

when will the vote issue get fixed?

rose spade
normal cradle
#

alrdy chanegd the way of that

#

thanks btw ๐Ÿ˜

jaunty plank
rose spade
jaunty plank
#

Are you using the library or making a request yourself.

#

The library hasn't been updated

#

And the docs haven't either

#

We use a page system now

rose spade
jaunty plank
#

Show code please

rose spade
#
import requests
from collections import Counter

BOT_TOKEN = "BOT TOKEN"

API_URL = "https://top.gg/api/bots/{bot_id}/votes"

headers = {
    "Authorization": BOT_TOKEN
}

def fetch_votes():
    print("fetching")
    try:
        response = requests.get(API_URL.format(bot_id=1317736045067894804), headers=headers)
        print(response)        
        if response.status_code == 200:
            votes_data = response.json()
            print(votes_data)
            return dict(Counter([v['id'] for v in votes_data]))
        else:
            print(f"Error fetching votes: {response.status_code}")
    except Exception as e:
        print(f"An error occurred: {e}")

jaunty plank
#

I'll try to write a Python example after the meeting I'm in.

rose spade
jaunty plank
#

The docs havent been updated yet

#

cc @woven coral is the new get last 1000 votes broken? Have you tested it recently?

jaunty plank
rose spade
severe jacinth
#

how to fix not showing the server count on my bot

tranquil steppe
severe jacinth
#

like what

#

code ?

tranquil steppe
#

As it's not an automatic feature, it has to be manually setup by the developer

severe jacinth
#

will it ok

#

but how

#

api ?

tranquil steppe
severe jacinth
#

can you show an example

tranquil steppe
#

It's just an api wrapper you setup, run it on port, add authorisation and use the docs I sent you which has examples and the variables you need to use.

#

What language are you using?

severe jacinth
#

python

tranquil steppe
#

Are you fluent with python?

severe jacinth
#

yes

#

hmm got

#

thx

tranquil steppe
#

No problem

severe jacinth
#

i updated

restive otter
#

it is beginner friendly but it is slow

#
  • node.js better for web development and is very easy
tranquil steppe
#

Personal Preference I guess

severe jacinth
severe jacinth
mighty shuttle
severe jacinth
tranquil steppe
#

No need to update it that much damn

mighty shuttle
#

Not sure what the ratelimits on Top.gg are, but this wouldn't change the value on TopStats

severe jacinth
#

can you give me exmit time

mighty shuttle
#

As we only fetch every hour

severe jacinth
#

ok

tranquil steppe
#

Just do a guild create Event to push each new member

severe jacinth
#

so i will set 1h

tranquil steppe
#

Or fetch hourly

severe jacinth
tranquil steppe
#

I wouldn't recommend it though

severe jacinth
#

bruh hm so i will set 1h

restive otter
severe jacinth
tranquil steppe
#

Basically

tranquil steppe
severe jacinth
#

but bad

#

My Bot is

#

PicGenV

silk idol
severe jacinth
tranquil steppe
severe jacinth
#

yep

tranquil steppe
#

Oh...

#

It's yours, congrats!

severe jacinth
#

yes! thx

severe jacinth
prime summit
#

I have a few questions. I'm setting up the webhook to receive when users vote for my bot but I'm facing some problems because I don't really understand how to do it and what I'm doing wrong.

class TopGGWebhook(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
        self.app = FastAPI()
        self.PORT = FASTAPI_PORT
        self.HOST = FASTAPI_HOST
        self.AUTHORIZATION = TOPGG_AUTHORIZATION

        @self.app.post("/webhook/topgg")
        async def topgg_webhook(request: Request, Authorization: str = Header(None)):
            logger.info(f"TopGG webhook received")
            if Authorization != self.AUTHORIZATION:
                raise HTTPException(status_code=401, detail="Unauthorized")
            data = await request.json()
            user_id = data['user']
            if data['type'] == "upvote":
                logger.info(f"Upvote webhook received")
            elif data['type'] == "test":
                logger.info(f"Test webhook received")
            return {"status": "success"}

    async def start_api(self) -> None:
        config: uvicorn.Config = uvicorn.Config(
            self.app, host=self.HOST, port=self.PORT, log_level="info")
        server: uvicorn.Server = uvicorn.Server(config)
        await server.serve()

This is the code I have really now in my topggwebhook cog but when I hit the button send test it doesn't log "TopGG webhook received" that is the first that it has to do before anything else.
Also I don't know where I have to use the "Token for this bot" thing that I can see in the webhooks page from my bot.

runic creek
#

The token is only useful when using the API. It is useless if you use webhooks

prime summit
#

for what I'm doing then I don't need it, okay

#

if I create the uvicorn server with my private ip and port and (obviously) I put the public ip and port in webhooks page, I have to type in "Webhook URL" http://ip:port/webhook/topgg based in the code I sent above?

#

knowing I don't need the token then my error must be the Webhook URL I put in website or the code itself, and I want to discard stuff

#

and am I okay asking this here or should it be in #development?

jaunty plank
prime summit
#

home network really now, after testing I want to upload and change ip and port to the one from my bot hosting

jaunty plank
#

You'll need to port forward on your router.

prime summit
#

oh okay, I'll try later, ty

dapper copper
#

if you do it at exactly XX:00 on the hour it'll update

#

our fetcher runs at 2 minutes past

severe jacinth
eternal crater
#

hello. i didnt see isWeekend boolean in the test response. will it exist in an actual response or exist only if it's weekend?

jaunty plank
#

Test endpoint doesnt include is weekend

#

only on real votes is it included*

eternal crater
#

noted, thank you!

rose spade
#

is the voting system still broken? I try to fetch the votes with a request but it always returns an empty list

jaunty plank
#

I don't think this will be a fast fix, there's no current ETA on a fix.

#

Webhooks do work and are more recommended anyway. I'd suggest moving that way

gray palm
#

Hi guys, I want my uses to vote my bot to let them use it, could you help me to do that? My bot language is python

#

โ˜บ๏ธ

robust root
#

since the bot and topgg votes both utilize user ids that should be pretty easy

gray palm
#

I will check how to do it

#

Thanks

cloud lantern
#

Hi anyone know why the vote Tracking is not working?

rose spade
#

it's not allowed to connect a Discord channel's webhook to the Webhook URL?

rose spade
dapper copper
#

and it never has as far as I know

#

this will allow you to do exactly what you're looking for I assume

#

it's run by a volunteer on our team too!

compact narwhal
#

Can someone guide me to make a voting system and when I vote, the bot will send a message to the voter thanking you for voting for me.
I don't know how to do it

cloud lantern
runic creek
normal cradle
#

how to get this badge ?

jaunty plank
normal cradle
#

that's mine !

jaunty plank
#

I meant the bot in the screenshot, but thats not a top.gg feature. They used custom css to add that

normal cradle
#

i would like to know how to earn that badge for my bot

normal cradle
#

@jaunty plank but

#

how they did it in the name ?

jaunty plank
#

using the css :after flag

#
signal harness
normal cradle
#

the css html code only for topgg description ? but the name of bot is from bot ID !! can't mess with name

jaunty plank
#

You can edit a lot with just css

normal cradle
#

@jaunty plank damn ๐Ÿ”ฅ thankkkk youu from topgg bot description right ?

jaunty plank
#

yeah

cloud lantern
#

but why its not working?

vestal wasp
#

very unspecific what the issue is

cloud lantern
#

When i vote

vestal wasp
#

what's your code for receiving the webhooks and sending the embed

#

are there errors

restive otter
#

How do I get the API from my Discord bot to let people vote and earn coins?

restive otter
#

How do I get the API from my Discord bot to let people vote and earn coins?

#

@vestal wasp

#

Help

vestal wasp
#

what

eternal crater
#

check the port your app (express) is listening to too

eternal crater
eternal crater
scenic gazelle
#

What is the API to check if a user has voted for a bot or not?

scenic gazelle
runic creek
#

Don't do that

#

It's a support scam

scenic gazelle
runic creek
scenic gazelle
scenic gazelle
runic creek
#

I don't know how these scammers work but if you didn't do anything or provide any information then you should be fine

scenic gazelle
#

Yeah I found out they wanted me to download discord again

#

Hopefully they didn't pull my IP

uncut forum
dapper copper
hollow minnow
dapper copper
#

Has your bot been approved yet?

hollow minnow
dapper copper
#

Try logging out and logging back in, if it doesn't show after that, it may be a bug

dapper copper
#

What does the page look like for you, are you able to share a screenshot, censoring anything private ofc

#

have you made sure you're logged into the correct account on discord in browser?

dapper copper
#

hmm. @jaunty plank has the API key section moved? or is it broken for new bots at the moment

jaunty plank
#

Velds looking into it iirc

jaunty plank
hollow minnow
jaunty plank
#

Yeah, veld was informed of the owner not seeing their token issue

#

lemme double check

hollow minnow
#

oki

jaunty plank
#

Yeah, he was informed earlier today

hollow minnow
#

ok thx for help

vital anvil
#

new bots dont generate a token at the moment bumtertongue

dapper copper
#

oh sad

#

alright, good to know though, thanks Veld

vital anvil
#

did you get their bot id?

#

got it

dapper copper
#

I reviewed their bot so yea one sec
1338896463509454939

#

nvm

#

lol

#

being on laptop sucks ngl

#

productivity down the drain

vital anvil
#

pushed a fix

#

@hollow minnow you should be able to access your token in ~5 minutes

outer socket
#

can anyone tell me the api to get whether the user have voted or not?

#

what

#

?snipe

vestal wasp
outer socket
outer socket
vestal wasp
#

you should because of ratelimits - but there is an endpoint

outer socket
vestal wasp
outer socket
vestal wasp
#

I directly started out with the webhooks - I'm not sure how many checks I do but it's likely in the range of thousands a day

rustic sonnet
#

Is there a way to mock webhook events ?

vestal wasp
#

else just use curl or any other HTTP client

rustic sonnet
#

Okay! Yeah thought about that too, but how would i know what the request body looks like? Is there an example?

vestal wasp
#
const schema = Zod.object({
    bot: Zod.string().regex(/^\d{15,20}$/),
    user: Zod.string().regex(/^\d{15,20}$/),
    type: Zod.union([Zod.literal("upvote"), Zod.literal("test")]),
    isWeekend: Zod.boolean().default(false),
    query: Zod.string().optional()
});
rustic sonnet
#

Eg. i want to get the discord-id from the user that has voted*

vestal wasp
#

body.user

rustic sonnet
#

eyyyy lets get it!! Thanks. <333

#

and the user object, is the same as you get from the discordAPI?

vestal wasp
#

no

#

it's a snowflake

rustic sonnet
#

how does that look?

#

ahh okay, so in your case body.user is a snowflake

vestal wasp
rustic sonnet
#

might be a stupid question but is discordId === body.user?

vestal wasp
#

yes

rustic sonnet
#

gotchu thanks for helping โค๏ธ

vestal wasp
#

yw

steep belfry
#

Now am i supposed to set this up for vote rewards?

#

How*

#

Flask? FastAPI? Idk

vestal wasp
#

any web server

steep belfry
#

Apologies im new,

vestal wasp
#

sorry, I'm not a python developer, but flash and fastAPI should be fine options

viral radish
# steep belfry What would be the best? (For python)

Flask is lightweight and user-friendly but sync (has little to none async support) whereas FastAPI is also lightweight but has more security features and is async. For something like this I would recommend using Flask but run it in another thread to not block the bot's heartbeat ๐Ÿ‘

steep belfry
#

I have a problem,

#

for the discord token in topgg

#

whats that random ass server bto

#

no thanks mate

#

anyway

#

dang

#

Anyway the problem im facing is that in the bot's webhook settings i cant get the token.

#

It returns some random data?

#

Instead of the actual token

frosty comet
#

I'm not sure if it's my bot's token (for top.gg) or not

brazen oxide
#

anyone know hov to add vote button to commands

#

and were is api for this

jaunty plank
brazen oxide
#

TOPGG_API_KEY

jaunty plank
#

We don't have an api endpoint to vote and we dont have any plans of adding one.

brazen oxide
#

not api for developers?

#

and why i not have dev role

jaunty plank
#

Preventing abuse, you could just send the api request for anyone without us actually knowing if they voted.

#

or wanted to vote

steep belfry
#

I think it mighyt be a glitch

west dove
#

hey, where can I find my full top.gg API token?
when I reveal it under the Webhooks tab, I only see the header and payload of a JWT, but not the full token. I swear I saw a normal token earlier today-

tidal idol
#

it looks like this now

tidal idol
#

oh stare

west dove
#

:(

#

no way to get the token now then?

jaunty plank
#

do we just base64 encode tokens? ๐Ÿ‘€

you might just be able to copy the token and encode it

dapper copper
jaunty plank
#

Someone was decoding them at one point right?

dapper copper
#

I can check with my api key if you want

west dove
#

which is an issue

dapper copper
#

lemme check smthn rq

tidal idol
#

fun fact and slightly unrelated but the API technically supports multiple webhooks stare

jaunty plank
#

shh

#

;p

tidal idol
west dove
#

all it shows are algorithm, bot id and issued at timestamp

#

so yeah i wont probably get a token out of it from base64

west dove
#

But I'll still try though

jaunty plank
#

Yeah, try encoding it with base64

#

see what happens

dapper copper
#

mans the definition of if I can I will lol

#

nvm

#

nvm

west dove
#

also another thing like

#

the library for python is "topggpy" right?

#

I installed it with pip install topggpy and even after importing it, I get ModuleNotFoundError: No module named 'topggpy' ๐Ÿ˜”

distant stump
#

Ask them

gusty locust
#

if topggpy doesn't work then download from source

dapper copper
#

didnt null rewrite it

#

thats 4 years OOD

gusty locust
#

im not sure, this is where the docs take me

dapper copper
#

its in the works

#

god that was hard to find rofl

west dove
#

why is python so threw away man

#

all of the videos i see on youtube are about js

gusty locust
#

lot of discord.js tutorials -> newbie devs pick js -> js becomes the predominantly used lang

dapper copper
#

Python is simple but hard to master

#

JS is a mediocre starting lang but hella easy to master

west dove
#

js is pretty much confusing me

gusty locust
#

it doesnt help that discordpy's fate was unknown a long while back bc a new dev had to pick up taking care of the lib

dapper copper
#

it's personal preference at the end of the day tho

gusty locust
#

i personally prefer js just bc it was easy to pick up and just go go go

west dove
#

I'm really stuck here man and it's driving me crazy- just trying to make a simple command to check if a user has voted or not. even though there are no errors in VS, my terminal is going absolutely wild. here's the code:

topgg_client = topgg.DBLClient(bot, TOPGG_TOKEN)

@bot.tree.command(name="vote", description="A command that only works for users who voted.")
async def vote(interaction: discord.Interaction):
    user_id = interaction.user.id

    try:
        has_voted = await topgg_client.get_user_vote(user_id)
        
        if has_voted:
            await interaction.response.send_message("โœ… Thanks for voting! You can use this command.", ephemeral=True)
        else:
            await interaction.response.send_message(
                "โŒ You haven't voted yet!", ephemeral=True)
    
    except Exception as e:
        await interaction.response.send_message(f"โš ๏ธ Error checking votes: {e}", ephemeral=True)

just can't figure out what went wrong, any ideas? ๐Ÿ˜”