#topgg-api

1 messages · Page 134 of 1

restive otter
balmy island
#

getting the user voted ip in python wrapper would be data['user'] right ?

restive otter
#

ip? you mean id?

#

that is the id of the user who voted yeah

upper nebula
#

Is there supposed to be a major delay in the stats posting? Thought it was cache but its been 10 minutes and its still reading old values

balmy island
upper nebula
#

I think the API may be broken hmm

#

Using the docs from the SDK to post the serverCount and shards

upper nebula
#

Finally managed to fix it

misty comet
#

Does anyone has a command in discord.js which will be triggered every time a user votes for a bot?

#

Yeah I know but im new to discord.js so that's why im asking if someone has it and if they could share it with me

#

Yes I currently use that, but I'll like my own custom message, I use DBL Vote bot

#

Either I can't explain myself well or you're not understanding

#

Yeah

#

Not using discord webhooks 🙄

#

Ok were getting to specific

#

Then I can't ty for ur help tho

#

I guess I gotta learn discord.js one day....

bleak trellis
#

npm init command in cmd doesn't work. any suggestions?

proud cloud
thorn surge
#

How do I make that my bot will show its vote of top.gg site...

#

Like when I type !votes it will show its vote..

#

This I know

#

Ok

#

Do you know... How to do this

#

Of knowing how many vote bot has

#

Ok

#

Very hard

#

Ok

#

This i don't understand

#

Ok

#

Ok

random harbor
#

How can I add the server count in python?

#

`import discord
import os

token = os.getenv('TOKEN')
client = discord.Client()

@client.event
async def on_message(message):
#do something

client.run(token)`

#

How can I add the server count

#

??

ornate dove
#

hello how to test a vote system without waiting 12 hours

restive otter
ornate dove
#

can i test without a webhook ?

restive otter
#

im not sure what exactly your asking for, you can’t test a webhook without a webhook lol

ornate dove
#

i using this code for the vote that right or not ?

restive otter
#

you can’t make voting system in a bot main file

#

you need to make it inside a cog

ornate dove
#

i already make in a cog but the code is not triggered

restive otter
#

you used the example cog?

ornate dove
#

yeah

restive otter
#

Does 0 mean not voted, and 1 means has voted?

#

Or it's how many votes the user has?

#

it will check if the user voted or no

#

i guess

#

Oh, so, 0 is no and 1 is yes? Thanks.

#

never tried it ngl, but probably yes

#

Thanks.

willow spindle
#

so yes

restive otter
#

Thanks.

random harbor
#

How can I add the server count in python?

hidden wave
radiant geode
#

how can i add bot votes count in js

rain heart
restive otter
mellow flame
#

hi so in the bot webhooks page what url am i supposed to be entering? im confused on how to set those up and, i use repl.it for hosting my bot

gilded mica
#

having some issues if someone could help

#

API failed: Votes request returned HTTP status code Unauthorized while fetching upvotes for bot

#

keep getting this error out of the blue

rain heart
#

Make sure you're authorized

gilded mica
#

how would i check that?

rain heart
#

have a authorization header with the correct top.gg token

#

which you can get under your bot page settings -> webhooks

gilded mica
#

i've double checked both api token and auth, they both seem fine checking with the webhooks

#

i click test and it seems to be working fine too but when it comes to processing votes it comes up unauthorized

mint rampart
#

there's a way to add server count without discord py cogs?

rain heart
rain heart
#

are you sure you're using the correct api key?

gilded mica
#

sorry i'm still a bit new to all of this so i might be being dumb haha

#

i'm pretty sure i am, the one at the top of the page "token for this bot"

random harbor
restive otter
#

Ofc, assuming you're using the sdk, just instantiate DBLClient and pass True to autopost parameter. Having it inside a cog or not makes 0 differences. Otherwise make the post request on your own, again, it makes no differences whatsoever despite the cog.

dire imp
#

Ok now that I've got an actual server to host my bot which has set ip and port. In order to use dblwebhooks I'll have to put the dblwebhook this way right?

12.345.67.89/:0.0.0.0

#

I maybe wrote it wrong lol

restive otter
dire imp
#

What to wrote in path? Like the actual path where my bot files are?

restive otter
#

The route you set

#

If you set it to /dblwebhook, then it's http://ip:port/dblwebhook

dire imp
#

I'll set it to /dblwebhook

#

On the website

restive otter
#

http://ip:port/dblwebhook
This is what to pass on the site

dire imp
#

Ty

grand ridge
#

how do i use the webhook im confused

#

what do i put in the url thing

#

shouldnt i put the discord webhook url? what should i put there

rain heart
#

You need to make your own webhook by hosting it yourself

#

discord webhooks do not work

grand ridge
#

ok how would i host it (if thats something i shouldnt ask here or something that takes a while to explain thats fine i can figure it out)

rain heart
grand ridge
#

ok ill try that

#

thanks

buoyant wave
#

hello I wanted help setting up webhooks inside my bot

willow spindle
#

you can read the docs

buoyant wave
#

yes but I am not totally

dry herald
#

Hi, there seems to be a bug with top.gg API, it seems to also do a GET request to the webhook that is added for votes.

#

Our Servers are getting a GET request for the webhook, to which they are responding with a 404.

#

and also getting a POST

restive otter
rain heart
#

your bot isn't approved yet, you wont be able to use webhooks yet

restive otter
#

oh

#

how do you know it isn't approved

rain heart
#

You don't have a role yet

#

if your bot gets approved, you get the developer role

restive otter
#

ok

#

