#topgg-api

1 messages · Page 10 of 1

runic creek
#

On this page you can use a discord webhook to send messages to the channel when someone votes

rugged gorge
#

you can do that by creating express server in your vps/bot then your bot will gonna send vote message wherever you want

tidal idol
#

you cannot receive review notifications however

rugged gorge
dim wolf
#

hi

rugged gorge
#

Soon i gonna code public npm package for this vote thing completely

tidal idol
#

there already is a public one

#

and a new official one too

pliant flicker
dire pecan
#

Hey ! I tryed to add the topgg libs in my discord.py bot.
I tried 2 way to do (The github example and another from ||chatGPT 😓 ||). But one give this error :

Traceback (most recent call last):
  File "C:\Users\noanh\OneDrive\Documents\Github\Altium\main.py", line 36, in <module>
    dblclient = topgg.DBLClient("TOKEN").set_data(client)
                                ^^^^^^^
TypeError: DBLClient.__init__() missing 1 required positional argument: 'token'

And the other said "there is no asynchronous loop"

Here's my actual code :

intents = discord.Intents.all()
client = Altium(intents=intents)

dblclient = topgg.DBLClient("TOKEN").set_data(client)
```this one give me the error ine the top
#

Mention me for infos

lucid nova
#

there example code in there

dire pecan
dire pecan
#

But it doesn't work for me

lucid nova
dire pecan
#

It's to hide it

lucid nova
#

also your code does not look similar to this(what I circled in red is where the token should be):

#

but im also not a pro at this so only guessing

dire pecan
#
My_Guild = discord.Object(id=Guild)

class Altium(commands.Bot):
    def __init__(self, *, intents: discord.Intents):
        super().__init__(command_prefix=Prefix, intents=intents)

    async def setup_hook(self):
        for filename in os.listdir('cogs'):
            if filename.endswith('.py'):
                await client.load_extension(f'cogs.{filename[:-3]}')
        for filename in os.listdir('event'):
            if filename.endswith('.py'):
                await client.load_extension(f'event.{filename[:-3]}')
        for filename in os.listdir('tasks'):
            if filename.endswith('.py'):
                await client.load_extension(f'tasks.{filename[:-3]}')

intents = discord.Intents.all()
client = Altium(intents=intents)
dblclient = topgg.DBLClient(dblToken, client)

client.run(Token)
#

This is my code

#

And I got this error :

Traceback (most recent call last):
  File "C:\Users\noanh\OneDrive\Documents\Github\Altium\main.py", line 36, in <module>
    dblclient = topgg.DBLClient(client, dblToken)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\noanh\AppData\Roaming\Python\Python311\site-packages\topgg\client.py", line 98, in __init__
    self.http = HTTPClient(token, loop=self.loop, session=kwargs.get("session"))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\noanh\AppData\Roaming\Python\Python311\site-packages\topgg\http.py", line 84, in __init__
    self.session = kwargs.get("session") or aiohttp.ClientSession(loop=self.loop)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\noanh\AppData\Roaming\Python\Python311\site-packages\aiohttp\client.py", line 228, in __init__
    loop = get_running_loop(loop)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\noanh\AppData\Roaming\Python\Python311\site-packages\aiohttp\helpers.py", line 289, in get_running_loop
    if not loop.is_running():
           ^^^^^^^^^^^^^^^
  File "C:\Users\noanh\AppData\Roaming\Python\Python311\site-packages\discord\client.py", line 108, in __getattr__
    raise AttributeError(msg)
AttributeError: loop attribute cannot be accessed in non-async contexts. Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook
lucid nova
#

@dire pecan this is what my code look like right now:

#

the logger stuff put info in a file for logs but is not needed

dire pecan
lucid nova
dire pecan
#

my bad maybe 😅

lucid nova
#

do you have ports open?

dire pecan
#

Don't know

#

How do I do an "test" vote ?

jaunty plank
#

On the page you added your webhook url there's a test button

dire pecan
#

Is that possible to do it without webhook ?

#

I give up

jaunty plank
green flame
#

hey, so i got a positive post but it doesnt seem to update on the site

#

how long does it usualy take?

jaunty plank
restive otter
#

Ty

vestal jackal
#

I don't see a java vote event/webhook thing. hampter

jaunty plank
vestal jackal
#

Ok.

untold ferry
#

I have this code for topggpy and I am not getting anything on test votes or user votes.

# bot stuff
# Installed topggpy
import topgg
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "(retracted)")

# The port must be a number between 1024 and 49151.
client.topgg_webhook.run(25509) # Pterodactyl server port

@client.event
async def on_dbl_vote(data):
    print(data)
    user_id = data['user']
    guild_id = data['guild']
    role_id = # Retracted  # Replace with the ID of the role to give

    guild = client.get_guild(int(guild_id))
    user = guild.get_member(int(user_id))
    role = guild.get_role(role_id)

    if guild is not None and user is not None and role is not None:
        await user.add_roles(role)
        await user.send(f"Thank you for voting! You received the {role.name} role.")

I am using Pterodactyl as my host, and idk what to set as my the Webhook URL on the bot's webhook top.gg page, aka what to post to. This is what I currently have it set to (domain retracted): http://hosting.example.com/dblwebhook. I assume this is wrong.

#

Please ping on response

jaunty plank
untold ferry
jaunty plank
#

http://SERVERIP:PORT/PATH

http://SERVERIP:25509/dblwebhook in the code example you provided

untold ferry
#

oh ok

jaunty plank
#

make sure not to add https:// just http://

https requires a domain

untold ferry
#

k

#

yeah still didnt work

jaunty plank
#

are you on a shared IP?

untold ferry
#

no

#

its a domain

#

not an ip

#

the HOSTNAME in the network tab shows a url

#

the network tab ^

#

i updated the webhook url on the top.gg page to this and it still doens't work
http://hosting.example.com:25509/dblwebhook

jaunty plank
#

👀 it might be https since its a domain

untold ferry
#

oh

#

still doesn't work

#

ill ask the host if its an ip

green flame
restive otter
#

Yoo

golden stratus
#

How do I receive the name of those who voted for my bot, given that the hosting where I host my bot does not have a fixed ip?

rain heart
#

using webhooks, that is your only way

safe flicker
#

can I check every time a user runs a command which requires a vote, the api? or is it more practical to store the user who voted for 12h and check everytime he runs a command once every 12h

restive otter
safe flicker
#

okay

sick rune
#

Invalid vote webhook request. Missing userId.
Is this normal for the webhook test or should it provide a userid?

sick rune
#

nvm

#

problem was I need to use user

safe flicker
#

how frequently do I need to post bot serverstats to the api?

rain heart
#

every hour is probably the best

safe flicker
#

this is fine right?

module.exports = (botID, serverCount) => {
    const token = process.env.TOPGGTOKEN;

    const data = {
        server_count: serverCount,
    };

    axios
        .post(`https://top.gg/api/bots/${botID}/stats`, data, {
            headers: {
                Authorization: token,
            },
        })
        .then(() => {
            console.log('Stats updated successfully');
        })
        .catch((error) => {
            console.error('Failed to update stats:', error.message);
        });
};
cron.schedule('0 0 * * *', () => {
            bot.logger.log(`Updating TopGG Servercount: ${bot.guilds.cache.size}`);
            updateStats(bot.user.id, bot.guilds.cache.size);
        });
