#topgg-api

1 messages · Page 164 of 1

jaunty plank
#

the public ip shouldnt be shared, local ips doesnt matter.

stable summit
#

ah kk

#

so do i input it into that?

jaunty plank
#

https://i.woo.pics/6aab31b77f.webp

green arrow is the url http://YOURPUBLICIP:3000/dblwebhook

purple is the auth you put here in your code const webhook = new Topgg.Webhook("your webhook auth")

stable summit
#

ok i did it

jaunty plank
#

make sure to save then test, if it doesnt log anything first time restart your code.

#

it should log something like
355427757376667659
in the console of the running program

stable summit
#

uh im not getting anything

jaunty plank
#

did you try restarting the code

stable summit
#

wait

#

i didn't save the auth

jaunty plank
#

ah

stable summit
#

im still not getting anything even after restarts

#

man idk where i messed up

jaunty plank
scarlet cobalt
#

One message removed from a suspended account.

barren sundial
#

why doesn't works?

#

_i will changes after the webhook _

golden adder
gritty adder
#

I'm using this method to post stats.

const Topgg = require(`@top-gg/sdk`);
const api = new Topgg.Api('xxx');

api.postStats({
    lib: 'discord.js'
});

but it is not posting the libraries but it is posting other guildscounts etcs

#

how to post lib with that method?

gritty adder
golden adder
gritty adder
#

oh

#

ok thanks man

ancient pawn
#

is there any way to track what the response from a webhook webserver is when using the test button on a bot's dashboard

#

some other lists send the request from the browser so you can use devtools to see exactly what is being sent and what the response is

#

in the case of top.gg, repeatedly redeploying my entire bot just to check this stuff when something in my code doesnt work is inconvenient at best

unique onyx
#

I’m having a problem with setting up the vote tracker in my server, when I put the topgg link and authentication code in the webhook section, when I click send test it says something went wrong

golden adder
#

It's either a problem on top.gg's end or on votetracker.xyz's end. I'd suggest contacting votetracker.xyz's devs to make sure you have everything set up correctly and they don't have any issues on their end and then coming back here for further support if needed.

solid crest
#

error for test webhook

unique onyx
#

Oh

solid crest
spare fiber
solid crest
#

it is valid yess

#

its my own ip so and it used to work and havent done changes

spare fiber
#

Hmm mist be a topgg issue

rain heart
#

work with webhooks

  • get the user id from the voter through the webhook requests
  • fetch the user
  • check if user can me messaged
  • send vote message
    done
hallow herald
#

Why it doesn't work? It's the tenth time i post this

//------------Top.gg------------
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("Porco dio")

    bot.channels.cache.get("860843237022498856").send(`${vote.user}`)

}))
barren sundial
golden adder
barren sundial
glacial stag
#

hot to check top user vote

hallow herald
#

ok

restive otter
#

Somebody help me
I can't test the webhook on the Top.gg website
he says:
Something went wrong An error has occurred while processing your request. I've already tried to refresh the page, but the issue remains, and nothing appears in the Chrome DevTools console other than:
508.bd0bd31c78a77c9d609f.js:1 POST https://top.gg/api/client/webhooks/testGuild 403

hallow herald
#

like this

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

const app = express();

app.listen(8080)

const webhook = new Topgg.Webhook(" ")

app.post('/dblwebhook', webhook.listener(vote => {
    console.log("Porco dio")

    bot.channels.cache.get("860843237022498856").send(`${vote.user}`)

}))
restive otter
#

yes

#

but i'm also having problems with the webhooks issue, so it might not work anyway

young rapids
#

how do I make when someone vote the bot and sends message to the channel thanks for voting (user)

jaunty plank
restive otter
#

bot

jaunty plank
restive otter
#

ah ty

young rapids
#

ty

formal sparrow
#

Does server webhook work fine line bot webhook or is it buggy?

stoic igloo
#

Could someone give me an API, so when someone votes for the bot it delivers a Reward?

#

I use aoi.js

still jasper
#

hey anyone can help me with if someone voted my bot on top.gg so it will get posted in my discord server and they will get rewards plss tell me how to make this 😦

#

my bot is in python by the way

rancid fractal
#

Is there an api url for getting bot ratings?

still jasper
jaunty plank
#

yep

still jasper
#

ok

#

thanks

stable summit
#

how do you stop a command from working unless they have voted?

rancid fractal
restive otter
#

Sa

stable summit
rancid fractal
fathom narwhal
#

ok so im going back to the autoposter for topgg

#

for python i need to pass in the token for my bot

#

is there a way i can give the servercount

#

and not have give topgg my bot token lol

stable summit
#

a couple things, i generally restrict commands with permissions and im not sure how to restrict it through a site request haha

#

i use javascript btw

rancid fractal
# stable summit a couple things, i generally restrict commands with permissions and im not sure ...

In the case of this GET request, the value will be a value in a json-formatted string. In the case of lua, there is a built-in way to decode JSON into a lua table, so you would replace

if member:hasPermission("Permission") then
--do the mario
end

with

if result.voted == 1 then
--do the mario
end

This is because the response to the vote check api is formatted as

{
  "voted": 1
}

or

{
  "voted": 0
}

Not sure if that helps though, I have no experience at all with javascript.

stable summit
#

it doesn't much but i appriciate it still haha

restive otter
fathom narwhal
#

uhh nothing then

#

whatever

#

something weird was going on

sullen nymph
#

You can see the topggpy code for yourself if you are concerned it does something shady

tame pulsar
#

How to get guild token?

smoky marten
tame pulsar
mellow peak
#

Hi ! Since few month i have to improvise with my bot to send correctly votes webhook to my channel by getting the username in the user file because the API return 404 for existing user.
When the API will be updated to avoid workaround and 404 errors ?

restive otter
#

ye

#

Hello ? topggpy

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password") what do I put in dblwebhook and password?

#

It can be anything, the path needs to start with a slash though

#

Path to where?

#

Can anyone specify an example?

restive otter
smoky marten
#

?

#

Anyway you don't get it

#

you put it

#

both there and

#

Here

#

(The area I marked red)