also i think there is something wrong with the auto message that we get when our bots are in more than 75 servers

rain heart
#

Yeah that's not related to top.gg itself, that is something from discord

restive otter
#

oh ok

#

i get confused on what server im in

brisk zenith
#

webhooks*

rain heart
#

You don't need a Domain, but you need something to host the webhook on

brisk zenith
#

such as

rain heart
#

Any webhost, any vps host

#

It is better to host the webhook together with your bot using express for example

brisk zenith
rain heart
brisk zenith
rain heart
#

http://serverip:port/path

#

Something like http://123.45.67.89:5000/dblwebhook would be valid

brisk zenith
#

would express be a lib

#

which creates and handles the path backend

rain heart
#

Yes afaik

brisk zenith
#

thankyou

rain heart
#

Can't help you with it though, as I don't code in js

brisk zenith
#

imma find express docs

jagged geyser
#

where is the api options on my bot page?

rain heart
jagged geyser
#

i mean how to find my topgg token

rain heart
#

bot page settings -> webhooks

brisk zenith
#

click generate token

brazen abyss
#

I believe there is a problem with the python library docs, I tried looking for the get_bot_votes() function but I couldn't find it in the client class, which is where it says it is in the docs, I listed out all the functions of the class and this is what I got

#

['annotations', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_auto_post', '_ensure_bot_user', '_is_closed', '_webhook', '_webserver', 'autopost', 'bot', 'bot_id', 'close', 'generate_widget_large', 'generate_widget_small', 'get_bot_info', 'get_bot_upvotes', 'get_bots', 'get_guild_count', 'get_user_info', 'get_user_vote', 'get_weekend_status', 'get_widget_large', 'get_widget_small', 'guild_count', 'http', 'loop', 'post_guild_count', 'webhook_auth', 'webhook_path', 'webhook_port']

#

Nothing that includes get_bot_votes, and get_bot_upvotes is different

restive otter
#

What version are you on though?

#

ig get_bot_votes exists on v1 which isn't out yet

brazen abyss
#

0.4.0

#

oh

#

that might be why

#

wait, 0.4.0 is the latest version

restive otter
#

yeah, but it's v1 on github

brazen abyss
#

alright then I'll install that version

restive otter
#

There's a breaking change on how it manages the webhook though, it's now a separate class

brazen abyss
#

alright

#

I think I'll just end up using a webhook

#

It's more accurate for what I'm doing

#

I just find it annoying how you have to set up a webhook system just to be able to know when someone has voted for your bot

restive otter
#

Oh welp, I think I got what you mean, disregard my prior message then.

severe viper
#

How do I get auth? and do i put my DISCORD webhook in the webhook url?

restive otter
#

if u dont know abt this better use the votereminder bot

#

the site is down

#

its not there

#

veld said site down

#

?

rocky basin
#

I can vote for my bot

outer fractal
#

how can i get my total votes for month ? JS

willow spindle
#

Bot Info endpoint

dry herald
rain heart
#

It does not do a get request, top.gg only makes post requests, something else (or someone else) is making these requests

#

Compare the IP you get with the test button with the IP from the get requests, though am not really sure if top.gg also uses cloudflare for making requests

dry herald
#

The first is a 404ed GET request.
The second is a 201 POST request.

Same IP!

rain heart
#

Yeah i don't seem to be able to reproduce it on my end, i'd suggest making a bug report about it on https://github.com/top-gg/issues

#

though the DBL useragent with the ip does confirm that it is indeed coming from top.gg

#

Maybe redirects on your end or something like that?

dry herald
#

Nope, there are no redirects at our end.

dry herald
rain heart
#

There's none? I see one on the screenshot though

dry herald
#

IP is same though

#

That is only on the POST request.

rain heart
#

oh nvm

#

yeah i see it

#

Still weird, don't seem to be able to reproduce it

#

the only way i could explain it is that the api is either making a test request to see if the url is valid or something else

dry herald
restive otter
#

wtf is that username my guy

#

Lol thats so weird

onyx wharf
#

Hello guys, I have a Turkish fun bot. I want to get this bot approved. How can I get it?

rain heart
#

wrong channel

tired carbon
#

This question has probably been asked a million times over, but how do I show server count for my bot?

jagged ingot
#

oh hope is now mod?

#

congrats

proud cloud
tired carbon
#

thank you

harsh crescent
#
const Topgg = require("@top-gg/sdk");
const webhook = new Topgg.Webhook("TOKEN FROM WEBHOOKS PAGE");
app.post('/topgg', webhook.middleware(), async(req, res) => {
  console.log(req.vote.user);
});
``` I don't understand why I'm getting 403 from whatever attempt is made whether it be evaling like below```js
require('axios').post('https://mydomain.com/topgg')
``` or using the "TEST" button on the webhooks page, the only one that has made a successful request so far is reqbin but that has no OBJECT for that purpose of testing
maiden pendant
#

HUH

#

AM I IN THE Wrong sever

rain heart
#

If you don't know what top.gg is, then yes

fathom narwhal
#

Extension 'dbl' raised an error: AttributeError: module 'dbl' has no attribute 'DBLClient' dpy any ideas

restive otter
#

Are you using old version?

fathom narwhal
#

nop

sullen nymph
#

Make sure lib is up to date and your files and slash or folders aren't named dbl

restive otter
#

yeah you might somehow shadow the module

fathom narwhal
#

worked

#

ty

#

it was file name

dire imp
#

So my server has apparently two IPs: one public IPv4 (which is called elastic IP) and one private IP. I guess im supposed to put the public elastic IP?

sullen nymph
#

mhm

chilly spire
#

Could I have some help with the Top.gg API?

#

It's telling me that dbl has no DBLClient member

#
import asyncio
import logging

import discord
from discord.ext import commands, tasks

import dbl


class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' 
        self.dblpy = dbl.DBLClient(self.bot, self.token)```
worn sphinx
chilly spire
#

heh

worn sphinx
#

discord.js for me

chilly spire
#

other people I talked to in other servers said they had no clue why this was happening

worn sphinx
#

idk

#

it happened to me too

#

🤔

chilly spire
#

yeah

#

hopefully someone can hel

#

help

cold oak
rain heart
#

Yeah it is actually under your webhook settings

#

bot page settings -> webhooks

cold oak
#

neat, tysm

chilly spire
#

so the filename was dbl, but now i have a new problem

#

pip install dblpy doesn't let me import dbl, and pip install dbl doesn't give me a package

sullen nymph
#

try pip3

chilly spire
#

nope

sullen nymph
#

Dear lord

#

python3 -m pip

#

or python

#

Whichever env var you use to run your bot

frank estuary
#

How can i add/link my website top.gg

brisk zenith
#

Can someone helpo me setup Express with TopGG voting webhooks?

knotty sparrow
#

help, i can't get the webhook running

#

I mean when I press test it does nothing

rain heart
#

did you press save too?

#

Otherwise you wont be able to test it

knotty sparrow
#

yep

rain heart
#

just to clarify: Discord webhooks do not work

#

you need to host your own

knotty sparrow
#

I know

#

I have it with my bot ip

#

where the host is

rain heart
#

what does the url look like? you can also dm it if you dont feel comfortable just sending it here

knotty sparrow
#

sure

#

oh your dm's are closed

rain heart
#

they should be open, give me a second

#

Nah you should be able to dm me

knotty sparrow
#

I can't

rain heart
#

now?

knotty sparrow
#

but its okay here

rain heart
#

Alright

knotty sparrow
rain heart
#

http

#

https doesn't work

#

for port-based web services

knotty sparrow
#

Oh

#

So what should I do instead?

rain heart
#

replace https with http

#

if it doesn't work, then there's most likely something wrong with your code or it isn't running or your post isn't open

knotty sparrow
#

what do you mean by my post issn't open?

rain heart
#

port i mean

#

20005

#

though are you sure the webhook is running? no response on that port

knotty sparrow
#

oh wait

brisk zenith
knotty sparrow
#

yeah its running

#

yep

brisk zenith
#

if ur doing it in js pls help me

#

;-;

#

idk how use express

knotty sparrow
#

I think it's working

restive otter
#

Hey there, I'm trying to make a vote command and people can see if they voted and how much time is left till their new vote. I know you can do that with the discord api and i read the docs at least 300 times but still can't understand how to take a certain action when a user has voted. Can someone explain this to me ? Thanks

hybrid flume
#

The API is not responding correctly, I defined dbl but it says it can not read dbl of undefined.

#

How I defined it: const dbl = new DBL(config.apikeys.dbl, client);

#

And it says it can't ready dbl

#

Nevermind I found it....

#

It couldn't ready my API key to save its life in v12.5

oak orbit
#
const client = new Discord.Client()
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client) ap.on('posted', () => { console.log('Posted stats to Top.gg!') })