rain heart
#

every day

#

sure thats fine

mellow crescent
#

hello, i have a error but i don't understand can you help me?

mellow crescent
#

.....

green flame
#

hey, so i got a positive to my POST request but it doesn't seem to update on the site

jaunty plank
mellow crescent
jaunty plank
mellow crescent
#

so how should i do it? ?

green flame
jaunty plank
jaunty plank
green flame
jaunty plank
green flame
mellow crescent
jaunty plank
# mellow crescent sorry but i don't enderstand

👀 I wish I could explain better, but I don't use python.

It can go into the setup hook(discordpy docs cover this) or inside another async context.
iirc discordpy provides async decorators

green flame
#

but how come i cant edit my bot manualy tho

rain heart
#

Should be through the edit button

green flame
rain heart
#

Can you drop your bot id in here

mellow crescent
green flame
jaunty plank
rain heart
#

Nah it's your patreon button

#

It's adding js, causing cloudflare to block it

green flame
#

oh ok

#

ill remove it

rain heart
#

Yeah that's the bug woo was referring to, that doesn't work atm

#

So just empty that field

green flame
#

ok works thanks ❤️

jaunty plank
#

anyone who knows asyncio can help give, most people in the discordpy support server should be able to help

#

Or looking into setup hook, or any discordpy decorators.

jaunty plank
#

I dont have it, iirc its on the docs

mellow crescent
#

ok

green flame
#

How do I make my navbar respond on mobile devices💀

rain heart
#

You can use js in iframes, but no you can't use any js at all in your description otherwise

limber otter
#

I'm using the topgg-autoposter (with sharding) but for some reason it only posts updates to the topgg-api when I start the bot. I don't have any errors logged and haven't made any changes to its implementation in my bot recently. Has anyone else run into this issue or know of a solution?

safe flicker
#

why aint this updating the details on my botpage?

module.exports = async (botID, serverCount) => {
    const token = process.env.TOPGGTOKEN;

    const data = {
        server_count: serverCount,
    };

    axios
        .post(`https://top.gg/api/bots/${botID}/stats`, data, {
            headers: {
                Authorization: token,
            },
        })
        .then(() => {
            console.log('Stats updated successfully');
        })
        .catch((error) => {
            console.error('Failed to update stats:', error.message);
        });
};

I only see the "prefix"-detail on my botpage

rain heart
#

Provide a content-type of JSON too

safe flicker
#

okay i will try

#

Failed to update stats: Request failed with status code 403

rain heart
#

How did you provide the header

#

Show you updated code

safe flicker
#
axios
        .post(`https://top.gg/api/bots/${botID}/stats`, data, {
            headers: {
                Authorization: token,
                'content-type': 'application/json',
            },
        })
        .then(() => {
            console.log('Stats updated successfully');
        })
        .catch((error) => {
            console.error('Failed to update stats:', error.message);
        });
rain heart
#

Case-sensitive iirc

#

Content-Type

safe flicker
#

okay
still same error

hearty lintel
#

just console.log it to make sure it exists

#

you can also do a quick test and do

curl https://top.gg/api/bots/123 -H "Authorization: abc"```
and replace abc with your token
#

it should say "Not found"

safe flicker
#

{"error":"Not Found"}

hearty lintel
#

than your token is correct

#

console.log the env variable to makes ure its there and defined

safe flicker
#

it is

#

i even reset my token on the website

hearty lintel
#

the token is valid

#

hm

#

well you can also be doubly sure and use the official top.gg sdk

#

easier that way

safe flicker
#

how often does it update the stats?

hearty lintel
#

topgg-autoposter?

safe flicker
#

yes

hearty lintel
#

it defaults to every 30 mins which is the suggested interval

safe flicker
#

okay I will try that then

#

and If I want to post the stats exactly at xx:30 and xx:00

#

omg I am just dumb..... I was testing this stuff out on my test bot and i used bot.user.id in the link to post the stats to.. no wonder it was giving me "access denied" LMFAO

rain heart
#

Shouldn't give you access denied tho lol

#

Just a 404

bright stag
#

does the server count update automatically after posting server count on my bot?

rain heart
#

Should be, plus minus some time for caching

bright stag
jaunty plank
bright stag
jaunty plank
#

You'll need a webhook url yes, one that points to the webserver you create in the example.

bright stag
#

Okay okay but that webhook url isn't necessarily connected to the one on the sample code right?

jaunty plank
#

The url you need will depend on your setup.

#

the top pin goes over it pretty well

bright stag
#

where can I get started on adding a webhook on my bot (4th point of top pin)

jaunty plank
# bright stag Do i need a webhook setup to run the example wehbook code on the python document...

This library does that

import topgg

# This example uses topggpy's webhook system.
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")

# The port must be a number between 1024 and 49151.
bot.topgg_webhook.run(5000)  # this method can be awaited as well


@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # `return await on_dbl_test(data)` in this case
        return bot.dispatch("dbl_test", data)

    print(f"Received a vote:\n{data}")


@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")

bot.topgg_webhook.run(5000)
starts a webserver on port 5000

bright stag
jaunty plank
#

Nothing "provides" a url.

A url just points to a location on the internet. In this case the url will depend on things like where you host your bot, if you are using a domain or direct ip, things like that.

It might help to take some time to look into what a url is, and how web requests/web servers work.

bright stag
#

well regardless, I tried the code on my bot, but it's not receiving the test vote

jaunty plank
#

Did you fill in the url and auth on your bots edit page in the webhook section?

jaunty plank
#

Not with a discord url

