#topgg-api

1 messages · Page 173 of 1

molten ginkgo
#

ight thx

slow bear
#

is that normal to receive GET query instead of POST query when a user vote using webhook ?

#

i've made some tests and your system reach my endpoint using GET instead of POST, but on the website it's clearly mentioned it should be POST 🤔

We will attempt to perform a POST request to this URL when sending you webhook data.
here's two entries logs
2021-11-09T17:35:18.165042+00:00 heroku[router]: at=info method=GET path="/" host=.......wumpus.bot request_id=e5f2ba9c-3cf0-45aa-b2d7-d9e036f7677f fwd="ips" dyno=web.1 connect=0ms service=5ms status=404 bytes=383 protocol=http
2021-11-09T17:35:24.045957+00:00 heroku[router]: at=info method=GET path="/" host=.......wumpus.bot request_id=46db4d48-5dbe-4d89-9763-29c9de94efbd fwd="ips" dyno=web.1 connect=0ms service=2ms status=404 bytes=383 protocol=http
Only your website know my endpoint, then I don't really understand what's going on 🤔

jaunty plank
rain heart
#

A short list of what would cause get requests:

  • a crawler going through your domains
  • you opening the link in your browser
  • you sending it through discord (embedding fetches the link, refer to crawler above)
  • a user accidentally visiting your voting endpoint

Top.gg does not make get requests, the only requests it makes are POST ones, so compare the ips the request came from

onyx cloud
#

Howdy, my Bot is currently experiencing a "401" error when trying to use the top.gg api

plucky lance
#

Make sure to send the authorization within the header

#

You can find an example in the docs

lost crane
#

Does anyone know why when i make a request to top.gg's API it gives me an error with "Authorization is an illegal HTTP header"?

jaunty plank
lost crane
plucky lance
#

You got an error log and code snipped to be able figure it out?

hollow owl
rain heart
#

DiscordBotListAPI#getBot(String id)

#

is your bet

forest trench
#

Can I get the number of votes my bot has?

mild elk
#

who pinged me ?

lapis totem
#

hi, how can i do to have my discordbotlist token ?

plucky lance
#

You can only generate a token if you got an approved bot on topgg

tidal idol
lapis totem
#

okay

#

thanks

slow bear
#

There's a reason to not receive the user tag along the user ID from the webhook query ?

rain heart
#

because you can fetch that user from the top.gg api afterwards

slow bear
#

sounds weird to me but ok, i'll fetch your API 😅

old marlin
#

Hey. I wanna use the Topggpy Library but I need a dblwebhook and password...where can I get this?

tidal idol
#

leave it as dblwebhook

#

password is just something you set

#

and then make sure you have the same password set on the webhook authantication field

old marlin
#

ah. But i tryed to upvote the Bot with this code but he print no notification for me

tidal idol
#

What are you intending to do on vote?

tidal idol
#

Give vote rewards or just see who voted?

old marlin
#

give vote rewards

tidal idol
old marlin
#

for example, like this?

tidal idol
#

yeah

old marlin
#

okay

tidal idol
#

replace ipaddress with the ip addrss of the place you want to host the bot

old marlin
#

i dont understand...

old marlin
#

into this link?

tidal idol
#

where are you hosting

old marlin
tidal idol
#

Replit, Heroku, VPS, PC etc

old marlin
#

vps

tidal idol
#

ah

#

that is heroku

#

not heroku

old marlin
#

ah shit hahaha

tidal idol
#

that is pterodactyl

old marlin
#

yeah sry

slow bear
#

@rain heart the dashboard display an empty token field

rain heart
#

Clear cache then try again

slow bear
#

I'm trying to generate it but the XHR query always encounter an internal server error

#

it changes nothing

rain heart
#

Oh known issue then

slow bear
#

there's a way to generate it from your side and then DM me the token ?

rain heart
#

If it doesn't work on your end, it will likely not work on my end either

slow bear
#

I finally got it, it took so much time 😅

old marlin
#

it doesnt work

#

can somebody help me

#

?

#

@tidal idol sry for ping but it seems like you know this api

tidal idol
#

@jaunty plank can help better

old marlin
#

ok

forest trench
tidal idol
forest trench
#

hm ok

#

well he needs to have the port 5000 open

full temple
#

Why my bot's server count is zero
it is in 69 servers

#

from where can I get the code for that

#

Ok Thank You

tidal idol
#

@mighty shuttle

#

oh

#

its gone

mighty shuttle
#

I took care of it

#

ty

tidal idol
#

epic

#

np

restive otter
#

how can I display my bot's votes and stuff in an embed

#

I have this installed

restive otter
#

how can i setup a webhook?

restive otter
#

?

#

how can i setup a webhook

#

im complete new

#

it didnt

#

it told me to setup a webhook

#

i dont know how to

#

I dont understnad it

#

what is your bot id @restive otter

restive otter
#

903596039917940758

#

though im not sure if topgg uses the client id

#

or diff id

#

But how can my bot recieve the data?

restive otter
restive otter
#

i dont understand

restive otter
restive otter
restive otter
#

im not sure i understand that. ill try and inform if i have any issue

#

thanks

wicked vapor
#

Can we check if an user has voted a server?

tidal idol
#

Information there

wicked vapor
#

Alright

#

I've check that page

#

Can you mention the area?

tidal idol
wicked vapor
jaunty plank
restive otter
#

i didnt see channel name ;d

humble ermine
#

Is there any way I can use top.gg api to show ServerCount and UserCount in my own website?

jaunty plank
#

Makes more sense to just send it from your bot to your site

humble ermine
#

Any way how

rain heart
#

make a public webserver on your bot to fetch bot stats
use js on your website to make a request to that and return the data it gets
embed it into your website

#

no spoonfeeding happening

humble ermine
#

K

restive otter
#

If im correct

humble ermine
#

Yes

patent rivet
#

Idk if this is the right way to post this suggestion but heres my suggestion:

Add an endpoint for editing a bots description
Motivation:

  • some people have autogenerated documentation for their bots that they may want to update automatically from a CI/CD pipeline
  • if the bot is open-source and has a github/gitlab/gitea repo, the repos readme on said git platform can be in synced to top.gg
rain heart
patent rivet
rain heart
restive otter
#

is lieing about your bots guild count and member count against tos.gg tos

rain heart
#

Yes, that is against the api guidelines

restive otter
#

what is the rate limit for updating bot guild and member count

rain heart
feral palm
#

What is the API to look at the number of servers in which the bot was added from TOP.GG

opaque bison
civic wolf
#

A separately-excited d.c. motor is rated at 8 kW, 230 V, 1200 rpm is supplied with power from a 6-pulse three-phase fully-controlled bridge rectifier. The armature circuit resistance is 0.50 Ω and the machine constant is 1.5 V.s/rad. The motor is assumed to operate in continuous current mode, calculate for firing angles of α = 0 ̊ and α = 30 ̊, (a) the motor speed in rpm, (b) the power factor, and (c) the efficiency of the system. Neglect any losses in the converter circuit and assume that the load torque remains constant for each case.

rain heart
#

@civic wolf sir this is top.gg API help

tidal idol
sullen nymph
#

Neglect any losses
You're about to be neglected

restive otter
#
    at IncomingMessage.<anonymous> (/home/runner/Clash-Chest/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:326:22)
    at IncomingMessage.EventEmitter.emit (domain.js:483:12)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:277) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
``` why??
#

its only with dblapi.js

#

and, this is top.gg topic, right?

willow pier
#

does my bot need to be approved before I can use the top.gg api?

willow pier
#

ok, thanks for letting me know

dusk nacelle
#

Guys! is it possible to have vote command ?
Eg: .vote should direct vote on the top.gg page

#

🥲

#

I was hoping to have a command for that - would make life easier

#

Abuse ? How so ?

#

Hmmm! That's a valid point

restive otter
robust halo
restive otter
#

it's solved

#

now i'm trying with webhooks to give reward automatically

restive otter
#

how i make a webook?

#

in "Webhook URL" idk what to put, can anyone help me?

jaunty plank
restive otter
#

sorry but i didn't understand properly

jaunty plank
#

The url depends on how you host your code.

#

And how you code it

restive otter
#

I host it in replit

jaunty plank
#

Your webhook url will be
Your replit url with the path you set in code

restive otter
#

this?

jaunty plank
#

Yeah, with the path you define at the end

#

Such as
/dblwebhook

restive otter
#

and the auth?

jaunty plank
#

You define that in code

restive otter
#

ok

#

worked

#

thx

#

but how can i send a message to dms?

#

vote.user.send doesn't work

rain heart
#

user is the user id of the voter

#

fetch the user with that id, then send a message

restive otter
#

ok

green hull
#
app.post('/vote', webhook.listener(vote => {
           (async() => {
              if(await vote.isWeekend()) {
                 console.log("is weekend")
              } else {
                 console.log("it is not weekend")
              }
            })();
        }))
#

it throw vote.isWeekend is not a function

rain heart
#

That is still a function you're using

#

Not a variable

#

isWeekend is a variable on the vote object

green hull
#

i dont understand where should I add .isWeekend()

rain heart
#

not isWeekend()

#

isWeekend() is a function
isWeekend is a variable

green hull
#

but how can I check if is weekend or not?

rain heart
#

Seeing the error "isWeekend**()**" is not a function

#

What would you do instead

green hull
#

if(isWeekend)

#

shouldn't this work?

rain heart
#

I again note towards your vote object having variables, one being user in the docs as an example

#

Perhaps that might be the same thing for isWeekend???

green hull
#

so vote.isWeekend ?

rain heart
#

Try it

green hull
#

but it only shows "it is not weekend"

#

even tho is weekend

green hull
#

@rain heart do u know why?

rain heart
#

Can't help otherwise

#

Test votes might display something different

#

Try an actual vote

patent lake
#

how to get the voter's tag?
not the id

jaunty plank
green hull
#

ty

silent summit
#

Is there a way to use your own bot to update the top.gg stats for a guild?

tidal idol
#

You can only use the top.gg bot

#

Mr @jaunty plank can confirm

jaunty plank
#

yeah, only @wild lantern

tidal idol
#

Yep thought so

boreal vapor
#

hasnt been updated in over a year and it seems to be very poorly documented for go

rain heart
#

not abandoned, just nobody willing to maintain it

restive otter
#
C:\Users\yigit\OneDrive\Masaüstü\Oyun\Botlar\Elzem destek\Deneme\node_modules\dblapi.js\src\index.js:118
            const err = new Error(`${res.statusCode} ${res.statusMessage}`);
                        ^

Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (C:\Users\yigit\OneDrive\Masaüstü\Oyun\Botlar\Elzem destek\Deneme\node_modules\dblapi.js\src\index.js:118:25)
    at IncomingMessage.emit (node:events:406:35)
    at endReadableNT (node:internal/streams/readable:1331:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
#

I get this error,

rain heart
#

have you provided your api token

restive otter
#

yes

restive otter
#

can you give an example command

robust halo
restive otter
#

okey

rain heart
#

dblapi

celest pierBOT
#

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

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

spark raven
#

For API for server votes, what is the checkId?

#

is it py (f'https://top.gg/api/servers/{serverid}/check?userId={userid}', headers={'Authorization' : os.getenv('TOPGGTOKEN')})

rain heart
#

Servers does not have an api

clever nest
#

@rain heart why I can't use a numerical ip

jagged nimbus
#

Add it before your ip

#

Not https....it is http

clever nest
#

Leme try

#

@jagged nimbus Ty it worked :) but idk why my bot Dosent gets it

clever nest
#

I mean I have a voting system

#

In which my bot if recives vote it does stuff with user

#

And dms the x user

#

But it didn't work

#

@jagged nimbus

jagged nimbus
clever nest
#

🥲

#
let votes = await axios.get("https://top.gg/api/bots/" + client.user.id + "/votes", { headers: { 'Authorization': config.topgg.token } });
#

cannot read property of Id undefined

#

@jagged nimbus

jagged nimbus
#

I really don't have any clue on it

clever nest
#

Should I send full code?

jagged nimbus
#

But I think someone else has

#

@rain heart can you help him

dusk swan
#

hello there im using this webhook example

import topgg

# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
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}")

I've put my webhook url instead of /dblwebhook and webhook auth in pass it isnt working any help?

#

it isnt sending any msg in logs

#
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("webhook_url", "webhook_auth")
client.topgg_webhook.run(5000)  # this method can be awaited as well

@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":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return client.dispatch('dbl_test', data)
    chan = client.get_channel(890317446605582386)
    await chan.send(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."""
    chan = client.get_channel(890317446605582386)
    await chan.send(f"Received a test vote:\n{data}")```