If I put just this it Will send the shard count too?

proud cloud
#

Yes

#

It will begin to post your server count, and shard count every 30 minutes.

oak orbit
#

Thanks

#

And if I shard my bot is const client = new ShardManager()
Instead of Discord.Client()?

#

Or it still the same?

balmy island
#

how do i change the buttons' colours for vote and invite and the other stuff ?

proud cloud
balmy island
#

sorry

brazen abyss
#

Is it ok to use flask to manage webhooks?

#

Because I'm not too keen on learning how to use express.js when I already know how to use flask

brazen abyss
#

In the DBLClient where you have to specify the webhook path, would it work if you already specified the webhook path in the webhook URL on the top.gg bot page?

cold ledge
brazen abyss
#

So I should keep it as that?

cold ledge
#

Yes

brazen abyss
#

alright

#

I tried it and I got nothing

#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("Received an upvote!")
cold ledge
#

Both URLs must match

brazen abyss
#

So they are both URLs?

#

in the DBL client and on the website

cold ledge
#

So it has to be the URL of where the client is listening to

brazen abyss
#

yeah I use an IP

cold ledge
brazen abyss
#

yeah

#

I use a VPS so I use the VPS's IP

cold ledge
#

Make sure it's the same on top.gg and in the client

brazen abyss
#

ok

empty violet
#

-docs

#

aaaaaaaaaaaaaa

proud cloud
empty violet
#

🙏

haughty lotus
#

i am having some problems with voting sir, like rpg games. i cant click the vote button, neither with pc nor android. what should i do sir?

#

where can i get help with this...........T-T

rain heart
haughty lotus
#

thanks sir

ornate dove
#

i have some problem in voting system i already using webhook but the bot not respon for a new vote

rain heart
#

Remember you cannot use a discord webhook

ornate dove
#

i using flask for the webhook

rain heart
#

Did you test it with a Rest client (such as postman)?

ornate dove
#

i already test in top.gg webhook

#

and the result

#

but in the bot still no response

rain heart
#

you used the test button to test it?

ornate dove
#

yup

rain heart
#

then it should fully work

#

have you tried voting?

ornate dove
#

i tried voting but not response too

rain heart
#

Did you enter the vote url into the correct bot?

ornate dove
#