bright stag
#

the flask app nor ngrok is connected to my bot in any way

jaunty plank
#

You'd probably have to reach out to ngrok support to verify that is setup correctly before I can really offer much more support.

I have no way of validating/helping with ngrok setups

bright stag
#

Alright, anyway, does it need to be connected to my bot for the code above and the test vote to work?

jaunty plank
#

I dont believe so

#

I mean as long as the 'bot' argument is filled
topgg.WebhookManager(bot)

bright stag
narrow zenith
#

oops wrong channel

open nacelle
#

hello, just verified my bot today, implemented a reward-system for voting on top GG, and got this now

what could be happening?

tidal idol
#

what URL are you accessing

#

and what are you using to access the site, based on the IP there it seems to be a datacenter IP

rain heart
#

Shouldn't affect API endpoints though

#

IF using API endpoints

open nacelle
rain heart
#

Oh then you did actually get cloudflare ratelimited

#

Did you try to fetch that endpoint too many times?

open nacelle
#

@lean cliff

#

this is my dev, he'll know better how to explain things

lean cliff
#

Hello @rain heart , I'm responsible for the futverse bot, I recently had problems with rate limit and I wanted to see if there is the possibility of increasing the number of requests per hour of /votes.

open nacelle
#

we have an entertainment bot that really demands votes request, due to the vote-rewards system we implemented today

#

we need to fix this asap because we already announced this system to our playerbase and we're being questioned by our community

rain heart
#

Consider using webhooks if you have a larger volume on votes than said endpoint can handle on ratelimits

#

There are a lot of benefits on using webhooks than the /votes endpoint too: first of all not having to keep ratelimits in mind as top.gg is the one making requests to that, aswell as having every vote rather than the last 1000 ones

#

The only requirement is to keep track of the votes on your end

lean cliff
rain heart
#

Some libraries have support for these too

lean cliff
#

what values do i get in the webhook?
these?

  {
    "username": "Xetera",
    "id": "140862798832861184",
    "avatar": "a_1241439d430def25c100dd28add2d42f"
  }
#

or a list?

jaunty plank
lean cliff
jaunty plank
#

{
    "bot": string,
    "user": string,
    "type": "upvote" || "test",
    "isWeekend": boolean,
    "query": string
}

"user" contains the users ID

lean cliff
#

thanks

lean cliff
#

doing a test every 12 hours complicates :/

hushed acorn
#

like the webhook one

rain heart
#

Using the test button on that same page you set the webhook in

restive otter
#

is it possible to get vote notifications without using webhook

jaunty plank
restive otter
#

i see

#

is it possible to enable and disable the webhook

jaunty plank
#

I mean, you can disable it by editing the setting on top.gg to go to another url? or invalidate the auth?

small wraith
#

Somewhere in the pinned messages is a DC webhook

#

There you can enter your top.gg webhook and your discord webhook you can even customize the text

#

Like so

#

And then you can check for messages in the channel

restive otter
#

Ooh that’s smart thanks

icy aurora
restive otter
#

is there a total server votes option?

rain heart
restive otter
#

yea, i was just asking cause im using webhook-topgg from the pinned messages and it has a server total votes option so i wanted to ask.

rain heart
#

Might be tracked by the bot/website itself

restive otter
#

I see, thank you for answering!

jaunty plank
unkempt hill
#

I haven’t used the api for a while now, anyway to see if a new core happened and get the user id from it?

rain heart
#

core?

unkempt hill
unkempt hill
#

For here it’s the api core

hushed acorn
unkempt hill
hushed acorn
unkempt hill
#

Alright thanks

prime badger
#

Hello everyone, I've been exploring the Top.gg API and noticed there are two variables 'points' and 'monthlyPoints' associated with a bot. 'Points' seems to be the total number of upvotes a bot has ever received, and 'monthlyPoints' is apparently the number of upvotes a bot has received in the current month.

I'm curious, does anyone know the exact process of how these points are accumulated?

Any information or insights would be greatly appreciated. Thanks in advance! https://uploadi.ng/85cd2LH8

Mr_President_White

85cd2LH8.png | 5.74 KB | image | png | 25.06.2023

jaunty plank
prime badger
#

Ah ok thx

strange tangle
#

TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)

#

it updates still this error

#

randomly half of the time

#

please look into this

rain heart
#

Your token is invalid then, press regenerate, refresh the page, then use that token

#

The first part of the token is always the same

strange tangle
#

its correct how else would that happen then?

#

just randomly this error

errant canopy
#

@rain heart yes bro what is it's use?

rain heart
#

and wait for someone else who can help

errant canopy
#

Yeh randi ka baccha bkl gyab ho gya

rain heart
#

-m @errant canopy no need to be rude towards moderators because of that, thank you | 3 weeks

abstract mothBOT
#

upvote .piyush_xd#0 was successfully muted

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

is it ok to temporary put false server count. it will be a lower server count then what the current bot count is because i will be using a test bot that separe from the main bot.

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lucid nova
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lucid nova
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lucid nova
#

true

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

i guess

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.

#

One message removed from a suspended account.

lucid nova
#

i mean it only going to be temporary and when I'm done testing I'm going to re enable the main bot stats so it will go back

lucid nova
scarlet cobalt
#

One message removed from a suspended account.

lucid nova
scarlet cobalt
scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

would Xiuh know?

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.

lucid nova
#

also what is staff pick role

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lucid nova
#

let me guess someone hack this discord from one of the bots they picked or something along those line?

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

or did they just stop

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

ok

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

ok

scarlet cobalt
#

One message removed from a suspended account.

lucid nova
#

ok

lucid nova
#

don't need help anymore. figure it out.

misty valve
#

Hello, I am on your website to find the api, I just wanna ask
What is “yourbotid”?

onyx locust
#

The id of your bot

misty valve
#

the application id?

#

or the user id??

onyx locust
#

It’s the same

#

So you could use both

misty valve
#

ye ok

#

also

#

do i keep the “:” or remove it

scarlet cobalt
#

One message removed from a suspended account.

misty valve
scarlet cobalt
#

One message removed from a suspended account.

onyx locust
#

He meant the bot user id and the application id

misty valve
scarlet cobalt
#

One message removed from a suspended account.

misty valve
#

oh ok

scarlet cobalt
#

One message removed from a suspended account.

misty valve
onyx locust
#

Where?

misty valve
#

nvm

onyx locust
#

Alright 😄

misty valve
#

wait wtf

