#topgg-api

1 messages · Page 140 of 1

rain heart
#

saying "fix it" does not contribute to their issue.

#

-api

abstract mothBOT
#

@short leaf

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.

white wyvern
#

Where can I find the startup code in the docs?

rain heart
#

in the getstarted section of the docs

latent ginkgo
#

🙂

white wyvern
#

Thanks! :)

#

What happened to dblapi.js?

#

Was it removed?

rain heart
#

read pins

white wyvern
#

.. and regarding the authorization header, where am I supposed to save that, please?

rain heart
#

read the docs

sullen nymph
#

What do you mean by "save"?

white wyvern
rain heart
#

That's something you send with the Request

#

that's the header

#

As the title of the codeblock says

cunning verge
#

slonk Test

rain heart
#

seems to work

white wyvern
#

What am I supposed to put here?

#

The webhook URL one, cause the authorization is the top.gg bot list token

#

I found you send this. http://ip:port/dblwebhook

#

ip is the 127... one and the port is the 8080 I think, and the dblwebhook?

sullen nymph
#

IP is not 127.0.0.1

uncut lintel
#

so i am trying to do a auto post of the server count and am getting the error Cannot read property 'size' of undefined

white wyvern
#

But what about the dblwebhook?

sullen nymph
#

What do your webhook settings look like in your code?

white wyvern
#
    /* Top.gg API*/
    const AutoPoster = require("topgg-autoposter");
    const ap = AutoPoster(process.env.TOP_GG, bot);

    ap.on('posted', () => {
        console.log('Sucessfully posted the server count for Top.gg API.');
    });

sullen nymph
#

That's the guild count autoposter

#

Not the top-gg/sdk package

white wyvern
#

But I yet didn't understand what you mean by showing the webhook settings

#

Like this?

#

One second.

sullen nymph
#

Yeah, that

white wyvern
#
    /* Top.gg API*/
    const Topgg = require("@top-gg/sdk");
    const express = require("express");

    const app = express();

    const AutoPoster = require("topgg-autoposter");
    const ap = AutoPoster(process.env.TOP_GG, bot);

    ap.on('posted', () => {
        console.log('Sucessfully posted the server count for Top.gg API.');
    });

    app.post("/dblwebhook", webhook.middleware(), (req, res) => {
        console.log(res.vote.user);
    })
#

I am not sure what to put on the http://ip:port/dblwebhook /dblwebhook part.

#

I know the server IP and port but the dblwebhook? 🤷‍♂️

sullen nymph
#

See the .post("/dblwebhook" part?

white wyvern
#

Yes?

sullen nymph
#

That's a handler for POST request on the //dblwebhook route

#

So just leave it there

white wyvern
#

But wait.

#

const ap = AutoPoster(process.env.TOP_GG, bot); This one is by using the token for the top.gg bot

#

right?

#

and what about this?

#

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

sullen nymph
#

Correct

#

For webhook it's your custom auth password

white wyvern
#

Oh.

#

my own custom password?

#

Alright.

sullen nymph
#

Mhm

white wyvern
#

I leave the dblwebhook part as it is, right?

#

I'm having trouble though

#

https://HostIPAdress:25569/dblwebhook

#

Didn't work.

sullen nymph
#

http

white wyvern
#

Yet

#

Didn;t work.

sullen nymph
#

You set https

white wyvern
#

http

sullen nymph
#

Is the authorization code same on top.gg and in your code? Are you sure there's no firewall blocking top.gg requests?

white wyvern
#

The authorization code is the my own custom password, correct?

#

This also applies on my const webhook = new Topgg.Webhook("P"); part

rapid kettle
#

Yes

white wyvern
#

Indeed.

#

http://connectionIP:25569/dblwebhook

#

I didn't edit the dblwebhook in 25569/dblweebhook

#

I give up on this.

sullen nymph
#

What about the firewall?

#

Or open port?

#

Are you sure the webhook is actually running?

uncut lintel
#

Could someone share the code for the server update code as the one im using from the docs is getting errors...

#

Cannot read property 'size' of undefined

#

im using auto poster

jaunty plank
#

are you using an old version of djs? ie v11

#

pretty sure discordjs v11 isnt compatible with it, as v11 is deprecated, so youll have to use the sdk. or, make sure your "client" variable is actually a discordjs or eris client.

uncut lintel
#

yeah im using v11

#

how do i see what version i have

jaunty plank
#

it will be in your package.json

uncut lintel
#

is there a way to do it in terminal

#

?

jaunty plank
#

probably, i just dont know it

uncut lintel
#

lol

#

np

jaunty plank
#

if you want you can manually post the stats and not use the autoposter library

#

manually as in use the sdk, not as in do it by hand

uncut lintel
#

how would that work then

#

would it change on restarts?

jaunty plank
#

every 30 minutes

uncut lintel
#

cool

jaunty plank
#
const client = Discord.Client() // Your discord.js client

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

const api = new Topgg.Api('Your top.gg token')

setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size,
    shardId: client.shard.ids[0], // if you're sharding
    shardCount: client.options.shardCount
  })
}, 1800000) // post every 30 minutes
uncut lintel
#

can the time be changed?

jaunty plank
#

ideally, no less than 30 minutes, as you dont need to post it so fast

#

the sites cached anyway, so it only typically updates once every 30 minutes on the site.

uncut lintel
#

i mean like every hour ?

jaunty plank
#

thats fine

uncut lintel
#

ok thx

jaunty plank
#

also, you will need to change some of the values around for djs v11

#