i put in the bot the webhook_path = http://ip:port/dblwebhook is this right ?

rain heart
#

http://ip:port/dblwebhook if you set dblwebhook as your path

#

oh wait

#

only have dblwebhook on it

#

on the webhook_path parameter

#

Though that tells you that your flask server does work correctly

#

just wrong webhook path

ornate dove
#

the flask server should return the data or not ?

green mantle
#

well it should return a 2xx status code

rain heart
#

Your webhook path is just wrong, replace it with dblwebhook or /dblwebhook

#

not sure if you define it with the / or not

ornate dove
#

ok let i try first

ornate dove
#

is it true i using the webhook path like this ?

sullen nymph
sullen nymph
ornate dove
#

but the bot still not response it means the flask server is wrong ?

rain heart
#

remove that - though

#

on your webhook path

odd falcon
#

hi i have api Error

rain heart
#

What's the error

odd falcon
#

"Failed to lookup view "docs" in views directory "/var/botlist/views""

rain heart
ornate dove
#
  • combine the / and dblwebhook
rain heart
#

Just have /dblwebhook on your webhook path

ornate dove
odd falcon
rain heart
# ornate dove

and the webhook still doesn't work on the dblwebhook path?

#

try opening the url on your browser

ornate dove
#

yup

rain heart
#

or make a manual request with postman

odd falcon
#

how to get the api in the new located

ornate dove
#

the postman result

rain heart
ornate dove
#

yep but if i test in top.gg webhook the response code 200

rain heart
#

use some dummy data to test it

{
"bot": "12345",
"user": "123456",
"type": "test",
"isWeekend": true,
"query?": "test&test2=2"
}
#

From the webhooks schema

ornate dove
#

the postman body is json ?

rain heart
#

yes

#

that is what top.gg sends to your webhook

ornate dove
#

the result of the postman in that picture

rain heart
#

then it works

#

did you get any request?

#

on your webhook itself?

ornate dove
#

i dont think get any request

mellow flame
#

Is there some sort of tutorial on how to create vote reward commands on discord.py ? I'm totally new to webhooks so can someone help?

rain heart
# ornate dove

Can you send me the url in dms or if you're comfortable, just in here?

#

Oh also, is your request authorized?

#

With a Auth header?

ornate dove
#

yep wait i send u a dms the url

rain heart
#

The request goes through, but doesn't log for you

#

weird sad

ornate dove
#

the bot not get the data i think

#

i using this code

#

but the bot not printed the xvote if user voting

#

or i test in webhook

rain heart
#

That's correct already

#

if you want to use dblwebhook as http://ip:port/dblwebhook

#

Yup

#

if you defined 5000 as the port

#

Yes

#

in your bot page settings on webhooks

cursive steppe
#

So I'm getting undefined when i use req.body

#

What's the issue

rapid kettle
#

what language and web server are you using

cursive steppe
#

Express

rapid kettle
#

ok

willow spindle
#

do you use bodyparser

rapid kettle
#

are you using the json parser

cursive steppe
#

I installed body-parser but I don't know how to use it

#

Is there any guides?

willow spindle
#

app.use(parser())

rapid kettle
#

app.use(express.json())

willow spindle
#

oh

cursive steppe
#

Express module?

rapid kettle
#

yep

cursive steppe
#
const bodyParser = require("body-parser")
const express = require("express")

module.exports = async (req, res, app) => {
  
  app.use(express.json())
 

  let check = req.body
  
  console.log(check)
  
}```
#

Doesn't works

willow spindle
#

use in your main file

cursive steppe
#
app.post("/", async (req, res) => {
  require("./api/main.js")(req, res, app)
})```
#

Oh ok

compact creek
#

Hi my voting webhook isn't working and I literally don't know why. I am using d.py and here is the code:

# __init__
self.dbl = self.config.keys.dbl_api_token
        self.dblpy = dbl.DBLClient(self.client, self.dbl, webhook_path='/dblwebhook', webhook_auth='no', webhook_port=1024, autopost=True)

@commands.Cog.listener()
    async def on_dbl_test(self, data):
        c = self.client.get_channel(739931876872945775)
        user = self.client.fetch_user(int(data['user']))
        e = discord.Embed(
            title="Test Upvote",
            description=f"{user.mention} `{user}` has test voted for me on [Top.gg](https://top.gg/bot/{self.client.user.id})!",
            color=0xfffff
        )
        await c.send(embed=e)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        c = self.client.get_channel(739931876872945775)
        user = self.client.fetch_user(int(data['user']))
        e = discord.Embed(
            title="New Upvote",
            description=f"{user.mention} `{user}` has voted for me on [Top.gg](https://top.gg/bot/{self.client.user.id})!",
            color=0xfffff
        )
        await c.send(embed=e)

All of the data is correct on the site too

cursive steppe
#

Finally worked

compact creek
restive otter
#

Maybe check the port, also fetch_user method is a coroutine

compact creek
#

Right ok

#

I'm pretty sure I've allowed the port access on my firewall

restive otter
#

Unrelated, but since you're using fetch_user which is gonna cast the id as string later, you don't need to cast it as int.

compact creek
#

ok

#

It still isn't going though

#

I don't know why it isn't going hmm

astral salmon
#

what is the webhook Auth?

mellow flame
#

um where can i view the authorisation value

rain heart
#

You have to set it yourself on your webhook

#

On the webhook of your code

mellow flame
#

...im unaware of how to do that

#

i heard that you have to do it with a cog?

#

how would i do that

cursive steppe
#

Is there an endpoint to check if a user has voted for the server?