#

it just takes me to my bots edit page

#

?????

#

how do i get the api??

rain heart
misty valve
#

i do the first step - the url thing
but it takes me to my bots webhooks page

#

how do i get the api??

rain heart
#

???

#

Get the API what

misty valve
#

can i get the api or do i just have to use webhooks?

rain heart
#

You can use the API by getting a key under your webhook settings of your bot on top.gg

#

That is where you obtain your token to use the api

misty valve
#

oh ok

fair pine
#

I've checked the api , but Still getting erorr

  try {
    const response = await axios.get(`https://top.gg/api/bots/${client.user.id}/check`, {
      headers: {
        Authorization: TOPGG_API_KEY,
      },
      params: {
        userId,
      },
    });

    if (response.status === 200 && response.data.voted) {
      return true;
    } else {
      return false;
    }
  } catch (error) {
    console.error('Error checking top.gg vote:', error);
    throw error;
  }
}```



error
```Error checking top.gg vote: AxiosError: Request failed with status code 401```
rain heart
#

Ensure the header contentType is set too

fair pine
# rain heart Ensure the header contentType is set too

Nothing changed still getting that erorr

  try {
    const response = await axios.get(`https://top.gg/api/bots/${client.user.id}/check`, {
      headers: {
        Authorization: TOPGG_API_KEY,
        'Content-Type': 'application/json',
      },
      params: {
        userId: authorId,
      },
    });

    if (response.status === 200 && response.data.voted) {
      return true;
    } else {
      return false;
    }
  } catch (error) {
    console.error('Error checking top.gg vote:', error);
    throw error;
  }
}
rain heart
#

Then your token is invalid

#

Press regenerate, refresh the page, then copy the token there

#

Refreshing the page is required

fair pine
#

Ok

#

-_- Error checking top.gg vote: AxiosError: Request failed with status code 401

rain heart
#

Print out the headers, the content and the response entirely

#

Replace the token with just "token"

fair pine
# rain heart Print out the headers, the content and the response entirely
AxiosHeaders {
  date: Wed, 21 Jun 2023 06:43:29 GMT,
  content-type: application/json; charset=utf-8,
  content-length: 24,
  connection: close,
  access-control-allow-origin: *,
  access-control-allow-headers: Authorization,
  etag: W/"1-xewnavbar1/PADAS",
  set-cookie: [ ... ],
  cache-control: private,
  cf-cache-status: TONAHTE,
  strict-transport-security: max-age=2678400; includeSubDomains; preload,
  x-content-type-options: nosniff,
  server: cloudflare,
  alt-svc: h3-413=":443"; ma=86100
}```

```Top.gg Error Response Data:
{
  error: 'Unauthorized'
}

Error Response Status: 401