tame pulsar
#

Oh

half depot
#

hi

#

how do i get started

smoky marten
half depot
#

mhm

smoky marten
half depot
#

.............

#

it doesnt exist

smoky marten
#

oh f

restive otter
#

May some pls tell me what to do here ?


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

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


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

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

crystal cloak
#

Any ideas? I randomly get this error:

humble raptor
#

any chegg free bot here?

warm hornet
#

any way to check if an user has voted and they did it only once so they cant get vote rewards several times after voting?

#

all data it sends is only 0/1 and no vote timestamp

#

i mean i can store cmd usage timestamp

#

but if ill do that, user can run cmd after an hour after they voted and the next vote will work only in an hour

jagged pine
warm hornet
#

i couldnt make express work

jagged pine
warm hornet
#

it just times out, maybe a firewall issue, need to try more

jagged pine
#

Did you try this?

#

Make sure to open port 80 in the firewall, on ubuntu it's sudo ufw allow 80

warm hornet
#

dont want to use 80 for that

#

and i finallt made it so nvm

#

it worked and failed at the same time

jagged pine
warm hornet
#

ik, got it already, i also add \tcp after the port in ufw

stone depot
#

how do i get the API key?

sullen nymph
stone depot
sullen nymph
#

See pins

warm hornet
#

brb lemme report you

plucky lance
#

You’re sure you entered your public IP and port correctly and the firewall doesn’t block your specified TCP port?

warm hornet
#

it works fine if i try to do a GET request

#

it says cannot GET /link

#

so POST should be fine

#

i tried axios and no errors

plucky lance
#

Did you send the GET request from an external source too or internally?

warm hornet
plucky lance
#

Hmm okay maybe topgg still has issues with their test feature

#

You may check the pins and announcements

warm hornet
#

so it shouldnt work on test?

#

hm

plucky lance
#

It should of course but I’m not up to date

#

Lots of users had issues with it

#

Make sure to hit the save button before hitting test

warm hornet
#

my friend voted after i saved and nothing logged

warm hornet
#

even with ufw disabled

plucky lance
#

Hmm weird tho, the code is accurate?

warm hornet
plucky lance
#

Port 80 isn’t used by another service already?

warm hornet
#

no

plucky lance
#

Is your endpoint a server, your home etc. static/dynamic IP?

warm hornet
#

static

#

its a vps

plucky lance
#

Hmm okay then I would guess the issue is caused by topgg

warm hornet
#

wait

#

i just checked the console of axios and it timed out

plucky lance
#

You could ask in support if there’s still an issue with receiving webhook requests

#

Oh how can it timeout

warm hornet
plucky lance
#

Hmm you may need to google that.
Haven’t ever seen that

warm hornet
#

i tried

#

all i get is how to set the timeout

plucky lance
#

You can try to use an online debug tool to send post requests to any endpoint you enter to test and check if the issue persists on your side

#

Unfortunately there aren’t much more tips coming into my mind atm

jagged pine
#

What did you set as your webhook url @warm hornet

warm hornet
jagged pine
#

Also, top gg sends post requests not get

warm hornet
#

i know

jagged pine
#

Btw top.gg has issues with the test button for webhooks iirc

plucky lance
warm hornet
plucky lance
#

Yeah probably

warm hornet
#

i do get everything besides topgg

#

do it just doesnt send snything

#

wait

#

i literally had to add http:// before my vpses ip to make it work?

plucky lance
#

lol without specifying the protocol the link isn’t valid okeh

#

At least it doesn’t seems to work in the scripts of topgg

warm hornet
#

i can see the raw data but not using the package

#

nothing when using the package

jaunty plank
warm hornet
#

yes

jaunty plank
#

did you set the auth on the site correctly?

warm hornet
#

yes

jaunty plank
#

hmm

#

ok

warm hornet
#

its notthe same then

#

i used token

jaunty plank
#

ah yeah, tokens used for accessing the api, not webhooks

#

the auth can just be a random string of characters.

warm hornet
#

why is it located on the webhook tab then

#

abit confusing

jaunty plank
#

its the most logical place for it.
it does say its for the api

#

Token
You will need a token to perform certain actions with the API such as posting your bot's server count and checking who has upvoted your bot.

API documentation can be found here

warm hornet
#

now it works

#

thanks

jaunty plank
#

no problem

plucky lance
#

Didn’t even think of that notlikenoot

#

at least it’s fixed

rich bison
#

for python, what will be the code to get requests from topgg if user has voted?

vote_check = requests.get(f"https://top.gg/api/bots/872356887193071677/check?userId={ctx.author.id}")

how do i give the authorization aliases?

#

this printed <request 401> something like this....

restive otter
#

You can pass a dict which contains the authorization to the headers kwarg. Anyway, don't use requests as it's blocking (assuming you're gonna use it on your bot)

rich bison
#

im not able to understand how to get the authorizatoin....
what do i put in the dict?

restive otter
#
headers = {"authorization": TOPGG_TOKEN}
requests.get(..., headers=headers)
rich bison
restive otter
#

Again though, you generally don't want to have a blocking code in your async app. So consider migrating to an async lib such as aiohttp

knotty gale
#

Can I fill discord webhook url in url section for voting webhooks?

torpid elm
#

im using discord.py, how do i get user id of someone who voted on my bot

torpid elm
stoic shuttle
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('<my password here>')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // 121919449996460033
}) // attach the middleware

app.listen(4002)
#

what am i doing wrong?

#

it logs nothing

crystal cloak
sullen nymph
#

Without digging through topggpy code, not really

smoky marten
stoic shuttle
#

ok ty

hasty adder
#

Accept my bot pls

hearty vortex
hasty adder
#

Mmm

restive otter
cunning basin
torpid elm
plucky lance
#

It's not necessary required but yes, a phrase you can use as auth (password)

#

You can also restrict the access to your endpoint for the topgg API source IP only

restive otter
#

hi

#

i have a problem

#

I had my bot send a message whenever someone casts a vote in a text channel on my server, but now it keeps sending messages over and over again. My friend cast ONE vote and sent the message 5 times, i had to restart the bot to stop. What can it be?