shard parameters is different in v11 and v12

uncut lintel
#

is there a way to log when the server count has been uploaded?

jaunty plank
#

inside the interval, just add a console.log

#

if you want to log changes, youll have to keep track of it in a variable.

uncut lintel
#

omg thx

#

whats the difference between auto and the sdk one?

#

is the auto just when someone adds it changes?

rapid kettle
#

no

#

posts every 30m

uncut lintel
#

so just the same then?

rapid kettle
#

no

upper spindle
#

Help?

jaunty plank
#

are you putting your bot id there?

upper spindle
#

The website is not loading at all

#

Press the link

rapid kettle
#

for the bot 1

#

it’d be

upper spindle
#

Ok ty

#

@rapid kettle see

rapid kettle
#

because

#

1 isn’t a real bot?

upper spindle
#

Ohhhhhhh

#

Ok

#

It

restive otter
wheat copper
#

'k'?

restive otter
#

:p

#

@wheat copper

wheat copper
#

What's the <<<< for? Don't recognize that as part of the package?

restive otter
#

if i use "@" cause this error

#

dblapi.js install normally

#

however dblapi.js has been discontinued, right?

wheat copper
#

Yeah just npm i @top-gg/sdk

rain heart
#

-api @void crown

abstract mothBOT
#

@void crown

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.

void crown
#

oops sorry

restive otter
#

@rain heart

loud jewel
restive otter
#

i have a motive

#

but i deleted

loud jewel
restive otter
#

yes

#

i need a support to use api

loud jewel
#

WHo's berry?

rapid kettle
#

the cool frog dude ( @hearty lintel )

loud jewel
#

@hearty lintel i need u

hearty lintel
#

what

loud jewel
#

Do you know a possible fix

hearty lintel
loud jewel
hearty lintel
#

well obv not

loud jewel
#

since i can run it on my pc without getting any errors

#

however on my vps i encounter that error

shadow acorn
#
npm install @top-gg/sdk
#

Run that

plush kayak
#

So i'm making a HTTP request because no python 3.9 support for the library, and this is my code to update my count every 30 minutes.

    @tasks.loop(minutes = 30.0)
    async def updateBotListCounts(self):
        if os.getenv("TEST_MODE") == True:
            pass
            #return
        async with aiohttp.ClientSession() as session:
            async with session.post("https://top.gg/api//bots/541373621873016866/stats", data = {
                "Authorization": "token removed for this message",
                "server_count":len(self.bot.guilds)
            }) as response:
                if await response.text() == "200":
                    print("top.gg server count updated successfully.")
                else:
                    print(await response.text())

I get this response from the server:
{"error":"Unauthorized"}
Is there something I've missed?

#

figured it out, i was sending the token as part of the body

shadow acorn
graceful merlin
#

Does anyone know how to solve the node shards and shard problem that gives the error "shards 0 took too long to get ready" is giving EventEmitter and this error, does anyone know how to solve this?

rain heart
#

-api

abstract mothBOT
#

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

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

rain heart
sacred turret
#

how to make avatar command?(js)

#

?

#

?

sullen nymph
#

First you read what this channel is about

#

In the channel topic and the big smart message above yours

sacred turret
#

oh okay

flat jetty
#

:vv

trim pelican
rain heart
#

you can technically just make that yourself using webhooks

sullen nymph
#

First you read what this channel is about

rain heart
#

-api

abstract mothBOT
#

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

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

restive otter
#

but failed

#

@rain heart where do i talk about this then ?

rain heart
crimson sandal
#

hello

#

my bot is in 46 servers but it doesnt say so in top.gg

#

just has a - there

#

and theres no server count category on my bot

rain heart
#

language

crimson sandal
rain heart
#

what language

crimson sandal
#

js

rain heart
crimson sandal
#

thx

oak orbit
#
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.middleware(), (req, res) => {
  // req.vote will be your vote object, e.g
  console.log(req.vote.user); // 395526710101278721 < user who voted
});

app.listen(80);
#

this thing in red is the webhook auth?

rain heart
#

use a different port than 80

oak orbit
rain heart
#

also, seems like you're using a bot for that

#

if you're using a bot, you don't need to create that in your bot code

#

follow the instructions on the bot

oak orbit
#

yea but I want to stop using that bot

#

I whould need to create a webhook on my server?

rain heart
#

yes

#

authorization would be the orange part you censored out

#

replace it with whatever you want

oak orbit
#

its something like this?

sullen nymph
#

No

#

Not Discord webhooks

oak orbit
#

how I create a topgg webhook then?

restive otter
#

soo hi

#

dbl.on('vote', (vote) => {

var user = message.mentions.members.first()

  db.fetch(`bal_${user.id}`)
db.add(`bal_${user.id}`,2000)


});```
#

what's wrong with it

#

i wan't when someone vote my bot the bot adds him a 1000 money

#

stop using dblapi.js

#

use @top-gg/sdk

oak orbit
#

do you know how can I don't get ratelimited?

#

I know I need to use webhooks

#

but how?

restive otter
#

what did you do to get ratelimitedKEKW

oak orbit
#

and it spams me on the console saiyng that I am ratelimited

#

too many requests bla bla

restive otter
#

i think you did something bad so it ratelimited you

#

i mean you made the speed for api things really fast

oak orbit
#

I just have a comand that needs vote, and I only use the api on that command

#

*one command

#
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('topgg token')

module.exports = {
    name: "test",

    async run (client, message, args) {

        api.hasVoted(message.author.id).then(c => {
            if(c) {
                message.channel.send('Nice')
            } else {
                message.reply(`you haven\'t voted me on top.gg, please vote to use this command!`)
            }
        })
    }
}
#