Error Response Full:
{
  status: 401,
  statusText: 'Unauthorized',
  headers: AxiosHeaders {
    date: Wed, 21 Jun 2023 20:13:29 GMT,
    content-type: application/json; charset=utf-8,
    content-length: 24,
    connection: close,
    access-control-allow-origin: *,
    access-control-allow-headers: Authorization,
    etag: W/"1-XPOV/My/PGA)/94/ST"",
    set-cookie: [ ... ],
    cache-control: private,
    cf-cache-status: DYNAMEC,
    strict-transport-security: max-age=15552000; includeSubDomains; preload,
    x-content-type-options: snift,
    server: cloudflare,
    cf-ray: 7descontosasor-BO
  }
}```
fair pine
rain heart
#

I need the request headers

#

Not the response

thorn estuary
#

ok

fair pine
#

Just deleted the bot from dev.portal freerealestate , 57 h wasted

rain heart
#

Lol

placid violet
#

I'm a bit confused on what /check?userId= is returning. Does it return voted:1 if you've voted in the last 12 hours, your total votes, vote streak? Not entirely sure what it's returning to use it properly and I couldn't find any information other than it shows if they voted.

#

I'd have to wait 12 hours to check to see if the number resets or goes up to 2

hushed acorn
placid violet
#

Thanks 👍

scarlet cobalt
#

One message removed from a suspended account.

dire pecan
#

Hello, I'm trying to do the on_dbl_vote event from the python libs.
But I don't understand nothing. When I just put all in my main, replacing all, An error show's up and tell me to put the topgg.WebhookManager in an setup_hook. I did, and now the dbl_web.run(5000) didn't work

jaunty plank
dire pecan
#

yes

#

I tried to put it in my setup_hook too

#

class Altium(commands.Bot):
    def __init__(self, *, intents: discord.Intents):
        super().__init__(command_prefix=Prefix, intents=intents)
        self.Token = Token

    async def setup_hook(self):
        self.dbl = topgg.DBLClient(self, Token)
        self.topgg_webhook = topgg.WebhookManager(self).dbl_webhook("","")
        self.topgg_webhook.run(5000)

@client.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        return client.dispatch("dbl_test", data)

    print(f"Received a vote:\n{data}")


@client.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")
dire pecan
lucid nova
# dire pecan Yes

have you try to put self.topgg_webhook.run(5000) in await? so like this await self.topgg_webhook.run(5000) idk if that will work tho

dire pecan
#

On the setup_hook ?

#

@lucid nova

lucid nova
# dire pecan On the setup_hook ?

yea like this:

async def setup_hook(self):
        self.dbl = topgg.DBLClient(self, Token)
        self.topgg_webhook = topgg.WebhookManager(self).dbl_webhook("","")
        await self.topgg_webhook.run(5000)
dire pecan
#

Gonna try

lucid nova
#

maybe keep the /

dire pecan
#

I reeplace this with the full link of a webhook

#

Is that bad ?

lucid nova
#

or is it maybe the token from top.gg website? 🤔

dire pecan
lucid nova
dire pecan
#

Got that

lucid nova
#

did you include the / in the beginning?

dire pecan
#

Bot is ready, no error showed up

#

gonna try

lucid nova
#

good!

dire pecan
#

I did this test one

#

but nothing appear in log

lucid nova
dire pecan
#

I think

lucid nova
#

or you could try the webhook token and not the top.gg token. like what battleless is saying

hushed acorn
#

if your running the bot on your home internet you likely need to do port forwarding

dire pecan
#

don't know what is this

hushed acorn
hushed acorn
dire pecan
#

And, how can I do that ?

hushed acorn
#

your routers control panel

lucid nova
hushed acorn
#

If you don’t want to do that you could always just create some mock data to test the code on. your VPS should have all ports forwarded, so it shouldn’t be an issue when you host it

#

that’s probably what I would do

dire pecan
#

Those are the only solutions ?

hushed acorn
#

what other solution would u like

dire pecan
#

All, if they don't involve my ports

hushed acorn
#

create mock data to test your code on

dire pecan
#

Is that the same for guild vote ?

hushed acorn
dire pecan
#

I need my ports forwarded

hushed acorn
#

they work in the same way

dire pecan
hushed acorn
dire pecan
# hushed acorn yes

Any others solution to just send a message with an webhook when the bot/guild is voted ?

hushed acorn
#

it's unofficial however it's made by a Top.gg moderator

dire pecan
#

thanks

dire pecan
#

Did the bump command still work on @wild lantern ?

hushed acorn
#

top.gg doesn't have a bump command, you can only vote on the website

dire pecan
#

Wasn't there one before? for guilds

hushed acorn
#

has never had one i think

dire pecan
#

I was sure there was one, I may be wrong on the platform

#

My bad

#

Was speaking of disboard

olive turtle
#

Can some1 help me? python

sand halo
#

How do I get my bots webhook?

tidal plover
#

https://top.gg/bot/BOT_ID/webhooks

little zinc
#

hi

tranquil pine
#

what is this??

restive otter
#

How do I know which url to provide for receiving webhook's data?

jaunty plank
upper granite
#

I made a significant pull request to the top.gg rust api, and it seems to have been ignored- do i need to do anything here?

rain heart
#

cc @woven coral since you're the maintainer seems like

tidal idol
#

nulls PRs are being ignored too KEKW

upper granite
#

what PRs

tidal idol
upper granite
#

oh it took two weeks

tidal idol
#

it takes quite a while why

#

anyways im getting off topic now

upper granite
#

The current state of the library is extremely worrying. No HTTP api library should directly use unsafe.

upper granite
restive otter
rain heart
#

a url can contain both of that

http://10.0.0.1:2020 for example

woven coral
#

so i can't approve it even if i wanted to

#

cc @upper granite

upper granite
woven coral
upper granite
#

i can remove the forbid directive

#

unwrap_unchecked is not something that should really ever be used

woven coral
#

not really tbh

#

for things like DateTime, in theory it should never errors as discord snowflakes are always valid UNIX timestamps

#

i'll further review your issues and pull requests later - it's still 6 am for me iara_yawn

#

your concerns are understandable though, thank you for bringing this up! iaraPat

upper granite
woven coral
#

an Undefined Behavior in this case is completely unlikely

upper granite
#

checks exist for a reason

woven coral
#

again - runtime checks are completely unnecessary here, unless discord API returns an invalid user ID for some reason, which is impossible

upper granite
#

in software, nothing is ever impossible

#

There is no reason to use unwrap_unchecked, because unwrap takes so few additional cycles, and it's just... better practice to halt and catch fire then to catch fire and hit someone's house
https://godbolt.org/z/ooczc6Yvb
godbolt example of how little code we are talking

#

from nomaxx117 (tokio core team):
I agree about #![forbid(unsafe)] being over-emphasized, but that is an unsafe function I almost categorically do not recommend using. It doesn't give you much performance (generally it gives you basically nothing, even in a hot loop) for the debuggability you lose, and if its enough of a hot loop that it makes any difference, then you probably should be writing your code a bit differently and not relying on option so much anyways.

upper granite
#

my philosophy on unsafe in rust is "use it if you have to, or if it's the only way to fix a performance issue"
I'm all for premature optimizations, but not unsafe ones.

woven coral
#

since currently i don't have commit/merge access and have to send pull requests to make changes (which is incredibly tedious)

#

cc @golden adder

echo sparrow
#

Hi, I would like to ask how can I make vote rewards so when someone vote for my bot, it gives him some rewards

Pls ping me

jaunty plank
#

re probably looking for webhooks

echo sparrow
#

Thx <3

echo sparrow
jaunty plank
#

Did you fill in :your-bot-id ?

#

You can also just go to your bots edit page, in the webhook section

echo sparrow
#

Oh

jaunty plank
#

Probably where it says :your-bot-id

#

^-^

echo sparrow
#

So in bot set up page, I am going to try

#

Actually in webhook page it does not require bot id, just webhook id so I will full fit it

jaunty plank
#

👀 what

echo sparrow
dark hare
#

Hi, when I vote for my server the vote count stays on 1. There were 4 votes in total a while ago and then the number reset for whatever reason. How to fix this?

rain heart
#

votes reset every month

#

voting once after the reset will roll back your votes to 1

dark hare
#

Ah okay

inner sage
rain heart
#

they do

inner sage
#

I haven't saw that before.

rain heart
#

larger bots just have reset votes barely noticed due to how many votes they're actually getting

inner sage
#

What about tacoshack?

rain heart
inner sage
#

👍

inner sage
high plinth
#

how to make my bot give coins to user if voted?

scarlet cobalt
#

One message removed from a suspended account.

high plinth
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rain heart
high plinth
rain heart
#

Yes, read the docs on how to use it

#

Especially the library section

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

rain heart
#

There's only this

restive otter
#

bruh what

austere jasper
#

How can I enable the display of the number of servers on the bot page?

rain heart
#

-servercount

abstract mothBOT
echo sparrow
#

Hi, I was following https://docs.top.gg/libraries/python/ and this happend to me: Traceback (most recent call last): File "/home/container/bot.py", line 37, in <module> bot.topggpy = topgg.DBLClient(bot, dbl_token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/topgg/client.py", line 98, in __init__ self.http = HTTPClient(token, loop=self.loop, session=kwargs.get("session")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/topgg/http.py", line 84, in __init__ self.session = kwargs.get("session") or aiohttp.ClientSession(loop=self.loop) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/aiohttp/client.py", line 228, in __init__ loop = get_running_loop(loop) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/aiohttp/helpers.py", line 289, in get_running_loop if not loop.is_running(): ^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/discord/client.py", line 140, in __getattr__ raise AttributeError(msg) AttributeError: loop attribute cannot be accessed in non-async contexts. Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook
Can someone help please?

Top.gg documentation

Top.gg Python library

restive otter
#

With what

#

If I may ask

runic creek
#

I guess he means AttributeError

echo sparrow
#

yeah

rain heart
#

it will remove it after 13

#

1 hour to allow the user to re-vote to keep the role

restive otter
#

-help

#

-botinfo 843829945662570557

#

-userinfo

rain heart
#

-botcommands @restive otter

abstract mothBOT
#

@restive otter

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.

green flame
#

does avatar support link or just the avatar string?

rain heart
#

What are you referring to

rain heart
#

Iirc that's the discord CDN

#

It's not hard at all to build that url yourself, just refer to discords docs on cdn avatars

green flame
#

this one

rain heart
#

That is the avatar hash yes

green flame
#

ok thx

rain heart
#

You need to build up the URL yourself, refer to above

green flame
#

wym build url yourself?

#

do i send the hash in the post or the url

rain heart
#

Are you trying to send the avatar of a user in a message?

green flame
#

no, was trying to update the avatar on top.gg using the api...

rain heart
#

That's not possible

#

The avatar is fetched from discord

green flame
rain heart
#

Correct

#

There is no post based endpoint to update a bots data on top.gg

green flame
#

only for servers and shards?

rain heart
#

Only for stats posting yes

green flame
#

oh ok thx

spring pebble
#

how do I perform a test vote? And what url do I put in here when I'm trying to test?

rain heart
#

your webserver that is able to receive requests

#

not a discord webhook

spring pebble
#

yes but I'm testing it locally

#

is there no way to test it locally?

#

and is there like a way to input a test vote?

rain heart
#

You might have seen webhooks mentioned in your apps' settings and wondered if they're something you should use. The answer, in a nutshell, is probably yes.
Webhooks are one way that apps can send automated messages or information to other apps. It's how PayPal tells your accounting app when your...

#

theres not no

#

there is the test button to make a test event

spring pebble
#

where? o.O

rain heart
#

but theres no way for you to test it locally, unless you're developing locally

spring pebble
#

I am developing it locally rn

#

I'd like to test if it works before pushing to production

rain heart
#

I meant remotely

#

not locally

spring pebble
#

oh I'm blind x.x

rain heart
#

you cannot provide something like localhost

spring pebble
#

ah alright guess I'll have to trust that my code works

rain heart
#

or just like, create a test app for the webhooks and test with that

jaunty plank
#

If you're just testing if the code works you can send a "fake" request using curl locally, or the postman client.

restive otter
#

Hi, how do I make a widget on top.gg?

#

like this

rain heart
spring pebble
#

What am I doing wrong here? The callback in webhook.listener isn't being called

  public setUpVotes() {
    const webhook = new Webhook(process.env.VOTE_AUTH);

    this.app.post(
      "/dblwebhook",
      webhook.listener(async (vote) => {
        // Doing stuff
      })
    );

    this.app.listen(3000);
    return this;
  }
rain heart
#

and MYIP is publicly accessible?

spring pebble
#

the MYIP is my vps's ip adress ofcourse

#

yeah

#

wait maybe the port isn't

#

how do I check if it's publicly accessible?

#

So I opened the port and when running netstat -na | grep :3000 and then pressing test vote I get this in the terminal:

POST /dblwebhook HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json
user-agent: Top.gg Webhook/1.0.0
Authorization: AUTH
Content-Length: 81
Host: IP
Connection: close

{"user":"259776081316282368","type":"test","query":"","bot":"425331296705708032"}

But it isn't being picked up by the express server, any idea why?

#

Anyone has an idea?

#

Please tag me if you do

spring pebble
woven coral
restive otter
#

how do i use the api without discord.py but with py-cord?

upper granite
woven coral
#

at this point i think the project is pretty much dead

upper granite
woven coral
upper granite
#

maybe we should fork

woven coral
#

way before i did

upper granite
#

ah

restive otter
mossy trail
#

how do i use it? is i am gonna look for authorization header and match the value?

mossy trail
#

i dont need topgg token for that right?

jaunty plank
#

No, its just an authorization header.

Whatever you put there will be the auth header sent in the request.

#

All you do is check if its the same one

rain heart
#

No

mossy trail
#

uh ;-;

#

awkward

mossy trail
#

Whats the endpoint for post_stats? Also may i know what headers / json i have to send while sending req to post_stats?

rain heart
#

Under the docs at API, is not hard at all to find

mossy trail
rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

mossy trail
#

um may i know why is it still showing my stats network is 0?

#

even tho i am updating my stats

restive otter
#

I want to ask if the TopGG API can only send requests to HTTPS URLs?

rain heart
#

are you referring to webhooks

#

if so, no it can also do towards http ones

restive otter
restive otter
mossy trail
stiff quiver
#
File "/home/container/247-casino-bot.py", line 89, in <module>
    CLIENT.topggpy = topgg.DBLClient(CLIENT, 'mytokenhere')
TypeError: __init__() takes 2 positional arguments but 3 were given``` hey why am i getting this error
#

