#topgg-api

1 messages ยท Page 166 of 1

golden adder
#

You need to check the port is open on your router.

tepid wave
#

It is

#

I host website so I can be sure it is cuz that uses port 80

smoky marten
tepid wave
#

I went to router settings and made port forwarding just for my device

golden adder
#

What's on the end of the url in the webhook url field?

#

Did you include /webhook?

tepid wave
#

so I need http://[my domain here]/webhook ?

#

oh yea I do

smoky marten
tepid wave
#

lemme try

#

didnt work

smoky marten
smoky marten
#

then test

tepid wave
#

How do I send back a 200 status?

coarse rune
tepid wave
#

tnx

safe wasp
#

hello im chatting in here because no one cares about my predicament when i type my question in general, so i have a 1.2k server and have 123 roles, i would like to give the upvoter a reward role however on the dashboard i cant scroll much and thus can't get to my desired role, is there another way to give an upvoter a reward role without using the dashboard?

#

idk how to use those lol :<

#

omg, why cant one just type in letters and then the corresponding letters from the roles listed in your server will pop up like others

#

damn my 123 emojis lol

#

yus i selected a role on the list, selected that, went back to discord server settings, changed its name and vola

#

im so smart

#

oh really? that sucks. Still though its alright. thank you for giving me your time ^^

static portal
#

can somebody help e

#

whats the command

#

for tog

#

to stream

#

youtube vids

smoky marten
#

also wrong server/channel I guess

fallow plank
#

How do I add server count?

smoky marten
# fallow plank How do I add server count?
const client = Discord.Client() // Your discord.js client or any other
const { AutoPoster } = require('topgg-autoposter')

AutoPoster('topgg-token', client)
  .on('posted', () => {
    console.log('Posted stats to Top.gg!')
  })
smoky marten
#

I wish you good luck

fallow plank
smoky marten
#

sure

fallow plank
#

we are talking about this right?

smoky marten
#

yes

fallow plank
#

ok thanks

smoky marten
#

The server count on top.gg bot page

fallow plank
#

I will check for python than

fallow plank
smoky marten
#