this should work right?

#

but it says that think 'too many requests'

rapid kettle
#

yes you should store your own vote data

oak orbit
#

I know that but I'm asking, HOW?

rapid kettle
#

use a webhook

#

store user ID and timestamp in a database

oak orbit
rapid kettle
#

it’s a http server

#

sends a post request with the Authorization header being what you set in the top.gg Authorization bit

rapid kettle
#

not 80 but

#

where are you hosting?

oak orbit
#

the host is called discloud

rapid kettle
#

hm dunno if you can do that there

oak orbit
rapid kettle
#

no

restive otter
#

-api

jaunty plank
#

you cannot do that command

restive otter
#

Ok

brittle spoke
#
const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster(process.env.dblTOKEN, bot) // your discord.js or eris client

// optional
ap.on('posted', () => { // ran when succesfully posted
  console.log('Posted stats to top.gg')
})```

@hearty lintel explain why this happens on my most recent approved bot but never happens on my oldest bot yet
hearty lintel
#

oh

#

i just pushed that and it worked fine for me e one sec

brittle spoke
#

I shall wait

hearty lintel
#

ah i see

brittle spoke
#

is this part of the 1.1.8

hearty lintel
#

ye

#

fixing it rn

brittle spoke
#

should I just revert back to 1.1.3 like my old bot is or whats the solution

hearty lintel
#

pushing rn

brittle spoke
#

mkay lemme know when

hearty lintel
brittle spoke
#

ok

#

thanks it works

hearty lintel
wide herald
#

What was the module for top.gg?

warped wolf
#

!help

restive otter
#

A

#
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('Your Top.gg Token', client)

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

Is this top.gg server count code?

rain heart
#

autoposter yeah

#

try it and see

restive otter
#

o k

#

but first my bot have to be verified 😂

#

also what is the version of topgg-autoposter

rain heart
#

read pins

restive otter
#

K

blissful belfry
#

where is a link of top.gg api ?

#

for copy the token

sullen nymph
#

Available once your bot is approved

blissful belfry
#

thanks^^

viscid cloud
rain heart
#

also, that npm is a fork

#

don't use it

#

read pinned messages for the official ones

viscid cloud
#

k

blissful belfry
#

I have a problem 😦

restive otter
#

:(

rain heart
#

Your bot needs to be approved first before using the api

#

that includes webhooks

blissful belfry
#

no

#

He is approved

restive otter
#

its not

blissful belfry
#

-botinfo @blissful belfry

abstract mothBOT
#

tickNo That's a user, not a bot...

blissful belfry
#

huuuummmmm

#

@rain heart x)

rain heart
#

Inspect element

#

open up the network tab, try saving your webhook and check the error

blissful belfry
#

okay

#

error 403 with the post

rain heart
#

check the response

blissful belfry
#

where ?

#
updateWebhook    @    webhooks:284
onclick    @    webhooks:237

​```
#

ah sorty

#
error: "Forbidden"```
rain heart
#

Forbidden

#

do you have edit perms on that bot?

#

i assume so

blissful belfry
#

Yes

rain heart
#

is it in a team?

blissful belfry
#

I am owner

#

I am 1 on the team

#

me

rain heart
#

Yeah possibly associated with the errors we're encountering on teams

blissful belfry
#

hum okay

#

possible to delete the team without supr the bot ?

rain heart
#

Not right now

blissful belfry
#

okay 😦

#

well then, all we have to do is wait x)

blissful belfry
#

What is url for see alasticsof the bot ?

restive otter
urban echo
#

.nw TiredGold

rain heart
kindred swift
#

Python
When someone votes, anyone got a code that sends me in a logging channel who voted when etc?

rain heart
stiff night
oak orbit
#

it has already been 3 days and topgg still give me this error Top.GG API Error: 429 Too Many Requests

#

the ratelimit expires after 1h right?

#

can someone help me?

rain heart
#

yes

oak orbit
#

I can't use topgg-autoposter anymore

rain heart
#

it expires after an hour

#

You're posting it too fast then

oak orbit
#

how can I delay that?

#

like to send in 5 minutes

#

or less

#

*more

rain heart
#

just post it manually using the package in the pinned messages

oak orbit
#

and it ratelimit me too when I use a vote needed command

#

like only I use the command and it ratellimit me

#

even if I use the command only one time

#

without spamming

kindred swift
#

I mean as you got any good tutorial or how I can learn it?

#

I saw this, is this right?

stiff night
# kindred swift I mean as you got any good tutorial or how I can learn it?

no u must learn for a week to know how to fix it,

from flask import Flask, request, Response
from discord_webhook import DiscordWebhook, DiscordEmbed

def on_vote(data):
    response = requests.get(url=f'https://discord.com/api/v6/users/{data["user"]}', headers = {
        'Authorization': f"Bot {config.TOKEN}"
    })
    response = response.json()
    embed = DiscordEmbed(colour=discord.Colour(
            0x5d4b98), url="https://discordapp.com", description="Thanks for your vote!")
    embed.set_footer(text="Pastep.Com | _invite",
                 icon_url="https://media.discordapp.net/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png")
    embed.set_author(name=f"{response['username']}#{response['discriminator']} Voted!", url="https://discordapp.com",
                 icon_url=f"https://cdn.discordapp.com/avatars/{response['id']}/{response['avatar']}")

    webhook = DiscordWebhook(url='YOUR WEBHOOK')
    webhook.add_embed(embed)
    response = webhook.execute()
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def respond():
    on_vote(request.json)
    return Response(status=200)```