im using py-cord

willow spindle
#

show code

pseudo locust
#

I cannot get a vote messages in my server channel. What did I miss??

jaunty plank
spark granite
jaunty plank
spark granite
#

is possible to check if the bot are online, or just the server_count?

jaunty plank
#

Our site has no access to that data.

#

Only bots that share a server with your bot can get online info.

mortal cloak
#

What is the bot stats update URI again? I forgor.

mortal cloak
dry dragon
#

Hi. I can't vote in karuta.

#

I heard china and indian users are in the blacklist.

#

But I live in Taiwan.

#

Can I verify my account?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dry dragon
#

Yup

scarlet cobalt
#

One message removed from a suspended account.

dry dragon
#

I'm sorry.

#

No one asnsered my question there.

scarlet cobalt
#

One message removed from a suspended account.

dry dragon
#

Okay. Ty

upper granite
grand finch
#

I am using python and i am unsure on how to use the topgg api. i am trying to create a vote message so that if a user votes for my bot, the bot DMs the user.

The problem i have i think is something to do with this:

topgg.DBLClient(bot=bot, token="TOKEN",autopost=False)

Error:

Unclosed client session
client_session: <aiohttp.Client.ClientSession object at ...>

This code is placed in the @faint geyserevent on_ready.
Do i have it in the wrong place?
Also is there a way to get a test vote?

upper granite
#

can i have the library dev role due to my open PR on the rust sdk

scarlet cobalt
#

One message removed from a suspended account.

upper granite
scarlet cobalt
#

One message removed from a suspended account.

upper granite
#

that’s not what topgg open source is for?

#

oh wait the open source contrib role, not the lib dev role

#

oops

scarlet cobalt
#

One message removed from a suspended account.

upper granite
#

bruh

tidal idol
#