#

this is my code

#
const topggSDK = require('@top-gg/sdk')
const express = require('express');
const app = express();
const webhook = new topggSDK.Webhook(process.env.topggPassword)

app.post('/topgg-upvote', webhook.listener(vote => {
  client.channels.cache.get("871494278856192000").send(":tada: Oba! O usuário <@!" + vote.user + "> votou em mim pelo Top.gg! Obrigado! ;)")
  console.log(vote)
}))
app.listen(8000)```
#

sorry, i speak portuguese

#

to solve this error, I imagine that it is necessary to answer the request with a status of 200, but how do I do this?

#

mention me when you answer, please

sullen nymph
#

What's your @top-gg/sdk package version

restive otter
#

humm

#

3.1.2

sullen nymph
#

Huh

restive otter
#

now another problem: it returns unauthorized (it is necessary to inform the token) and I informed it.

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

AutoPoster(`${process.env.topggToken}`, client)
  .on('posted', () => {
    console.log('Posted stats to Top.gg!')
  })```
cunning basin
sullen nymph
#

Yup

restive otter
#

hey how can we choose a random member who reacted to a message in a guild by specifying these [reaction emoji] message-id, channel-id, guild-id using eval?

restive otter
#

sorry my bad wrong channel

twin reef
#
1|mg   | TopGGAPIError: 504 Gateway Time-out
1|mg   |     at Api._request (/home/jnsp/minigames/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19)
1|mg   |     at runMicrotasks (<anonymous>)
1|mg   |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
1|mg   |     at async Api.postStats (/home/jnsp/minigames/node_modules/@top-gg/sdk/dist/structs/Api.js:99:9) {
1|mg   |   response: Response {
1|mg   |     size: 0,
1|mg   |     timeout: 0,
1|mg   |     [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
1|mg   |     [Symbol(Response internals)]: {
1|mg   |       url: 'https://top.gg/api//bots/stats',
1|mg   |       status: 504,
1|mg   |       statusText: 'Gateway Time-out',
1|mg   |       headers: [Headers],
1|mg   |       counter: 0
1|mg   |     }
1|mg   |   }
1|mg   | }

this is currently spamming my pm2 logs lol

lime rock
#

since now its possible to add discord bots within the discord app, top.gg should make a search system in this server which can search bots and send their invite link
(if u open bot invite link from discord it opens it within discordapp)

restive otter
#

how to i fix this error: TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)

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

AutoPoster(process.env.topggToken, client)
.on('posted', () => {
  console.log('Posted stats to Top.gg!')
})```
bold sable
#

Umm, I am a beginner and I can't seen to find yourbotid to put in https://top.gg/bot/:yourbotid/webhooks . I tried adding bot token and id from copying id by developer mode but it's showing 404 error page

#

any help ?

craggy sentinel
bold sable
craggy sentinel
#

...that sounds like you'd be looking for server votes instead

bold sable
#

Yeah I am creating a bot which tracks server votes

#

But i would need the api to confirm if the user voted or not

bold sable
craggy sentinel
#

server vote webhooks

#

effectively same thing, except for servers

bold sable
rain heart
#

check the webhooks section

restive otter
#

Hi I used bots/bot:id/stats to get my bot stats but it doesn’t show my total votes per month

#

What is the url to fetch to get total bot votes?

bold sable
#

Ohh i got a bit gist of it from help in #development , still I'm confused about this your webhook auth, where to get this ? (by creating a new webhoook and connecting with bot ?)

I guess we have to use this, right ? ```const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

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

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)

rain heart
restive otter
#

Ah Alr sorry and thx

bold sable
#

So i found this in docs,

// URL = http://your.server.ip:80/dblwebhook
// Authorization: webhookauth123```

How to get `your server ip` ?
rain heart
#

thats where your webhook is hosted on

bold sable
# rain heart thats where your webhook is hosted on

https://discord.com/api/webhooks/channel_id/token like this is the webhook I created , where channel_id and token have values, should I just copy paste it (is it where it is hosted) ?

I'm hosting my bot on replit, do I have to get something from there ?

rain heart
#

you cannot use discord webhooks for your webhook

#

also, your bot has to be approved first before being able to use webhooks

bold sable
rain heart
#

oh server votes

#

you said bot

bold sable
#

I thought I have to track server votes using bot

bold sable
#

umm, help ?

#

I checked the pins of channel too SadGirl

restive otter
#

how to i fix this error: log TopGGAPIError: 401 Unauthorized (You need a token for this endpoint) at Api._request (/home/runner/junibot/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Api.postStats (/home/runner/junibot/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 } } }

#

this is my code

#
const topggAutoposter = require('topgg-autoposter')

topggAutoposter.AutoPoster('***********************.**************************.*****************************************', client)
  .on('posted', () => {
    console.log('Posted stats to Top.gg!')
  })
#

***********************.**************************.***************************************** is my authorization token

golden adder
#

Where did you get your token from?

#

Make sure it's valid and from the Webhooks tab of your bot page

restive otter
#

from here

golden adder
#

Try regen and updating your code

restive otter
#

ah ty

#

a instant

#

same error

hasty adder
olive turtle
#

Why i cant post my shard_count

restive otter
#

Probably cause your bot isn’t on any shards 🤷‍♂️

restive otter
main basin
#

is it possible to check the via discord bot if users is ready to vote again using top.gg api?

#

like a boolean request

golden adder
#

I'd suggest using the vote webhook to store the voter ID and timestamp in your database instead of hitting the API repeatedly. That avoids getting rate limited.

rain heart
#

read pins

#

seems like you're using the wrong type of token

thorny fractal
#
Error loading botmisc.toppy
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 606, in _load_from_module_spec
    spec.loader.exec_module(lib)
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/Main-perseus/botmisc/toppy.py", line 5, in <module>
    class topp(commands.Cog, name='topp'):
  File "/home/runner/Main-perseus/botmisc/toppy.py", line 25, in topp
    update_stats.start(self)