sullen nymph
#

Don't leak your webhook URLs

sullen nymph
#

In what sense?

stiff night
stiff night
sullen nymph
#

I mean, it's not hard to do.

#

With Flask it's literally just a few lines and auth confirmation

stiff night
#

it force u to use cogs, for someone who is not expert in cogs, is confusing

sullen nymph
#

The examples will be rewritten

stiff night
oak orbit
#

are the rate limits cumulative? like if i got ratemited 2 times in 1 min will it be 1h 59min? or it still 1h?

stiff night
# kindred swift mk

this is my code...., feel free to edit it and if you found a better way to use it, send it for me :)

kindred swift
#

and @rain heart My learning method is poking with code :p

tight trellis
#

how do i log if someone had voted for my bot, the docs are confusing

rain heart
#

use webhooks, read the pinned messages

green roost
#

Okay I was really late wtf is up with my net

eager kelp
#

Quel quin et fr

oak orbit
#

are the rate limits cumulative? like if i got ratemited 2 times in 1 min will it be 1h 59min? or it still 1h? because no one used the command that needs vote and it still ratelimited

rain heart
#

no they're not

#

at some point you just get completely blocked on cloudflare's point

#

but i doubt you would exceed this limit

tacit tree
#

Does the api work with python?

near remnant
#

what webhook do I need to use for voting?

sullen nymph
#

A webserver hosted on a machine

shy vortex
#

yes

#

that means no discord webhooks

#

lol

near remnant
#

whats a webserver

#

do i need a webhook?

#

@sullen nymph

sullen nymph
#

You need a webserver. Discord webhooks are not implied here

tacit tree
rain heart
#

the official one

#

dblpy would that be

tacit tree
#

So, I need to define a class to define the dbl client, if I'm doing that in a Cog, it'll be a nested class?

restive otter
#

Define a class? You just need to instantiate the DBLClient object

sullen nymph
rain heart
#

if even the official maintainer of dblpy is confused, i doubt that it is official KEKW

tacit tree
sullen nymph
#

It doesn't claim to be official or even try to look like an official package

tacit tree
#

v1.0.1

restive otter
#

lmao

sullen nymph
#

Modern TopGG API wrapper 🤣

tacit tree
sullen nymph
#

huh

#

Seems like an interesting package now that I look at it

tacit tree
restive otter
#

Because it is

sullen nymph
#

Seems to be like an OOP approach

tacit tree
#

Where do I instantiate it and how?

#

outside of my cog I assume, but do I need to write class?

restive otter
#

By calling it dboatsMmlol

sullen nymph
#