#

this is what im doing

clever nest
dapper copper
#

Do you plan on using webhooks or the api, the webhook is recommended

#

webhook

#

this is a good example

#

np

#

none

#

it's bare express and such

#

oh

#

there is

#

uh

#

also just realised its using an old version of the lib

#

its not using the latest top.gg node sdk

tidal idol
#

woah new pfp luke

#

babi pfp

dapper copper
tidal idol
#

ohhh

#

well congrats

dapper copper
#

thanks

tidal idol
#

npnp

dusk swan
#

@dapper copper heya can you help me

dusk swan
shell gazelle
rain heart
#

Is that token valid? Try regenerating

neat bison
restive otter
#

h

robust halo
shell gazelle
#

Ok

shell gazelle
#

Ok

blissful junco
#

I've been looking in the documentation admittedly, not very hard but similar to how you can vote on a bot and you get rewards from that bot, can you vote on a server and the bot gives you rewards for it?

rain heart
#

you will have to use webhooks on the servers end, top.gg/servers does not have an api

#

only webhook support

restive otter
restive otter
#

no

#

yes

obtuse bay
#

What is the difference between monthlyPoints and points ?

sullen nymph
#

One is monthly, the other is total

#

They're votes

#

I'll let you figure out which is which

wicked vapor
#

How to check if an user upvoted any listed server

brave cedar
#

ummmmmmm hi
So i use the topgg webhook manager (i want to detect votes)
What do i put in here?

here is the code:

bot.topggwebhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook","pass")
bot.topggwebhook.run(5000) 

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    print(f"Received a vote:\n{data}") ```
restive otter
brave cedar
#

okk

restive otter
#

how i add vote log?

tidal idol
#

add vote rewards?

#

see who votes?

#

Vote Logs/Rewards

If you want to add vote rewards:
Visit https://docs.top.gg and find the needed library, or just the documentation on webhooks if your library isn't there.

If you just want to see WHO votes:
Visit https://webhook-topgg.com and follow the instructions to setup vote webooks!

Top.gg documentation

Welcome to Top.gg

crystal ibex
#

cause no ads

restive otter
#

adblock

crystal ibex
#

brave is faster

rugged compass
#

Heyy

vocal mauve
#

how do i add a user to my bot like here

sullen nymph
#

Isn't that votes, not users?

#

Ah, could be page visits

vocal mauve
#

I need the number of users, not the number of servers

#

@lament pawn

rain heart
#

You can't post the number of users on top.gg

#

Only the servers

#

Nah it should also support sharding stats

hushed path
#

your webhook auth does it mean the Top.gg token?

jaunty plank
hushed path
jaunty plank
#

you are the one who decides it

#

its like a password, you are the one who makes it

jaunty plank
#

yep

hushed path
#

thanks

hushed path
# jaunty plank yep

in which events am I supposed to put this? 'cuz I want to DM the user and I have to use the client inside an event

jaunty plank
hushed path
jaunty plank
#

sure, depends on you to do that though

hushed path
#

cannot try, already voted for my bot

jaunty plank
#

use the test button on the page you added the auth on

hushed path
#

ah yeah

hushed path
jaunty plank
jaunty plank
#

thats just the path, the whole url will be something like http://yourip:80/dblwebhook

jaunty plank
#

itll be something like http://yourip:80/dblwebhook

#

it depends on your hosting method and whatnot

hushed path
#

ok but how do you get the real URL?

#

just by logging it for example

jaunty plank
#

You are the one who has to make it.
It's not something you can just get, the code cannot tell you it, nor can I.
The answer depends on your hosting.

hushed path
jaunty plank
#

yeah, or if its hosted somewhere without a public ip youll need to use your project url + path

tidal idol
#

If its a Discord bot hosting company using Pterodactyl then remember to include the port number

hushed path
hushed path
#

uh, does /dbltoken need to be the URL that I put in Top.gg? ._.

rain heart
#

you mean /dblwebhook

hushed path
rain heart
#

yes, thats the path

#

http://yourip:port/path

hushed path
#

your or the other one?

rain heart
#

well :80 is unnecessary

#

as http is port 80 by default so if your webserver is 80, you wont need to provide that on the url

hushed path
restive otter
#

They're no different

trail juniper
#

can i use connect.sid to use the api from the bot or it's not allowed?

severe gorge
#

hey ive getting an error and help

uncut beacon
#

Hi

fossil mural
#

ok... so I entered the url in the field so what I have to do.. for getting who voted? using python

hushed path
#

this doesn't work (I didn't receive a DM from my bot

fossil mural
jaunty plank
jaunty plank
#

What are you using to host? Vps?

hushed path
#

yes

jaunty plank
#

Do you have any firewalls blocking port 80?

hushed path
#

how can I check?

jaunty plank
#

What operating system is your vps?

hushed path
#

GP-2

#

all informations about my VPS

hushed path
jaunty plank
#

Doesn't really lower the possible number of operating systems

hushed path
jaunty plank
#

Well, firewalls depend on your operating system, not sure what OS your vps is using so I can't help you check if your firewall is blocking it.

jaunty plank
#

Iirc debian uses iptables by default
"iptables -L"

hushed path
jaunty plank
#

Does it return anything blocking ports?

jaunty plank
#

So it's not the firewall. Try using a diffrent port like 3000 just incase

#

You'll need to update the url on topgg and your code

hushed path
jaunty plank
#

Yep

hushed path
jaunty plank
#

Yep

hushed path
jaunty plank
#

I'd suggest adding this to your code

app.get('/test', (req, res) => res.send('Hello World!'));

then visit http://VPS-IP:3000/test in your browser then.

hushed path
jaunty plank
#

its just a test, if you want it to be something other then test thats fine, but /test should work no problem

hushed path
#

I'll try

jaunty plank
#

http://VPS-IP:3000/test not http://VPS-IP:3000/dblwebhook

hushed path
#

ah shit

jaunty plank
#

do you have any non unicode characters in your authorization?
such as ü or anything like that?

hushed path
jaunty plank
#

yeah /dblwebhook is a post, it cannot be used in a browser

#

are you sure your auth(on topgg) and auth you put in code is exactly the same?

hushed path
#

yep

jaunty plank
#

hmm, very strange.

#

@rain heart any ideas?

jaunty plank
# hushed path yep

I'd suggest trying to simulate the request topgg is sending with postman or something else tbh

rain heart
#

You can't access it on your browser, that's called a get request

#

A post request sends data

hushed path
rain heart
#

What host

jaunty plank
hushed path
jaunty plank
#

no firewall issues(we added a get request and it functioned)

hushed path
#

Kernel: Linux
OS: Debian 11

rain heart
#

And what exactly does not work

hushed path
rain heart
#

Use reqbin and try making a request yourself

#

Otherwise give me the URL and I'll try it myself

hushed path
rain heart
#

Yeah just change it to something different

#

@hushed path whats your current up to date code handling the webhooks

hushed path
#

should I send it in a codeblock?

rain heart
#

nah thats fine

restive otter
#

can i get the number of votes with a command ? js

jaunty plank
hushed path
rain heart
#

am not able to try rn

#

will do in a bit

restive otter
#

const url = https://top.gg/api/bots/617806421551087699/stats; // api endpoint
fetch(url, { method: "GET", headers: { Authorization: config.auth }})
.then((res) => res.text())
.then((json) => {
console.log(json)
votes = JSON.parse(json).points;
console.log(votes + " votes")
})

#

json = {"shards":[]}

tawny blade
#

From the docs, I can see there is isWeekend field, but it doesn't appear in my webbook ?

rain heart
#

Doesn't show on a test

#

Shows on an actual vote

uncut beacon
#

How to keep vote logs

halcyon root
#

how do i authorize myself for accessing topgg api? (python)

edit: getting the thing in chrome returns the expected results but using it in python code returns {'error': 'Unauthorized'}

#

nvm

lofty talon
#

So can the top.gg api get the amount of people that have voted for a server?

hushed path
rain heart
hushed path
rain heart
#

Just start your webhook

#

to be able to make requests to it

#

yeah

hushed path
rain heart
#

It has to be on your host

#

because otherwise it cannot be accessed from an external ip

hushed path
rain heart
#

cannot post and cannot get

#

hm

#

whats your path

#

whats config.DBLWebhook

hushed path
#

the one that I sent in DM

rain heart
#

dont do config.DBLWebhook

#

actually set a string there

#

/dblwebhook exactly that one

hushed path
#

just /dblwebhook instead of config.DBLWebhook ?

rain heart
#

app.post('/dblwebhook', etc

hushed path
rain heart
#

yup

#

run that

hushed path
rain heart
#

Yup works now

#

set that as your webhook url and the auth etc

#

then try testing/an actual vote

hushed path
rain heart
#

no

#

change it back to /dblwebhook

#

your config.DBLWebhook seems either invalid or malformed

#

what does that config section look like

hushed path
rain heart
#

what does that section on your config look like

hushed path
#

sent in DM

rain heart
#

Yeah thats not what that parameter is for

#

it is the path, the path after http://yourip:port/THISHEREISTHEPATH

#

so entirely change it to /dblwebhook

hushed path
rain heart
#

yes

still niche
#

hey can someone help me out how to i post my server on top.gg

hushed path
celest pierBOT
#

@still niche

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

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

rain heart
hushed path
rain heart
#

no, keep that

#

remove the :3000 though

hushed path
#

3000 to 80

rain heart
#

no

#

just remove :3000

#

http:// is port 80 by default

#

unless your server actually has a webserver running already

#

then you need to use 3000

hushed path
#

if I put app.listen(3000); I have to put 3000 in the URL?

rain heart
#

yes

#

:3000

hushed path
rain heart
#

nothing, just literally changes the port

hushed path
#

thanks so much for your help 🙏

#

it works

halcyon root
#

you know if
someone votes for my bot
then claims their reward
they're able to claim the award like 12 hours straight
how do i like
prevent this

jaunty plank
#

if they have, dont give it again.

halcyon root
jaunty plank
#

no, the way I would personally do it is save the time they claimed the reward in a database, then only if its been 12 hours from the saved time then give the reward

#

or even better give the reward on the webhook event

halcyon root
jaunty plank
halcyon root
jaunty plank
#

then the above method is what I would personally do

halcyon root
#

ok

uncut beacon
viscid island
#

Hey, is there a way to "shutdown" a webhook listener that received a POST request with an invalid Authorization header? I'm using the official JavaScript library

jaunty plank
viscid island
#

For all requests going forward for that specific webhook listener, until a guild owner re-configures the authorization code through a command (this part I can handle)

#

Just not sure how do I disable the webhook listener

jaunty plank
#

so, you are making a webhook listener for every guild?
probably better to make one, and just disable it via an ID.
kind of a #development question anyway.

viscid island
#

Mhm I've just realized this might be a bad idea

#

So if someone were to maliciously send a request with an invalid authorization header it would disable the webhook even though the actual authorization value hasn't changed and is correct

harsh terrace
#

hey is it possible that when someone vote the bot it give him voter role automatically and after 24 it removes it till the time he votes back

tidal idol
#

There is a bot that does that

#

Vote Tracker

harsh terrace
rain heart
#

0.0.0.0 is incorrect

#

0.0.0.0 means "being able to connect from anywhere

#

You need to portforward port 3000 and then use your public ip

knotty gale
#

Hey I wanna embed my bot's information embed like servers,votes etc, but its showing rate limited

rain heart
#

then you didn't properly made sure you're following our ratelimit guidelines

novel quiver
#

I've never worked with API and I'm honestly a little lost but I'd love for a server count to show on my bots page, I've had a look at the API documentation but I'm not sure how to implement it into my code (js btw). Would anyone be able to assist or guide me in the right direction of how I should use the server_count field?

knotty gale
#

I am getting this error

#

nvm fixed that by installing express and its types

vernal fractal
jaunty plank
#

Only approved bots get an api key, but it can be found on an approved bots edit page in the webhook section

oblique hornet
#

but its the same as the one from top.gg, because i want to use vote tracker

jaunty plank
#

If so try regenerating it and using the new one

#

Weird bug that's recently been happening

oblique hornet
#

okey wait

jaunty plank
#

Are you using a topgg library? Or doing it yourself?

oblique hornet
#

i did it 3 times and it works now

jaunty plank
#

Op

#

Okay ^_^

#

Normally it's just once and it fixes, I'll keep this in mind for others

fossil mural
#
OSError: [Errno 10048] error while attempting to bind on address ('0.0.0.0', 2911): only one usage of each socket address (protocol/network address/port) is normally permitted```