the open source channel is dead anyways

random plank
#

i have a question how to see how many votes does a specific user have ?

  • OTHER then database does it automatically store in top.gg ?
rain heart
#

no

#

only by tracking it yourself

nova fox
#

Is there an api which i could use to see if the user has voted?

rain heart
nova fox
#

Why does the token have 2 "."

#

In between

#

Is it seperated

#

Should i use the first to Authorization header?

#

Or the whole?

#

I used the whole

#

Didnt seem to work-

rain heart
#

the whole

#

the whole token is the token

nova fox
#

Wondr why its saying unauthorized

rain heart
#

show your code, replace your token with token

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

warped sand
#

Hey! Could someone please send me a link to get my API key? 😁

rain heart
#

you need an approved bot

warped sand
#

Oh, okay

#

Thanks anyways 🙂

wild sedge
#

Is there a way to utilise top.gg to give a role to a user every time they vote and take it away when the vote cool-down has finished? (Python)

jaunty plank
wild sedge
jaunty plank
#

Yeah, you would receive a webhook request every time someone votes.

wild sedge
upper granite
scarlet cobalt
#

One message removed from a suspended account.

upper granite
#

a site powered by bots, which often use open-source tech to interface with it... which is utterly broken

woven coral
#

Mac has been ignoring my messages about the Rust SDK so i don't think we'll be getting one anytime soon considering how busy he is, i assume

woven coral
#

oh well, at least i got to make the Rust SDK fully working without any concerning bugs/vulnerabilities before the project died poggythumbsup

#

the library is still not perfect, yes, but i just don't care anymore honestly

upper granite
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

woven coral
#

read the message following that

upper granite
#

sigh

woven coral
scarlet cobalt
woven coral
scarlet cobalt
hearty lintel
upper granite
#

Yeah

woven coral
#

tokio native tls best rust http request library

#

i love doing things raw

scarlet cobalt
onyx locust
rose sierra
#

is it possible to retrieve the id of the user who voted up your bot?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rose sierra
scarlet cobalt
#

One message removed from a suspended account.

rose sierra
#

i can get the ID of the user voting
but for the purpose of my bot, the premium is tied to the guild the bot operates into

scarlet cobalt
#

One message removed from a suspended account.

tidal idol
#

top.gg lets you pass query params

scarlet cobalt
#

One message removed from a suspended account.

tidal idol
#

you could always pass the guild ID as a paramater

rose sierra
#

ah-a! that's what i was guessing

tidal idol
rose sierra
#

noice

tidal idol
rose sierra
#

nice pfp btw 😄

tidal idol
woven coral
unreal skiff
#

is there anyway I can fetch my bot's review from top.gg page ?

barren garnet
#

/help

odd ocean
coral flicker
#

Has the api been timing out recently?

tidal idol
#

website was down earlier so yes

coral flicker
empty moon
#

Is it possible to receive guild votes with a webhook?

runic creek
#

That's the only way to be honest

mortal cloak
#

i verified the requests are being made correctly

#

it's been like a week and they still arent showin up

icy aurora
#

You have to post them

mortal cloak
#

i am

#

:p

#

theyve been getting automatically posted for a week now

#

and they still dont show

icy aurora
#

what language are you using

mortal cloak
#

Go

icy aurora
#

try this

mortal cloak
#
data := fmt.Sprintf("{\"server_count\":%d}", len(s.State.Guilds))
request, err := http.NewRequest(http.MethodPost, TGGStatsURI, strings.NewReader(data))
if err != nil {
    fmt.Println(err)
    break
}
request.Header.Set("Authorization", auth)
_, err = http.DefaultClient.Do(request)
if err != nil {
    fmt.Println(err)
}
``` is what I'm doing
mortal cloak
#

even when I manually try to post the data

#

nothing happens

#

it doesnt return any errors

#

it gives me 200 wait

tidal idol
#

try going to "Edit Bot" -> "Save Changes"

#

that force refreshses cache

mortal cloak
tidal idol
#

awesome

mortal cloak
#

why wouldnt the refresh data button do it though

tidal idol
#

because that does not refresh cache for whatever reason

#

that just refreshes the data and stores in the DB, but it takes time to refresh cache

mortal cloak
#

wild

mortal cloak
#

time to force a certain big bun to rebuild a certain bot :)

#

hey bunnnnn :3

tidal idol
#

::uhh

mortal cloak
tidal idol
#

done

mortal cloak
#

ty bestie

barren garnet
wild linden
#

Hey guys, anybody able to help me with some top.gg API intergration. Looking to change the cooldown of a command, depending on if somebody has voted that day or not.

Bot's in discord.py, currently using hybrid commands, and handling command cooldown via built in method.

    @commands.hybrid_command(brief="Claim a random card for your collection.")
    @commands.cooldown(1, 600, commands.BucketType.user)```
jaunty plank
wild linden
rose sierra
#

cant find it in the docs, whats the url to give people to keep track which guild they'r voting for?

#

*the bot they'r voting for, and the guild they'r voting from

jaunty plank
rose sierra
jaunty plank
#

One way would be to fetch it when the webhook server starts. Every time you get a vote increase the counter by one.

That way you don't need to fetch it all the time, and don't have to store it in a database.

Sadly it's not something we send with the webhook. I do agree it would be a nice to have!

#

Might be a good suggestion for https://feedback.top.gg/

tidal idol
queen ore
#

So I was redirected here, and I would need help with using a webhook to send a message every time someone votes for my server. I don't have a bot (well, I do but through web builders), same with the website, so I don't have any hosting either. I'm green at this, and would appreciate any help

jaunty plank
restive otter
queen ore
inner sage
#

Can someone help me with updating my bot servet count on botghost?

icy aurora
inner sage
#

But I am in somehow.

inner sage
tidal idol
#

with 5 custom commands 👍

inner sage
#

Yeah.

#

I just got my thing, I think I can make this myself.

icy aurora
rain heart
#

we allow botghost, but as long as it has 5 custom commands and doesn't mention botghost on their description, as botghost is a competitor

icy aurora
inner sage
#

With making link.

icy aurora
inner sage
#

Because I failed 3 times.

inner sage
#

It seems useful.

restive otter
bright inlet
#

why isn't my bot's server count updated on top.gg?

tidal idol
#

you need to POST the server count with the API

#

or use a library for the language you use

bright inlet
tidal idol
#

for posting stas?

#

i highly recommend using the library

bright inlet
tidal idol
#

has code snippets on there