mf called dibs on toppy :(

#

topggpy it is then

restive otter
#

Lmao, it's the same thing as dblpy isn't it

sullen nymph
#

Nah, it's actually different

rain heart
#

visible confusion

sullen nymph
#

Shhh

#

I'm slowly migrating the docs

rain heart
sullen nymph
#

totally intentionally fucking it up for the older versions

rain heart
#

petition to rename it to toppy

sullen nymph
#

no

rain heart
#

cri

sullen nymph
#

topggpy >

restive otter
#

add dot

rain heart
#

bottomggpy

sullen nymph
#

import top.gg

restive otter
#

top/gg/ KEKW

sullen nymph
restive otter
#

That isn't bad doe

tacit tree
#

how can i insatiate the client

sullen nymph
#

DBLClient(myargs, poggers=bro)

rain heart
#

poggers=bro

tacit tree
#

How can I set the client to bot when im in a cog insantiating the dbl client

#

becasue im not using discord.py client, im using bot

sullen nymph
#

It's fine to pass commands.Bot instead of discord.Client

#

since the former inherits the latter

tacit tree
#

The thing is, I defined it in the main file, which is why I cant get it in the cog

#

so should I setup the dbl client in the main file?

sullen nymph
#

Cogs' __init__ methods get one argument passed which is the bot object

#

Create the instance in the cog's init method

tacit tree
#

got it

#

thx

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'dbl' has no attribute 'get_bot_votes'

???

sullen nymph
#

upvotes

restive otter
#

New docs moment

tacit tree
sullen nymph
#

well

#

you see

#

It's DBLClient.get_bot_upvotes

#

not dbl.get_bot_upvotes

tacit tree
#

I have the client defined as dbl

#

dbl = dbl.DBLClient(token=token, bot=bot)

restive otter
#

Still, it's referencing to the dbl module

sullen nymph
#

Did you attach it to your cog?

tacit tree
#

yes

#

self.dbl = dbl

sullen nymph
#

self.dbl = ...?

#

Why not just self.dbl = dbl.DBLClient(...)?

tacit tree
#

I could do that too

#

but it works

#
import discord
from datetime import datetime
from discord.ext import commands
import dbl

class Listing(commands.Cog): 
    def __init__(self, bot, dbl): 
        self.bot = bot
        self.dbl = dbl
    
    @commands.command()
    @commands.is_owner()
    async def votes(self, ctx): 
        await ctx.send(self.dbl.get_bot_votes())


def setup(bot):
    bot.add_cog(Listing(bot, dbl))
restive otter
#

What

sullen nymph
#

what

#

you're passing the dbl module in your setup

#

Then do self.dbl = dbl

tacit tree
#

yes

#

Im a noob

sullen nymph
#

Why even require it in the init as an argument in the first place

restive otter
#

dbl is accessible in the whole scope

#

You never instantiated the object either

#

Or you did in the main file?

tacit tree
#

i did in the main file

#

dbl = dbl.DBLClient(token=token, bot=bot)

restive otter
#

Well then you can attach it to the bot object

tacit tree
#

how?

restive otter
#

And then you can access it from any cog since it got access to the bot as well

tacit tree
#

bot.dbl?

sullen nymph
#

Yes

restive otter
#

Tmw both objects attach each other exdee

sullen nymph
tacit tree
#

Command raised an exception: AttributeError: 'DBLClient' object has no attribute 'get_bot_votes'

#

is it upvotes then

restive otter
tacit tree
#

got it

sullen nymph
#

Yeah

tacit tree
#

it says courotine obj

sullen nymph
#

await

tacit tree
#

One last thing

#
@commands.Cog.listener
async def on_dbl_vote(self, data):
    print(data)
#

For some reason the 2nd line is invalid syntax

sullen nymph
#

listener()

tacit tree
#

That didnt make a difference

#

i know it should be included but it says invalid syntax still

sullen nymph
#

Show how you're entering it

tacit tree
#

wdym?

#

I fixed it

stiff night
sullen nymph
#

what

tacit tree
#

I think I need that

#

but it isnt working either way

#

no error

#

just not sending i think

finite grove
#

hi

tacit tree
#

@sullen nymph is there?

sullen nymph
#

in v0.4 there's on_dbl_test that's emitted for test requests specifically

#

Merged into one on_dbl_vote in v1.0

tacit tree
#

but how can I test in the first place

sullen nymph
#

Test button in the bot's Webhooks section, Edit page

tacit tree
#

ok

#

Nope

#

becasue technically it isnt a webhook anyway

#

its an event

#

so how does it reciveve the event

#

I got a 405

#

hen i put the url

#

*when

sullen nymph
#

It's an event that's emitted by the webhook running from DBLClient if you pass correct webhook arguments

craggy marsh
#

how can I get the api key

sullen nymph
steady steeple
#

Whats the example python libary with webhook do?

sullen nymph
#

a?

steady steeple
#

Nevermind actually

#

Thanks

oak orbit
rain heart
#

You don't

#

Just don't exceed the ratelimits of 30 minutes when posting stats

oak orbit
#

but I don't use topgg on my commands since 3 days ago, and I still am ratelimited

#

but on my test bot I use the same info and tokens from topgg and it worked

rain heart
#

Then I'd suggest going through your code again

#

Start debugging

oak orbit
# rain heart Then I'd suggest going through your code again
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('topgg token')

module.exports = {
    name: "test",

    async run (client, message, args) {

        api.hasVoted(message.author.id).then(c => {
            if(c) {
                message.channel.send('you\'ve voted me')
            } else {
                message.reply('vote on me')
            }
        })
    }
}
#

this should work right?

#

it says too many requests, even with just one test

rain heart
#

Actually, i suggest not interacting with the api at all for a few days if it really says you're doing too many requests

#

Reset your token too

oak orbit
#

i forgot where I can find my token?

rain heart
#

Read pins

oak orbit
#

thanks

heady cradle
#

isn't the ratelimit for posting stats 15 minutes

jaunty plank
#

theres very little reason to post more than once every 30 minutes.

tacit tree
#

What does autopost do?

#

How can I config it to post in a specific channel

#

Or is that not how it works

chilly hornet
#

autopost is for posting bots stats like shard count and server count to the top.gg page

slate river
#

has the API endpoint moved for updating guild count?

rain heart
#

No

slate river
#

it's still /api/bots/<client id>/stats?

rain heart
#

Yes

#

goddamn caps

slate river
#

OK, it's been a while since I've checked the dashboard, has the location where my token can be found the same place?

#

Checking my bot's webhooks as the documentation says seems to get me a 404

jaunty plank
#

like going to the webhook section?

slate river
#

yeah

#

oh wait, I keep getting mixed up which list uses the bot user ID or application ID.

inner torrent
#

Any one need help dm me!

dull thicket
#

Can someone help me? This isnt posting my server count

jaunty plank
#

"this"? youll have to be more specific

dull thicket
#

self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=8175, autopost=True)

#

I had autopost=True

#

and before it worked

#

Now it dosent

dull thicket
#

aw

jaunty plank
#

what programming language?

dull thicket
#

Why is my bot in 6 servers??/

#

Its in like 128

rain heart
#

You need to actively post to the api

jaunty plank
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)

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

app.listen(3000) // your port

and then https://camo.githubusercontent.com/de589c73a4a72f855b595407134d890551d32b77fdd17b28409815b0c656ee2e/68747470733a2f2f692e696d6775722e636f6d2f77466c703448672e706e67

#

topggauth123 needs to be the same on the website, and your code

#

if you host somewhere other than a VPS or proper dedicated server(with a dedicated ip) youll need to do some other stuff.

#

@long cipher

#

tag me if you need something else, im actually at my pc now

#

where are you hosting?

#

home network?

#

youll need to port forward your router, and allow the connection through any firewalls

#

np

thorny oxide
#

Do I make up a URL for the API or do I get one from somewhere. If I need to get one from somewhere how do I get it? (Please ping me) Thanks in advance!

jaunty plank
thorny oxide
#

oh

#

How do I make a URL for webhooks?

#

and how do I host? (I host my bot on a Raspi 4)

jaunty plank
#

http://yourpublicip:yourport/path

#

you will need to port forward on your router

#