getting this error ... while using webhook thing for getting voting events
restive otter
#

You've had something else running on port 2911, use another port

fossil mural
tidal idol
fossil mural
#

I am confused so please tell me.... that we have to create a webhook and then put it's url in this field right? or something else

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

#

probably good to look into this

fossil mural
rain heart
#

@stable galleon lets not advertise

#

thanks

full temple
#

How to add top.gg api for server count in python?

sullen nymph
#

topggpy has an autopost feature that can automatically post your bot's server count at a certain interval

quick sundial
sullen nymph
#

Replace mybotid in the URL with your bot's ID

quick sundial
sullen nymph
#

Return home and make sure you are logged in with the right account

quick sundial
#

Ok

restive otter
sullen nymph
#

Oh right KEKW

torn adder
#

whats the problem?

plucky lance
#

You’re using an outdated library

#

Check the docs to get the latest library which interact with the topgg API

#

As the one you have doesn’t work anymore

sand pilot
#

.

lime anchor
#

How to code a discord bot?

rain heart
#

-api also

abstract mothBOT
#

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

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

kindred swift
#

What happened to the 'isWeekend' parameter

#

does double votes on weekends not count anymore?

jaunty plank
kindred swift
#

Oh

iron viper
#

I have some issue installing topggpy (from git)

As topggpy new implementation (supporting for discord.py and other forks etc). They required aiohttp 3.8.0 or above to work. Forks & discord.py requires aiohttp 3.6.0 or above and below 3.8.0 to work. PIP stuck in installing aiohttp requirements.

#

i tried forking it and edit the requirements

#

it says that Cannot import "Handler" from "aiohttp.typedefs"

#

ping me when someone replies thx

sullen nymph
#

@restive otter poggythumbsup

restive otter
iron viper
#

ok?

restive otter
#

@iron viper mind trying git+https://github.com/top-gg/python-sdk@3042f40a9fea4f3d0065d4ab8a00492cfc7e716e#egg=topggpy?

#

In the meantime, I need to test if it's compatible with all the versions specified

jagged wigeon
#

Hello there,

