#topgg-api

1 messages · Page 2 of 1

broken latch
jaunty plank
#

yep

rain heart
#

:80 not being needed

#

as http is 80 by default

jaunty plank
#

should work either way

west shuttle
#

jes

rain heart
#

then the port is open, what happens when you try to access the same thing when your bot is running

#

aka start the bot, then go to http:// serverip:3000

west shuttle
#

got an result

rain heart
#

what exactly

summer nebula
#

fucking hell that fixed it

#

it is a valid URL

#

but i forgot the content type lol

rain heart
#

no I mean start your bot, then check the same page

#

stop the netcat

broken latch
west shuttle
rain heart
#

the netcat is still running is what I'm seeing

jaunty plank
west shuttle
#

i do it again

rain heart
#

do not run netcat

west shuttle
#

ok

rain heart
#

start your bot, then visit the page with the port your bot is using

west shuttle
#

unkown website

rain heart
#

are you sure the Webserver is running on the port? It would tell me it is not

west shuttle
rain heart
#

can't help much then, your server is reachable under the port but something within your code does not work

west shuttle
#

and what

rain heart
#

02Shrug dunno, add some debug lines along where you start the Webserver

west shuttle
#

öhm 👀

old kernel
#

504 Gateway Time-out

#

mean?

broken latch
#

@jaunty plank

hallow epoch
jaunty plank
#

you decide the authorization

hallow epoch
#

Ohh

#

So

#

It check that user is voted or not

#

Am I right?

jaunty plank
#

nope, it sends a webhook to you when someone voted. it doesnt check, it receives.

hallow epoch
#

Yes

#

Means from webhook i make check

#

For it

jaunty plank
broken latch
#

I've been dealing with this for 2 days. I don't know where is the error. i will die

jaunty plank
#

The error is on line 101, which seems to be code unrelated to the topgg api.
It's probably better to ask in #development, I don't know quickdb so I won't be much help.

broken latch
#

Okay

molten summit
#

hi,
how to hide Shards count?

rain heart
#

that's not possible if you've posted it once already, you can set it to 0 likely

rain heart
west shuttle
fluid venture
lyric mural
#

what endpoint should i use to get this username

lyric mural
#

{'error': 'Unauthorized'} , when i try get result in py

fluid venture
#

ur topgg bot token

lyric mural
#

o

#

but its working fine on web browser

fluid venture
#

yeah cuz u are loggedin on topgg

lyric mural
#

oo

coral arrow
#

I need help, i make my bot in bdfd, the bot always says i didn't vote even if i vote

coral arrow
#

Yes

restive otter
coral arrow
#

Yes

restive otter
#

Does it hv webhook set?

coral arrow
#

What's that?

#

@restive otter

jaunty plank
#

I'm not sure if bdfd supports webhooks

restive otter
jaunty plank
#

a quick glance of their docs it doesnt appear to support webhook listeners.

You'll likely need to use another service for your webhooks.

coral arrow
#

there are so many people that do rewards for voting in bdfd

#

but it doesn't work for me

#

the supporters from bdfd told me to ask here

jaunty plank
#

I wouldn't know how, unless bdfd supports normal javascript

restive otter
#

any way to find if user has voted server?

#

ik there is thing if voted bot, but i'm looking for server

#

ping me when u reply

jaunty plank
coral arrow
jaunty plank
#

yep, you can get stuff using the api. just not webhooks(afaik)

misty dove
#

Yo nothing is working...
Theres an error code in my browser when enter the webhook
405: Method Not Allowed

#

topggpy btw

coral arrow
#

@jaunty plank it works now

#

i needed bd script 2

jaunty plank
misty dove
#

hmm But when i click on Test nothing happens

jaunty plank
misty dove
#

yea

misty dove
#

ig that's not right what I am doing

jaunty plank
#

thats the url to your webhook listener, its typically something like
http://yourVPSIP:port/dblwebhook

misty dove
#

okay

#

how i get the port from my local machine

#

or must i do this on a server?

#

@jaunty plank

jaunty plank
#

If you want to do it from a local machine youll need to configure your router(which will depend on your router model) so that topgg can reach your webhook.

#

youll also need to provide your public ip, not the local one.

#

The port you set in code

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

Oh okay

verbal wyvern
#

how do I get the server count on my bot?

abstract mothBOT
#

@verbal wyvern

To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.

verbal wyvern
old kernel
#

after 1 hour

#

still error is showing