if you have any firewalls, you will need to let the port through those too

thorny oxide
#

port?

#

(sorry, not very good at this)

jaunty plank
#

web requests have a port, it just says "go here, in this location" in a way.
they are numbers.
as long as they are the same between what you port forward, what you use in your code, and what you use in the URL your fine.

thorny oxide
#

ok...

#

I'll see what I can find online

jaunty plank
#

no

restive otter
#

where do i find my bots server count key?

#

sad literally can not find it

jaunty plank
#

server count key?

cunning crown
restive otter
#

ye

#

dw though

#

i found it

#

for anyone else searching for this later its in the webhook section when u edit ur bot

jaunty plank
#

yeah, its pinned.

heavy cosmos
#

does anyone know how to do server count on top.gg using discord.Client() and not discord.commands.ext.Bot()? I'm using discord.py btw

lean sable
#

use_agree

rain heart
#

-botcommands

abstract mothBOT
#

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

sullen nymph
#

The rest can be pretty much scrapped

restive otter
#

hi

#

why is my name Meintonable name

sullen nymph
#

Firstly, you read the channel topic and wonder if you're in the right channel

restive otter
#

ok

sharp nacelle
#

I've put my server on https://top.gg/, and I made it so when you vote you should get a role, but that doesn't work. Why?

golden adder
#

How are you doing it?

sharp nacelle
#

Well, I just put my role in the settings of the site.

golden adder
#

Do you have the DBL bot on your server? Is it above the role you're trying to assign? What does the "Test Webhook" button do for you?

sharp nacelle
#

Yes

#

The Test Webhook doesn't do anything, because I don't need it? Or do I?

golden adder
#

That's just to test the webhook. If you've selected the role, click "Test Webhook" and then check your server to see if you've been assigned the role.

sharp nacelle
golden adder
#

Don't worry about those. Just see if that works. I don't know how the server voting works I only know bots. If that doesn't work then maybe someone else can help you.

sharp nacelle
#

Should I make a new webhook? If so, what channel should it direct to?

golden adder
sharp nacelle
#

It doesn't work for me. I tried it multiple times with multiple accounts.

golden adder
#

Ok welp you'll have to wait for someone else to help you! 😬 Sorry

sharp nacelle
#

Oh, wait, do I have to give the role of the bot the permission to change roles?

#

That wasn't on by default.

golden adder
#

Probably 😂

sharp nacelle
#

Ok, I'll try next time

restive otter
#

Where do you get this information

brittle spoke
#

read pins

restive otter
#

What?

#

Can you tell me where this information really is?

brittle spoke
#

in the pins...

#

to get your token...

restive otter
#

Can you send a print?

brittle spoke
restive otter
#

ah

tacit tree
#

How can I check if someone has voted and if they have how long yntil they can vote again

rain heart
#

how long yntil they can vote again
is something that top.gg does not provide, you need to track it yourself with making your own webhook

sharp nacelle
rain heart
sharp nacelle
#

Ok, thanks

sharp nacelle
sharp nacelle
#

https://top.gg/api//bots/:bot_id/check
What do I have to do with this URL?

jaunty plank
#

send a get request to it

#

you must fill in the userId query parameter

sharp nacelle
#

But with what? I don't get it.

sullen nymph
#

With a user's ID

sharp nacelle
#

Also, I want to check when someone can vote on a specific server, not a bot.

rain heart
#

That's something you cannot do with the top.gg api, you wil need to do that with webhooks

sharp nacelle
rain heart
#

I'd suggest hiring someone to do it then

#

-needdev

abstract mothBOT
#

DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.

sharp nacelle
drifting ridge
#

is there any docs for the api?