NameError: name 'self' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 80, in <module>
    bot.load_extension(extension)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
    self._load_from_module_spec(spec, name)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 609, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'botmisc.toppy' raised an error: NameError: name 'self' is not defined

Using cogs...

fluid violet
#

self isnt defined

thorny fractal
# fluid violet read the error
class topp(commands.Cog, name='topp'):

    def __init__(self, bot):
        self.bot = bot
        self.token = ''  
        self.dblpy = dbl.DBLbot(self.bot, self.token)
        self.update_stats.start()
``` it is ig...
#

code```py
@tasks.loop(minutes=30)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count."""
await self.bot.wait_until_ready()
try:
server_count = len(self.bot.guilds)
await self.dblpy.post_guild_count(server_count)
print('Posted server count ({})'.format(server_count))
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).name, e))
update_stats.start(self)

fluid violet
restive otter
#

May some pls tell me what to do here ?


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

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


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

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

#

How should the path loook like?

ember void
#

node v16.6.1 isn't supported by topgg api?

jaunty plank
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

ember void
#

Ok thanks

formal thunder
#

h

dusky monolith
#

Does the webhook url has to be on port 5000?

#

Since my bot server's ip is donator2.sweplox.cloud:1111 and not donator2.sweplox.cloud:5000

delicate saffron
#

top.gg-api = not pog

restive otter
#

lol 😆

restive otter
lament widget
#

how can i send a webhook after someone has voted to my server?

winter dust
#

In the Docs, it says this:

#

What should I put in for bot id?

lament widget
#

but thats all last 1000 votes

#

oh

#

your bots id

winter dust
#

The discord id or is there a separate bot id

lament widget
#

bot id

winter dust
#

Oh ok

#

So

#

280094303429197844 for example

#

{"error":"Unauthorized"} :(

#

Do I need a api key?

lament widget
#

yes

winter dust
plucky lance
#

See the pinned docs:

To access our API you need to authorize yourself, this can be done by using your discord bot list token. Your token can be obtained from your bot page settings under Webhooks (https://top.gg/bot/:yourbotid/webhooks replacing :yourbotid with the ID of your bot).

nocturne canopy
#

How to setup server count pls

#

i only get the vote count and owner

winter dust
#

Oh nvm it was deleted

restive otter
#

How should the webhook path look like ? For topggpy

restive otter
restive otter
winter dust
#

Ohh sry

#

I didn’t read it properly

restive otter
plucky lance
#

Of course, the IP or DNS to your endpoint.
How would topgg know it's address if you don't provide it?

#

But the path the webhook service (webserver) is waiting for POST requests can be anything you like.

#

It isn't a physical path so it can be anything as long as it's a valid URI.

lament widget
#

What is ErrorCode "EAI_AGAIN"?

lament widget
#

Can someone help me? i always get the ECONNRESET error now after ive workaround the EAI_AGAIN error

restive otter
sage basin
#

Hi

plucky lance
restive otter
#

Alr

proud rune
#

What do we connect the webhooks to?

#

A host server link or what

brave pumice
#

API down?

peak prism
hearty vortex
sleek canopy
#

Hi guyz i am new to discordKEKW

dire cairn
#
401 Unauthorized Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kTransformState)]: [Object]
    },
    disturbed: true,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://top.gg/api/bots/489076647727857685/check?userId=436184825423069194',
    status: 401,
    statusText: 'Unauthorized',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}
``` why I'm getting this when I'm trying to check vote, when I open the url in my browser it works fine
jaunty plank
dire cairn
#

I am

jaunty plank
#

then its not a valid token

dire cairn
#
.set("Authorization", this.client.config.dbl);
#

I just copied from topgg

#

and did that

#

and if it needs token why it is opening in browser without need of token

#

you can try for yourself https://top.gg/api/bots/489076647727857685/check?userId=436184825423069194

jaunty plank
#

👀

dire cairn
jaunty plank
dire cairn
#

hm

#

I copied the token again and pasting it to the method directly

#

oh nvm sorry, I wasn't passing the headers to the method

jaunty plank
#

ah

dire cairn
#

{ voted: 0 }

#

Thanks for your time

nocturne canopy
#

Leave a ping...

rancid fractal
#

I wrote some code to get information from the top.gg website, since there is no api for getting ratings (that I know of). It works by looking for a JSON value with all of the bot's information, including votes, rating, individual ratings, and a bit more information unavailable in the current api. Unfortunately, it looks like they recently added DDoS protection, meaning GET requests to the actual website only show Cloudflare's redirect page. Is there another way I can retrieve this information? Are there plans to add a new api for this?

restive otter
#

How do I add users count

#

?

restive otter
#

Hi

#

I set my webhook url but I’m not getting anything when tested

jaunty plank
restive otter
#

Yes this time I did
http://myip:port/dbl

#

Like that^^

#

When I search it up it’s shows refused to connect

restive otter
#

Must the iP be public orrrr?

#

The device ip?

restive otter
#

how do i get my bot to show the servers it is in

#

?

rain heart
#

-servercount

abstract mothBOT
restive otter
#

Ok thank u

jaunty plank
restive otter
wise dome
#

lol

uncut rivet
#

how can i get my bots vote count? python

restive otter
#

Request :
Wish topgg had an option : in the bot page , u can enter a discord webhook url, and whenever someone votes , it sends a message to that webhook

Would be a awesome feature which would help pretty much all the developers

restive otter
#

also, it wouldnt help all developers

#

what if developers wanted to reward their users when they vote but they cant because the webhook is a discord webhook

restive otter
#

Ok that’s different case and sorry for saying “help all developers” but would be a rly nice feature to have , not like majority of bots on topgg give readers

#

Rewards

#

Sorry if that offended u just wanted to suggest

restive otter
#

Ye I am currently using request and web server etc

#

But just wanted to suggest that idea , but seems like it got turned down , thx tho

restive otter
#

Hi
I’m tryna check if a user has voted in the last 12 hours

But whenever I vote and check it shows as False

jaunty plank
restive otter
#

How can I see total votes of my bot without going on site? (I mean by executing a command)

#

discord.js btw

jaunty plank
restive otter
#

yes ty

jaunty plank
restive otter
#

Ok

restive otter
restive otter
#

Alright

restive otter
#

Or only console?

jaunty plank
#

neither, its a object response

restive otter
#

Oh alright

jaunty plank
#

well, correction, its an promise response. that promise resolves to an array of short users

restive otter
#

oh cool

jaunty plank
restive otter
#

Also i have a doubt how to give double rewards on weekend? Do I need to multiply the amount by using isWeekend()?

jaunty plank
#

yeah

restive otter
#
let amount = 500;
let weekend = await api.isWeekend();
if(weekend) {
amount *= 2
}```
jaunty plank
#

probably easier to use a tenory
let amount = isWeekend() ? amount : amount * 2;
maybe cleaner to even just one line it if you prefer.
const amount = isWeekend() ? 500 : 1000;

restive otter
#

Oh cool ty

jaunty plank
#

op its a promise, youll still need to await isWeekend()

restive otter
#

umm how can i use await without async function tho. I mean how can we use async in the webhook code?

jaunty plank
#

same way as anywhere else.

#

just make the callback async

restive otter
#

async => {}

jaunty plank
#

or if you dont want to
.then() works on promises

restive otter
#

Oh alright

restive otter
jaunty plank
restive otter
#

Alr thx 🙏

restive otter
#

It sent [object object]

jaunty plank
#

its an object

#

you need to get the data from that object and put it in an embed

restive otter
#

how

jaunty plank
#

well what are you trying to get? votes?

restive otter
#

yes

jaunty plank
#

getBot(client.user.id).points iirc

restive otter
#

Oh lemme try it

jaunty plank
#

or well, .points on the object

restive otter
#

Oops

#

i need in an embed like lucas -botinfo command

rain heart
#

refer to the docs and what it returns

restive otter
#

ok

rain heart
#

you need to create that embed completely yourself, getBot provides a Bot object you can use to get the data

restive otter
#

i created embed

rain heart
#

again

#

it returns a bot object

#

you cant simply put it on your embed

restive otter
#

Oh

restive otter
rain heart
#

again refer to the docs for the library you're using

restive otter
#

oh ok

knotty gale
#

I've a problem, I want to setup vote rewards for my bot but idk y top.gg sends the webhook 3-5 times

knotty gale
#

okay thanks

restive otter
#

hey, how do i get started using the api and discord.py?

#

i want my bot to send a message in a certian channel when someone votes

sleek pond
#

hello, can anyone tell me how to use api.
I want the user Id who votes and want to display the no. of servers on the main page of top.gg

grizzled cliff
#

how can I authorize my bot to see this

thick fern
#

Is there a way to send vote webhooks to localhost servers?

snow nymph
dusky monolith
#

Are points the vote count?

golden adder
#

Yes

rain heart
#

feel like they should be renamed ngl

main basin
#

how do you guys get the number of votes at top.gg is it possible? how u do it

main basin
#

nvm i managed to know how

main basin
#

how do i add auth to https://top.gg/api/bots/814580247973986314/votes

#

ill be using

    const { topggcountapi } = await fetch(`https://top.gg/api/bots/814580247973986314/votes`)
    .then(response => response.json());

to get count of votes

main basin
jaunty plank
jaunty plank
#

@restive otter did you set the webhook auth?

#

also whats your hosting location?
replit/heroku/glitch/vps/home?

restive otter
#

Repliy

#

I am only using webhook url

jaunty plank
#

you need an auth too

restive otter
#

Ok

#

How can I get that

#

Because ihave very less experience

restive otter
jaunty plank
#

you make the auth

#

its like a password, you're the one who decides it

jaunty plank
#

let me know if you need more help

crystal field
#

can someone help me with why i keep getting the "An error has occurred while processing your request" message when i'm trying to test the top gg vote webhook?

jaunty plank
crystal field
#

oh does it not work for servers

#

huh

jaunty plank
#

youll need to use your own testing methods for testing webhooks.

#

such as remote postman requests

crystal field
#

oh interesting i see

#

ty i'll try that then

restive otter
#

I’m always getting an error saying port in use

small wraith
#

( I work with classes)

#

How can i use the API in Python when i Not use ctx

restive otter
#

Hi

#

My url is
http://my-public-ip/8000/dblwebkhook

#

And When I test I get nun

restive otter
#

and you should port forward

#

Ye it’s like that sorry

#

/ ~> :

#

Still no response

restive otter
#

Meaning?

#

Port forward?

#

Wait

#

I see that’s my mistake

#

@restive otter ty

jagged merlin
#

fuck lol

wise dome
#

Can Anyone Help Me To Make A Vote Required Command For Top.gg Please

knotty garnet
#

when someone votes you'll receive their ID, just save it in an array or database so you can check it later

wise dome
#

are u free rn

#

@knotty garnet

knotty garnet
#

free for?

#

I'll not give any code

#

basically what you wanna do is:
user voted -> save ID to array

then when the command is executed:
user uses command -> is ID in array?
if yes -> execute command
if not -> show error message

#

or as fake said, use the api to manually retrieve data from top.gg

#

just be careful not to spam requests to top.gg

golden adder
#

Best to save voters locally than hit the API. Hitting the API isn't scalable.

sleek canopy
#

Guys what is better GTX or RTX?

golden adder
knotty gale
#

I am setting up express app to get webhooks, but req.body is giving me undefined

smoky marten
knotty gale
#

no basic express app

#

is it necessary

#

?

smoky marten
#

then are you parsing the body ?

#

like

app.use(express.json())
knotty gale
#

ohh okay thanks

#

I forgot

#

lol

smoky marten
#

np

thorny fractal
#
bot.dblpy = dbl.DBLBot(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.dblpy.post_guild_count()
        print(f'Posted server count ({bot.dblpy.guild_count})')
    except Exception as e:
        print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

update_stats.start()

Error

Traceback (most recent call last):
  File "main.py", line 100, in <module>
    bot.dblpy = dbl.DBLBot(bot, dbl_token)
AttributeError: module 'dbl' has no attribute 'DBLBot'
#

solution ?

sullen nymph
#

lol

#

rtfd

#

P.S. dblpy is outdated, refer to topggpy

#

and it's DBLClient, not DBLBot

thorny fractal
#

alr

main basin
#

do top.gg have upvotesThisMonth?

golden adder
#

Yes it's monthlyPoints

restive otter
#

Hey, so, i'm trying to use the library @top-gg/sdk but it doesn't seem to work.

This is my code:

import { Webhook } from "@top-gg/sdk"
import express from "express"

const app = express()

const webhook = new Webhook("lolitotop");

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

app.listen(4433, () => console.log("Listening to the server"));

The authentication matches, the url i'm using on the dashboard is: http://my_ip:4433/dblwebhook. When I press the Test button, nothing happens on my code.

knotty garnet
#

did you test if the request is even reaching it?

#

like with postman or apitester

restive otter
#

Nop, I have to?

#

I though that the Test button would simulate a real vote

knotty garnet
#

it will

#

but you first need to know if the server can receive the requests

#

like, is port 4433 open?

#

and if you use top-gg/sdk why do you use express?

restive otter
#

I'm just following the example that they gave, in the example they used express

restive otter
knotty garnet
#

example where?

restive otter
knotty garnet
#

ah, didn't notice it

#

anyway, make sure your port is open

#

and the address is right

restive otter
#

The port is open, when I make a get request to localhost:4433/ in insomnia it returns what I said to

#

So i guess the problem is the address

knotty garnet
#

errr

#

just by chance

restive otter
forest trench
#

topgg webhooks cant reach local host right?

rain heart
#

correct

#

it needs to be publicly reachable from an external source

#

which can be allowed through portforwarding for example

forest trench
#

i see

forest trench
rain heart
#

Portforwarding is required when hosting your webhook service on your local computer

#

if you're hosting it on a host provider like a vps, that port is very likely already open and you wont need to do stuff regarding portforwarding

#

unless you're using a firewall on that vps, then you need to open your desired port

forest trench
#

yea, thats the problem, im currently self hosting

rain heart
#

Yeah portforwarding is required, unless you're able to tunnel that port to another server

#

which is very complicated and more difficult than portforwarding

forest trench
#

is there any risk of port forwarding?

rain heart
#

portforwarding is essentially allowing a single port to be accessed from external sources, so there are some risks of course

#

I'd suggest reading through that

forest trench
#

ah, alright thanks!

#

"This allows you (or someone else) to access something on your computer from the internet. " 😳

rain heart
#

in regards of that specific service you're portforwarding for

pallid cedar
#

To make vote messages in my server, do I need to set up port and network stuff? Or can I just download topggpy, write some code and done?

rain heart
#

not your whole computer of course

forest trench
#

oh ok

forest trench
pallid cedar
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")

With this bit of code - where do I find my password to connect to my bot on top.gg? And also - do I need to change the /dblwebhook or can that stay the same?

golden adder
#

It's the token on your webhooks tab

#

In bot page edit settings

forest trench
#

webhook

pallid cedar
#

for which, /dblwebhook or password?

golden adder
#

The token goes where password is

pallid cedar
#

ok right, I tried that, what goes in /dblwebhook though?

sinful pond
#
const Top = require('@top-gg/sdk');
const express = require('express');
module.exports = client => {
	this.top_gg = null;

	if (process.env.TOP_GG) {
		const app = express();

		this.top_gg = {
			api: new Top.Api(process.env.TOP_GG),
			webhook: new Top.Webhook('Demon*****')
		};

		app.post('/dblwebhook', this.top_gg.webhook.middleware(), (req, res) => {
			client.emit('userVoted', req, res);

			if (res && res.status(200)) {
				res.send('OK');
			}
		});

		app.listen(1200, () => {
			console.log('[dbl] Connected!');
		});
	} else {
		// Do nothing..
	}

	function _post() {
		const serverCount = client.guilds.cache.size;
		this.dbl ? this.dbl.post() : null;
		this.top_gg ? this.top_gg.api.postStats({ serverCount }) : null;
	}

	function init(loop) {
		if (loop) {
			this._post();
			setInterval(() => this._post(), 1800000);
		} else {
			this._post();
		}
		return;
	}
	_post();
};
#

Why its doesn't working

golden adder
pallid cedar
golden adder
pallid cedar
sinful pond
golden adder
#

You have to set the url the payload will be sent to

pallid cedar
golden adder
#

So http://YOUR_IP:PORT/dblwebhook

pallid cedar
#

Oh ok I understand right

#

IP of my router I am guessing?

golden adder
#

Wherever you're hosting your bot

pallid cedar
#

So the IP of my device? I am not good with networking, not one of my strongest points

golden adder
#

Where are you hosting your bot?

pallid cedar
#

I am hosting my bot on a VPS, but I am testing this on my DevBot - which is hosted on my laptop

golden adder
#

It has to be your VPS's IP then once you're hosting there. If you're testing for now in a local environment then you'll need to use the IP address of your local machine.

pallid cedar
#

I found my IP

#

But getting this error now:
ValueError: path should be started with / or be empty

rain heart
#

remove everything but the /dblwebhook part

#

and token is not supposed to be your top.gg token

#

that is something you define yourself

#

like a password

pallid cedar
#

why do I need to remove everything but the dblwebhook part, the other people told me to do that?

golden adder
#

You put the IP in your top.gg dash

#

Same way you did there but in the dash

pallid cedar
#

I have done

golden adder
#

Don't touch the code except for what Hope said

pallid cedar
#

so this is where I get the token right?

#

this is what I have

#

oh wait

#

like this?

forest trench
#

yep

pallid cedar
#

ok, how long does it take for a test to come through?

forest trench
#

few seconds

pallid cedar
#

ok because nothing came through

forest trench
#

are you trying it when hosting it locally?

pallid cedar
#

yes, just for testing purposes

forest trench
#

wont work, unless you port forward just like Hope said

pallid cedar
#

don't think anyone mentioned port forwarding?

#

so would this work if I put it in the VPS though?

forest trench
#

yea, it should

pallid cedar
#

ok, and just change the IPs etc

forest trench
#

yea

pallid cedar
#

it didn't work 😦

#

no errors given

#

wait I might know why

#

I don't know why - it just doesn't work 😦

#

anyone have any suggestions? Pretty sure I have done everything as everyone said

forest trench
#

did you add the event which triggers when the test button is clicked?

tall wind
#

how do i do the api thing

#

it just gives me errors when i click on them

pallid cedar
tall wind
#

how to get api token

pallid cedar
#
@client.event
async def on_dbl_vote(data):
    if data["type"] == "test":
      return client.dispatch('dbl_test', data)

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

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

This is the whole code for top.gg excluding the webhook 2 lines of code

#

Yeah I got all that

forest trench
#

hmm

#

should work then

pallid cedar
#

guess I will have to give up cos it not working damm

forest trench
#

is the ip of your vps correct?

pallid cedar
#

as far as I am aware, yes

forest trench
#

hmm

#

@pallid cedar what did you add in the authorization field on your bots page?

pallid cedar
#

Nothing

#

I was just about to ask that

forest trench
#

ok

#

wait

#
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
``` im pretty sure you have something like this in your editor, now change the password field in that with a actual password that you know.
#

and use that to add it to the authorization field on your bot page

pallid cedar
#

ok, what about the token?

#

Does that need to be in my code?

forest trench
#

as far as i know, no

pallid cedar
#

ok will try now

pallid cedar
forest trench
#

hmmm

#

did you add the password on your bots page?

pallid cedar
#

This is what I have: (the password is changed by the way):

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "morgan5556")

forest trench
#

did you click the save button?

pallid cedar
#

yes lol

forest trench
#

ah lmao

#

im out of ways

pallid cedar
#

ahaha thanks for your help anyway

#

hopefully I can get this sorted

forest trench
dull thunder
#

do your website still working with dblapi.js ?

#

or just http requests only

#

just asking

golden adder
#

Recommended packages are in the pins here.

#

Or you can use http requests.

#

As per the docs.

dull thunder
#

yeah i see

dull thunder
#

{ error: 'Forbidden' } ?

#

?

#

no help ?

rain kraken
#

Can you receive webhooks for when a server is voted for?

dull thunder
#

no api support at the moment

#

idk where's helpers

formal agate
#

hello, is there any available documentation on how one could get information when there bot has been voted for? thanks

golden adder
formal agate
#

thanks

dapper copper
#

@jolly hornet ^^

main basin
#

All of this api request is monthly upvotes?

    //For user to check their upvotes
    axios.defaults.headers.common['Authorization'] = process.env.TOPGG;
    try {
        const topggvotes = await axios.get(`https://top.gg/api/bots/814580247973986314/check?userId=${msg.author.id}`);
        console.log("[Top.GG] " + msg.author.username + " | Total Vote: " + topggvotes.data.voted); 
        if (topggvotes.data.voted === 0 || topggvotes.data.voted === null) {
        topggvotedcount = "N/A"
        }else {
        topggvotedcount = topggvotes.data.voted;
        }
    } catch (error) {
        console.error(error);
    }
    //for top.gg prunebot total vote checking
    axios.defaults.headers.common['Authorization'] = process.env.TOPGG;
    try {
        const topggcountapi = await axios.get('https://top.gg/api/bots/814580247973986314/votes');    
        if (!topggcountapi.data.length) {
        topggcount = "N/A" 
        }else {
        topggcount = topggcountapi.data.length; 
        }
    } catch (error) {
        console.error(error);
    }    
thorny fractal
coarse rune
#

hi

#

i am planning to use heroku for hosting can some one help me with webhooks on it

smoky marten
coarse rune
smoky marten
#

test

coarse rune
coarse rune
#

@smoky marten

#

sorry for the ping

vale sundial
#

How would i be able to show my bot's server count?

quasi solar
#

hey there

#

so I am facing an issue with getting test votes

#

idk what to fill where

#

what should I put here?

coarse rune
quasi solar
#

im testing rn

coarse rune
#

like do u have a vps

quasi solar
#

no virtual server

#

like rn no

#

why?

coarse rune
#

do u have ngrok or any other tunneling service

quasi solar
#

nono

#

no ngrok

coarse rune
#

ok

#

pls download it

quasi solar
#

what should i fill here idk

quasi solar
coarse rune
quasi solar
#

which url

#

i ran ngrok

coarse rune
#

what does it show

quasi solar
coarse rune
#

ok so put

#

https://3220001b644e.ngrok.io

quasi solar
#

ok

#

idk

#

im using py

#
@client.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")```
#
@client.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    user = data['user']
    embed = discord.Embed(description="New Vote! Voter: {}".format(user), color = discord.Color.gold())
    channel = client.get_channel(859397571226370068)
    await channel.send(embed=embed)
    await user.send("Thanks for voting me on top.gg!")```
#

@shut flume

#

any idea?

#

of whats wrong

#

and so is the pass

#

wdym

#

wai

#

i need webhooks

#

and i want it to send msg to a discord channel

#

for taht i need webhooks

#

exactly

#

thats y

#

how else will i do

#

I host it on CDH

#

Chaotic desiny hosting

#

idk bout that

#

idk anything bout webhooks

#

:(

#

oof

#

*dies instantly *

torpid elm
#

i cant seem to figure out how to use the api lol

#

doesnt work

quasi solar
#

lol yea

quasi solar
#

i mean there's no error in the code

#

but

#

it didnt

torpid elm
#

exactly

quasi solar
#

idk how to use webhooks

torpid elm
#

it doesnt give any errors

#

but it doesnt even work

#

LOL

restive otter
#

Where bot

foggy acorn
#
FetchError: invalid json response body at https://top.gg/api/bots/594189989143904264 reason: Unexpected token < in JSON at position 0
#

just using a GET method (and yes authorization was provided)

#
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://top.gg/api/bots/723726581864071178/check?userId=843503225030049812')
#

this too

smoky marten
foggy acorn
#

i mean it seems like everything bricked in the past 15 mins, cuz the code worked perfectly for weeks, until it didnt.

pastel light
#

literally everything seems to be broken

#

gg

restive otter
#

Who will dm me if my bot gets accepted

smoky marten
smoky marten
restive otter
foggy acorn
#
fetch("https://top.gg/api/bots/594189989143904264", {
    method: "GET",
    headers: {
      Authorization: `${ConfigFile.top_gg}`,
    },
  })
    .then((res) => res.json())
    .then((json) => {
// ...
async with aiohttp.ClientSession() as s:
        async with s.get(f'https://top.gg/api/bots/723726581864071178/check?userId={user_id}', headers={'Authorization': TOP_GG_TOKEN}) as r:
            vote = await r.json()
            if vote['voted'] == 1:
                return True
            else:
                return False
smoky marten
#

What's this Discord api ?

foggy acorn
#

2bruh_what what

smoky marten
#

I saw discord api use Authorization
and everyone else uses authorization

#

the cap A

foggy acorn
#

it doesnt matter

#

i have cap A in both, the've worked for weeks/months

#

bricked about an hour or so ago

#

i changed nothing

smoky marten
#

can you do me a favour and send a content-type header with it

#

Also dosen't change anything

foggy acorn
#

sure

#

same exact error AA_Ruby_Stare

smoky marten
#

oh nvm It's python

foggy acorn
#

they are two different languages, two different projects

#

actually this vote error is persistent on every single project ive checked.

#

at least 4

#

the api seems to just be dying in general

#

yea i found the issue

#

<title>Access denied | top.gg used Cloudflare to restrict access</title>

#

👍 nice job

#

<p>The owner of this website (top.gg) has banned you temporarily from accessing this website.</p>

#

nice.

pastel light
pastel light
#

we did

foggy acorn
#

thats not gonna change anything

pastel light
#

Well, for my bot i regenerated the token. still having this issue

smoky marten
#

Your bot / ip sent waaaaay toooooo many requests

restive otter
#

i setted up a webhook and copy pasted the url in my bot webhook colum

#

but test not coming

pastel light
#

How? we set the posting time to 30 minutes

#

or whatever the default is

foggy acorn
#

im just going to limit the update rate on the site

smoky marten
foggy acorn
#

to like an hour

pastel light
pastel light
restive otter
#

i setted up a webhook and copy pasted the url in my bot webhook colum

pastel light
#

nice, makes sense actually.

restive otter
#

when i try test its not working

smoky marten
pastel light
#

our websites are connected to our bots

smoky marten
restive otter
smoky marten
# pastel light our websites are connected to our bots

Then it's possible
Like someone does ddos on your site and the whole thing go brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

smoky marten
restive otter
# smoky marten yes

i created an intergration on a channel and copy pasted its url on the site

#

but not working

restive otter
pastel light
smoky marten
foggy acorn
#

the timeout seems to be 30m

foggy acorn
#

for tempban

restive otter
#

ok

smoky marten
#

I have a question
Actually I have lots of questions

#

Are you not setting up a webhook ?
What integration ?
You mean a Discord webhook ?
Are you trying to put a discord webhook for a top.gg webhook ?

restive otter
#

but i don't have much idea

smoky marten
#

okay

restive otter
#

can u help me ? sir

smoky marten
#

I am thinking about how should I explain this

#

Okay
you know what
If you want a simple vote tracker there are bots for it

restive otter
smoky marten
restive otter
#

ok

#

@smoky marten can i use top.gg npm for vote logs ?

coarse rune
thorny fractal
dull thunder
#

i'm getting unauthorized error

sullen nymph
#

That's bad

dull thunder
sullen nymph
#

Why is it Headers and not headers

#

server_count is integer, not string

dull thunder
#

oh

#

im just trying any number at the moment

#

i use client.guild.cache.size

#

ty btw

#

now im getting bad request 🤦‍♂️

#
    body : {
      "server_count" : 100
    }```
#

what's wrong with this

#

im getting bad request

sullen nymph
#

No idea

dull thunder
#

who is this ?
scam ?

sullen nymph
#

Yes

#

And ping one online moderator

dull thunder
#

ok i tried everything
why im getting bad request ?????

plucky lance
#

It’s still NOT a valid JSON formatted body

#

{ "server_count": 99 }

#

body: { "server_count": 99 }

dull thunder
#

still same error

#

and i used JSON.stringify(body)

#

and got the same error

plucky lance
#

🤦‍♂️

dull thunder
#

that's why im here

plucky lance
#

Why should you use that

#

You have to POST a body with JSON content not a string

dull thunder
#

i told you i used that. now im using json

#

and don't blame me i was trying

#

still getting bad request

plucky lance
#

Are you kidding me?

#

Compare your screenshot to the text I wrote

dull thunder
#

body: { "server_count": 99 }

#

?

plucky lance
#

Yes, now look on to your screenshot

dull thunder
#

i think i need glasses

#

i cant see any difference

plucky lance
#

seRver not sever

dull thunder
#

FUCK

#

xDDDDDDDDDDDDDDDDDDDDDDDD

#

as i said i need to get glasses

plucky lance
#

And stop use spaces behind property names, that’s no coding style that’s just nonsense

dull thunder
#

ok

#

ty

plucky lance
#

👍

dull thunder
#

same error

#

i think it's the api

#

my code is 100% right

plucky lance
#

Tested it a few minutes ago…
Works well.

#

Just provide some more code

dull thunder
#

i just sent the token wait

#

i didn't code for a year

#

maybe i cant find the wrong thing here

plucky lance
#

It expect a content type set to JSON and there’s another typo.
body not boday

dull thunder
#

still not working

plucky lance
#

Last typo I’m helping out with.

dull thunder
#

boday was an error i know

#

i misstyped it while removing the token

plucky lance
#

Anyway the content type needs to be application/json

#

You haven’t added that to the header

dull thunder
#

i will wait

plucky lance
#

Just give it try to stringify the body again, I might have been wrong on that one, can't test it atm

dull thunder
#

didn't work

plucky lance
#
fetch("https://top.gg/api/bots/<bot_id>/stats", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": <dbl_token> }, body: JSON.stringify({ "server_count": 50 }) });```
dull thunder
#

idk why

#

but it worked

#

ty