#
TopGGAPIError: 429 Too Many Requests
0|Bot  |     at Api._request (/home/ubuntu/bot/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
0|Bot  |     at runMicrotasks (<anonymous>)
0|Bot  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|Bot  |     at async Api.postStats (/home/ubuntu/bot/node_modules/@top-gg/sdk/dist/structs/Api.js:99:9)
0|Bot  |     at async Timeout._onTimeout (/home/ubuntu/bot/src/events/ready.js:19:9) {
0|Bot  |   response: Response {
0|Bot  |     size: 0,
0|Bot  |     timeout: 0,
0|Bot  |     [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
0|Bot  |     [Symbol(Response internals)]: {
0|Bot  |       url: 'https://top.gg/api/bots/stats',
0|Bot  |       status: 429,
0|Bot  |       statusText: 'Too Many Requests',
0|Bot  |       headers: [Headers],
0|Bot  |       counter: 0
0|Bot  |     }
0|Bot  |   }
0|Bot  | }
#

even i removed the part where bot sending much requests

restive otter
#

it doesnt show the correct server count on the bots page. is this a known issue?

thick cedar
#

How do i get api?

jaunty plank
tidal idol
# old kernel after 1 hour

Probably worth waiting longer, as Cloudflare will be the one rate limiting you and it can take up to 24 hours to clear up

jaunty plank
thick cedar
#

@jaunty plank so i have my token but i cannot edit the
{
"Authorization": "your-topgg-token-here"
}

#

What do i do here?

#

I cannot edit

jaunty plank
#

thats an authorization header, you set it when you send the http request.

restive otter
thick cedar
jaunty plank
#

what language?

thick cedar
jaunty plank
#

and what are you trying to do with the api?

thick cedar
thick cedar
jaunty plank
#

yep, that library is the official python library for the Topgg api.

thick cedar
#

Do i need to import topgg?

#

For that?

jaunty plank
jaunty plank
#

I'm not sure what you mean by that.

thick cedar
jaunty plank
#

the python library uses the api

thick cedar
#

ohk thank You

thick cedar
cunning citrus
#

how do i make a vote command
discordpy btw

#

wasnt there like a site where it explains?

#

im intending to make a vote command which gives back a message

rain heart
dawn oar
#

Hi

cunning citrus
fluid venture
agile quail
#

excuse me but was there some kind of unnanounced change to how stats are recieved?

#

System.FormatException: Cannot add value because header 'Authorization' does not support multiple values.

#

this is very recent

jaunty plank
# agile quail System.FormatException: Cannot add value because header 'Authorization' does not...

Are you using a topgg library? or making the request yourself?

is it possible you've set the authorization header multiple times?
https://stackoverflow.com/a/57744638

agile quail
jaunty plank
#

that error seems to happen before the request is even sent.

#

If you cant find where the header is being set twice you can remove the previous add.
request.Headers.Remove("Authorization");
and re-add it with
request.Headers.Add("Authorization", "Authorization Here");

jaunty plank
# agile quail

I'm not a c# dev so bare with me, but is _http.DefaultRequestHeaders.Add running every request?

#

from what I gather you're clearing the request headers but not the default headers.
If you're setting the default every time it feels like It'll error

#

(correct me if I'm wrong, I admit I might be)

agile quail
#

seems like im the idiot here

#

every time its run, it updates the existing http client service

#

and it doesnt like that, so for future people here, make sure to initialize a new client

#

or initialize it once in the constructor if that specific client isnt gonna be used anywhere else

jaunty salmon
#

@rough crater ^

wooden vale
#
    private readonly HttpClient _httpClient;

    public SomeClass(HttpClient httpClient)
    {
        _httpClient = httpClient;
        SetupHttpClient();
    }

    private void SetupHttpClient()
    {
        _httpClient.DefaultRequestHeaders.Accept.Clear();
        _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        _httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bot " + _botToken);
    }

I'd also make sure your registering it as an HttpClient and not a singleton or else.
services.AddHttpClient<ISomeClass, SomeClass>();

#

Calling this in constructor and running clear on each construct should ensure you're not duplicating header values. Unless you try registering that same header inside your function logic.

#

Reach out to me via DM if you need further assistance.

quiet harbor
wooden vale
#

A lot easier to test using something like Postman instead of writing code as well.

rain heart
#

the sdk is only usable for bots, you may need to create your own webhook handler for servers

wooden vale
rain heart
#

servers does not have an API like bots does

#

webhooks are a thing on servers but not a whole api

wooden vale
rain heart
#

no

#

an api is just not a thing on servers, only on bots

wooden vale
#

So member count for servers is just automatically queried?

rain heart
#

yes, that is fetched through @wild lantern

wooden vale
quiet harbor
#

Ah okay; I see. And as for posting webhooks upon receiving a vote?

rain heart
#

they're referring to webhooks though, not updating the member count

round salmon
#

can someone help me start with top.gg api

#

cant understand the docs of it

#

what shall i put in the webhook url

fluid venture
elder lotus
#

where i got api key?

#

or how do i get topgg token

rain heart
#

check the pinned messages

bitter maple
#

How can i log in my current user in top.gg?

tidal idol
bitter maple
tidal idol
bitter maple
torn vigil
#

Hi there, i wanted to send who voted my server on top.gg to my server
So, i just create a bot and use this code ( from top.gg docs )

#

Thank you ~

unique peak
#

are there any additional ways users can vote on a bot without going directly to the website? for example, can users vote using commands? or is going to the webpage and clicking 'vote' the only way to vote

dim kettle
#

There is no in discord method of doing it no. This is due to the risk of vote botting and other issues with tracking legitimate votes

unique peak
dim kettle
#

You can link directly to the vote page, but yeah thats the only way

austere portal
#

how can i get the api to see if the user voted for the bot?

jaunty plank
austere portal
dim kettle
jaunty plank
#

I cant even visit that site.
I'm not sure what that is but it doesn't seem from topgg

austere portal
#

There it said that this api checked if the user had voted for the bot

dim kettle
#

Yeah don’t use that. It’s not something we own at all

austere portal
#

Ok

#

Thenks

dim kettle
#

And the docs where linked by @jaunty plank above

austere portal
#

Ok

#

@jaunty plank

#

i wanted it to return if the user voted for the bot:
true or false

jaunty plank
#

Yep, it will return an object though, and using 0 or 1

{ voted: 1 }

vestal cypress
#

what do i set as a webhook url? i dont have a website and i just wanted to log when users vote :/

plucky lance
#

You don’t need a domain but at least need to provide the IP (and port) of your endpoint - a webserver listening for webhooks coming from topgg

jaunty plank
vestal cypress
#

hmm okay

#

can i put two ips then, because my development device is separate from the vps the public instance of my bot runs on

jaunty plank
#

We only accept one at a time.

vestal cypress
#

alright

jaunty plank
#

If you test from a device which isn't a server(in a datacenter) you'll most likly need to port forward

plucky lance
#

As well as adding a firewall rule to accept incoming requests on the port you specified

restive otter
#
TopGGAPIError: 504 Gateway Time-out
    at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Api.postStats (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:99:9) {
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
    [Symbol(Response internals)]: {
      url: 'https://top.gg/api/bots/stats',
      status: 504,
      statusText: 'Gateway Time-out',
      headers: [Headers],
      counter: 0
    }
  }
}
dim kettle
arctic rivet
#

How can I get the all votes of my bot? Using topgg api ?

rain heart
restive otter
dim kettle
# restive otter some times

If it still does not happen, you dont need to worry about it
The internet is unstable at times, so top.gg may be down, your hosting providers network may be having issues or a thousands of other reasons could cause that issue

stray saddle
#

No idea what I'm doing

jaunty plank
#

With the api or topgg webhooks?

stray saddle
#

Both lol

#

Just got approved

#

Where do I get started

#

I mean I have the docs

#

but idk what to do

#

Well I gtg

#

Just make sure to mention me or reply to me with mentions on and I will come back to the message later, thanks

#

I just am not understanding where I put the code on my end, what type of file, what I need/can edit, etc

stray saddle
jaunty plank
stray saddle
#

discord.js/javascript

#

server count

#

status

#

That sort of thing

jaunty plank
stray saddle
#

how can I post server count?

jaunty plank
stray saddle
#

alr

#

Lets see if I can't make this work

#

What is the webhook url on the website for?

stray saddle
jaunty plank
#

You've finished with the servercount?

stray saddle
#
const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

const webhook = new Topgg.Webhook("it is setup")

app.post("/dblwebhook", 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(80)
#

That is what I need, right

#

How do I get the webhook url

jaunty plank
#

If you are using webhooks yeah, but they are uneeded for server counts.

stray saddle
#

?

jaunty plank
#

Your webhook url will be the url to your code server(host)

stray saddle
#

oh

#

It is a local server

#

So how can I get around that

#

It doesn't have it's own public ip

jaunty plank
#

You'll need to port forward

stray saddle
#

I don't understand

jaunty plank
#

Your router needs to be told what local ip to send requests to(forwarding) when it gets a request on a specific port.

stray saddle
#

Oh

jaunty plank
#

The process will depend on your router model

stray saddle
#

I am not going down that road

#

Not for the short term at least

#

Is that required for server counts?

jaunty plank
#

Nope, webhooks are entirely uneeded for server counts

stray saddle
#

Ok

#

how do I do strictly the server count

jaunty plank
stray saddle
# jaunty plank https://docs.top.gg/libraries/javascript/#posting-bot-stats
TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)
    at Api._request (/home/ubuntu/New-Bot/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Api.postStats (/home/ubuntu/New-Bot/node_modules/@top-gg/sdk/dist/structs/Api.js:99:9) {
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
    [Symbol(Response internals)]: {
      url: 'https://top.gg/api/bots/stats',
      status: 401,
      statusText: 'Unauthorized',
      headers: [Headers],
      counter: 0
    }
  }
}


jaunty plank
#

Did you fill in your topgg token?

stray saddle
#

Yes

jaunty plank
#

Regenerate the token, refresh the page, then copy the token again

stray saddle
#

yup

#

gtg

#

Lets see

#

IT WORKED

#

ty bye

lyric mural
#

where can i get dbl token?

rain heart
#

read the pinned messages

dawn oar
#

How can I see my bot's server count on Top.gg

jaunty plank
dawn oar
#

I did not understand anything

#

int serverCount = ...; // the total amount of servers across all shards

api.setStats(serverCount);

#

is this coding?

#

please someone please explain it properly

solid imp
dawn oar
#

is it possible to do it from phone

#

?

fluid venture
#

💀

solid imp
dawn oar
#

can you please tell me step by step how to do it

solid imp
restive otter
#

giving me this error after installing the topgg exention

#

@queen solar ?

rain heart
#

doesnt seem like an error related to the package

#

which package have you installed

restive otter
#

pip install topggpy

rain heart
#

not from us

restive otter
#

it was working before it

rain heart
#

nevermind

#

thats from us

#

but that error doesnt seem to be related to topggpy

#

post your code and wait for someone who can help

restive otter
restive otter
#

that package deleted the discord,py

#

just needed to install it

#

well ty!

restive otter
#

What is dis

jaunty plank
#

This channel is for the topgg 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
#

Contains a mysql password

#

please reset thank you

restive otter
#

i did

#
Traceback (most recent call last):
  File "C:/Users/psstu/PycharmProjects/Astra-redesign/main.py", line 63, in <module>
    bot.topggpy = topgg.DBLClient(bot, dbl_token)
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\topgg\client.py", line 98, in __init__
    self.http = HTTPClient(token, loop=self.loop, session=kwargs.get("session"))
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\topgg\http.py", line 84, in __init__
    self.session = kwargs.get("session") or aiohttp.ClientSession(loop=self.loop)
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\aiohttp\client.py", line 227, in __init__
    loop = get_running_loop(loop)
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\aiohttp\helpers.py", line 289, in get_running_loop
    if not loop.is_running():
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\discord\client.py", line 110, 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
Exception ignored in: <function ClientSession.__del__ at 0x000002575AF45280>
Traceback (most recent call last):
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\aiohttp\client.py", line 336, in __del__
    if not self.closed:
  File "C:\Users\psstu\Astra-redesign\lib\site-packages\aiohttp\client.py", line 986, in closed
    return self._connector is None or self._connector.closed
AttributeError: 'ClientSession' object has no attribute '_connector'```
rain heart
#

still contains your mysql credentials

restive otter
#

damn wait i'm lost

rain heart
#

your code has your mysql credentials within it

restive otter
#

here

left thunder
#

@rain heartbruh yk how to make a upvote log?

abstract mothBOT
#

@left thunder

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

left thunder
restive otter
left thunder
#

huh

left thunder
solid imp
left thunder
#

like isnt there a walk through or smth

#

im from what i see its more js supporting

solid imp
left thunder
#

wheres this information coming from? like where do i get it?

jaunty plank
jaunty plank
#

you are the one who decides the value of those two parameters, its not something you "get" from somewhere

left thunder
#

also, this is my current code, is there anything else i need?

dbl_token = "my token"
bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)


@bot.event
async def on_autopost_success(ctx):
  channel = bot.guild.get_channel(1007425782592831559) 
  await channel.send(f"Posted server count ({bot.topggpy.guild_count}), shard count ({bot.shard_count})")


bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")


bot.topgg_webhook.run(5000)


@bot.event
async def on_dbl_vote(data):
    if data["type"] == "test":
        return bot.dispatch("dbl_test", data)
    channel = bot.guild.get_channel(1007425782592831559)
    await channel.send(f"Received a vote:\n{data}")


@bot.event
async def on_dbl_test(data):
    channel = bot.guild.get_channel(1007425782592831559)
    await channel.send(f"Received a test vote:\n{data}")
left thunder
#

or like, a password i can make up

jaunty plank
#

yep, you're the server when hosting webhooks; you're the one who gets to decide the token.

left thunder
#

so what about the dbl webhook?

#

whats that about?

jaunty plank
#

thats the path for your webhook url

left thunder
#

so could it be smth like

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "Jalalala")
jaunty plank
#

yourwebhookURL/path

left thunder
jaunty plank
#

do you mean discord server? 👀
because topgg webhooks are not discord webhooks. they do not work together

left thunder
#

so the webhooks are from topgg?

#

right here? how do i create one?

jaunty plank
left thunder
jaunty plank
left thunder
#

so a webhook listener, that means its waiting for a webhook

#

where is that webhook coming from then?

left thunder
jaunty plank
#

a webhook url

#

not a webhook

left thunder
#

from where?

#

where is the webhook url coming from

#

am i creating one from my discord server?

jaunty plank
#

its the url to the server your code is being hosted on(a vps, a dedicated server, replit, heroku, etc)

jaunty plank
left thunder
#

im so confused, im hosting on replit atm, what where do i get this url?

jaunty plank
#

it will be yourrepliturl/dblwebhook

left thunder
#

like this?
https://Truth-Bot.bradymc222.repl.co/dblwebhook

jaunty plank
#

I have never used replit, so I'm not sure how they work.
If that's what the docs say then it should work

left thunder
#

bruh

#

i dont get it

#

your jumping all over the place

jaunty plank
#

I'm only answering your questions.

left thunder
jaunty plank
#

the url gets filled in on the website

left thunder
#

so the code or the website?

#

and u still havent told me if Jalala could be an example of a password

#

mhh, what do i do here?

arctic rivet
#

If you want to use topgg with dpy you need to use topgg rest api with aiohttp sessions

arctic rivet
left thunder
#

thats why im asking for an example

arctic rivet
#

That's it

left thunder
#

well then ig i dont, i dont remember using aiohttp

arctic rivet
#

Then make a predecate ( is_voted ) or whatever and pass the predecate in commands.check

left thunder
#

how do i do it

#

can u walk me through when u get the time?

arctic rivet
#

Example

#

Read it and do it

#

It's really 10 lines of code

left thunder
#

but ill read it again and see if i can grasp it

arctic rivet
#

👍

left thunder
arctic rivet
left thunder
arctic rivet
left thunder
arctic rivet
left thunder
#

who said anything about what ur saying

#

im asking u whats that doing

rain heart
arctic rivet
#

It's not sessions

left thunder
left thunder
restive otter
#

how is it that someone voted my bot multiple times but does not get fetched in api.hasVoted?

rain heart
#

wdym voted multiple times

#

you can only vote once every 12 hours

#

have you made sure retrial doesn't occur? check the docs

restive otter
#

i think so

rain heart
#

check that first

merry vapor
#

Question, can we get an API downtime role too?
So it'll be separated from website downtimes?

solid imp
solid imp
#

Np

dawn oar
#

I want to see the server number of my bot on top.gg site, how do I do it and is it possible from mobile?

#

Is it possible to do it from mobile?

solid imp
dawn oar
#

Where will I use that link after I've done all of them?

#

or where to send my request

#

?

solid imp
#

That should have all the necessary information that’s needed

dawn oar
#

from discord.ext import tasks

import topgg

This example uses tasks provided by discord.ext to create a task that posts guild count to Top.gg every 30 minutes.

` dbl_token = "Top.gg token" # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token)

@tasks.loop(minutes=30)
async def update_stats():
"""This function runs every 30 minutes to automatically update your server count."""
try:
await bot.topggpy.post_guild_count()
print(f"Posted server count ({bot.topggpy.guild_count})")
except Exception as e:
print(f"Failed to post server count\n{e.class.name}: {e}")

update_stats.start() `

#

do i do this code? number of servers

dawn oar
#

that's not my bot in the picture
I want it to be like in this picture, let it show the number of servers there

#

I don't know English well and I understand something you wrote thanks to the translation. I'm sorry to bother you but you don't give detailed explanations

solid imp
dawn oar
#

tell me how to do it from mobile

solid imp
cedar widget
#

can someone drop an example url to update the server count ?

rain heart
#

just read

cedar widget
#

just to be honest with you, those docs don't explain much to people who are still learning new stuff, as for my question, i found the solution, it's as simple as:
make an api post with your api token in the headers and {server_count: number} as the body.
i hope someone will find this a bit useful, thanks for the support 😄

jaunty plank
#

I might be a bit harsh here, but its documentation for an API not a guide.

its not supposed to teach you how to use an API, thousands of other amazing resources exist for that purpose.

rain heart
#

the general assumption for an API documentation is:

  • you know how to work with your programming language
  • you have previously done requests
  • you understand documentation

an API documentation is not a ground up thing for "setup your environment, install requests, use https://example.com, you see the response xyz

strange thorn
#

so many bug fixes and updates but still can't leave a team on top.gg

#

either remove that feature or fix it

rain heart
#

on the team under "settings"

#

also -api

#

-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.

strange thorn
#

@rain heart you there?

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.

strange thorn
rain heart
strange thorn
#

as if I didn't

#

but they said they can't fix it soon neither they can give an eta

odd iron
#

Sorry if this is silly, but I am very new to this

odd iron
#

huh?

#

sry, I know nothing about top.gg

solid imp
odd iron
#

I didn't even make a bot to publish it on top.gg

solid imp
#

the top.gg api is accessible only by the bots which have been approved on the site!

#

i'd suggest you to read the article above for more clarity about that!

odd iron
#

oh, sorry, then I should stop thinking about the api start making a bot

#

and get to know about top.gg first of all

solid imp
odd iron
solid imp
#

anything in general which is related to code. It could be a discord bot as well dblSmile

odd iron
#

ok, for not only discord bots, but also other development related topics too

solid imp
#

correct!

odd iron
#

Just red the topic of that channel

#

and found it

finite shell
#

How to know if someone voted in python?

#

@solid imp

#

Sorry for ping

solid imp
abstract mothBOT
#

@finite shell

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

finite shell
#

Im new to toogg

#

Oh

#

Wow i was looking for voter only cmdd

#

Lemme read

finite shell
#

I made it myself

#

Yeee

#

🔥 🔥 ✅

solid imp
#

Nice!

urban tangle
#

Why does const { AutoPoster } = require('topgg-autoposter') not work in js for me?

jaunty plank
#

what do you mean "not work"

urban tangle
#

I get this error ReferenceError: require is not defined in ES module scope, you can use import instead This file is being treated as an ES module because it has a '.js' file extension

jaunty plank
#

are you using modules?

urban tangle
#

Yes

jaunty plank
#

you cant use require in modules, you must use import

urban tangle
#

So what would be the correct way to import it?

#

ive tried import AutoPoster from 'topgg-autoposter'

jaunty plank
#

yep

urban tangle
#

It just made the whole script a loop tho

#

The script runs forever with many errors

jaunty plank
#

the autoposter is a loop.
or more specifically an interval

urban tangle
#

TypeError: AutoPoster is not a function

#

thats the full error

#

WAIT

#

NVM

#

I forgot to add the token

#

That didnt fix it

jaunty plank
#

I think it might be

import { AutoPoster } from "topgg-autoposter";
urban tangle
#

Ok

#

Thats it! Thanks!

#

That looks good

#

Does it take some time to show on the website?

viscid citrus
#

yes, wait sometime

abstract mothBOT
#

The issue you're experiencing is due to server-side caching. Please wait for up to 1 hour for site cache to clear before trying again. You may also need to clear your browser cache.

dawn oar
#

Why is my top.gg bot token not showing up?

solid imp
abstract mothBOT
#

@dawn oar

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

torpid sparrow
#

where can i find the webhook and password

#

got it

#

but password?

rain heart
#

is something you define yourself

#

has to match the authorization field in the webhook settings on top.gg

torpid sparrow
solid imp
dawn oar
#

Will I send files about my bot's server number? and where do i send it

torpid sparrow
abstract mothBOT
#

@dawn oar

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

solid imp
#

If I recall correctly, top.gg will send the same payload for both events to the same url
You don’t have to have 2 different routes

torpid sparrow
torpid sparrow
jaunty plank
#

@torpid sparrow
For your question in #general
The python library has two events, one for real votes and one for test votes

torpid sparrow
#

yup

jaunty plank
#

If you only get a response on real votes you're likely not using the test endpoint

torpid sparrow
jaunty plank
#

And nothing is logging in your console?

torpid sparrow
#

yup

jaunty plank
#

But the real vote event works?

torpid sparrow
#

ye

jaunty plank
#

It might be you need to refresh if you haven't tried that

torpid sparrow
torpid sparrow
jaunty plank
#

Refresh the page on topgg

torpid sparrow
#

i added / in front of actual webhook url

#

cuz my bot wasnt starting without /

#

sorry if i sound silly i never used webhooks before :/

jaunty plank
#

if you're receiving real votes your url settings should be fine.

torpid sparrow
jaunty plank
#

🤔 so its possible everything is working fine just print isnt?

#

I dont know python so I cant help debug printing issues.

torpid sparrow
#

🤷‍♂️

#

no wait

#

print isnt broken

#

ig the event isnt triggered

torpid sparrow
jaunty plank
#

sure, but on_dbl_vote is firing but not printing

jaunty plank
jaunty plank
#

then where are you doing it from?

#

you cant have topgg send webhooks to multiple locations

torpid sparrow
#

its same webhook-

torpid sparrow
#

the webhook is same though

jaunty plank
torpid sparrow
#

yes

torpid sparrow
#

not to the dedicated bot server

jaunty plank
#

not your channel, the server your codes running on

#

then how would your code receive the webhook?

torpid sparrow
#

I-

#

uh i guess to need to learn more about webhooks

jaunty plank
# torpid sparrow doing it here https://i.imgur.com/QQ5mhIS.png

no problem, they are pretty simple.

All they are is sending an http request to a server listening for a webhook.
They are like a website for server to server communication.
When you go to a website like https://top.gg you are saying "hey site at top.gg I want to visit you!". webhooks are essentially the same thing.

so for example
topgg gets a vote -> topgg sends a request to your code at your "site" -> your code processes it.

right now with the url you've filled in its going to this site, and they are forwarding it to discord.

elfin iris
#

hello guys need help i want create vote require command how i can create this command

jaunty plank
elfin iris
#

i just find that

const Topgg = require("@top-gg/sdk")
client.topgg = new Topgg.Api("")
torpid sparrow
jaunty plank
#

you'll need to code that yourself.
My recommendation is use webhooks and store votes in your database, then check your database when someone tries to use the command.

jaunty plank
proud cloud
jaunty plank
#

replit/vps/home/heroku/etc

torpid sparrow
#

oh

solid imp
abstract mothBOT
#

@elfin iris

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

elfin iris
#

how i can get AuthToken

#
const webhook = new Webhook('YourAuthToken')
solid imp
elfin iris
#

what i add here when someone use require vote command

const lastVote = db.get(<User>.id.toString())
#

i Mean db.get

solid imp
#

the logic is, you save the user id and the timestamp into your db. upon using a command, you see if they have voted, i.e the saved timestamp and the current time do not differ by 12/24 hours. if it exceeds it, they need to vote in order to use it else they don't need to

#

the pinned messages should have more info

elfin iris
torpid sparrow
#

when using in python, we have to add / to start, will it be then /http://yourip:port/path?

#

is this correct? cuz im not getting test/vote events

rain heart
#

it is not

#

the code is wrong, it should not be the full url

#

only the path/context

graceful surge
#

hello, may I ask what to do 'cause the bot will just automatically leaves the server? after I invited

rain heart
elfin iris
#

i have question how i can add code when someone vote my bot and bot dm user who voted and thanks him

rain heart
#

the bot itself, no

#

it can only reward a role

#

you'll need a different bot for that, use top.gg to look one up

modest ledge
#

@rain heart sir my bot is not approved yet and how long will it take?

rain heart
rain heart
#

how would eval help there

quiet pendant
#

Hey guys

#

Why am I getting this err ?

honest turtle
mint finch
#

Yeah Its a network error

plucky pilot
#

hello, is the top.gg webhook only available for Upvote event? it doesn't seem able to send data when someone posted a review.

mint finch
plucky pilot
mint finch
#

Well

#

Theyre still working on the V1 docs

rain heart
#

aswell as the v1 itself

mint finch
#

yes

plucky pilot
#

got it. thanks! 🙂

stable bay
#

so how i setup webhook logging for bot without using @top-gg/sdk like using webhook-topgg.com but wanna send username of voter not wanna mention voter

tidal idol
tidal idol
thorn vector
#

Is there any way to request server information or will that be in v1

rain heart
#

might be something in v1

#

but as of now no

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rain heart
#

no

scarlet cobalt
#

One message removed from a suspended account.

jaunty plank
#

I dont think v1 is entirely planned yet. so neither can be properly answered.

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

jaunty plank
#

that section on v1 has been in the docs for pretty much 2 years iirc.
so itll probably be awhile anyway

mint finch
#

Damn

plucky pilot
#

is there an API to get data of written reviews and ratings on a specific bot?

mint finch
#

just make your own api to do that

#

using http requests

#

js const data = await fetch("site.com").then(res => res)

plucky pilot
#

do you mean, I should scrape the data from top.gg site?

mint finch
#

kinda, although Idk if its allowed

dense cloud
#

umm

#

doesn't work at all

#
@commands.Cog.listener("ready")
    async def on_ready(self):
        client = self.client
        webhook_manager = topgg.WebhookManager().set_data(client).endpoint(self.endpoint)
        dblclient = topgg.DBLClient("[TOKEN]").set_data(client)
        dblclient.default_bot_id = client.user.id
        if not webhook_manager.is_running:
            await webhook_manager.start(8000)

    @topgg.endpoint("/dblwebhook", topgg.WebhookType.BOT, "youshallnotpass")
    async def endpoint(vote_data: topgg.BotVoteData, client: discord.Client = topgg.data(discord.Client)) -> None:
        print("Received a vote!", vote_data)
#

I voted and it didn't print out anything

rain heart
#

have you set that for a bot or a server

dense cloud
#

bot

rain heart
#

And the bot is approved too?

dense cloud
#

yes

mint finch
#

they don't have the role?

rain heart
#

Have you set the webhook url within the bot page settings?

dense cloud
rain heart
mint finch
rain heart
#

That needs to be done too

dense cloud
#

what to set there?

rain heart
#

The url of your webhook and the authorization

dense cloud
#

how to get Ek_Hmm

#

@rain heart ?

rain heart
#

http://yourwebserver:webport/path

dense cloud
#

hm?

mint finch
#

You have to create a web server and host it basically, if I'm right

dense cloud
rain heart
#

the web server is essentially the code above

#

you just need to add the url to the bot page settings

dense cloud
rain heart
#

ip is the server running the application, port is the webhook port, path is the endpoint essentially

#

read the code you've made and you should understand it a bit more

dense cloud
#

lemme try

#

k ty

mint finch
rain heart
#

no

#

localhost is not something you can reach out to through the internet

mint finch
#

yeah

#

okay got it thanks

rain heart
mint finch
#

Localhost is hosted on your pc and only you can visit it, 127.blahblah is something that anyone on your wifi can visit, that's what I know

dense cloud
#

what if I hosted it on VPS?

mint finch
#

https://vpsurl:port that works for my vps

dense cloud
mint finch
#

You can try it

plucky lance
mint finch
#

Okay...

plucky lance
#

Or you won’t receive any request as it ends in a verification error

mint finch
#

Yeah

#

Just use http instead if you don't have a SSL certificate

restive otter
#

Hello, i edited the webhook for my bot on topgg but i cant click on save

restive otter
#

is there any reason, why my test vote dont work?

#

in my code, i set the right port and on the web, the right io

#

ip*

restive otter
#

Does anyone know why this happens when i test the webhook?

#

Code:

#

Error:

restive otter
#

how do i do that this dont display?

restive otter
#

Hm i guess i fixxed but why does this warning happen?

#

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f0a6ffc1510>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f0a6ec282e0>, 5597643.094051545)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f0a6ffc1390>

#

it happens when i use on_dbl_vote often

#

Code:

#
@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    try:
        bot.topggpy = topgg.DBLClient(bot, dbl_token)
        if data["type"] == "test":
            user = bot.get_user(int(data["user"]))
            guild = bot.get_guild(811730903482761246)
            data2 = await bot.topggpy.get_bot_info()
            votes = int(data2["monthly_points"])
            channel = guild.get_channel(840666055777058836)
            astra = bot.get_user(int(data['bot']))
            embed = discord.Embed(title="Test Vote successfull ", description=f"![vote](https://cdn.discordapp.com/emojis/901962581760159744.webp?size=128 "vote") ``{user}({user.id})`` voted up for {astra}\nNow we have ``{votes}`` votes in this month.\n\nYou can vote **[here](https://top.gg/bot/811733599509544962/vote)** every 12 hours.", colour=discord.Colour.red(), timestamp=discord.utils.utcnow())
            embed.set_thumbnail(url="https://media.discordapp.net/attachments/813029623277158420/901963417223573524/Idee_2_blau.jpg")
            embed.set_footer(text="Thank you for your Support", icon_url="https://media.discordapp.net/attachments/813029623277158420/901963417223573524/Idee_2_blau.jpg")
            msg = await channel.send(embed=embed)
            heart = bot.get_emoji(841215892137574410)
            await msg.add_reaction(heart)
            return bot.dispatch('dbl_test', data)
        votedata = await bot.topggpy.get_bot_info()
        votechannel = bot.get_channel(904384880064999424)
        heart = bot.get_emoji(841215892137574410)
        votes = int(votedata["monthly_points"])
        user = bot.get_user(int(data["user"]))
        guild = bot.get_guild(811730903482761246)
        channel = guild.get_channel(840666055777058836)
        astra = bot.get_user(int(data['bot']))
        embed = discord.Embed(title="Thank you for voting for Astra", description=f"![vote](https://cdn.discordapp.com/emojis/901962581760159744.webp?size=128 "vote") ``{user}({user.id})`` voted up for {astra}\nNow we have ``{votes}`` votes in this month.\n\nYou can vote **[here](https://top.gg/bot/811733599509544962/vote)** every 12 hours.", colour=discord.Colour.blue(), timestamp=discord.utils.utcnow())
        embed.set_thumbnail(url="https://media.discordapp.net/attachments/813029623277158420/901963417223573524/Idee_2_blau.jpg")
        embed.set_footer(text="Thank you for your Support", icon_url="https://media.discordapp.net/attachments/813029623277158420/901963417223573524/Idee_2_blau.jpg")
        await votechannel.edit(name=f"👍| Upvotes: {votes}")
        msg = await channel.send(embed=embed)
        await msg.add_reaction(heart)
    except:
        pass```
exotic salmon
#

im new to this, so i may be confused alot.
Im using integromat/make for the webhook, i put in the url and authorization, everything works fine it sends a message to a channel in my server,
but I want it to send a message to the user who voted, and do other things like give the user a reward for voting, instead of sending the message to a certain channel in a server and doing nothing else

rain heart
#

then you will need to make your own webhook, integromat will not support that

exotic salmon
rain heart
#

fetch the user from the id provided by the webhook, fetch the user through your corresponding library, then use the corresponding libraries methods to send a direct message

exotic salmon
jaunty plank
exotic salmon
jaunty plank
#

Topgg sends webhooks to your webhook listener that you'll need to add to your code

exotic salmon
jaunty plank
#

It can be any path you want as long as it's the same path you use in your url

#

The url will depend on your hosting method

#

Vps/dedicated server/replit/heroku

exotic salmon
jaunty plank
#

afaik ec2 provides an ip?
http://yourEC2IP:port/path

exotic salmon
jaunty plank
#

Probably the public ip, but it might be auto-assigned.
I dont use ec2 so I'm not sure how ips are handled.

You won't want to share ports with multiple seperate services.

Yeah the path doesn't really matter.

/dblwebhook will be fine if you just want to use that.

exotic salmon
compact meteor
#

will there webhook callback for review?

rain heart
#

likely not anytime soon

misty dove
#

Whats the best way to make a revote message?

rain heart
#

take advantage of the query param

misty dove
#

I found nothing should i add a sleep event?

brazen zephyr
#

Hey, how can i trigger a test vote?

jaunty plank
#

Its on your bots edit page in the webhook section

brazen zephyr
#

thanks

restive otter
#

My bot is not showing in top.gg search.

#

Its been 2 days of being approved.

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
restive otter
rain heart
tidal sonnet
#

why api is not working i provided right key

#

<@&817055174613794826>

solid imp
rustic pollen
jaunty plank
#

are you possibly running this on a test bot but using the topgg token of the main bot?

long furnace
#

with the topgg-autoposter npm module it says "any other client" however it also refers to a djs sharding manager. Is this the required/recommended case or can we just send it on the first shard instead for example.

jaunty plank
#

That explains the issue.
The token only gives access for one bot, trying to send another bots info won't work.

long furnace
#

Yeah for some reason im getting a 403 even though I am parsing the correct authorisation header

#

axios.post('https://top.gg/bot/(mybotid)/stats ',{server_count: 5000, shard_count: 5}, {headers: {"Authorization": process.env.TOP_GG_TOKEN}})

(just testing it out)

#

In the error response I can see my headers are correct

#

I am using the correct id just to clear that one up

long furnace
#

<@&817055174613794826> (not sure if I am allowed to ping but) any clue why this might be happening?

jaunty plank
long furnace
#

Done and tried that

#

(same result)

rain heart
#

pass the token directly, there had been users who were using env variables and these where invalid

long furnace
#

I mean that can't be the issue because in the error I can see the token is in the headers

rain heart
#

just try passing it directly

#

otherwise go to the webhook settings again, press regenerate, refresh the page and use that new token

restive otter
autumn marsh
#
const TOP_GG = new TOP_GG_API.Api("token");
await TOP_GG.postStats({
    serverCount: client.guilds.size,
    shardCount: 0,
  });```
Error: Missing Server Count
rain heart
#

what package are you using

#

also no need to ping unrelated staff members, just ask and be patient

autumn marsh
silver bolt
#
const app = express()

const webhook = new Topgg.Webhook("")

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

app.listen(80)

Hey. I'm attempting to use topgg sdk but I am getting cannot read properties of undefined reading 'webhook', I am using the example from the documentation.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

silver bolt
#

well it errors before listening to the port

#
const webhook = new Topgg.Webhook("")
                          ^
TypeError: Cannot read properties of undefined (reading 'Webhook')

Even with a port change.

#

Fixed it. Import was wrong 🙂

pulsar tree
#

Two things, 1: is there a way that I can see failed webhook attempts and what response that my server sent and 2: is the data that I receive JSON data in the request?

chilly terrace
#

-api

solid imp
pulsar tree
solid imp
#

all good!

pulsar tree
#

Is it common for Top.gg not to consistently send webhooks? We have had several occasions now where votes do not reach our server. Occasionally we will get one and it will work but we have started to log each "access attempt" which is what has led us to see the inconsistency.

jaunty steppe
#

Is there a way to get the current ratelimits for * and /bots/*? I thought it'd be included in headers but that seems to be only when its ratelimited

rain heart
#

is there a reason why you'd want to get the current ratelimits?

rain heart
#

note that just because 2 votes were added during Friday to Sunday, it is currently double vote weekend

jaunty plank
pulsar tree
jaunty plank
#

where did you get notified about the two votes that had their webhooks missed though?

#

did a user tell you? did you vote and it not get received?

heavy cosmos
#

anyone know how to post guild count with pycord?

#

halp 😭

jaunty plank
heavy cosmos
#

tried it, doesn't work with pycord I believe? due to breaking changes

#

will try again though 👍🏾

#

thank you!

#

ok I can confirm that it doesn't work with pycord

#

is there anyway to just send HTTP requests instead of using topggpy? it seems to depend on discord.py

twin portal
heavy cosmos
#
url = "https://top.gg/api/bots/804445656088576002/stats"
payload = {"server_count": str(len(bot.guilds))}
headers = {"Authorization": TOPGG_TOKEN}
r = requests.post(url, data=payload, headers=headers)
#

would something like that work ^

twin portal
#

it should

heavy cosmos
#

ok thanks!

fading meteor
#

Guys

#

I’m back with the milk

#

🥛

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.

jaunty steppe
# rain heart is there a reason why you'd want to get the current ratelimits?

Sorry for the late reply
I'm just thinking along the lines of persistence. my library doesn't save the current ratelimit anywhere so if it happens to get reloaded (e.g. the process restarts), the internal ratelimiter then assumes the current bucket is at 0 requestes and whatnot, which will results in hard limits being hit eventually
Its more convenience than anything but yk, I can live without it 😅

twin walrus
#

whats the use of topgg-autoposter package?

solid imp
twin walrus
#

is there any example of making vote rewards using api? lol the pinned msg was funny it doesn't helped me actually

solid imp
astral spear
#

what am I doing wrong (just doesnt do anything)

#

I have got the link and the auth on the website saved and when I press send test it does nothing

#

@rain heart soz 4 ping but pls help

rain heart
#

It does not support discord webhooks

#

read the docs again, cannot help with technical stuff right now

astral spear
#

<@&817055174613794826> 🙏

#

@solid imp help me ur a good lawyer

solid imp
#

pasting a discord webhook url there will make top.gg attempt to send a post request to that url and discord would simply ignore it

astral spear
#

what URL shall I put there?

solid imp
#

the url to your express sever

#

note that localhost won’t work, to test it out before rolling out to production, use something like ngrok

astral spear
solid imp
jaunty plank
#

@restive otter
hey, did you add webhook listening to your code?

restive otter
#

it's just that it does not execute as my votes are bugged

#

i asekd 5 people to vote for my bot in screenshare, and the vote counter didnt go up

#

after like 30 days it went up by 1

jaunty plank
#

the vote counter can take a few hours to go up after a vote.
every month the vote count resets, so after 30 days it going up by 1 would be someone else voting

#

did you configure your bots webhook url to a non discord webhook(ie one to your bots host)

pulsar tree
jaunty plank
#

I dont think I've had this issue tbh.
I run a site which hosts vote webhooks for other peoples bots/servers. It currently handles around 900 servers and bots listed on topgg. I dont think ive had a single missed vote in a few months.

pulsar tree
# jaunty plank but you've received some votes? just not a few?

We have recieved some but it is very hit or miss and we don't know if it ourside or top.ggs side or DNS, cloudflare, etc. We have stuff that logs every attempt made to the server and have seen where top.gg is either not sending them or they are not delivered to us. Cloudflare is not showing us anything helpful either. Hence why I am here. If you have any ideas, let me know and I will track them down and test them.

jaunty plank
#

You mentioned cloudflare, are your webhooks configured correctly on cloudflare?

cloudflares default settings are intended for use for websites, not webhooks. so a lot of settings could be blocking topgg's servers from reaching your webhook.

rain heart
#

most anomalies I've encountered happening are between topgg and your server behind Cloudflare. Make sure Cloudflare is properly setup

#

perhaps try setting up a quick web worker with logging to ensure it is sent correctly

#

also to ensure: is it occurring during the weekend? I'm referring to the double votes eeeken

#

weekend

pulsar tree
jaunty plank
#

in my case, I added a WAF rule allowing the topgg ip(https://docs.top.gg/resources/webhooks/#security)
disabled bot fight mode on the webhook path
disabled integrity checks on the webhook path
lowered the security level on the webhook path

and probably a few other things
(the above things are things I changed, these may not apply to you. make sure you understand what you're disabling if you modify any of your CF security settings).

#

What you need to disable will depend on your sites cloudflare configuration.

if you have other security features enabled on your domain you may need to disable them for your webhook path.

#

Like you said Cloudflare has a ton of options and settings, so many we probably are not the best ones to ask. Especially since these are Cloudflare security settings its probably better to ask their support, or community.

twin walrus
#

how do i send the vote message to a discord channel using webhook?

restive otter
#

how often should u update bot stats

As i dont see my server count on my page after running this script for 48h
And before that for 1 month (for no shards)

rain heart
#

per docs, the ratelimit is 60/Minute, globally 100/second

You wont need to post it more than once in an hour or so, maybe every 12 hours

#

not getting any errors within your code either? Can you confirm that everything there is indeed executed?

#

Yeah it seems like it never posted stats at all

restive otter
rain heart
#

what is params before sending it

restive otter
#

how can i get my dbl token ?

rain heart
#

read the pinned messages

rain heart
#

-m @tulip atlas

abstract mothBOT
#

upvote Mate2014#2839 was successfully muted

cedar saddle
#

Hi, i've send my stats by api for the first time but i get this:

It won't update please help

#

<@&817055174613794826> help

#

seems like it appears

solid imp
cedar saddle
#

ok ty

distant wedge
#
var botStats = {
    server_count: client.guilds.cache.size
};

let TPGTokenHeader = {
    headers: {
        'Content-Type': 'application/json',
        'Authorization': process.env.TPGToken
    }
};

axios.post(process.env.TPGURL, botStats, TPGTokenHeader).then((res) => {
    console.log(`Stats posted to top.gg!\nHTTP Status: ${res.status + " " + res.statusText}`);
});
#

i get a 401 or 403

#

what am i doing wrong

#

and i've checked the token and url multiple times they're correct, even tried directly using them instead of environment variables

#

nvm i somehow fixed it

#

actually it sometimes POSTs successfully sometimes returns 401/403 without any code change wtfBacon

unique ruin
#

how to reset authorisation token of webhook, it's showing error when I'm using @waxen widgetgg/sdk for webhook server, it shows invalid token, though it's the correct one

rain heart
#

regenerate it using the link on the webhook section, refresh the page and the token that is there is the new one

#

note that the first part of it will be similar

rain heart
#

-wrongserver

abstract mothBOT
#

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

distant wedge
distant wedge
#

:\

#

dunno why

cedar saddle
#

a

restive otter
#

I know this isn't an official Top.GG thing, but it is closely connected to it so.. has anyone else had problems using: https://github.com/Hopeful-Developers/topggwebhooks4j

It works perfectly for me for a few days, then it stops working until I restart my bot and then it works perfectly fine again. Is there a solution for this that anyone is aware of other than restarting my bot every other day?

rain heart
#

that's made by me, elaborate what stops working

#

it should work fine without restarting at all

restive otter
#

It will work for the first few days, registering voting events.

#

Then at some point after that it stops registering them until I restart the bot (then it works perfectly fine again).

#

It didn't always used to do this either. This is a recent development of the last few months (I just haven't had time to address it till now). It used to work perfectly fine the whole time. I could easily believe it was something on my end, I just cannot imagine what would cause this issue so I was curious if anyone else had insight into this.

limber otter
#

Hey, I'm following the top-gg/sdk docs but haven't been able to successfully communicate with the webhook

const Topgg = require('@top-gg/sdk');
const express = require('express');

const app = express();
const webhook = new Topgg.Webhook('');

app.post('/dblwebhook', webhook.listener((vote) => {
  console.log('Voted!');
}));

app.listen(3000);

I'm not using an auth for this test and my webhook URL is set as: http://xx.xx.xx.xx:3000/dblwebhook

What am I missing? I've tried this both from my vps using its IPv4

jaunty plank
#

Are you using your vps's public ip? not internal.

Do you have any firewalls on?
It might need an authorization, I've never tested with none used.

limber otter
#

I've tested it both with and without auth.
The vps indicates that there's no firewalls.
The IP is the same one I ssh to.
(I'm using Vultr vps)

#

I've also tried both the test button and an actual vote

#

Now I'm scouring through past questions to see if there's any help. I'm fairly lost at this point

jaunty plank
#

If you put your webhook url in your browser do you get a
"Cannot get /dblwebhook" error?

limber otter
#

No I don't
I'm think this has to be a firewall issue

jaunty plank
limber otter
#

Thanks, I've been messing with it to see if I can get anything

limber otter
rain heart
restive otter
#

Alright

#

I’ll let you know how it goes.

cedar saddle
#

help, i'm sendding server stats each 30 seconds but i have that

#

<@&817055174613794826>

golden adder
#

You're being rate limited

#

Only send stats every 30 minutes to an hour

cedar saddle
distant wedge
#

well I've set it up to send stats on every guild join/leave and every member join/leave

#

would that be fine

solid imp
#

send stats every 30mins to 1 hour like mac mentioned!

distant wedge
#

ok np sure

solid imp
#

@jaunty plank

ember void
#

Hello guys i just update the API and now im getting this ?

TypeError: Cannot read properties of undefined (reading 'split')
    at toIdentifier (/root/white3/node_modules/toidentifier/index.js:26:6)
    at forEachCode (/root/white3/node_modules/@top-gg/sdk/node_modules/http-errors/index.js:245:16)
    at Array.forEach (<anonymous>)
    at populateConstructorExports (/root/white3/node_modules/@top-gg/sdk/node_modules/http-errors/index.js:243:9)
    at Object.<anonymous> (/root/white3/node_modules/@top-gg/sdk/node_modules/http-errors/index.js:30:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)

bugs? or my fault?

restive otter
solid imp
solid imp
#

@limber edge you can get the last 1000 votes for your bot using the endpoint listed here https://docs.top.gg/api/bot/#last-1000-votes, however if you bot receives more than 1000 per month, you need to implement your own caching method

Top.gg documentation

API resource for a bots or apps on a platform like Discord

limber edge
#

ah I see, thank you

ember void
solid imp
rain heart
#

white3 is causing the issue

#

whatever that is

ember void
#

I downgraded @top-gg/sdk 3.1.4 to 3.1.0 and I don't have the bug anymore...

languid ibex
#

Anyone else having issues with top-gg java-sdk v2.1.2 to update their server stats?

gray juniper
#

hello im new to this server and i was wondering how to set up my bot to dm a user if they have voted for it on top.gg

#

if anyone could help get me started, that would be greatly appreciated

abstract mothBOT
#

@gray juniper

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

gray juniper
#

im guessing its this one @solid imp right

solid imp
#

correct

gray juniper
#

ok coolio thx

gray juniper
solid imp
# gray juniper ok coolio thx

if you just want to dm users upon voting, you likely do not have to save anything. You will receive the discord user ID of the person who voted as a webhook payload from top.gg

solid imp
gray juniper
languid ibex
solid imp
gray juniper
#

but i do know js

#

so i could convert it manually

#

maybe

solid imp
gray juniper
#

how do i set up a webhook

solid imp
gray juniper
solid imp
#

gotta be a bit more specific, the resources should cover everything

gray juniper
#

where do we find the ports for it