bright inlet
#

Thanks

bright inlet
tidal idol
#

it takes time for cache to clear

#

but you can speed it up by going to Edit Bot -> Save Changes (don't make any changes)

#

and give it a sec and it should show updated version

bright inlet
#

yes

#

Thanks

tidal idol
#

np

queen ore
restive otter
#

Ye?

queen ore
#

If I wanted to start writing (technically - rewrite) file bot, i.e. normally using Visual Studio Code, what would I need additionally (some libraries or something) and where I could host the bot (if possible, for free, at least just to test what I create)

restive otter
#

I host my bot on my phone lol

queen ore
tidal idol
#

the users endpoint is outdated

#

for example, still shows Xetera as admin and mod

#

and some mods as not mods

#

not that major of an issue, just wanted to put it out there lol

jaunty plank
#

👀

rain heart
#

I'm gonna make a really bold statement, might not reflect what's actually the case but

#

The user endpoints aren't getting updated internally

#

Because "Ae" is iirc what I had before being a bot reviewer at all

#

just an assumption

tidal idol
#

Yeah that’s what I thought

#

And they’re not really endpoints I can imagine people using?

#

Plus the docs are incorrectly showing socials in the response object

#

But that’s not in the real response

scarlet cobalt
rain heart
#

well I'm guessing for webhooks, though this would only benefit bots

inner sage
#

I ask again, can someone help me making bot servers count update command on botghost.

#

I need only link.

#

How to make?

#

Command itself I can make.

#

POST <link>.

rain heart
#

-servercount

abstract mothBOT
rain heart
#

the docs mention that

inner sage
rain heart
#

no clue what that means

#

I dont think you will get far with using the api at all with botghost

#

if at all

inner sage
#

It has post url and http headers.

#

https://top.gg/api/bots/:bot_id/stats/server_count

#

Is that wrong url?

rain heart
inner sage
#

I am not smart enough to build that link.

#

Url*.

inner sage
rain heart
#

its not hard to read the docs and combining that

base url: https://top.gg/api
what you wanna do: post stats
reading the second docs link will tell you that: https://top.gg/api/yourbotid/stats is where to make a POST request towards, with the post data server_count in json as the body

inner sage
#

Where I should put server count?

#

@rain heart

#

URL params?

#

It requires key and value.

tidal idol
#

request body

inner sage
#

Key and value?

#

Key server_count right?

#

@tidal idol

tidal idol
#

yes

inner sage
#

But value?

#

Sorry for ping @tidal idol .

#

But I need value.

tidal idol
#

value is your server count

#

server_count is the key, the value is your server count

inner sage
#

I should change that manually?

#

Ok, thank you very much!

#

@tidal idol Thanks, I just made smart auto event.

#

Bot joins new server and updates automatically.

silk patrol
#

Hello, please help, here is such a problem on your site, after adding the bot to the channel.

jaunty plank
subtle lotus
#

Alright, I'm stumped on why I'm not receiving any votes. In main.py i've got this event:

@client.event
async def on_dbl_vote(data):
    print(f"Received a vote:\n{data}")

And in vote.py i've made this function that is called after a couple things in on_ready in main.py -

async def init_topgg_client():
    post_stats = True if production_build else False
    client.topggpy = topgg.DBLClient(client, dbl_token, autopost=post_stats, post_shard_count=post_stats)
    client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
    client.topgg_webhook.run(5000)

The stats autopost fine, but sending a test vote does nothing. (webhook url being https://publicipv4:5000/dblwebhook)
Any ideas?

rain heart
#

do http instead

#

unlikely you have a https server running with the library

subtle lotus
#

Didn't change anything

rain heart
#

try visiting the url on your browser

subtle lotus
#

refused to connect

#

hmm

#

any way to print the url(s) it's listening to?

void dagger
#

Does the top.gg return when a user voted or just whether or not they voted

#

Because I'd rather not re-poll every few hours

idle seal
#

says im unauthorized

tidal idol
#

if you visit in your browser, you are logged into Top.gg

#

that is valid authorization

#

otherwise you need to pass your bots token

idle seal
#

is there a way to get the server count without authorization?

tidal idol
#

no

#

you already have an API key though

#

go to your bots edit page, go to "Webhooks" and your API key can be generated there

idle seal
#

but i cant just put it there. do i need to do some expressjs magic and create my own api?

tidal idol
#

no

#

are you trying to fetch the server count for your website?

idle seal
#

yes :)

tidal idol
#

i wouldn't use Top.gg API for that

#

how is your website built (framework, etc)

#

since you should probably find a way to get it from your bot

idle seal
#

like discordjs

tidal idol
#

your website though

idle seal
#

oh um. its just html

tidal idol
#

i would recommend for the time being just putting an estimated server count

#

since being 100% accurate is probably not necessary

hollow willow
#

what's the time period of the individual user vote endpoint

rain heart
#

12 hours

vocal aspen
#

For Upvote

rain heart
#

cant help with that

rain heart
#

sure then wait someone who can help

vocal aspen
#

Ok

jaunty plank
#

I'm probably not going to have time to help you from start to finish tonight.

icy aurora
north osprey
#

Why does the python sdk still installs discord.py even if its not in the github requirements?

rain heart
#

it shouldn't per the requirements.txt yeah

north osprey
#

Yea it still does, thats weird. And I installed a fresh bot with py-cord no other lib that probably need discord.py

rain heart
north osprey
raven creek
#

I try to reset my token, but nothing changes even after I refresh the page

rain heart
#

The first part of the token is always the same, just regenerate, refresh the page then copy the token

#

Also remember to set the content type to json

raven creek
rain heart
#

no

raven creek
#

I fixed it though, it was an issue with my topgg_api url ig

rain heart
#

set the content-type sending it

#

oh well

slim falcon
#

is there still a function in the javascript library that can return whether a user has voted the bot, like in the old wrapper dblapi.js?

#

does dblapi.js still work? altho apparently its not been maintained for 3 yrs

rain heart
#

DBLapi is long deprecated

#

Check the docs on the new one

slim falcon
#

is the only way to retrieve user voted information by setting up the webhook?

rain heart
#

Knowing the point they voted at, yes

slim falcon
#

but what if i dont care abt when they voted

rain heart
#

If they voted, no, use the API check endpoint

slim falcon
#

just whether they did or not

#

i couldn't locate info on this within the javascript library

rain heart
#

Which Library

slim falcon
#

@top-gg/sdk