oak orbit
#
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('topgg token', client)
``` what should I write to make this post stats every 30 mins?
#

thank you so much

#

😐

drifting ridge
#

ty

restive otter
#

How can i get the Autorization ?

rain heart
#

You create it yourself

#

Name it whatever you want

wraith skiff
#

I can't find the on_dbl_vote function in the top.gg python-sdk

#

is it even there

#

I mean how to does it work

restive otter
wraith skiff
#

uhhh this on_dbl_vote wont work

#

I have question

#

how do yall host a webhook for it?

green roost
rain heart
#

-api

abstract mothBOT
#

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

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

restive otter
#

pepehmmNoBG is the search query in the https://top.gg/api/bots (GET method) ever gonna be fixed? It's been awhile

restive otter
#

https://top.gg/api/bots?search=<query>

#

Just returns a timeout

heady cradle
#

oh

#

what does that do

#

because i'm pretty sure it's ?q=<query>

restive otter
#

Nope, it searches for bots with a specfic query

heady cradle
#

oh wait no it is search

#

oops

#

well /api/search still works for some reason mmLol

restive otter
#

It does?

#

Weird

woven ravine
#

Hey i need some help setting up Webhooks for my discord bot

#

I need it to get the userID of someone who votes for my discord bot

jaunty plank
#

what lib/language/host?

digital nexus
#

I was wondering if it would be possible to block my bot's commands and unlock if they vote for it, is that possible?

woven ravine
jaunty plank
jaunty plank
digital nexus
jaunty plank
#

store users who voted in a database, check the database when the command gets run.

woven ravine
jaunty plank
#

the heroku url to your project with /dblwebhook
at the end

thorny oxide
#

How do I create a top.gg webhook?

jaunty plank
#

what programming language?

thorny oxide
#

python

#

and how can I integrate into code?

thorny oxide
#

ok

#

let me see

#

I've seen that site and read through it over and over but I still don't get it...

#

it tells me to enter a webhook path, port, and auth but where do I get those?

jaunty plank
#

you make them.

thorny oxide
#

how...

jaunty plank
#

well
path can be any string within some limits
port can be any number between like 1 and 60,000 thats not already in use(you can use like 6000, should be free).
auth you can litterally just type whatever

thorny oxide
#

How about the link?

#

How do I get that...

jaunty plank
#

http://ip:port/path

#

ip = your hosting ip
port and path is explained above

thorny oxide
#

I use raspi to run bot so I put the IP address of the raspi?

jaunty plank
#

the ip of your home network

thorny oxide
#

oh

jaunty plank
#

the public ip

#

you will also have to port forward

thorny oxide
#

and path...

#

what does that do?

jaunty plank
#

path is just a path.
youtube.com/subscriptions
subscriptions is the path

thorny oxide
#

oh

jaunty plank
#

its just a way for you to specifically point to something

thorny oxide
#

ohhh the path to my bot file?

jaunty plank
#

nope

thorny oxide
#

oh

jaunty plank
#

path of the url

thorny oxide
#

uh

jaunty plank
#

filesystems, and http servers are seperate things.

thorny oxide
#

ohh

jaunty plank
#

they can sometimes be linked, but thats not the case for this

thorny oxide
#

is the url a file?

#

or

jaunty plank
#

nope
its a url, like visiting a website

thorny oxide
#

sorry, I'm new to this

#

how can I find the path?

jaunty plank
#

you make it

#

👀

thorny oxide
#

ok?

jaunty plank
#

you can type whatever the heck you want

#

jndfioadonda

thorny oxide
#

ok then lol

jaunty plank
#

could be your path if you wanted

thorny oxide
#

ok cool

#

I'll test it out

#

Thanks

jaunty plank
#

just make sure you port forward, and the path and port are the same between the code and url

#

should work fine

thorny oxide
#

ok

#

Do I need to fill something out for the authorization (in the site)? If I do, what is it?

#

nvmd

cold root
#

What do I put in that box?

#

..

restive otter
#

you're supposed to pass your web server url instead of discord webhook url doe

cold root
#

?

cold root
thorny oxide
#

When I test a webhook what does it return?

cold root
#

idk

thorny oxide
#

um ok

restive otter
vestal jackal
restive otter
#

How can i do webhook ... Which webhook it needed?

thorny oxide
blazing ledge
#

I'm currently trying to update my setup for receiving votes from dblapi.js to @top-gg/sdk but I've got a question about this example image:
It shows IP:PORT, but is that required or would a normal url be okay? Cause when I did update my code to the new package the voting wasn't working anymore so I had to revert it. I may be just doing something really dumb, which is probably the case cause I'm not used to express routes and just handling requests in general

rain heart
#

It can be a IP and/or a Domain

#

Or what do you mean

#

As long as you properly set that domain on the ip that is

runic sail
#

the api is wrong? they are displaying two different server counts and idk which one is true or not

#

discord says its 18.1k but top.gg api says its 18.0k

willow spindle
#

you have to post server count to top.gg api

rain heart
#

Also, the server count you get through your code to post to our api is very likely the correct one

vale arrow
#

how to see if someone voted my bot

rain heart
calm pulsar
#

hi

#

what is the problem

gusty bolt
#

I can't read the error

#

lol

rain heart
#

unauthorized

#

shrug wrong token

gusty bolt
rain heart
#

nah not really

gusty bolt
#

patience of doing that but thanks for the future idea

brittle meadow
#

How come I got this error?

rain heart
#

-api

abstract mothBOT
#

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

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

rain heart
static kayak
#

I don't get how to use top.gg npm to receive vote notifications when a user voted my bot.

civic spoke
#

API is used for vote-posting, right?

static kayak
#

I have trouble in Setting up webhooks...

stiff night
stiff night
restive otter
#

If you need help with them lmk

static kayak
#

@sullen nymph See, my bot is hosted on heroku, so I tried to put my webhook as https://project-name.herokuapp/dblwebhook and a custom Auth password.

Now when I runner the code and tested the webhook on top.gg, I checked the logs of my app in heroku. It was showing an error:

2021-03-16T11:09:41.109507+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=project-name.herokuapp.com request_id=39ada476-023e-4246-a853-37356c67cfc4 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https

What's should I do?

@stiff night

sullen nymph
#

Did you turn the web dyno on? Which port do you run the webserver on?

static kayak
#

Port value?

stiff night
static kayak
#

I think 8000 @sullen nymph

sullen nymph
#

You don't rely on a static port with Heroku webservers

#

Refer to the PORT environment variable instead

sullen nymph
sullen nymph
#

Right, didn't see that

rain heart
#

@fluid matrix hey please don't advertise, thanks

static kayak
#

@sullen nymph

sullen nymph
#

?

static kayak
#

You told about web dyno

sullen nymph
#

Yeah

#

Turn it on

static kayak
#

Ahh lemme do

static kayak
#

@sullen nymph i did it, but then when I trigger a command, bot is showing two same responses

sullen nymph
#

Tried only running the web dyno?

static kayak
#

Yeah

#

It showed my app crashed

sullen nymph
#

Well I wish I was more familiar with Heroku

static kayak
#

Wait

#

Is dblapi still there?

sullen nymph
#

What do you mean?

static kayak
#

Ahh npm

sullen nymph
#

Use the @top-gg/sdk one

static kayak
#

Ahh ok

knotty garnet
#

@static kayak you can't run a bot on a web dyno

#

that's because web dynos go idle after a set time without any request

#

just like glitch

restive otter
#

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

#

How do i make webhook url

knotty garnet
#

you don't

#

you need a VPS, which will have an IP

restive otter
#

vps

#

ip

knotty garnet
#

if you run a webserver in said VPS, it'll have a path

restive otter
#

What is vps

#

xD

knotty garnet
#

so http://IP:port/path

restive otter
#

i mean what does it means

knotty garnet
restive otter
#

o

knotty garnet
#

a computer that is 24/7 somewhere in the planet

restive otter
#

im Using website Hoisting tho ...

knotty garnet
restive otter
#

no

#

Tech host

#

It have ip and port

#

: think:

knotty garnet
#

this techhost?

restive otter
#

no no

#

the url is pp

#

I shall not advertise

green roost
#

sus

#

But eh if you have IP and another free port

#

You can run a Webserver ez

restive otter
#

okAy hOw

green roost
#

Which lang?

restive otter
#

there is a api option where i gen my api key in TechHost

knotty garnet
#

gotta say, it's sus

green roost
restive otter
knotty garnet
#

but anyway

#

yeah, you need a webserver

restive otter
#

Thats the website not panel.

#

bUt hOw

#

where

green roost
#

Ehh web hosts are poo for bots especially when you want to use webhooks like this.

knotty garnet
#

express for JS, springboot for java, idkwhat for python, etc

restive otter
#

Im using js/d.js

knotty garnet
#

express then

#

if, however, all you want is for voting

restive otter
#

yep

knotty garnet
#

top.gg@sdk has webhook auto setup

restive otter
#

o

green roost
#

You probably can't run a webserver on web hosts since the only exposed port is occupied with keeping your discord connection alive.

knotty garnet
#

well, there's that too

restive otter
#

hmMM

#

ok i totally understand

#

Its the same?

graceful merlin
#

anyone who uses repl.it can ask me for help, I use and post the status of my bot and created the server to collect voting information

sullen nymph
#

You need to have your webserver attached to your bot under the same port to work

jaunty plank
#

👀

digital nexus
#

how l continue with required vote commands

jaunty plank
#

do you have the webhook setup?

digital nexus
jaunty plank
#

your using js right?

digital nexus
jaunty plank
strong mica
#

I have a question are there servers that help people with servers?

cold root
#

I cant figure out how to give top.gg bot info.. 😐

#

ya

#

and? I have it

#

wait

#

ILl read the description and examples

#

hm..

#

I got this after I putted exactly what u have, and what the example has, and got this, again.

#

does that mean my token is incorrect or smth?

#

i copy pasted it from top.gg.............

#

yes

#

index?

#

it gave me this error

#

here in bots folder?

#

yes

#

after const Discord = ..

#

no

#

its before message

#

ok

#

like so, right?

#

stil

#

@long cipher its same thing

#

😐

#

😦

#

anyone?

jaunty plank
#

👀 can you show your package.json?

cold root
#
{
  "name": "smug_fugy",
  "version": "1.0.0",
  "description": "",
  "main": "index..js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "Smug",
    "Smugy",
    "Smugy Fugy",
    "Moderation"
  ],
  "author": "SmugTheKiler#7012",
  "license": "ISC",
  "dependencies": {
    "beautify": "^0.0.8",
    "discord-giveaway": "^1.1.3",
    "discord-giveaways": "^4.4.3",
    "https": "^1.0.0",
    "ms": "^2.1.2",
    "pm2": "^4.5.4"
  }
}
jaunty plank
#

so, your not using discordjs directly?

cold root
#

it does..

#

just not... in there

#

I have it

cold root
jaunty plank
#

can you show the part you require discord.js?

#

or if you have a discord variable(something like this)
const Discord = require('discord.js');
try doing below that
console.log(Discord.version);

cold root
#

alr

cold root
#

I updated the packages like a week ago

jaunty plank
#

and your sure of this? afaik, this issue only arises with djs v11, and wont happen on v12.

#

if you want, you can just post the stats with the sdk

#

its not completely required if he is using node filename anyway

vestal jackal
#

I need help with my voting webhook. My thing was http:IP:8000/index.js. IP removed for obvious reasons.

jaunty plank
#

your path is index.js? the path is the path of the endpoint, not the actual file.

vestal jackal
sullen nymph
#

What's the issue

vestal jackal
# sullen nymph What's the issue

It isn't working. Like nothing happens, even though I have to so it should log it in the console. There are no erros, but it isn't logging.

sullen nymph
#

Are you sure the Authorization key matches the auth key in your code? Are you sure your port is accessible?

vestal jackal
sullen nymph
#

IPv4

vestal jackal
sullen nymph
#

Yeah

vestal jackal
# sullen nymph Yeah

I put the link in my browser to see if I can get any issues, and this is what it says. Is it normal?

sullen nymph
#

Mhm

#

It accepts POST requests and browsers by default send GET

#

So it seems to be accessible at least

vestal jackal
sullen nymph
#

Should work with both

vestal jackal
jaunty plank
vestal jackal
jaunty plank
#

have you port forwarded?

vestal jackal
jaunty plank
#

like the local ip?

vestal jackal
jaunty plank
#

is it like an rpi your sshing into? or a computer your on?

vestal jackal
jaunty plank
#

windows?

vestal jackal
jaunty plank
#

network, network properties, ipv4 address

vestal jackal
jaunty plank
#

its an ip

#

likely starts with 192 or 10

#

I think shiv can help you from here. its getting late here