#

I know you can check for bot but for server?

rain heart
#

Servers doesn't have a api

#

You will need to make a webhook for yourself

mellow flame
#

what should i enter in webhook_path if i use port 5000 and repl.it

#

@rain heart could you perhaps help me ?

rain heart
#

The path your webhook should be on

#

http://ip:port/webhook_path

mellow flame
#

oh wait i matched the port number

#

this is an older screenshot

#

that isnt a problem

mellow flame
#

when i test it with the test button it sends me a post as it should

balmy hamlet
#

that's painful to read ngl

mellow flame
#

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

def __init__(self, client):
    self.client = client
    self.token = 'token'
    self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='ip:5000/dblwebhook', webhook_auth='yeahok', webhook_port=5000)



@tasks.loop(minutes=1.0)
async def update_stats(self):
    """This function runs every 30 minutes to automatically update your server count"""
    logger.info('Attempting to post server count')
    try:
        await self.dblpy.post_guild_count()
        logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
    except Exception as e:
        logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))



@commands.Cog.listener()
async def on_dbl_vote(self, data):
    logger.info('Received an upvote')
    print(data)

def setup(client):
global logger
logger = logging.getLogger('client')
bot.add_cog(TopGG(client))
`

#

@balmy hamlet

balmy hamlet
#

I can't help with this tho

mellow flame
#

is there no one else 😫

balmy hamlet
#

well shiv could help but he's probably busy with something

#

just do something else for the time being

#

somebody will eventually answer

sullen nymph
#

a

#

webhook_path is only the route

#

aka the thing that comes after ip:port

mellow flame
sullen nymph
#

DM me what you entered in your bot's Webhooks settings on top.gg

carmine vessel
#

does anyone know how to put the amount of server my bot is on?

rain heart
carmine vessel
#

ok

ornate dove
rain heart
#

Don't know python unfortunately

#

use a different port

#

Yeah, that means that port might be already in use

#

what are you using for your webhook server? what language

balmy hamlet
#

use port 8080 or 8000 or something else

ornate dove
carmine vessel
#

what is the token requested by the api?

proud cloud
#

@steady delta have you seen the docs yet?

steady delta
proud cloud
#

no problem

steady delta
#

@proud cloud curious if i can get the username and tag of the user who upvoted?

carmine vessel
proud cloud
steady delta
#

thanks again

proud cloud
# steady delta thanks again

you can do it with Last 1000 Votes method or just webhook thingy (this will return the id everytime a user votes)

rain heart
#

i generally suggest using webhooks from the start on than relying on the last 1000 votes

steady delta
#

yea i am working on the webhook thing

steady delta
#

thanks!

sullen nymph
#

found in your the Webhooks section on your bot's Edit page

#

That absolutely doesn't explain what the exact problem is

steady delta
#

are you using py?

#

oh

#

im not much of any help then

restive otter
#

webhook url is just an ip adress or an domain

#

its ip:port/dblwebhook

quiet saffron
#

Sa

restive otter
ornate dove
carmine vessel
#

where do i find this token?

willow spindle
#

bot page > edit > webhooks section

carmine vessel
#

ok

#

does anyone know how to solve?

odd herald
#

it's listening on any ip address

#

it'll still work on 0.0.0.0

restive otter
#

if you go to localhost:5500/dblwebhook

#

it wont work

#

because you are doing an get request

odd herald
#

you need to use something like postman to send the request

restive otter
#

^

odd herald
#

to simulate the POST request

carmine vessel
restive otter
carmine vessel
#

does anyone know how to solve?

restive otter
#

they should make it redirect to there lol

restive otter
#

i think you can ignore it if it doesnt repeat

carmine vessel
#

I'm trying to put how many servers this bot is, but I'm not getting

restive otter
#

can you show your code

#

its prob js

carmine vessel
#

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("top.gg");
const dbl = new DBL('Your top.gg token', client);

// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})

dbl.on('error', e => {
console.log(Oops! ${e});
})

restive otter
carmine vessel
#

already did that

restive otter
#

top.gg isnt an official module btw

#

use topgg-autoposter

#

how do i get the username of someone who just voted?

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

const poster = AutoPoster('topggtoken', client)
carmine vessel
#

ok

restive otter
#

is it something like req.vote.username?

carmine vessel
#

it worked

restive otter
#

ok

proud cloud
sleek rain
#

Thanks!

restive otter
#

got this eror

#

language - js

#

my bot is not aproved yet

brittle spoke
#

@restive otter are you using dblapi.js?

restive otter
brittle spoke
#

Not 100% sure if its cause your bot is not approved yet or mot

restive otter
#

ok

#

@brittle spoke got the issue bot is not verified bcoz i have a bot which is verified and topgg-autoposter successfully ran thanks you

#

and yeah sorry for ping

brittle spoke
#

Is cool

full elk
#

Grizz on api needs help

#

nvm

wanton nymph
#

When I try to use https://top.gg/api//bots/:bot_id/check?userId= I get an "unauthorized" response. Is there some authentication I need to use?

#

perfect, thanks

wraith raptor
#

Is the api compatible with python 3.9?

drifting sequoia
#

Are the docs down?

#

Ah wait nvm

shy vortex
#

like any other api does

#

lol

#

so TL;DR yes it is

carmine vessel
#

does anyone know how the bot sends a message on a channel when someone votes for my bot?

hot axle
#

they probably use the last channel the user sent a message on or something

drifting sequoia
#

I just saw the top.gg docs but I dont know where I can get the ID

#

I do see the part where we have to use the discord bot list token but I cant find the My bots page

#

this doesnt work

rain heart
#

It is at your bot page settings -> webhooks

#

have made a pull request that changes the explanation of where you can find your discord list token

#

just need veld to approve it

drifting sequoia
#

THANKS

#

@rain heart Quick Question when they talk about stats in general, what is included?

rain heart
#

where exactly?

drifting sequoia
#

here

rain heart
#

stats such as your server count ofc and shard count

drifting sequoia
#

Ah server count too

rain heart
#

if shardingmanager is used, then it will also send the corresponding shardids i think

#

not sure

drifting sequoia
#

Ahh ok. Thx

drifting sequoia
#

How would I access the dbl api in my actual bot

#

cause I know you can use curl and authenticate

#

but how do you actually fetch the stats of the bot in json

#

weird

#

I was trying to use node-fetch to get the number of votes

abstract mothBOT
drifting sequoia
#

you can check whether if shows when you try to search your bot btw

#

dbl-stats 790985487107620865

rain heart
drifting sequoia
#

oops sry

wheat totem
#

where do I put the authorization thing```js
const {Webhook} = require("@top-gg/sdk");
const express = require("express");