(It's the api docs btw)

fallow plank
#

oh thanks ๐Ÿ™‚

silver trellis
#

How can i make if someone voted takes a role in the support server

smoky marten
silver trellis
#

What is dsl๐Ÿ˜ฌ

rain heart
#

@wild lantern

#

but that's for servers only, you'll need to completely make your own bot if you wish to connect that with a custom webhook

silver trellis
#

Yeah so my bot needs to be verified in top.gg so i can connect it with a custom webhook.

rain heart
#

Yup,

#

dblupto

celest pierBOT
#

The average up-to-date approval times are stated [here](#support message).

This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.

There is no exact time for how long bot approval will take.

There is a queue and you're not first, nor are you last.

real yew
#

I wanted to know that if I make a vote only command that requires the user to first vote my bot on top.gg website otherwise he won't be able to use that command. Then is it okay ?

restive otter
#

@celest pier up to

#

dblupto

analog yacht
#

What am I doing wrong? The webhook isn't doing anything.

kind path
#
class Top(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.dbl_token = "token" 
        self.dblpy = topgg.DBLClient(self.bot, self.dbl_token)
        self.topgg_webhook = topgg.WebhookManager(self.bot).dbl_webhook("path", "pass")
        self.topgg_webhook.run(0000)

@commands.Cog.listener()
    async def on_ready(self):
        print(f"TopGG Loaded")

    @tasks.loop(minutes=30)
    async def update_stats(self):
        try:
            await self.dblpy.post_guild_count()
            logger.info(f'Posted server count ({self.dblpy.guild_count}), shard count ({self.bot.shard_count})')
        except Exception as e:
            logger.exception(f'Failed posting server count on top.gg: {e}')
#

i can't load the cog and idk why

distant oak
#

And this is not for Discord Webhooks

analog yacht
distant oak
#

Regen it

marsh acorn
#

heelo!
so I have:

topggpy = topgg.DBLClient(self.bot, self.token)
if await topggpy.get_user_vote(ctx.author.id):
    doStuff();
await topggpy.close()
```But I still get `unclosed client session` error ![upsidedown_cry](https://cdn.discordapp.com/emojis/701525440418021475.webp?size=128 "upsidedown_cry")
civic ocean
#

my bot says "N/A" instead of "server amount"
how can i open
this feature

rancid fractal
vast umbra
# kind path

you should close that on unload or once its finished

civic ocean
rancid fractal
tardy mauve
#

Can we only get API keys when Bot is accepted?

civic ocean
rancid fractal
# civic ocean lua?

Its just another language, I'm not sure how http requests are made for any other language. If you can figure out how to make an http request, it shouldn't be too hard

wicked horizon
#

is there a way to get a users bot via the api im only asking cause i dont see how via the docs

wicked horizon
#

damn

brittle stratus
#

A transformer has 1200 primary turns and 200 secondary turns. The primary and secondary resistances are 0.2 ๏— and 0.02 ๏— respectively and the corresponding leakage reactances are 1.2 ๏— and 0.05 ๏— respectively. Calculate (a) the equivalent resistance, reactance and impedance referred to the primary winding, and (b) the phase angle of the impedance.

jaunty plank
#

what even is this ๐Ÿ‘€

#

@brittle stratus no random copy pasta's in random channels please

marsh acorn
fast heath
#

how i make to show the votes in the bot?

jaunty plank
jaunty plank
fast heath
restive otter
smoky breach
#

Don't suppose anybody knows what this error means? It seems to happen when testing the voting webhook from the website.

jovial kiln
#

@hearty lintel

hearty lintel
#

mongo has nothing to do with the top.gg api or libs @jovial kiln @smoky breach

jovial kiln
#

wait thats mongo

#

im dumb sorry

smoky breach
#

Seems to definitely be related somehow, it doesn't show up until I press the "test" button on the website.

jovial kiln
#

It's something with mongo, nothing to do with the API. Could ask someone in #development that maybe knows about mongo

smoky breach
#

Managed to fix the Mongo issue though now it seems the webhook isn't being sent.

#

Nothing is logged to console and I've tried it like 10 times, all credentials are correct and I've even reset them multiple times.

#

It definitely should be listening:

#

https://www.youtube.com/watch?v=11WE2_sIZTE followed along with this tutorial. Not sure how outdated it is but I assume it isn't that old since it was only a month ago.

Yes, yes im not dead, i just took a 2 week long break ๐Ÿ˜…
Anyways, Here is a highly requested one, i thought of leaking my methods ๐Ÿ˜‰

Like, sub and share to other fellow coders :D

Code(s) used in the video: [ #public-codes In the discord server]
NPM Package used - https://npmjs.com/package/@top-gg/sdk
Discord server: https://discord.gg/S2GGa23
So...

โ–ถ Play video
fallow plank
jovial kiln
#

@fallow plank

fallow plank
#

not working

#

404

jovial kiln
#

Are you logged in?

fallow plank
#

yeah

jovial kiln
#

Replace it with your bots ID

fallow plank
#

ok

jovial kiln
#

:botid = your bot id

fallow plank
#

ohhhhhhhhh

#

sorry

jovial kiln
#

all good lol

fallow plank
#

how to make vote forced commands

jovial kiln
fallow plank
#

ok thanks

cunning dagger
#

how do i make a command for only who voted to my bot using py and replit?

fluid violet
#

Use aiohttp

#

And just read the top gg docs

smoky marten
thorn seal
#

how do I connect my account to roblox

#

๐Ÿง๐Ÿปโ€โ™€๏ธ

rocky sedge
#

is there a way to get, from the token, the bot id this token is attached to ?

#

ok I found, decode the second part of the token in base64

solid pelican
#

Hi there,
i need help..
i am trying to check my webhook setup on the server by clicking on 'send test' button but it is showing something went wrong for both me and my friend.
Would this affect the Webhook in any way?

smoky marten
wicked warren
#

๐Ÿ‘

unkempt yew
#

Can anyone say how to host the bot 24/7 online??

gleaming briar
signal hawk
#

dont do that

#

use a vps

#

also this channel is for top.gg api only, thanks

unkempt yew
restive otter
#

@unkempt yew it costs money but you can do that

#

Bot hosting sites

#

How Im keeping mine up 24/7 rn

#

Im using pebblehost

weary flicker
#

um can anyone provide a link for top.gg api for python?

sullen nymph
rain heart
odd turret
#

I have something for hosting @unkempt yew

#

Turn on dm,s

unkempt yew
#

Ok

#

@odd turret done

odd turret
#

Ok

fiery cloud
#

Whenever I try to post my bot's stats to topgg I get a 403 response code. I know I have the right token in the authorization so what could it be? Just decided to use the node module, it works

marsh acorn
# sullen nymph Version? When does it happen?

Randomly lol
I use the command... and then minutes/hours later, it prints... and then minutes/hours later, it prints again... over and over..
Version... I just installed the most up-to-date one

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000163D64400D0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000163D61B4D00>, 3144144.921)]']
connector: <aiohttp.connector.TCPConnector object at 0x00000163D6440D90>

with code:

class Vote(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def vote(self, ctx):
        token = 'token'
        topggpy = topgg.DBLClient(self.bot, token)

        if await topggpy.get_user_vote(ctx.author.id):
            doStuff()
      
        await topggpy.close()
restive otter
#

Just have an object and reuse it, why bother making one and closing it on every command call

#

That'll also cause the rate limiter to not work

marsh acorn
#

well, originally i had it as:

class Vote(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        token = 'token'
        self.bot.topggpy = topgg.DBLClient(self.bot, self.token)

    @commands.command()
    async def vote(self, ctx):
        if await self.bot.topggpy.get_user_vote(ctx.author.id):
            doStuff()

but it also errored

sullen nymph
#

Huh

restive otter
marsh acorn
next pendant
#

Hi, I recently switched over to the official @top-gg/sdk package and after 24 hours, I got my first duplicate vote. ( An issue I've been experiencing since the new web hooks system in March ) I'm not sure what else could be causing this issue CC: @elfin solstice

elfin solstice
sullen nymph
#

Do you get only 2 messages for each vote?

next pendant
#

It doesn't happen for each vote, just randomly happens

#

I thought it was my own routes, but apparently not because even using the official package it does it after some time

#

this is the first duplicate in nearly 48 hours

#

but this never happened until March when the system was changed

sullen nymph
#

Latest versions should be responding to requests so it's strange

#

You sure the requests just didn't delay themselves?

next pendant
#

I'm not sure, I guess I can check in the nginx logs

#

i did make vote async but I doubt that could be the issue

webhook.listener(async vote =>
sullen nymph
#

Doubt it

next pendant
#

I've had about 100+ votes since switching to the package and this is the first duplicate, took almost 48 hours

#

very strange

#

would looking at nginx access log help?

rain heart
#

there is a possible issue regarding double webhooks caused by a bug on the vote page

#

have added it to our issues, though not anyone who could reproduce it so far

next pendant
next pendant
#

I've been telling you guys this for months lol and Yukine kept saying it was on my end

rain heart
#

It was not related to your previous issue, this is something different

#

this happened just recently

next pendant
#

oh ok

sullen nymph
#

It's hard to reproduce it as well as Hope claims so I'd say it seems that it's hard to really pinpoint it

next pendant
#

Well on my system, sometimes it wasn't just duplicates. It was nearly 4-5 requests sometimes.

#

but ever since switching to the top gg package, i've only had 1 duplicate and it's just been a duplicate, not like 3-4+ requests.

rain heart
#

are you possibly using some sort of proxy between it, maybe that's sending duplicates through it

#

because this issue here is so rare that only one user seems to have encountered it

#

melmsie was the one to experience it

#

nevermind

#

that's an older one lol

next pendant
#

well on my old system, I wasn't using express directly, it was a routes api plugin built in the framework I'm using for my bot. On the new system, I am just using the ready event basically

rain heart
#

Otherwise, not sure what the issue might be

#

And you're saying it never happened when using your old system when using express directly?

#

Have you changed anything else apart from the system such as already said a proxy?

#

that could possibly cause double requests to somehow generate

next pendant
#

what's odd is it, I've kept logs of my votes since last year 6/2020 the first ever duplicate was 3/18/21

rain heart
#

was that before or after the new vote system you have implemented?

next pendant
rain heart
#

Because the only thing that might cause double vote requests are you not acknowledging requests on your webhook

next pendant
#

one day after the announcement for the re-write

rain heart
#

such as a random 5xx error happening from a proxy for example

next pendant
#

nope, all my logs show 2xx

#

even when it was multiple alerts, it was 2xx

rain heart
#

But are you using some sort of proxy like cloudflare or no?

#

such as a ddos protection etc

next pendant
#

I am using cloudflare

#

yes

#

should I just use my IP directly

rain heart
#

Nah bad idea, wouldn't suggest

#

but I'd suggest using some sort of app on cloudflare that logs traffic to proxy-based stuff

#

to see if either top.gg is sending double votes or your webhook receiving double votes through the proxy

next pendant
#

but I was using this same system since last year with no issues

#

lol

#

I showed this earlier when I was getting duplicates

rain heart
#

yeah I know, still could be caused by something else if you're saying that you're acknowledging requests

#

because the only thing that can cause these double votes is retrial stuff like timing out or a 5xx

#

I'd suggest enabling an app on cloudflare to log incoming traffic through the cloudflare network and check them occasionally

next pendant
#
[02/Apr/2021:19:48:04 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
 [02/Apr/2021:19:48:04 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
[02/Apr/2021:19:48:06 +0000] "POST /api/votes/topgg HTTP/1.1" 200 24 "-" "Top.gg Webhook/1.0.0"
rain heart
#

But these are your logs behind the proxy, I'm referring to cloudflare's end

rain heart
#

because requests go through cloudflare first and if cloudflare isn't able to transfer that request to your webserver, it responds to the webhook with a 5xx

#

causing retrial, thus possible double webhooks

#

Enable some sort of logging app on cloudflare, check the traffic for a few weeks or so and check it specifically if you've gotten another double vote

#

This should tell you if that's top.gg's fault, actually sending double votes to your webhook

#

or some sort of issue between cloudflare and your webhook causing timeouts or 5xx codes, thus retrials

#

Or if you're actually comfortable with that, letting requests go to the ip directly rather than cloudflare

next pendant
#

you think that could resolve the issue?

rain heart
#

Well might not resolve, but seeing where the issue might originate from

next pendant
#

but you're saying the nginx logs wouldn't show this 5xx you're talking about?

#

only top gg would get that?

#

also, you guys have no way to keep your logs? based on my webhook url or something?

rain heart
#

Because Cloudflare is the one to respond with a 5xx, not your webserver

#

Not sure if there are

#

top.gg probably does have logs about activity and errors, but not sure

next pendant
#

I see

#

well I guess I will try this

rain heart
#

any will do probably

next pendant
rain heart
#

I mean you're essentially exposing your servers ip unless you don't really mind

tardy bridge
#

;start

rain heart
#

dblbotcommands

celest pierBOT
#

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

tardy bridge
#

Can anyone tell me how to start?

rain heart
#

dblwrongserver too

celest pierBOT
#

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

rain heart
#

@next pendant logflare might help with it

next pendant
#

ok

rain heart
#

This will for sure help to find the issue

#

just use that for a bit to see if you're getting double requests

tepid wave
#

Is it possible for the webhook to be sent to a different port? because no matter what way of hosting I use, I have problems using port 80

gusty fog
#

ุนุฑุจูŠ

#

ููŠ ุญุฏ ุนุฑุจูŠ ู‡ู†ุง

tepid wave
rain heart
#

you'll have to define the port in the url though

tepid wave
#

k

gusty fog
#

My bot will save my nation

tepid wave
rain heart
craggy sentinel
#

top.gg currently requires you to reply with a 200

sullen nymph
#

200 specifically?

next pendant
#

?

#

I'm using the top gg package right now

#

v3.1.2

#

I've only had 1 duplicate in over 100 votes

craggy sentinel
sullen nymph
#

The js sdk responds with 204 apparently

#

Can't confirm

#

I respond with 200 so hell yeah

next pendant
#

yeah it does

#

its a 204

#

on the stk package

#

even on my routes I responded with 200 and still has duplicate alerts

#

not sure anymore lol

restive otter
#

the webhooks don't seem to be working after i upgraded to dj13 and node 16

#

does that have any effect?

restive otter
#

if i run it on the same code but node js 14 it works

plucky lance
#

Do you have 2 instances of nodejs running?

#

They canโ€™t listen to the same port.

shy vortex
#

^

restive otter
plucky lance
#

And you adjusted the port on topgg, pressed save and then test?

plucky lance
#

Thereโ€™s a webhook tester around the web.
Try to send a webhook to your endpoint using anything else than topgg.
If that doesnโ€™t work as well, the issue is on your side.

#

I mean I dunno your environment but if you host that service on a server you may have added firewall rules for the node v14 process in the past to pass your firewall.

#

If so did you repeat that for the new node v16 process/executable as well?

restive otter
rain heart
# next pendant not sure anymore lol

Again give it a try with logflare or using your actual IP for the webhook, I still think it has something to do with between cloudflare and your webserver

jaunty plank
#

Cloudflare can think top.gg is a bot and restrict access with default pagerules.
You'll really want to configure cloudflare for an api if you are using a webhook behind it.

jaunty plank
#

Cloudflare shouldn't by default block top.gg, but I'm under attack mode(or any browser checks), or if the security level for top.gg drops below your limit it will block top.gg.

void obsidian
#

@smoky swift

gray finch
#

where can i get the api token?

gray finch
#

ok thank you

smoky marten
#

np

rain heart
jaunty plank
rain heart
#

oh?

jaunty plank
#

comes from the digital ocean servers

rain heart
#

oh then nevermind kekw

#

thought that was a cloudflare network ip

native dust
#

this is don't working

#

help me

steady steeple
#

any errors?

rain heart
#

yeah "help me" doesn't describe the issue you're facing

muted plover
# native dust help me

#-- Description ----------
A short 1-2 sentence description of the issue

#-- Date ----------
DD/MM/YYYY (the date the issue was seen on)

#-- Steps to Reproduce ----------
(A list of steps with Request/Response copies for each step)
1.) Perform a step with a given purpose
2.) Do next step to produce outcome

#-- Expected Result ----------
(A short 1-2 sentence description of the result expected)

#-- Actual Result ----------
(A short 1-2 sentence description of the result that occurred and why that is incorrect)

#-- Relevant Links ----------
(Links to any relevant messages, articles, outcomes or results with titles)

Fill that out and send it here ๐Ÿ‘† Iโ€™m sure you will get a better response from their team if you do

rain heart
#

this

#

is 1:1 what would be cool

sullen nymph
#

YES PLEASE

rain heart
#

Dont mind

sullen nymph
#

YIS

muted plover
#

Lol

royal dock
#

Hey. Some votes are currently sent twice, is this a known issue?

willow tendon
#

What is the event with someone vote my bot (i am using event handler)

smoky marten
willow tendon
willow tendon
#

@smoky marten In index.js right ?

smoky marten
#

in any file you want

willow tendon
#

@smoky marten So

#
const express = require('express')
const { Webhook } = require(`@top-gg/sdk`)

const app = express()
const wh = new Webhook('webhookauth123')

app.post('/dblwebhook', wh.listener(vote => {
  // vote is your vote object e.g
  console.log(vote.user) // => 321714991050784770
}))

app.listen(80)

I didn't setup webhook before

#

So what should i change here

smoky marten
#

(For test I guess it's Xet)

smoky marten
#

Don't forget the /dblwebhook

willow tendon
#

oh okay

restive otter
#

Hi all

smoky marten
#

Bye all

willow tendon
#

This error

#

wait min,

smoky marten
#

You're using worker process not web

#

switch to web

willow tendon
smoky marten
willow tendon
#

I can't find it

#

oh yea

#

I found it

#

@smoky marten

2021-08-24T10:59:24.995450+00:00 app[web.1]: npm ERR! missing script: start
2021-08-24T10:59:25.004845+00:00 app[web.1]: 
2021-08-24T10:59:25.005440+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-08-24T10:59:25.005754+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-08-24T10_59_24_996Z-debug.log
smoky marten
#

Put
"start": "node ."
under scripts

willow tendon
#

ok

#

@smoky marten Didn't crash but i don't know if it's working

jagged nimbus
#
wow
willow tendon
#

@smoky marten

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
smoky marten
willow tendon
#

@smoky marten Same thing
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

smoky marten
#

Show code

willow tendon
# smoky marten Show code
const express = require('express')
const { Webhook } = require(`@top-gg/sdk`)

const app = express()
const wh = new Webhook('webhookauth123')

app.post('/dblwebhook', wh.listener(vote => {
  // vote is your vote object e.g
  vote.user.send(`![Diamond](https://cdn.discordapp.com/emojis/853496052899381258.webp?size=128 "Diamond") Thanks for supporting our bot!`)
  console.log(vote.user) // => 321714991050784770
}))

app.listen(process.env.PORT || 80)
rain heart
#

process.env.PORT || 80
just use 5000 instead

smoky marten
smoky marten
# willow tendon ```js const express = require('express') const { Webhook } = require(`@top-gg/sd...

also
vote.user.send() won't work
because vote.user is just the user ID
You have to fetch the user first
Try this

//const client = Your Discord.js Client
const express = require('express')
const { Webhook } = require(`@top-gg/sdk`)

const app = express()
const wh = new Webhook('webhookauth123')

app.post('/dblwebhook', wh.listener(vote => {
  console.log(vote.user)
  client.users.fetch(vote.user).then(u => {
    u.send("Thanks for voting")
  }).catch(console.error)
}))

app.listen(process.env.PORT)โ€Š
willow tendon
#

oh okay

smoky marten
#

@fierce dove about the message in #support which language are you using ?

smoky marten
#

Try this

const fetch = require("node-fetch")

const name = "Dyno" //The one to search
const token = "YOUR_TOPGG_TOKEN"

fetch(`https://top.gg/api/bots?limit=10&search=${name}`, {
  method: "GET",
  headers: {
    "authorization": token,
    "content-type": "text/json"
  }
}).then(r => r.json()).then(bots => {
  //Bots is the list of bots
  console.log(bots[0])
}).catch(console.error)
#

@fierce dove ^^^^

smoky marten
#

You can also use @waxen widgetgg/sdk which will be easier

#

sorry top

old kernel
#
app.post('/vote', webhook.listener(vote => { //ending url
    console.log("User with id - " + vote.user + " Voted!")
    let value = JSON.stringify({
        embeds: [
            {
                title: "New Vote!!",
                description: `<@${vote.user}> (${vote.user.tag}) Just Voted For \`The Real\`!!`,
                author:``,
                footer: `You can vote again after 12 hours`,
                color: "2461431" //Hex -> Decimal
            }
        ]
    })
#

this is correct or not plz tell me

#

<@${vote.user}> (${vote.user.tag})

#

for this tag #pukhraj0581

arctic musk
#

you miht wanna cache the userid

old kernel
#

oh

arctic musk
#

so that if there not in any mutuals you still get the tag

old kernel
#

so what i need to do for topgg sdk

smoky marten
old kernel
smoky marten
#

user is string

#

it doesn't have . id

#

or .tag

arctic musk
#
dbl.webhook.on('vote', async (vote) => {
  let testserver = client.channels.cache.get('828148248131665941');

  let oh = client.channels.cache.get('820851306595352597');
   console.log(vote)

   const userID = vote.user;
   const votedfor = vote.guild ? `oh 2.0` : `<@${vote.bot}>` ;
   let type = vote.guild ? `servers` :  `bot`;
   const id = vote.bot || vote.guild ;

   const user = await client.users.fetch(`${userID}`, { cache: true });
   const userTag = `${user.username}#${user.discriminator}`;
   
        const embed = new Discord.MessageEmbed()
            .setColor('#FFE082')
            .setTitle('New UpVote')
            .setDescription( `<@${userID}> Just Voted For ${votedfor}`)
            .addField(`Username`, `\`\`\` ${userTag} \`\`\``)
            .addField(`Website`, `[Top.gg](https://top.gg/${type}/${id}/vote)`)


   // If the channel to send messages in exists, we send a message in it with the ID of the user who votes
   if(testserver) await testserver.send(embed)
   if(oh) await oh.send(embed) 

});
#

something like that

#

thats what i do

#

for vote logging

old kernel
#

oh

#

thnq

arctic musk
#

just change the channel id's at top for your channel id's if you do copy it

old kernel
#

๐Ÿ‘€

#

interesting

arctic musk
#

i can send my full code for my vote tracker if u want

rain heart
#

let's not spoonfeed

#

thank you

arctic musk
#

?

#

im just trying to help them understand

rain heart
#

That's essentially spoonfeeding what you're doing

#

That's not understanding

#

that's plain spoonfeeding

arctic musk
#

rip

#

sorry then nvm

rain heart
#

You can explain them how it works, but not simply provide code that causes them to not learn anything from it

arctic musk
#

well some proplr learn better from seeing what you are talking about then just hearing it

#

having a visual example

#

but yea i see where you are coming from sorry

willow tendon
#

@smoky marten

2021-08-24T16:58:19.988473+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=POST path="/dblwebhook" host=my-botjs.herokuapp.com request_id=dd9e878c-e121-4dbf-8d50-91f5ede9aae7 fwd="159.203.105.187" dyno= connect= service= status=503 bytes= protocol=https
plush musk
#

just want to report an issue regarding my account that got blacklisted in karuta bot

hushed reef
#

helo am karuta suport

#

please DM

plush musk
#

i tried contacting them but they lead me here

sullen nymph
#

How the fuck

plush musk
#

they said to contact the developers of the bot

#

then press the Developers there

#

then lead me here

sullen nymph
#

Uhh...

#

Can you show where you clicked?

plush musk
sullen nymph
#

Not the bot

plush musk
#

but i can ask here cant i?

#

i mean theres no problem at all about asking about an issue

#

am i right?

sullen nymph
#

You always can. Just don't expect anyone to answer you as we don't know shit about that bot

#

Plus wrong channel as it's not related to Top.gg API at all

plush musk
#

sorry my bad

#

i've been contacting supports for a whole day now

#

@nova cedar

#

@magic star

nova cedar
#

? you getting blacklisted from karuta has nothing to do with top.gg, nor did anyone direct you here

plush musk
#

i was just trying to find a way to contact any support out there

#

is there any way that i can play karuta again?

#

@nova cedar

#

even if it means starting from scratch again

stone needle
#

stop using this discord as a means to contact them, it has nothing to do with karuta

rain heart
#

Please avoid pinging members from this server for unrelated things of top.gg

plush musk
#

okie sorry for the trouble

rain heart
#

If you have any inquiries about Karuta, visit their support and not bother their staff through this server

#

dblwrongserver

celest pierBOT
#

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

smoky marten
# willow tendon <@!584309117380853770> ``` 2021-08-24T16:58:19.988473+00:00 heroku[router]: at=...
The router will enqueue requests for 75 seconds while waiting for starting processes to reach an โ€œupโ€ state. If after 75 seconds, no web dynos have reached an โ€œupโ€ state, the router logs H20 and serves a standard error page.

Your app was put to sleep for no request for a long time and when it was waking up It took more than 75 seconds. To prevent this keep pinging your application using uptimerobot or something.

pastel light
#

Hey my bots server count isnt updating even while im posting its statistics, why is that

sudden flare
#

in earlier versions of the Python lib of Top.gg api (v0.4.0), I was able to listen to the same webhook port from different applications/bots. Now I get error while attempting to bind on address ('0.0.0.0', 5000): address already in use. How do I get around this?

sullen nymph
#

You can't re-use a port while it's occupied

sudden flare
#

of course

#

but isn't it possible to listen to it by multiple applications? @sullen nymph

sullen nymph
#

Negative

restive otter
#

Heyy, so how can my bot Dm the person who voted for my bot? Basically - person votes for bot, they recieve Dm from bot saying thanks for voting and here's a reward.

jaunty plank
jaunty plank
#

Ping me if you need more help.

restive otter
#

Kk

restive otter
#

@jaunty plank so I'm new to express / js how can I have embeds in it and make the bot Dm the person who voted. I used some tutorials but it only was like a channel log

jaunty plank
#

At that point it's just using your bots client.
Fetch the user, and send a message to them like normal

restive otter
sudden flare
#

I am getting 403 from https://top.gg/api/bots/193431106647883776/check?userId=90076279646212096 with a proper header (my token is valid). why could this be happening?

rain heart
#

What's your bot id

sudden flare
#

its in the url

#

topgg python library debug log: topgg.http: GET https://top.gg/api/bots/193431106647883776/check with None has returned 403

rain heart
#

that's not your bot id

sudden flare
#

wait

#

its true

#

its not my bot id

#

its 212783784163016704

#

why is it using a different id

rain heart
#

because you have provided it that id

#

193431106647883776 is not a bot on top.gg, if thats even a bot

sudden flare
#

I think I understand what's going on

#

I can't check a vote on another bot?

rain heart
#

correct

#

only for the corresponding api token

sudden flare
#

does the 403 response explain this? I didn't fully check

rain heart
#

yes it does

sudden flare
#

like in its content

rain heart
#

193431106647883776 is not a valid id, at least none on top.gg

#

your bot id is 212783784163016704 according to the logs

sudden flare
#

yes

#

I just have a second bot, and was trying to pull votes using my main bot's top.gg credentials

#

I understand the issue now, thank you

stuck plume
#

@rain heart please, review my bot quickly.

rain heart
#

dblupto @stuck plume

celest pierBOT
#

@stuck plume

The average up-to-date approval times are stated [here](#support message).

This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.

There is no exact time for how long bot approval will take.

There is a queue and you're not first, nor are you last.

stuck plume
#

So that, I am requesting you specially.

rain heart
#

No, wait for your to to be reviewed

whole iron
#

How do I make my bot send a DM to the user who has voted my bot on top.gg??

golden adder
whole iron
#

Thanks!

next pendant
#

@rain heart hey so I took of proxy off cloudflare, still had a duplicate today lol

rain heart
#

Lol

next pendant
#

It has to be something in the new webhooks

#

how do I go an entire year without a duplicate

#

and suddenly duplicates since then

rain heart
#

Weird is that you're the only one encountering it full time

#

It's so weird

next pendant
#

yeah

#

hmm

#

I haven't tried logging yet

#

maybe I'll do that

rain heart
#

Yeah try that

formal jackal
#

i tried to post my bot server count and i got an error

#

Unauthorized: Unauthorized (status code: 401)

#

This error

restive otter
#

Anyone can set my bot stats

#

Please

void obsidian
#

no u need to set it up in ur code

restive otter
#

@golden adder

void obsidian
#

dont ping mods for this lol

restive otter
#

I am not using java

void obsidian
#

wat are u suing

restive otter
#

I am using Aoi.js

#

Not node.js

#

@void obsidian

void obsidian
#

well

#

get sad then lol

restive otter
#

๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ

formal jackal
void obsidian
formal jackal
#

so what is top.gg token how can i get it ?

void obsidian
#

dont kiss him lol

formal jackal
#

soo can i ask, what is the shard count ?

jaunty plank
#

its the number of shards your bot uses, if you dont know what a shard is you dont need to use it.

hasty adder
#

Accept my bot

jaunty plank
formal jackal
whole iron
#

So...After getting the token...?

formal jackal
fierce dove
restive otter
#

idk what is wrong, sometimes the votes keep coming and then suddenly stop, how many ever times i click on test the vote does not count

rain heart
restive otter
rain heart
#

it is very likely something with your webhook if you receive votes inconsistenly

restive otter
forest trench
#

so im trying to test my webhook which isnt really working, im making it print the data but nothings happening, im hosting my bot on a vps.

brave pumice
#

How much RPS are allowed

#

For API

shrewd vector
#

Why did i get pinged

forest trench
sullen nymph
restive otter
#

Got the vote log running for js but how do i give them reaards now?

forest trench
#

Anything I'm missing?

rain heart
devout gate
#

Hi

#

Bro I am not able to use dank memer

#

Can anyone please help me out?

tidal idol
#

dblwrongserver

#

Huh

#

Oh

devout gate
#

Thanks btw

abstract yew
#
const { Webhook } = require(`@top-gg/sdk`)

const app = express()
const wh = new Webhook('astrexauth')

app.post('/dblwebhook', wh.listener(vote => {
  // vote is your vote object e.g
  
  console.log(vote.user) // => 321714991050784770
}))

app.listen(process.env.PORT || 80)```
This isnt working im using heroku btw
keen gull
restive otter
#

@abstract yew help me

restive otter
haughty peak
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)
#

someone help?

#
TOKEN = os.getenv("token")
dbl_token = os.getenv("topggtoken")
client = commands.Bot(command_prefix=commands.when_mentioned_or('?'), intents=discord.Intents.all(), case_insensitive=True,  description='Best moderation bot ever!')
client.topggpy = topgg.DBLClient(client, dbl_token)
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
client.topgg_webhook.run(5000)
client.remove_command("help")
```These are the variables
restive otter
#

can someone help me

#
from discord.ext import commands
import os
import dbl
#using webhooks
from discord import Webhook, AsyncWebhookAdapter
import aiohttp

#For Intilizations
dbl_token = os.getenv("dbltoken")
dbl_webhook = os.getenv("dbl_webhook")
dbl_auth    = os.getenv('dbl_auth')

url_for_dbl_vote = os.getenv('dbl_webhook_for_vote')


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = dbl_token  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path=dbl_webhook, webhook_auth=dbl_auth, webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")
        
        async def dbl_vote(data):
            async with aiohttp.ClientSession() as session:
                webhook = Webhook.from_url(url_for_dbl_vote, adapter=AsyncWebhookAdapter(session))
                await webhook.send(data, username=f'{self.bot.user.name}',avatar_url = self.bot.user.avatar_url)

        await dbl_vote(data)
        

        

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")

        async def dbl_vote(data):
            async with aiohttp.ClientSession() as session:
                webhook = Webhook.from_url(url_for_dbl_vote, adapter=AsyncWebhookAdapter(session))
                await webhook.send(data, username=f'{self.bot.user.name}',avatar_url = self.bot.user.avatar_url)

        await dbl_vote(data)
        


def setup(bot):
    bot.add_cog(TopGG(bot))
#

this is my code

#

but it's not working

#

dbl_vote and dbl_test doesn't work

#

btw i am using the dbl module since i am coding in python

sullen nymph
#

Use topggpy

#

Wtf

#

Just have the dbl_vote function in the class and call it

#

Why recreate it

#

What URL did you set on Top.gg and do your Auth keys match?

restive otter
restive otter
restive otter
# sullen nymph Just have the dbl_vote function in the class and call it

so like this right?:

import discord
from discord.ext import commands, tasks
import os
import dbl
import json
#using webhooks
from discord import Webhook, AsyncWebhookAdapter
import aiohttp

#For Intilizations
dbl_token = os.getenv("dbltoken")
dbl_webhook = os.getenv("dbl_webhook")
dbl_auth    = os.getenv('dbl_auth')

#To Inform Developer that the bot has been voted
url_for_dbl_vote = os.getenv('dbl_webhook_for_vote')


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = dbl_token  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path=dbl_webhook, webhook_auth=dbl_auth, webhook_port=5000)

    async def dbl_vote(data,self):
            async with aiohttp.ClientSession() as session:
                webhook = Webhook.from_url(url_for_dbl_vote, adapter=AsyncWebhookAdapter(session))
                await webhook.send(data, username=f'{self.bot.user.name}',avatar_url = self.bot.user.avatar_url)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")
        await self.dbl_vote(data)
        
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")
        await self.dbl_vote(data)
        


def setup(bot):
    bot.add_cog(TopGG(bot))

sullen nymph
#

Can you DM me the URL you have set?

rain heart
#

test it using a request client like postman or reqbin

restive otter
#

Hi can anyone help me to add embeds, say and add reaction on bot created in discord bot clint

rigid linden
#

quick question, where do I get a dbl token

celest pierBOT
#

@restive otter

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
rigid linden
forest trench
rain heart
#

test your webhook using postman or reqbin

forest trench
#

alright

forest trench
dim knot
#

how do i add server count?

rain heart
#

dblservercount

celest pierBOT
#

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

rain heart
forest trench
rain heart
#

tcp

forest trench
#

Alright

forest trench
#

how do i get the user id from data?

#

i tried data.user but didnt work

paper sentinel
#

p

forest trench
#

Nvm it's data["user"]

nocturne escarp
#

bd!help

#

db!help

#

@celest pier

sullen nymph
#

Was supposed to work on that PR further, fuck

jovial kiln
nocturne escarp
#

dblbots

#

dblhelp

#

ohh

smoky temple
#

dblapidocs

#

dbl api docs

smoky marten
drowsy flame
#
const Topgg = require('@top-gg/sdk')

const webhook = new Topgg.Webhook('E_E')

    app.post('/dblwebhook', webhook.listener(async(vote) => {
         hook.send(`<@${vote.user}> , **has voted for ${client.user.username}!**๐Ÿ’—`)
    }))

    app.listen(4069, function() {
        console.log('Listening to port ' + port)
    })
``` This supposed to work right?
lament talon
#

i am a bit dumb, can someone help me out with setting up the server count feature

sinful sierra
#

dblhelp

#

dblservercount

smoky marten
lament talon
#

i am jusing javascript.
discord.js library

smoky marten
#

@lament talon ```js
const { AutoPoster } = require('topgg-autoposter')

AutoPoster('topgg-token', client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})

lament talon
#

thank you so much!

smoky marten
#

np

restive otter
#

hey, can some tell me what that mean ?

plucky lance
#

On the edit page you can see another input for Authorization. Here you can provide a shared secret that you can check for on the server side.
To verify requests are coming from us, look for the value in the Authorization header and make sure it is the same as the value you provided in the form.

smoky marten
restive otter
uncut kelp
#

i put this on webhooks url
https://myapps.herokuapp.com/dblwebhook

at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=myapps.herokuapp.com request_id=48521e2c-53a2-45d2-94fb-ea2458d800ee fwd="159.203.103.184" dyno= connect= service= status=503 bytes= protocol=https

any solution?

tidal idol
#

With your heroku url

uncut kelp
tidal idol
#

Oh

uncut kelp
#

what?

verbal citrus
#

how do i post server count to my bot's topgg?

#

i read the docs but i dont reallt know how the code would look like

uncut kelp
verbal citrus
#

but somebody could just set it to like 9999999 ?

#

i imagine that it would be against the rules tho

smoky marten
#

@sacred shell

verbal citrus
#

suuuuure

sacred shell
#

ty

smoky marten
sacred shell
#

i already banned them but their message didnt get bonked๐Ÿ˜”

uncut kelp
#

i change into npm start? that's will be ok?

uncut kelp
#

i try to use web but still same error

native dust
#

dbl!help

#

dbl help

rain heart
#

that bot doesn't have a help command

#

also

#

dblbotcommands

celest pierBOT
#

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

smoky marten
#

*dyno / dino nit sure

#

Like this

uncut kelp
#

yup but still same error

smoky marten
uncut kelp
smoky marten
smoky marten
#

And you didn't close a )

uncut kelp
#

ok i'll try later, thanks btw

uncut kelp
rain heart
#

Up to you

uncut kelp
#

TypeError: webhook.listener is not a function

#
app.post('/webhook', webhook.listener(), async (req, res) => {

    console.log(req.vote.user)
})
app.listen(process.env.PORT)
smoky marten
uncut kelp
#

uh im not update haha

#

i try to update it

smoky marten
#

see the first code in the pins @uncut kelp

#

Top.gg Node SDK has been updated
In v3.1.0

The Webhook.middleware() still works, however there's a new method to work with webhooks,
using the Webhook.listener() method
Here's an example

const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('Top.gg webhook password')
const app = express()

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

app.listen(80)โ€Š

As you can see Webhook#listener() takes a function that is ran whenever a valid vote is passed
You can also error in this function in order to have the webhook re-queue the payload by passing back a 500 (via the retrial flow https://docs.top.gg/resources/webhooks/#retrial)

Docs for the new listener() method:

uncut kelp
#

npm start can auto install ?

#

like node index.js

smoky marten
uncut kelp
smoky marten
#

OwO

uncut kelp
#

i got this message
at=info method=POST path="/webhook"
and userid

#

i think thats work right?

smoky marten
#

Does it console.log anything ?

uncut kelp
#

that is not error?

smoky marten
#

no
It works

#

Completely as intended

#

Good job

uncut kelp
#

thanks!

uncut kelp
smoky marten
uncut kelp
smoky marten
uncut kelp
#

put that code on index.js?

smoky marten
uncut kelp
#

okk thanks

smoky marten
uncut kelp
smoky marten
#

yes

uncut kelp
#

ok

#

@smoky marten

#

i got error

smoky marten
# uncut kelp i got error

F u c k
Use this code sorry

app.all("/", (req, res) => {
  res.status(200).json({ status: 200 })
})โ€Š
uncut kelp
#

this log always show for a few minutes, it's normal?

rapid path
#

for votes can u use a discord webhook

restive otter
#

Not directly

rain heart
#

you need some sort of bridge that converts the requests from top.gg for a discord webhook

#

because top.gg does not send a webhook as data

#

not data in form of a webhook per se

last bloom
#

if I vote now, will the vote reset after 24 hours?

#

like are the counted votes permanent or do they reset?

rain heart
#

resets every 12 hours

#

aka every vote cycle

#

if they have voted within the last 12 hours, shows 1

#

if they haven't, shows 0

sharp moon
#

LETSFUCKINGGO thanks for giving me their profile picture

#

so helpful

last bloom
smoky marten
violet spire
#

app.all("/", (req, res) => {
res.status(200).json({ status: 200 })
})

restive otter
#

@violet spire can you help me

violet spire
#

How

violet spire
restive otter
#

i want to see my bot in how many server

#

Like

#

20

#

30

#

Or above

violet spire
#

Mmmm wait

restive otter
#

can someone help wit applicaiton bot?

#

@restive otter tell prob

#

idk hot to work it

smoky marten
restive otter
#

oh ok

#

i want to see my bot in how many server@smoky marten

#

@violet spire @violet spire

jovial kiln
#

Please stop pinging users randomly

#

You were already told to read the documentation on how to use the API and post your server count

jovial kiln
#

I have sent you the link twice now

#

Go to the "Libraries" section and select your language

restive otter
#

I read

jovial kiln
#

It will tell you how to use it if you read it

restive otter
#

My lang is node.js

jovial kiln
#

Then use the javascript lib

restive otter
#

@jovial kiln which one i use webhbook

jovial kiln
restive otter
#

Or its bot token

jovial kiln
#

go to your bots page, then go to edit and select webhook

restive otter
#

@jovial kiln bro its on which website

jovial kiln
sinful sierra
#

Hi

balmy wharf
balmy wharf
real yew
#
const DBL = require('top.gg');
const dbl = new DBL(my dbl token, {webhookPort: 2025, webhookAuth: 'topgg123' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

In console when the bot runs then it shows - Webhook running at http://0.0.0.0:2025/dblwebhook/

#

but when I do test vote then it does not give any error and does not work

#

can anyone help ?

real yew
#

Now its fixed

balmy wharf
#

Why i pasted my client id to top.gg but it didnโ€™t recognize my bot?

rain heart
#

Clear cache and try again

plucky lance
#

Depends on your browser, CTRL + F5 or SHIFT + F5

#

If that doesnโ€™t help, navigate through your browser settings, and delete the cache for topgg

#

Well then itโ€™s your mobile browser settings

#

Named website data on iOS

#

Probably similar on Baddroid

tardy mauve
#

How do i obtain my api key on the the theme? can't seem to find it.

midnight vapor
#

Hello. I have question. In the java api something exist called: api.setStats(shardId, shardCount, serverCount); but how can i post how many servers my bot has and many shards my bot have?

#

I dont test this example but i dont want to post stats for just one shard

gilded flax
#

why it does not work ?

smoky marten
#

also check if nginx is configured correctly

gilded flax
#

where I find my port

smoky marten
#

you're already putting 2039 without knowing what port is ?

gilded flax
#
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const app = express()

const webhook = new Topgg.Webhook('topggauth123')


app.post('/vote', webhook.listener(vote => {
    console.log("User with id - * + vote.user + * Voted !")
    let value = JSON.stringify({
        embeds: [
            {
            title: "Top.gg - Votes",
            description: `![Th_rank_up](https://cdn.discordapp.com/emojis/872300581350441000.webp?size=128 "Th_rank_up") <@${vote.user}> a votรฉ pour Eclix, merci ร  lui !

[Vote toi aussi !](https://top.gg/bot/870653313559957504/vote)`,
             color: "BLUE"      
            }
        ]
    })
    fetch("my webhook", {
        method: 'POST',
        headers: {
            'Content-type': 'application/json',
        },
        body: value
    }).catch(e => console.log('Error occured while posting webhook : ' + e))
}))
app.listen(2039)
console.log("Your app is ready to log vote :D")```
restive otter
#

hi how can i set that the user have to vote to access a particular command do we have some docs like structure ?

#

@jovial kiln where can i get the section of it in the docs

jovial kiln
#

What lang are you using

restive otter
#

djs

jovial kiln
west narwhal
#

I need need help setting up webhooks inside of My bot

#

f you need help setting up webhooks inside of your bot don't be afraid to ask in our discord server in the #topgg-api channel.

golden adder
west narwhal
#

nope

golden adder
#

You can't set up webhooks until your bot is approved

west narwhal
#

Who approves the bots?

golden adder
#

Bot reviewers

west narwhal
#

Your one of them

golden adder
#

Yes all Moderators and CMs are also bot reviewers.

west narwhal
#

lol are any of you all avalible ?

jovial kiln
#

I am available what's up @west narwhal

golden adder
celest pierBOT
rain heart
#

staff only

scarlet cobalt
#

One message removed from a suspended account.

west narwhal
#

oH

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

west narwhal
#

Xd

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.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

restive otter
#

hello

#

how i get webhook link

#

to make a voting system

jovial kiln
marsh acorn
#

I know cog_unload can't be a coroutine... so how do I close my connection with await topggpy.close() in def cog_unload(self): since i can't do await def cog_unload(self):
Also, is there a cog_reload form of a function?

#

im only asking because i am getting this error: Unclosed client session
and i was told its because i need to close my connection when i unload the cog

sullen nymph
#

asyncio.run(topggpy.close())

#

Or get an event loop with asyncio and run_until_complete

sullen nymph
#

Well, "issue"

restive otter
#

@jolly hornet

abstract yew
#

how to check if user has voted in last 12 hrs

real yew
#

I have made a vote tracker event in my bot which is hosted on heroku. So the problem comes that my bot goes on idling if there is no vote for 30min

#

Any solutions ?

real yew
restive otter
real yew
abstract yew
real yew
#

and did it

#

And for database you can use mongoDB or anything else you like

grand wave
#

hm

sullen nymph
restive otter
#

how can i put server count at my bot page ?

rain heart
#

dblservercount

celest pierBOT
restive otter
rain heart
#

Language?

restive otter
#

bot language ?

rain heart
#

programming language

snow panther
#

Js

rain heart
shy vortex
#

is there a way to get reviews yet through the api

#

a way to get a list of reviews and a review by id or something

#

by discord user id for example

restive otter
#

wait lemme get the endpoint because its not documented (ig)

#

https://top.gg/api/client/entities/:botid/reviews?page=1

polar birch
#

how do i make when someone votes it sends an ty message in an spesific channel?

real yew
restive otter
#

is there a way I can do a test vote for a bot?

jaunty plank
restive otter
#

thank you

restive otter
#

is there any way to stop the webhook from running? because everytime i reload my code it gives me error while attempting to bind on address

plucky lance
#

Exit the CLI your webhook code being fired in

deep orbit
#

How do I advertise my sever in top.gg

rain heart
#

dblauctions

celest pierBOT
rain heart
wooden harbor
#

@jovial kiln wdym-

jovial kiln
wooden harbor
#

huh

#

why i need this :<

jovial kiln
#

Because that is how our API works

rain heart
#

@jovial kiln I think that wasn't why they asked in support

#

the server said widgets need to be enabled which is an issue atm iirc

jovial kiln
#

oh

#

oops

restive otter
#

Why can't I edit the bot page on top.gg?Every time I log in and enter the bot it says you must log in

rain heart
balmy wharf
#

Is aplication id is client id?

jovial kiln
#

yes

balmy wharf
#

Is sth wrong or i havenโ€™t done sth

fervent thistle
#

How do I make it so it shows how many server my bot is In

restive otter
uncut kelp
#

btw why my server count not update?
i put this code

setInterval(async() => {

    api.postStats({
      serverCount: client.guilds.cache.size,
    })

}, 60000 * 60 * 24);
restive otter
#

i dont know how to get webhook url

serene shuttle
#

I have my cog for the bot set up like follows:

class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot

        self.dblpy = dbl.DBLClient(
            self.bot,
            os.getenv("dblwebhook_key"),
            webhook_auth=os.getenv("dblwebhook_auth"),
            webhook_port=5000,
            autopost=os.getenv("environment") == "main",
        )

But the server count is not being updated - is autopost not working, or have I set something up incorrectly?

#

Trying to post manually I get the following error:

Traceback (most recent call last):
  File "/bot/modules/cogs/forbidden.py", line 347, in evaluate
    ret = await func()
  File "<string>", line 2, in func
  File "/usr/local/lib/python3.9/dist-packages/dbl/client.py", line 160, in post_guild_count
    await self.http.post_guild_count(guild_count, shard_count, shard_id)
  File "/usr/local/lib/python3.9/dist-packages/dbl/http.py", line 168, in post_guild_count
    await self.request('POST', '/bots/stats', json=payload)
  File "/usr/local/lib/python3.9/dist-packages/dbl/http.py", line 93, in request
    async with rate_limiter:  # this works but doesn't 'save' over restart.
  File "<string>", line 6, in __aenter__
TypeError: object Lock can't be used in 'await' expression
flint summit
#

how do I authorize myself?

#

I'm using node.js and node fetch

#

and I have my token but idk what to do here

plucky lance
#

As the docs describe you have to specify the header called Authorization as option of node-fetch
headers: { "Authorization": "your-topgg-token" }

jaunty steppe
#

can someone help me out understanding this bit?

#

I have a feeling that my lib is ratelimiting this incorrectly

#

right now I've interpreted it as sending 60 requests to ANYTHING under /bots to be a ratelimit

#

however the wildcard suggests to me that it may be per resource under /bots

#

so like

#

60 requests to /bots/ + random_user_id would be ratelimited? (how I'm currently handling it)
60 requests to /bots/ + singe_user_id would be ratelimited (how I think it's meant to be handled)

plucky lance
#

Those 60 requests/min apply to all resources of /bots, yes, no matter it's /bots/stats /bots/whatever
Different (child) ressource can have tighter restrictions but not necessary have them

#

Requesting 30x /bots/stats and 31x /bots/whatever will get your rate limited

jaunty steppe
#

I see, thank you

plucky lance
#

Requesting 61x /bots/stats as well

#

and so on

#

All requests within the /bots resource will be added sum up

#

No matter it's a sub (child) resource or not

jaunty steppe
#

So 60 requests to /bots/1 will be fine, but sending a request to /bots/2 after that would ratelimit?

plucky lance
#

If /bots/stats would have a ratelimt of 10/min and you would be rate limited after calling 11x /bots/stats you can still use other resources of /bots but not /bots/stats any longer

plucky lance
lament talon
#

hey i am having some difficulty in using the top.gg api
so i am trying to use the individual user vote to give them access to some features
but i am not aware on how to use the api

#

can someone pelase help me out

jaunty steppe
restive otter
plucky lance
#

If you terminate the webserver's process it's (guess) terminated

#

The app will no longer listen to the port

restive otter
#

hmm but even after a complete restart of my pc it still gives the error when i launch it for the first time

plucky lance
#

It will be a free available port again, may takes asecond but it will be free again

#

Which port do u use?

#

not even aware of the error anymore, can u send the error, pls?

restive otter
restive otter
plucky lance
#

Do you manually start the webserver or is the process automated?

restive otter
#

btw it still works correct i just dont like to see errors

plucky lance
#

But does this process (bot) starts automatically if the system boots up?

lament talon
restive otter
lament talon
#

but i am confused about one thing, so i would like to give access to a user to a certain set if commands. So would i need to have backend for it?

plucky lance
#

And no other process is using port 5000? Did you try another port on the startup?

restive otter
#

btw do i have to use a webhook to get the on_vote event?

jaunty steppe
#

if response.json["voted"] is true, they voted

#

if it isn't, they haven't voted

lament talon
#

ah ok

#

and a vote lasts for how long until they can vote again?

plucky lance
#

12 h

lament talon
#

ok

restive otter
#

i tried a different port and the same thing happens, once it runs it basically always runs

#

so i will simply add a command to run the webhook

plucky lance
#

Try to bind it to your system's IP address instead of 0.0.0.0

restive otter
#

oh i can try that

#

do i just add that as the first argument of the webhookmanager?

plucky lance
#

huh what?

#

To run what webhook?

restive otter
#

topgg.WebhookManager(self.client).dbl_webhook('ip/webhook', 'password')

plucky lance
#

hmm actually can't help u out with python, don't speak snakish oldEyes

restive otter
#

oh alright

#

ill just try some stuff ig

plucky lance
#

But the webhook service will continuesly listen to incoming events, it's not something u wanna start via. a command

#

You wanna init it's process

#

(events = POST requests)

sullen nymph
restive otter
#

yeah i got that

#

i figured out the problem apparantly the __init__ function gets called twice on startup

plucky lance
#

alright

winter ridge
winter ridge
dim knot
#

dank memer

winter ridge
#

ok thx for info bruh

shut remnant
#

What should I add to Webhook URL ?

cold root
plucky lance
sullen nymph
#

So /shrug

restive otter
#

but i found a couple different solutions

cold root
sullen nymph
#

You mean route not webhook?

cold root
#

Oh yeah that's how they call it ๐Ÿ˜…

plucky lance
cold root
#

Oh

#

ping in replies btw always :)

plucky lance
#

Not needed tho

sullen nymph
#

SSL is supported though

plucky lance
#

Looks like an issue on my end unable to verify the first certificate

#

nvm yeah an issue on my site

sullen nymph
#

Skill issue

#

:^)

plucky lance
#

challenge accepted, Sir

sullen nymph
#

Roger

restive otter
#

i did a webhook to my bot vote

#

next what to do?

#

anyone help plz