I wanna ask that what does topgg-autoposter & topgg-api do?
(assume that I've a zero knowledge of it)

sullen nymph
#

Former is official the latter isn't

jagged wigeon
#

What is included in that info? only servercount or something else like usercount?

sullen nymph
#

Autoposter just has an interval at which your bot's server count is posted to Top.gg

The API is intended for working with Top.gg API directly (getting user/bot data/votes, posting server count manually)

jagged wigeon
#

oki thanks!

#

one more thing I wanna ask is that .. Can I get message in a specific channel(inside support server) if someone voted or reviewed my bot?

#

Look at this ...

#

How?

#

with topgg-api or autoposter?

#

oki

#

is that the thing I'm looking for right?

#

oki thanks!

iron viper
#

well but it seems like is no longer receiving?

iron viper
# iron viper well but it seems like is no longer receiving?
    @topgg.endpoint("/dbl", topgg.WebhookType.BOT, 'lwkz1234')
    def dbl_vote(self, data: topgg.types.BotVoteData, client: discord.Client=topgg.data(discord.Client)):
        if data["type"] == 'test':
            self.bot.dispatch("dbl_test", data)
            return
        self.dispatch("dbl_vote", data)``` code btw
restive otter
iron viper
ruby thistle
#

hello, random q, is it possible to do bot.top.gg run at the same time as bot.run()?

restive otter
#

Btw, since you got access to the bot already, you don't really need topgg.data, it's there for those of you who like functional approach

#

Kinda irrelevant to it not being called but are you sure AutoShardedBot have bot attribute?

meager harness
#

using the topggpy when I do py dbl = topgg.DBLClient(bot, os.environ["DBL_TOKEN"])

I get an error saying

Traceback (most recent call last):
  File "/home/shahriyardx/Projects/customcommands/venv/lib/python3.8/site-packages/nextcord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "bot.py", line 144, in on_ready
    self.load_extension(cog)
  File "/home/shahriyardx/Projects/customcommands/venv/lib/python3.8/site-packages/nextcord/ext/commands/bot.py", line 733, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/shahriyardx/Projects/customcommands/venv/lib/python3.8/site-packages/nextcord/ext/commands/bot.py", line 678, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
nextcord.ext.commands.errors.ExtensionFailed: Extension 'cogs.admin.topgg' raised an error: TypeError: __init__() takes 2 positional arguments but 3 were given
#

@restive otter

tidal idol
#

what are you trying to use it for

iron viper
tidal idol
#

also might be a compatability issues as you are using Nextcord

meager harness
#

Ahh

tidal idol
#

i'm presuming so

meager harness
#

Then the only way is to doing api requests manually

tidal idol
#

i'm guessing thats the issue as it says supporting discord.py on the readme, not nextcord

iron viper
restive otter
tidal idol
iron viper
#

@restive otter so how can i fix my issue... basically the webhook doesn't work....

tidal idol
#

for example, from discord import Webhook works but from nextcord import Webhook doesn't

restive otter
restive otter
#

I was asking how you register the endpoint, you defined the endpoint but I don't see you register it

iron viper
#

oh

#

wait

iron viper
tidal idol
#

menager?

iron viper
restive otter
sullen nymph
#

Petition to rename DBLClient to TopGGClient

#

and not mention it in changelogs

restive otter
iron viper
#

ok?

restive otter
# iron viper ok?

Few things you can try doe:

  1. make the callback static method, perhaps what you register is the unbounded one, i.e., doesn't have self injected. But that should've thrown an error
  2. Build the endpoint with WebhookManager.endpoint() instead of topgg.endpoint() and finally call add_to_manager()
iron viper
#

ok

tidal idol
#

@jaunty plank this is the issue i mentioned a while back - the bot just full on stops posting entirely every few days

#

stopped yesteday morning

jaunty plank
#

First try just restarting the bot. If that works it might be a lib issue?
If that doesn't work try getting your auth again and restarting

tidal idol
#

That usually works

#

its just the fact that it also likes to crash my bot every few times

jaunty plank
#

The autoposter lib?

tidal idol
#

yeah

#

it seems to be every 3-4 days unless i have restarted the bot to fix an issue etc

dapper copper
#

Actually

#

no

#

that should be built into the lib

#

If in doubt

#

just make your own autoposter

#

not hard

#

just make a POST request every 5-10 minutes

tidal idol
dapper copper
#

yea

#

You're probably better off just doing something like

tidal idol
#

I can just do a tasks loop

dapper copper
#
async function postStats() {
  return axios.post('https://top.gg/api/bot/id/stats', json, headers).catch(_ => { //Handle error
  })
}

setInterval(postStats, 600000)
#

then just

#

handle the errors

tidal idol
#

I use Python

dapper copper
#

Oh

#

then yea, use a task loop and do it that way

kindred swift
#

uh so for

#

python on_dbl_vote

#

when i placed that event in my main.py file

#

suddenly "bot" doesn't work anymore.

tidal idol
tidal idol
#

wrong channel

craggy sphinx
#

ow sorry

restive otter
#

Can someone ban this bot?

rain heart
#

?

#

what?

sullen nymph
#

Yeah

stable cargo
#

Hi, is there a way to get previous stats of a bot from this api ? Or do I have to use the Bdl-statistics one ?

#

I want to generate the canvas of servers evolution

tidal idol
#

you can get a graph of growth

stable cargo
#

Yeah but thats not my question

#

Ik that the bot generates it, but what i want to know is, can I from the apis provided ?

tidal idol
stable cargo
#

Yeah i saw that

#

But the previous route returns tons of data

#

There is no way to get previous data with the top gg api ? With a datetime parameter

#

Couldnt find it in the doc but maybe I missed it

shut hornet
#

how to get topgg token

rain heart
shut hornet
dapper copper
#

not in the current version at least

dapper copper
stable cargo
#

ok ty for the infos

shell gazelle
#

this much bad

#

regenerated token like 10 times

#

but still same errors

#

@subtle pulsar

slow sonnet
#

show your code

shell gazelle
#
const Discord = require('discord.js');
const client = new Discord.Client() // Your discord.js client or any othe
const express = require('express')
const app = express()
const port = 8080

app.get('/', (req, res) => {
  res.send('Server Online!')
})

app.listen(port, () => {
    console.log(`Posting`)
})

const { AutoPoster } = require('topgg-autoposter')

AutoPoster(process.env.TOP, client)
  .on('posted', () => {
    console.log('Posted stats to Top.gg!')
})

client.login(process.env.TOKEN)
slow sonnet
shell gazelle
#

this works for my other bot

shell gazelle
shell gazelle
#

i tried without env too

#

but still

#

this works fine for my other bot

hoary urchin
#

is the bot already approved?

shell gazelle
#

ofc

slow sonnet
#

btw just a note dblapi.js is deprecated

shell gazelle
slow sonnet
#

it's @top-gg/sdk

#

ah

shell gazelle
#

just help me

#

this is api error

#

because this works fine for my other bot

#

@slow sonnet

#

also refresh data not working

#

and logout also not working

noble lintel
#

how to post shrads in top.gg website

shell gazelle
#

sed lyf

tidal idol
tidal idol
#

you're seemingly the only one with the issue

#

and you need to read the errror

noble lintel
noble lintel
tidal idol
#

wdym

noble lintel
tidal idol
#

what do you mean by "Post the library"

rain heart
shy vortex
#

don't need to pass anything to the function

worthy marten
#

Hey !
I have a question where can i get my Webhooks token of top.gg
because i don't see it for vote

restive otter
#

It's the other way around, you give Top.gg the token

worthy marten
#

How to do that ?

restive otter
#

Your birth date Could be anything really

worthy marten
#

But i send it where ?

restive otter
#

You set the auth there to whatever you want, and every time Top.gg sends you a request, it'll have that auth you set in the Authorization field in headers

worthy marten
#

I still don't understand but no big deal I'll see if I get there

shell gazelle
restive otter
#

The pre-release yeah

#

Oh okay, and what version is the pre-release? 2.0.0a ? Like if I want to use pycord for my discord.py fork would I use that version?

#

Yeah it's 2.0.0a0, next pre-release will be after PR #68 I guess

#

Oh okay

#

There are some snippets in the docs and also examples in the repo. If you have any doubts you can ask me here

#

okay, thanks

restive otter
#

how i get the token topgg api?

restive otter
#

thanks

charred abyss
#

i tried using the auto post feature with the topgg python wrapper but i got topgg.errors.Unauthorized: Unauthorized (status code: 401)

#

the token is valid

tidal idol
#

Try regenerating the token first

rocky siren
#

How to set a webhook? For voting

glad mist
delicate badge
#

Not sure why I get this error

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    import topgg
ModuleNotFoundError: No module named 'topgg'
delicate badge
# rocky siren How to set a webhook? For voting
const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('Top.gg API token')
const app = express()

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

app.listen(80)
pastel raptor
delicate badge
#

It's already installed

pastel raptor
#

pip install topggpy

delicate badge
#

Yeah

pastel raptor
#

if you have multiple python versions

#

make sure ur using the right version

#

might not have installed the library into the one you wanted

delicate badge
pastel raptor
delicate badge
pastel raptor
#

not the actual python version

delicate badge
pastel raptor
#

try doing pip install topggpy again

#

see what it says

delicate badge
# pastel raptor see what it says
~/AntiScammer$ pip install topggpy 
Requirement already satisfied: topggpy in /opt/virtualenvs/python3/lib/python3.8/site-packages (1.4.0)
Requirement already satisfied: discord.py in /opt/virtualenvs/python3/lib/python3.8/site-packages (from topggpy) (1.7.3)
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from discord.py->topggpy) (3.7.4.post0)
Requirement already satisfied: yarl<2.0,>=1.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (1.7.2)
Requirement already satisfied: multidict<7.0,>=4.5 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (5.2.0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (3.0.1)
Requirement already satisfied: chardet<5.0,>=2.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (4.0.0)
Requirement already satisfied: typing-extensions>=3.6.5 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (3.10.0.2)
Requirement already satisfied: attrs>=17.3.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (21.2.0)
Requirement already satisfied: idna>=2.0 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py->topggpy) (3.3)
WARNING: You are using pip version 21.2.dev0; however, version 21.3.1 is available.
You should consider upgrading via the '/opt/virtualenvs/python3/bin/python3 -m pip install --upgrade pip' command.
pastel raptor
#

hmm

delicate badge
#

Yeah

#

Not much

#

It keeps getting uninstalled for no reason

pastel raptor
#

its not being uninstalled, it's installed fine

#

hmm

#

what ide are you using

delicate badge
#

When I wake up I saw that my bot was offline and when I started the bot again it said that there was no module named topgg

pastel raptor
#

oh

#

issue with your vps or whatever you're using then, perhaps? Thonk

delicate badge
#

Replit

pastel raptor
#

interesting

#

try some other host, see if that helps

delicate badge
#

I'll just stick with replit as I know it the most.

delicate badge
tidal idol
#

alr

scenic timber
#

what is password?

#

plz tag when answer

tidal idol
scenic timber
rain heart
#

also you cannot use webhooks whe nyour bot is not approved

drowsy plover
#

is there a way to get a user tag from someone who votes

#

i can get user id but i dont have permissions to fetch the user

rain heart
#

you'll have to look for alternatives that provide user data with the id

drowsy plover
#

just trying to do a giveaway type deal, but i cant message the user to tell them they've won without their tag 🙃

rain heart
#

Your users are required to be in the server to participate, no?

#

you can just mention them using <@id>

drowsy plover
#

it's gonna be across multiple servers

rain heart
#

Top.gg provides the query parameter, which is linked to your vote page

https://top.gg/bot/yourbotid/vote?allofthisisquery

#

so you could use that to pass the guild id and user id to then get both on the vote request

drowsy plover
#

it's presence intents i need for user

#

hmmm i just thought, i could copy the user ids to another bot under 100 servers and get their usernames right

rain heart
#

probably yeah

drowsy plover
#

presence intents is the right one to apply for though?

jaunty plank
#

Discord might not like that though

#

Do you need a privileged intent for user tags even?

drowsy plover
#

i figure ill apply for that and hopefully get it before the end of December so i dont have to worry about it

#

to fetch the user tags from id

#

because top.gg doesnt give you the tags

rain heart
#

you could then fetch that user after they've won the giveaway

#

ID* not ip

drowsy plover
#

oh nice, so you can do it. Thanks!

rain heart
#

issue is, it might not be up-to-date

drowsy plover
wicked egret
#

🛡️ 🎧

thorny bane
#

Hey can anyone tell , how can i make vote reminder system in my bot?

#

Is there something related to this in the api?

flat geode
#

how to thread message move to other channel or thread??

tidal idol
#
  1. Don’t spam it in literally every channel??
dull acorn
#

Quick question for you lot, i would like to rewards my players with an in game currency for voting for the bot on top.gg, how would can i tell my bot when a player votes to give the player that reward? So like on vote, gather the users id…

dull acorn
#

i have, just not sure where to start to be perfectly honest

jaunty plank
wanton lava
#

How can I print a webhook from the top.gg api on how many servers the bot is on | djs

restive otter
#

What

wanton lava
restive otter
#

Ah, the print a webhook bit was confusing lol

true pilot
#

How can I see my bot's votes by topgg/sdk

jaunty plank
#

Just see them? Or an event when someone votes

novel yoke
#

How we can send voters name using webhook?

tidal idol
#

but user ids are

#

so you should get the users name from the userid

orchid salmon
#

Is there a python library for topgg api?

jaunty plank
#

yep

orchid salmon
#

Thanks

keen plover
#

hi

novel yoke
rain heart
#

Is the user variable

#

Check the docs

true pilot
#

const topgg = require("@top-gg/sdk")
const topg = await new topg.Api(process.env.topt)

var voted = await topgg.hasVoted(message.author.id)
if(voted == "true") return message.reply("already voted")

#

Why does this not work

rain heart
#

const topgg = require("@top-gg/sdk")
const topg = await new topg.Api(process.env.topt)

true pilot
#

But I want my bot to say "already voted" if the user(message.author) is already voted

rain heart
#

Sure thing

#

but your code is wrong

#

Look at how you defined the variables

#

why are you trying to use topg on a const called topg

true pilot
#

@rain heart

rain heart
#

why are you using hasVoted on a variable that is not the api instance

true pilot
#

@rain heart I didn't understand

true pilot
rain heart
#

You have an example

#

you defining the variables is wrong

tidal idol
#

const topg = await new topgg.Api(process.env.topt)

rain heart
#

lets not spoonfeed

#

they wont learn from that

true pilot
#

@rain heart ok ty

rain heart
#

even if it is a minor error, they wont understand

#

ffs

true pilot
#

@rain heart lmfao

true pilot
tidal idol
#

no

#

you have topg.Api

#

not topgg.Api

true pilot
#

thanks but still that dosent work

tidal idol
#

read the docs then

true pilot
#

read already

#

Nvm

#

Found

#

Error

tidal idol
#

ok

true pilot
#

Thanks

#

@tidal idol tysm

tidal idol
#

no problemo

storm iron
#

Um do server votes have an api?

rain heart
#

Nope

restive otter
#

how do i get the token

rain heart
#

read pins btw

restive otter
#

where do i find the token

#

@rain heart

rain heart
#

read pins

restive otter
#

do i use my client.login one?

#

ig so

rain heart
#

not your discord token

restive otter
#

where is the api token then

rain heart
#

you cant use the api before your bot isn't approved either

#

see the pins

restive otter
#

HH

#

oh

true brook
#

@rain heart what can u do with Vote Credits?

rain heart
#

-credits

abstract mothBOT
#

Auction Credits

What are they?

  • If enough people vote for your bot or server per month, you have the ability to get credits that you can then use for auctions.
  • Don’t know what auctions is? See here for how to apply.
  • These auction credits can be used to pay for any winning bids you may make
  • You CANNOT “withdraw” them for real money

How does the System Work?

  • Each month, bot monthly votes reset
  • If you get 100 votes on your bot in the month, you can redeem $15 worth of voting credits (can’t redeem till you actually get 101 votes)
  • Any vote after 100 will be worth $1 per 1000 votes (or $.001 per 1 vote)

How Can I Redeem Them?

  • At the end of the month, you will be eligible to redeem your credits (you redeem them on your bot or server's Votes page on your bot’s dashboard). You will have 30 days to redeem them before they expire.
  • After you redeem them, you have 31 days to use them before they expire (so you can technically stack 2 months worth)

**How can I Use them to Pay? **

  • When you pay for your winning bid, you have the option to use your credits
  • If your winning bid cost is more than the amount of credits you have, make sure to apply the credits first and then pay the rest with the supported payment providers

A more simplified, less detailed version can be found in #580510490074152961 after you get auctions access and any questions can be asked in #auctions-general.

pseudo sierra
#

How do i set up the API to detect the votes for my bot?

wild bear
#

What is top.gg's new way of posting the server count of your bot?

rain heart
#

Never changed

#

-servercount

abstract mothBOT
dark river
#
internal/modules/cjs/loader.js:1102
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/container/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /home/container/node_modules/node-fetch/src/index.js from /home/container/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /home/container/node_modules/node-fetch/src/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/container/node_modules/node-fetch/package.json.

    at new NodeError (internal/errors.js:322:7)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/home/container/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  code: 'ERR_REQUIRE_ESM'
}
container@pterodactyl~ Server marked as offline...
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const app = express()

const webhook = new Topgg.Webhook('Me Key')

app.post('/vote', webhook.listener(vote => {
    console.log("User with id - " + vote.user + " Voted!")
    let value = JSON.stringify({
        embeds: [
        {
            title: "New Vote!",
            description: `<@${vote.user}> Just Voted For Vern!!`,
            color: "8388736"
        }
    ]
})
fetch("My Discord Webhook :D", {
    method: 'POST',
    headers: {
        'Content-type': 'application/json',
    },
    body: value
}).catch(e => console.log('Error occured while posting webhook : ' + e))
}))
app.listen(2245)
console.log('Your app is ready to log votes :D')
robust halo
gusty mantle
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "my_token")
bot.topgg_webhook.run(5000)

@bot.event
async def on_dbl_test(data):
    print(data)

i'm sending a test request to my bot and it's receiving it properly "POST /dblwebhook HTTP/1.1" 200, the problem is that the on_dbl_test is not being called at all, am i doing something wrong

restive otter
#

It's on_dbl_vote, you gotta dispatch dbl_test yourself

#

Check the type field to tell whether or not it's a test

gusty mantle
restive otter
#

print is unreachable

restive otter
#

Err, if you wanna print that inside on_dbl_vote, you might as well just remove the dispatch

gusty mantle
#

i tried both but it's still not doing anything after sending a test

restive otter
#

How does it look like now?

gusty mantle
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "my_token")
bot.topgg_webhook.run(5000)

@bot.event
async def on_dbl_vote(data):
    if data["type"] == "test":
        print("test")
restive otter
#

Where did you get the access log?

gusty mantle
#

well the bot is hosted on repl, so the repl console

gusty mantle
dapper copper
#

this also works

#
const { default: fetch } = require('node-fetch')
quiet finch
#

-servercount

tidal idol
quiet finch
#

ok sorry

jagged nimbus
#

As of now

#

33332 online

tidal idol
#

they mean this