const app = express();

const webhook = new Webhook(process.env.topggToken);

app.post("/dblwebhook", webhook.middleware(), (req, res) => {
// req.vote wil lbe your vote object, e.g
console.log(req.vote.user); // 395526710101278721 < user who voted
});

app.listen(80);

rustic cobalt
#

Help

#

I need make vote sistem

wheat totem
#

is the auth the top.gg token or the webhook authorization

#

ok

formal wraith
#

Aaaah

cedar arch
#

-help

#

-bots

abstract mothBOT
cedar arch
#

-bots @abstract moth

abstract mothBOT
#

tickNo Bots don't have bots, silly

cedar arch
#

Hmm

#

-help

#

-servers

#

-bots 679867543066116169

abstract mothBOT
cedar arch
#

Mts help

#

Lol

#

@sharp delta

#

-bots

abstract mothBOT
cedar arch
#

@Maths+Mod ka fun

#

@sharp delta

#

@sharp delta

brittle spoke
uncut granite
#

d

#

-bots 406890967958945793

abstract mothBOT
restive otter
glossy dock
#

Hey I want to publish my bot's server count via a command instead of a event

#

How can I do that?

brittle spoke
#

why would you want it to be a command?

glossy dock
#

I dont know

restive otter
#

Can someone send me topgg vote link api

#

JsonRequest

cedar arch
#

-bots

abstract mothBOT
foggy sigil
#

-bot

#

-bots

abstract mothBOT
#

tickNo This user has no bots

carmine vessel
#

-bots 724671971316596756

abstract mothBOT
#

tickNo This user has no bots

carmine vessel
#

-bots @carmine vessel

abstract mothBOT
carmine vessel
#

Ok

#

does anyone know how to get my bot to show on the console the id of who voted for him?

dull hedge
#

-bots @dull hedge

abstract mothBOT
restive otter
#

bruh

steady delta
#
hook = Webhook(tokenhere)



@commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("Received an upvote:", "\n", data, sep="")
        hook.send(data)
#

on_dbl_vote doesn't fire

#

@sullen nymph help?

sullen nymph
#

Inteersting

#

Show your full code

restive otter
#

What

#

Then why this thing not working

pulsar flume
#

-bots

abstract mothBOT
harsh wadi
#

-bots

abstract mothBOT
restive otter
#

-bots

abstract mothBOT
neon sphinx
#

-bota

#

-bots

abstract mothBOT
sullen nymph
#

@neon sphinx @restive otter @harsh wadi @dull hedge @carmine vessel @foggy sigil @cedar arch @uncut granite use #commands for any commands you use

restive otter
#

Ok sorry

harsh wadi
#

oh sorry

dull hedge
#

aight

restive otter
#

🙏

steady delta
#

this doesn't work when someone votes

steady delta
#

anyonee

#

pls

oak epoch
#

-bots

abstract mothBOT
restive otter
#

-bots

abstract mothBOT
restive otter
#

lmao not again

rain heart
#

@restive otter and @oak epoch

restive otter
#

srr

oak epoch
#

Sowwy

restive otter
#

-BOTS

abstract mothBOT
#

tickNo This user has no bots

restive otter
#

bruh

brave quiver
#

-bots

abstract mothBOT
willow spindle
#

omg can you read above @brave quiver

brave quiver
#

?

willow spindle
brave quiver
#

Oh, I am sorry

tribal ridge
willow spindle
rain heart
#

yup

#

if you have the same parameter on your webhook (port, webhookpath)

sullen nymph
#

@steady delta I suggest not leaking webhook URLs

steady delta
sullen nymph
steady delta
#

so http://<publicip>:<port>/<path>?

sullen nymph
#

yup

proud cloud
#

@restive otter you're getting ratelimited that's why

#

can I learn which methods you're using?

restive otter
#

yes ratelimit but like this since last night and as soon as i opened the bot i ran into this problem

#

I get the data with the snekfetch module

proud cloud
#

^^

restive otter
#

I don't know the name of the method

#

Can you understand if I send a sample piece?

#

get

proud cloud
restive otter
#

the method i use

    snekfetch.get(`https://top.gg/api/bots/784697814298263572/votes`)
      .set("Authorization", dbltoken)
      .then(async response => {
        let usrnm = response.body[0].username.replace(/[^a-zA-ZığüşöçĞÜŞİÖÇ ]+/g, ``)
        console.log(usrnm)
        })
proud cloud
#

you can request this 60 times in a min, you know that right?

restive otter
#

yes i know and i demand 1 time per minute to avoid risk

outer fractal
#

how can i get Total Upvotes

proud cloud
outer fractal
#

Thanks

restive otter
#

Isn't there a solution for this?

rare stag
#

-bots

#

-help

#

ok

proud cloud
grave river
#

eyw

rain heart
cedar arch
#

Why voting for bot doesn't fires
on_dbl_vote event

#

Lol

#

Which port

#

I used code on main page

rain heart
#

You need a webhook in order to receive on_dbl_vote events

#

read the pinned messages for that

cedar arch
#

I used

#

But

#

It's not mine

#

Vote tracker bot

rain heart
#

That is not how the webhooks work, you have to choose between using vote tracker and not being able to receive on_dbl_vote events, or you use your own webhook

#

only one is possible

cedar arch
#

Lol

#

But what I should write

rain heart
#

Read the pinned messages for the webhook documentation

cedar arch
#

From where I'll get URL

rain heart
#

it is mostly http://yourserverip:port/path

cedar arch
#

Hmmm

#

Ok

#

I'll try

kindred mountain
#

Hey could u tell me how to start my api poject?

#

like should i make a folder?

#

or do it in main.js

rain heart
kindred mountain
#
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 wil lbe your vote object, e.g
  console.log(req.vote.user); // 395526710101278721 < user who voted
});

app.listen(80);```
how to use this?
what should i put for webhook auth?
rain heart
#

You cannot use 80 for your webhook, unless that port is not used

kindred mountain
rain heart
#

80 is the port used by the webhook, if that port is used already (most likely occupied by a website through the http port 80), it wont work

#

replace your webhook auth with whatever auth you want to have for your webhook

rain heart
#

You define that yourself

kindred mountain
rain heart
#

It is like a password you can set

kindred mountain
#

pls explain

kindred mountain
#

pls show like a example

rain heart
#

12345 would be a auth password

#

maybe WebhookPassword123

#

It is just like a password you have to set on your bot page settings on your webhooks

rain heart
kindred mountain
#

o

rain heart
#

You can define that authorization there, it has to be the same as your your webhook auth

kindred mountain
#

since i made it using dbl bot

rain heart
#

You cannot have 2 webhooks, if you have one already then you're good to go

#

or what are you trying to do?

kindred mountain
#

@rain heart when does the server count update? does it update instantly?

rain heart
#

If you're using the API to post it, it should update in up to 30 Minutes to an hour

kindred mountain
#

ohk

#

how can i make it to dm the voter?

rain heart
#

again, is there any webserver running on your host?

kindred mountain
rain heart
#

replace the 80 with 5000 for example

#

not sure how heroku's webhook url looks like though

kindred mountain
rain heart
#

keroku has one for webservices though

#

again not usre

kindred mountain
#

umk

#

should i try?

rain heart
#

go ahead, you already got the layout for the webhook, it should log the user ID on your console

rain heart
#

and for sending a DM to a user when you concluded the main part works, https://discord.js.org/#/docs/main/stable/class/User?scrollTo=send

#

Remember that the user has to be on the same server and dms enabled

kindred mountain
#

@rain heart when i voted it did not log my id

rain heart
#

Did you enter the webhook url in your webhook settings?

kindred mountain
rain heart
#

again i never used heroku and never will, i can't help with the heroku url

kindred mountain
rain heart
#

Because hosting a bot on a vps is more efficient and more safe

kindred mountain
tight hound
#

hello, where can I get the api token? I had one token before, but I think it expired and I don't know where to find it now.

rain heart
#

bot page settings -> webhooks

tight hound
#

oh yes ty

dawn kernel
#

we have a forward option with retry

#

and auth

#

but well its their issue for questioning topgg about this and not us

jade crystal
median badger
#

any idea why this would return with status code 400

#

im aware what the status code means

#

im asking why

#

turns out i needed to include the content type

brazen abyss
#

In the client class do I need to specify the port number if I already have it included in the link. example: 12.34.56.789:5000

brazen abyss
carmine vessel
#

how do i send message in the dm of those who vote for my bot?

carmine vessel
#

how do I see the username of those who voted for my bot

#

?

graceful abyss
#

Any property to see how long a user has to vote again?

mellow flame
mellow flame
#

nvm but how can we access the variables?

#

like the id of the user who voted

brittle spoke
#

what language

mellow flame
#

the on_dbl_vote() worked once but now it still shows the 404

brittle spoke
#

unfortunately idk d.py

mellow flame
#

how can i access the variables

#

@burnt trellis maybe you can help 👉👈

#

also why is it so inconsistent

#

one time it works the other it sends the 404

idle sable
#

I believe I'm getting 500 errors when posting bot statistics

#

anyone else having this issue?

mellow flame
idle sable
#

yep

#

alright good to know

steady delta
#

how do i format the data sent by top gg? the one it sends when one votes

mellow flame
steady delta
#

@mellow flame thanks man

mellow flame
steady delta
#

man i thank shiv everyday

mellow flame
#

haha ive been doing that lately too

steady delta
#

@mellow flame what did you do with the data? you sent it to a discord webhook?

mellow flame
#

you use .py right?

steady delta
#

yes, but i'm trying to make it be sent to a channel where users can see who voted. to reward them

mellow flame
#

ill tell ya once i do

steady delta
#

i already did actually, but it returns None when i try to print user even after i use get_user

mellow flame
#

so i think we can include the command within the cog itself?

#

its either genius or a trrible idea

tiny compass
#

In dblpy how do I use post_guild_count with manual sharding? Does each shard have to connect with dbl?

sullen nymph
sullen nymph
tiny compass
#

list of shard id's or shard's guilds

sullen nymph
#

Shards' guild counts

sullen nymph
mellow flame
sullen nymph
#

Ah

steady delta
sullen nymph
#

Eh

#

because fetch_user is an API request so it's a string sent to Discord API in the end

mellow flame
#

OMFG I JUST FINISHED MY VOITE REWARDS ND IT WORKS

#

ty yall

sullen nymph
#

nice

#

nope

steady delta
#

thanks shiv, as always lol

mellow flame
#

same

sullen nymph
#

aye np

rain heart
#

You cannot make Webhook requests to localhost

#

Localhost means only on your machine

sullen nymph
#

Use your public IPv4 address and make sure your network allows port 5000

restive otter
#

Api noluy

oblique fossil
#

hi

#

i tried

#

to do

#

the $meme command

#

with the reddit api

sullen nymph
#

P.S. read the channel topic

oblique fossil
#

oh

#

sorry

restive otter
#

As

sullen nymph
#

-notr

abstract mothBOT
#

İngilizceden başka dillerde sohbet etmek için #general-int kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.

magic bridge
#

shoud i hide the api key?

rain heart
#

I mean the API "Key" is a secret, so yes

magic bridge
#

ok ty

autumn valley
#

what is the minimum rate of posting server count ?

rain heart
#

there is no minimum rate

autumn valley
#

we can do as fast we can?

rain heart
#

I'd suggest only posting your server count every 30 minutes or hour

#

no you can't

autumn valley
#

oh ok

#

30 is ok yes?

rain heart
#

30 minutes, yes

#

every 30 minutes

autumn valley
#

ok

#

ok thx

frozen flame
#

How do I make it so if you vote for my bot it messages you

#

Also ps I have no idea how to use webhooks lmao

rain heart
frozen flame
#

I’ve read that

#

But all it does is give code

#

That doenst help

jagged ingot
#

did i got pinged?

proud cloud
#

@restive otter please don't ghostping users

dire imp
#

So dbl.py already makes us the webhook right?

sullen nymph
#

dblpy does support a webhook system, yes

tiny lantern
#

Can I make a system for the bot to notify me when someone votes?
JavaScript

proud cloud
plush kayak
#

where do i get my DBL token?

#

thanks

sullen nymph
#

plural webhooks

plush kayak
#

is the python library compatible with 3.9?

sullen nymph
#

v1.0.0 is but it has some breaking changes

plush kayak
#

that's fine, i haven't written any code yet i just wanted to check

mellow flame
sullen nymph
#

It's not out yet

restive otter
#

hi

dire imp
past trellis
#

Is there a limit for using of the test button when setting up webhooks?

willow spindle
#

no afaik

past trellis
#

Do you need to save to test?

willow spindle
#

hm?

past trellis
#

Yea you do - I have been troubleshooting this code for too long and you need to save to press test BigBrain thanks

#

My code finally worked when I clicked save so idk

willow spindle
#

ah yes you have to save webhook settings

green wharf
#

Is there a server api similar to bot api that lets you grab server stats? And where would I find docs for that

rain heart
green wharf
#

oh ok thanks

restive otter
#

hey I have a quesiton about the api

#

how do you get your bot's api token?

rain heart
#

Bot page settings -> webhooks

delicate fog
#

that only is accessible if you have added a bot on top.gg and it was approved

jagged ingot
#

lol

dense copper
#

How to receive webhooks for discord server webhooks?

jaunty plank
#

top.gg webhooks are not compatible with discord webhooks

dense copper
dense copper
jaunty plank
#

a url is just a destination for the webhook to go to

#

you need to make a webhook receiver, and put the url to that webhook.

dense copper
#

Are there any npm modules for that? Or i have to make my own?

jaunty plank
daring escarp
jaunty plank
daring escarp
jaunty plank
#

thats guidelines for voting

empty violet
#

dbl.postStats(bot.guilds.size, bot.ws.totalShards) is this the correct way to post shard counts to the website

jaunty plank
#

the dbl library is deprecated, I would suggest using the auto poster

shy vortex
#

yes

#

the auto poster would handle it for you

#

with shard count and so on

empty violet
#

what is the auto poster

jaunty plank
#

pins

empty violet
#

thanks

graceful merlin
#

What it means Shards?

empty violet
#

does the autoposter still get voter data or is that just the dblapi.js

hot axle
#

yea it can get vote data too

little gorge
#

i have read the docs

#

but still don't understand

steady delta
#

@knotty garnet if you're going to answer, pls do here

knotty garnet
#

ik

steady delta
#

thx

knotty garnet
#

dlbclient = dbl = only for dbl

little gorge
#

anyone going to awnser my question?

knotty garnet
#

webservers aren't hard to setup, once you have one running all u need to do is use it for all HTTP stuff

little gorge
#

wat that

steady delta
#

@knotty garnet yea how to i listen to kofi events? isn't there a wrapper like dbl for kofi too?

knotty garnet
little gorge
#

i have read that

#

i still dont understand

steady delta
#

use dblpy

knotty garnet
knotty garnet
#

dblpy is a lib

#

you need a solution for python, not dblpy

little gorge
#

const dbl = new DBL('my api token', {webhook: 80, webhookAuth: 'my_very_secure_password'})

#

is this right?

steady delta
#

oh he's using js lol

knotty garnet
#

yes

little gorge
#

ok