#topgg-api

1 messages · Page 132 of 1

jaunty plank
#

make sure to use the public ip, not 0.0.0.0

void warren
#

no i did not

#

what is the public ip?

jaunty plank
#

wheres your bot being hosted?

void warren
#

repl

#

being honest

jaunty plank
#

youll use your repl url
replurl/dblwebhook

void warren
#

kk

jaunty plank
#

you should change the port in the code to 8080

#

repl expects 8080 for all webservers(including webhooks)

main kayak
#

and for votes, do i need to add some extra command or it counts itself? i dont want to receive notis of people voting. The number would go up right if people vote?

void warren
#

so where do i put the host ip?

jaunty plank
#

no need to use an ip if using replit

void warren
#

ok

jaunty plank
#

its just replurl/dblwebhook

main kayak
jaunty plank
#

np

void warren
#

sorry if im being annoying

jaunty plank
#

its no problem at all, its what im here for

void warren
#

so it goes in webhookPort?

jaunty plank
#

op sorry i explained that terribly.
in webhookPort use 8080

void warren
#

okay

jaunty plank
#

on the site in the url section use yourreplurl/dblwebhook

void warren
#

ohhh

#

where do i set that

#

LOL

#

i am so bad at this

jaunty plank
#

your bots page, click edit, left side click "webhooks"

void warren
#

oh

#

k

main kayak
#

in this code i need to add client id in place of 'client' or just put it as it is?

jaunty plank
#

whatever you named your bots client.

main kayak
#

name on website right?

#

or can i just put client id of bot

jaunty plank
#

no

#

the name of the variable of your bots client.

#

like
const client = new Discord.client();
. ^ this here
or whatever

main kayak
#

ok

jaunty plank
#

if using dbd it might be bot.client or even client.client

void warren
#

uh

#

it still doesnt detect it???

jaunty plank
#

do you mind dming me the url you used?

void warren
#

sure

main kayak
#

i am still having some issues :/

#

its giving me error

#

401 unauthorized

#

it says you need a token for this endpoint

#

you there woo?

jaunty plank
main kayak
#

where lol

jaunty plank
#

in the code

#

'topggtoken'

main kayak
#

oh lemme tr

#

try

#

i am unable to figure this out

#

i got the token

#

but i am unable to figure how to work it out, its always crashing

#

should i dm you my screenshot?

jaunty plank
#

sure

void warren
#

how can i get the avatar url of the person who voted for my bot? (i got sent here again haha)

rain heart
#

The Webhook returns their User ID, you can use that ID to get that users avatar

#

On how to do that, read the docs of your Library

void warren
#

oh

#

its in the docs? thanks!

void warren
rain heart
#

If you want to get the actual avatar, use your discord library

#

Check the docs for that i meant

void warren
#

well i got this working somehiow

rain heart
#

With the dbl library? It does return the avatar too, though only the on stored on top.gg

void warren
#

also is it user.displayAvatarURL

#

i think it is

#

i meant like how to get the user who voted and that code i sent did it

#

now it screams at me for user.displayAvatarURL

rain heart
#

Because it can happen that a user changed their avatar and it doesn't exist on top.gg anymore

void warren
#

e

#

so how can i get it to show the avatar?

rain heart
#

Use the id and get the avatar through your discord bot library

void warren
#

k

#

so cache?

rain heart
#

Read the docs for that

void warren
#

honestly i wish i was a professional

autumn valley
#

can we use another bot voting thing like we vote my bot name testing and like i have another called testing2 and can we access the voting through my testing 2 bot?

#

anyone can help me?

autumn valley
#

umm

#

i want people to get gift when then vote my another bot

#

my order it is in top.gg and when someone vote it another bot give them soething

#

oh O_O

#

then i wont lol

rain heart
#

So just don't

autumn valley
#

yup i wont 🙂

#

just gonna make it so the bot they vote thx them

scenic kelp
#

K

autumn valley
#

is DBLToken and top.gg token same?

dim wren
#

Hi, why on top.gg does it mean that my bot is on 2 servers while it is on about 25 servers? please (ping me in case of answer)

green mantle
dim wren
#

no

#
    setInterval(() => {
        api.postStats({
            serverCount: client.guilds.cache.size,
        })
    }, 1800000)
#

@green mantle

#

I am using the correct token

dim wren
#

It's not ```js
client.guilds.cache.size

#

ok

#

no that gives me 24 (the number of servers)

#

and not 2

#

what do you mean ?

#

I never test no

#

how to do ?

#

@shut flume ?

#

ok

restive otter
#

How can i get all votes a bot has?

#

can i even do that?

dapper copper
manic notch
#

Hello if im using glitch.com and i want to see who votted .
What to write in Webhook Url

rapid kettle
#

No

manic notch
#

Or?

rapid kettle
#

Your glitch project URL

manic notch
#

Only project url?

rapid kettle
#

And the path ofc

manic notch
#

Example:- like this?
https://projectname.glitch.me

#

Or i need to put /webhook in last

rapid kettle
#

yes but add your webhook server’s path

manic notch
#

https://projectname.glitch.me/webhook
I did this still not working

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

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth3356') // 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(5040) // your port```
I ran this but how am I supposed get the webhook url to add it top.gg
rain heart
#

god fuck

#

hold on

wraith skiff
#

?

rain heart
#

http://serverip:port/path

manic notch
#

Thanks i solved

rain heart
#

replace serverip and port with your server ip and webhook port

#

path with the webhook path, in your case dblwebhook

manic notch
#

My error i put https

wraith skiff
#

it just keeps loading but never loads

rain heart
#

you cannot open it in a browser

#

how does the url look like?

wraith skiff
#

where am I supposed to open it

rain heart
#

you have to put it inside your top.gg bot page settings

wraith skiff
#

ohhh

#

ok

rain heart
#

Test it with a request client such as postman first

#

Is your bot/webhook hosted locally?

wraith skiff
#

for now yea

rain heart
#

if yes, you need to portforward, can't help you with that

wraith skiff
#

oh ok ill add it to the server now

hybrid peak
#

the python library can autopost the guild count. how often does that happen?

wraith skiff
#

Is it possible to send a message in a channel when someone votes?

austere swallow
#

you will need to use webhooks to allow your bot know when it gets a vote, then send a message to the channel you want

wraith skiff
#

I just found this in the dblpy docs

async def on_dbl_vote(data):
    print(data)```
And what do I need to do before I can use that?
hybrid peak
#

does the go sdk have the same autopost functionality dblpy does?

wraith skiff
#

probably

#

wait

sullen nymph
#

topgg-autoposter does, the SDK doesn't

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

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

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

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


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

I have this

#

now

#

the webhook_path

#

what is that

sullen nymph
#

What have you entered in your bot's webhook settings on top.gg?

wraith skiff
#

everything

#

the url and auth

#

it worked

#

but

#

this

sullen nymph
#

webhook_path is just the string that comes after the domain/IP:port

wraith skiff
#

oh

#

ok

sullen nymph
#

/dblwebhook leading to the proper link being http://ip:port/dblwebhook

wraith skiff
#

mhm

hybrid peak
sullen nymph
#

Oh

#

Uh, I don't think the Go library is even maintained?

wraith skiff
#

what "bot" do I have to give when calling setup()

sullen nymph
#

bot arg is the bot object that's passed by discord.py internally

#

Unless you're using the Client object instead?

tropic halo
#

hello

dapper copper
#

@tropic halo you can make a GET request to https://top.gg/api/bots/yourbotid and it should give you a points value in the body

tropic halo
#

gotcha, will check it out

#

thanks!

dapper copper
#

no problem

hybrid peak
tropic halo
dapper copper
#

you need to set the authorisation header

sullen nymph
#

You'll have to write your own lowkey wrapper

#

and/or send the requests yourself

tropic halo
#

and what do i send there?

#

bottoken

#

ig?

dapper copper
#

headers: { Autothorization: 'TOP-GG TOKEN' }

#

you can find the topgg token under webhooks on your bot edit page

tropic halo
#

ah thanks a lot!

wraith skiff
#

when I use on_dbl_vote with my heroku webhook I get a problem:
at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=python-bot-69.herokuapp.com request_id=d963025d-ee07-4cfb-a860-3be798e6ccaa fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https

#

am I supposed to be using another webhook?

tropic halo
#

also @dapper copper is there a tutorial where i can get started with the $$ for the votes i get? my bot got 15k votes (points) i got from that api ;-; and i saw somewhere we can get paid for votes

dapper copper
#

You have to be in auctions

tropic halo
#

ah i applied for it ig

dapper copper
tropic halo
#

waiting for the response

dapper copper
#

ah ok

tropic halo
#

there was no follow up which got me confused

#

jsut a "luca will dm you"

#

thanks a lot!

wraith skiff
#

I can't get on_dbl_vote working😭 when I use the heroku webhook it says no web processes running

#

how did anyone create a webhook and use it

restive otter
#

idk it doesn't work

thorny thicket
#

It was working just fine and suddenly i'm getting this err.. idk how/why

#

any idea?

restive otter
#

What ip does dblpy use as a default?

#

i mean webhook

wraith skiff
#

how do I get my dbl token?

rain heart
#

though the site has some issues at the moment

restive otter
#

or

#

or that webhook_path requires entire path http://ip:port/other things?

rain heart
#

0.0.0.0 is not a valid webhook ip

#

http://ip:port/path

#

ip:port with corresponding ip of your server and port etc

restive otter
#

like, after ip

wraith skiff
#

I cannot find any docs for top.gg servers

#

only bots

#

so that I can send a message when someone votes for the server

restive otter
#

i need help with voting roles

#

role rewards

thorny thicket
wise onyx
#

is there any plans for top.gg's api to support resending vote webhooks if they aren't received? I've noticed quite a few people don't get their vote rewards in my bot due to the webhook not receiving the vote from top.gg

open bone
#

if i don't put my bot client in the dbl constructor will postStats still work?

#

oh nevermind

wise onyx
#

it requires the id

restive otter
#

😭

wraith skiff
#

what do you need?

#

exactly

restive otter
#

Like

#

How do I make the role rewards?

#

Not the roles itself, but putting them and configuring them on the dashboard

wraith skiff
#

there is a option to give a user a role when he votes

restive otter
#

Where is that?

wraith skiff
#

but it doesnt work now

restive otter
#

Ok

#

I’ll check it out later

#

Thank you

wraith skiff
#

np

quaint torrent
wraith skiff
#

?

restive otter
#

nope

#

api go brrr

#

i meant backend lmao

restive otter
brittle spoke
#

I think your bot needs to be approved but i'm not sure

serene bloom
#

I am trying to send a specific channel message when someone votes for my bot, but I fail to do this. Is there anyone who can help me?

serene bloom
#

must to put webhook_path
to work o_dbl_vote ?

meager harness
#

Endpoint to fetch reviews?

willow spindle
#

nope

jaunty plank
tropic halo
#

oops was in the wrong channel my bad

restive otter
sullen nymph
#

Something you can technically ignore

restive otter
#

@sullen nymph btw, are you aware of this? It's subtracting utc timestamp by local timestamp.

sullen nymph
#

Now I am

#

feel free to throw a PR or submit it as an issue on the repo

restive otter
#

Eh, I've never made a PR before, but let's see

restive otter
#

done ig

sullen nymph
#

will take a look in a bit

dull pumice
#

Hi, how do I set up webhooks?
I have tried connecting it but it won't work. I would love it if someone can assist me privately. Thanks.
Am ready to provide requested info.

wraith skiff
#

I just used to vote bot

vernal trench
#

How do i get the webhookAuth/password?

#

Ok so i can just do webhookAuth: 'secretpassword.exe'

#

Is there a way to test if my code works?

#

(with webhooks)

restive otter
#

yes

vernal trench
#

How?

rain heart
#

test button

vernal trench
#

Hmm

#

Doesnt work and i got this code

dbl.webhook.on('vote', vote => {
  const webhook = new Discord.WebhookClient("2","i8x") 
  webhook.send("Big thanks to: ${vote.user} he just voted for Ark mobile bot! <3  ")
  console.log(`User with ID ${vote.user} just voted!`);
restive otter
#

thats old

vernal trench
#

What?

restive otter
#

there is a new library for js

vernal trench
#

can u send the npm documentation for it?

restive otter
#

pins

#

so you can't access the api without a registered bot?

#

that sounds dumb

rain heart
#

It's a good practice against malicious use

restive otter
#

i think you should update the c# library page then cause the Unauthorized API Usage section doesn't work

rain heart
#

You can contribute to it if you want to

sullen nymph
#

If only there was an active maintainer

dull pumice
#

Here's my code:

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

const app = express();
const webhook = new Topgg.Webhook('topggauth123');

// eslint-disable-next-line no-unused-vars
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
    // req.vote is your vote object e.g
    console.log(req.vote.user);
});

app.listen(3000);

And this is what Top.gg looks like:

#

Why won't it work

restive otter
#

You should censor your ip

#

just in case

#

And check if the port is open

jovial kiln
#

API is slow atm to sending webhook votes

restive otter
#

hello is it possible top post shard count in discord.py ?

#

i don't find any info about it

rain heart
restive otter
#

if i ask here, it's because i don't find it

rain heart
worn lion
#

@sullen nymph There's an issue with the python-sdk readme

#

You write "posting server count manually" with an example of tasks.loop to do it automatically

#

maybe you can rewrite it to "posting server count every {} minutes"?

#

I can go ahead and make PR if you'd like

#

also "With autopost" with an example of just an event listener

sullen nymph
worn lion
#

whynot hmm ok

#

done loggers

vocal robin
#

Which libary is the most updated one to post stats?

#

dblapi.js is depracated?

dapper copper
#

hold on

#

@vocal robin ^^

near remnant
#

@dapper copper

#

do you know?

vocal robin
#

api.postStats({
serverCount: client.guilds.cache.size,
shardId: client.shard.ids[0], // if you're sharding
shardCount: client.options.shardCount
}) Should I pass here the server count of all shard?

earnest pasture
#

hello where should I post my data too?

#

to what webhook

#

and should I have any headers?

#

that one?

#

nope I got error code 404

rain heart
earnest pasture
#

oh

#

okay got a respone 200

#

ty

compact creek
#

Has the d.py wrapper voting webhooks broken cause mine don't work anymore

dapper copper
#

cc @sullen nymph

wraith skiff
sullen nymph
#

@compact creek library version?

green mantle
#

It shouldnt be

wraith skiff
#

i could find it

sullen nymph
compact creek
wraith skiff
#

it said I could

green mantle
#

It should be working then

sullen nymph
#

Not anymore

green mantle
#

either a you code issue or site issue

wraith skiff
compact creek
#

hmm I'll check some stuff one sec

sullen nymph
#

Docs aren't updated

wraith skiff
#

oh

sullen nymph
#

It was set before top.gg removed the library field

wraith skiff
#

damn

#

not even server count

compact creek
#

Definitely not working for me

#

The webhooks just won't work

green mantle
#

you sure your firewall isnt blocking anything

#

you got the right ip

#

right port

compact creek
#

Yep

green mantle
#

not needing to port forward

#

right url

compact creek
#

It's on my VPS and it's correct details

worn marsh
hot axle
#

those are the query params on the user's browser whne they voted

#

for example, if you vote from a reminder, there's a reminderClicked query parameter

worn marsh
#

hmm thx

stoic shuttle
#

What happens when i hit test in the webhooks page?

cursive steppe
#

Is this error due to invalid token?

vocal robin
mellow aspen
#

My bot was posting stats last night, work up this morning to find it had randomly crashed saying it cannot post "Id" of undefined, its never done this before and I havent changed its code, anyone know why this happens?

wraith skiff
#

You should provide more info

mellow aspen
#

I literally provided

#

All info

#

Anyone could want

wraith skiff
#

So I am supposed to know what id belongs to

sullen nymph
#

You haven't provided your code

#

Traceback

mellow aspen
#

But I havent had any code issues for 4 months and I havent changed the code in 4 months so why would it be helpful lmao, I'll post it here anyway but yeah

#

restarting the server literally fixed it I just wanted to know why it broke

sullen nymph
#

Well that's fun

mellow aspen
#
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);

client.login('token');

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

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

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});

And before u say it, yes I have defined discord and client

wraith skiff
#

Well if it said "id of undefined" that means that shards wasn't defined

mellow aspen
#

doesnt help me

#

Had 0 issues with the code

#

If that was actually the case

#

I would get that error everytime I boot the bot up

#

1 error 1 time isnt caused by a syntax error

#

Anywayyyyy I just removed the shard parts bcs cba

wraith skiff
#

Well the shards exist when you boot it, but after some time they dont exist anymore

#

Im not very familiar with shards

mellow aspen
#

I had restarted the bot hours before it happened

#

Doubt they disappear after a couple hours or smt lol

wraith skiff
#

But how did you use them?

#

One for every server

#

Or what

brittle spoke
#

@mellow aspen read pins in this channel

#

dblapi.js, now known as node-sdk or @top-gg/sdk has been remade.

#

(actually just read the whole pinned message)

restive otter
#
<a href="https://discord.com/oauth2/authorize?client_id=786351005821567027&scope=bot&permissions=838721">INVITE NOW!</a>```


This will work?
full elk
#

how do i check if array is undefiend log js [ undefined ]

rain heart
#

Try it and see

restive otter
#

ok

rain heart
#

Also wrong channel

restive otter
#

oh wait ye lol

rain heart
restive otter
#

Sorey

full elk
restive otter
#

LOL

little matrix
#
console.log(req.guild)
)}```

Hello for server voting webhook, my `req` returns well, but why my `req.guild` or `re.body.guild` is undefined, but `req.headers.authorization` works too,

req.body.guild works in my other bot
hearty lintel
#

@little matrix are u parsing the body?

stiff imp
sullen nymph
#

It will return 1 since the user has voted and will start returning 0 12 hours after that

stiff imp
#

ty

#

I made a command for when a user type it, it will use the .hasVoted to verify if he really voted and present it. But I don't want to reward more than once for the same vote, would I have to create a timer?

sullen nymph
#

Preferably use a webhook instead

stiff imp
acoustic peak
#

Hey, automatic server count seems to be broken on Py3.9

#

any workaround available?

sullen nymph
#

install dblpy from the github repo

acoustic peak
#

does that version of dblpy support py3.9?

sullen nymph
#

yeah

acoustic peak
#

Nice, thanks!

manic notch
#

How can i get message.author ?

sullen nymph
#

in a message event

manic notch
#

Yes

sullen nymph
#

Yes

manic notch
#

dbl.webhook.on("vote", (vote, message) => {

ebon rain
#

when i try to install the top-gg/sdk with npm it gives me an error,

#

does anyone know whats wrong

sullen nymph
#

which is an ID

#

there's no message in a vote request

manic notch
#

I want to get the author

#

Is there any way?

sullen nymph
#

Why specifically author

#

A message author is literally just a user/member object in d.js. In this case you get the voter' ID by accessing vote.user and get the user object from that

ebon rain
#

you can fetch the user using the id that u get from vote.user

manic notch
#

I want to get that user vote!

#

Not total users vote.

#

And im using database for storing data

rain heart
#

Use webhooks and track the votes for yourself

manic notch
#

I want to count how much vote i have/a user have!

rain heart
#

Yes

#

Webhooks and track the votes for yourself

rain heart
#

Each vote-request contains the user id from the voter

#

Which you can use to track them

ebon rain
manic notch
#

Hmm i know but its giving all users votes not a single user im doing mistake with db.

#

Thankyou for help ❤

ebon rain
#

whats the event trigger for when someone votes?

#

or how do you tell when someone votes

sullen nymph
#

as once said

#

rtfd

autumn valley
#

is there any way to do test vote?

rain heart
#

yes

#

through the test button on your webhook settings on your bot page

autumn valley
#

ok

#

what to put in webhookauth?

#

i mean what is webhookauth?

restive otter
#

it's simply the password you provide in the authentication field of your bot's webhook page and in the code

the wrapper module you use will compare the password top.gg sends with the requests with one you have set in the code

#

just for safety

autumn valley
#

or only in code?

restive otter
#

yeah, there and in your code

autumn valley
#

ok

rain heart
#

Your webhook url

#

which is http://yourip:port/dblwebhook

#

replace yourip and port with your servers ip and the port you entered on your webhook options

autumn valley
#

how to find my ip?

rain heart
#

it is the ip of the server your bot is hosted on

cyan condor
#

you dont need to put anything there if you dont have a webhook

autumn valley
autumn valley
cyan condor
#

okay!

rain heart
autumn valley
#

bruh i cannot make it work 😦 sorry for ur time waste

supple egret
#

I need some help for setting bot vote logs. Can anyone help me please.
Language:- discord.py
Dm me if you know the same

rain heart
#

wrong channel

supple egret
#

@rain heart you were the one who approved my bot. BTW thanks for help

rain heart
supple egret
hybrid peak
#

what can cause a 400 status code

rain heart
#

wrong request method

#

wrong post format

hybrid peak
#

im POSTing my bots stats to top.gg. wdym by wrong post format

hot axle
#

your request body might be invalid

#

check that you're setting the Content-Type header correctly

hybrid peak
#

that worked, thx

hot axle
#

np

hybrid peak
rain heart
#

Clap good job

hybrid peak
#

😳

charred hound
#

how can I give rewards to people who bump on the website?
and is that possible?

#

I have a custom bot that my mods made that gives cookies for bumping disboard, but I wanted to add tops to it.

rain heart
#

Vote, yes

#

Webhooks

#

There's no such thing as bumping on top.gg

charred hound
#

bumping = voting to me

#

but thanks

#

besides disboard, discord.me, and tops, is there any other websites that are effective at generating member invites?

rain heart
#

Can't give you any help about that, sorry

solar grail
#

d

outer fractal
#

Why do I get this error when the bot sends its stats?

04.02 00:10:04 [Bot] (node:41) UnhandledPromiseRejectionWarning: Top.GG API Error: 404 Not Found
04.02 00:10:04 [Bot] at Api._request (/node_modules/@top-gg/sdk/dist/structs/Api.js:74:19)
04.02 00:10:04 [Bot] at runMicrotasks (<anonymous>)
04.02 00:10:04 [Bot] at processTicksAndRejections (internal/process/task_queues.js:97:5)
04.02 00:10:04 [Bot] at async Api.postStats (/node_modules/@top-gg/sdk/dist/structs/Api.js:94:9)
04.02 00:10:04 [Bot] (node:41) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
jaunty plank
#

what library are you using to post stats?

dapper copper
#

it says in the error

#

he's using top-gg/sdk

hot axle
#

maybe it's an internal server error

#

shit happens

dapper copper
#

404 is not found

#

lol

hot axle
#

ik but like

dapper copper
#

Can you not read

#

It says 404

#

not found

hot axle
#

the lib shouldn't give a 404

dapper copper
#

It does

#

when the id its posting to

#

is incorrect

#

sigh

hot axle
#

o

#

right

dapper copper
#

Its just returning the value the HTTP server returns

dapper copper
hot axle
#

yes i had forgotten about that

stiff imp
#

Is there any way to see how long before a user can vote for my bot again?

hot axle
#

but you can use webhooks to store the time at which users vote

jovial kiln
hot axle
#

finally docs for top-gg/sdk

jovial kiln
#

mhm

atomic turret
restive otter
restive otter
#

what do you use(js, py etc)

#

this on top gg page

#

🤦

#

i meant what language you use

#

oof XD

#

css

#

bruh

#

from writh a description

#

i meant the p r o g r a m m i n g language

#

the bot lang is .js

#

finally

#

use topgg-autoposter

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

const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client
#

tnx

#

Guys, for some reason in Top.gg it dosent show how many servers my bot is in. Is there a way to make it show it?

#

@restive otter maybe you know?

#

what do you use(js py etc)

restive otter
#

Js @restive otter

restive otter
#

Do I just copy n paste this in my index.js? @restive otter

#

And how do I even find my top.gg token?

restive otter
#

And that’s it? @restive otter

#

Just that

#

paste your token(top.gg) and your done

#

Woah, alr thanks!

#

HOLY SHIT MY BOTS IN 40 SERVERS @restive otter

#

And is there a way to find out which servers my bots in?

manic notch
#

Like how manually?

#

Oo oki leme try

sleek pond
#

Hello guys is there any api which counts in how many server the bot is

rain heart
#

Your bot Library should be capable of that, though #development as this is the wrong channel

devout pewter
compact creek
#

Can someone show me an example of what the API sends to your webhook when you vote? What does the JSON response say basically?

sullen nymph
#

user, bot/guild, query, type

#

those exact key names

compact creek
#

alright ty

rain heart
#

The actual json schema is also mentioned on the docs

compact creek
#

Oh is it?

sullen nymph
compact creek
#

Ah thank you

devout pewter
#

Is there a video of changing the server number here? I am Turkish and did not understand anything about the api site.

rain heart
#

The docs has a few examples on how to do it, see the link above

austere palm
#

这是什么?

#

Jk i know english

#

So yeah the server count isnt working

#

The updates are really slow

#

And im using cURL

#

to update server stats

devout pewter
#

I guess we can't remove the "number of servers" section.

#

Is it correct?

rain heart
willow spindle
#

post 0

rain heart
austere palm
#
curl -X POST -d "{\"serverCount\": "$servercount"}" https://top.gg/bots/$clientid/stats -H "Authorization: $topggauth"
sullen nymph
#

Posting 0 doesn't remove it

rain heart
austere palm
#

Try -1

sullen nymph
#

anything below 0 won't work

austere palm
#

Or null

#

Or void

#

Or undefined

sullen nymph
#

only numbers and array of integers is are accepted

austere palm
#

Or try a DELETE instead pf POST

#

That might work

rain heart
#

I mean, can't say that's a bad idea to implement in v1 zoomeyes

sullen nymph
#

The team has kinda far greater priorities atm so

rain heart
#

Yeah

compact creek
#

So this is what I have but it doesn't send anything or show any errors

@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)

self.dblpy = dbl.DBLClient(self.client, self.dbl, webhook_path="/dblwebhook", webhook_auth="something_you_cant_see", webhook_port=5000, autopost=True)
abstract gulch
#

@compact creek Hey broo

compact creek
#

hi

sleek pond
#

hello

red cove
#

Are there any issues with the API? My vote logs (server not bot) stopped working properly around 10pm yesterday. It's been working flawlessly for months until now. I'm not at my PC so I can't really easily debug this

rain heart
#

Normal vote webhooks seem to work properly, just tested it on my bot

red cove
#

Server votes.. right?

rain heart
#

Let me check server votes aswell, one moment

red cove
#

I know our members reported that they got a message about the way votes work for servers being changed to prevent fraud

rain heart
#

Yeah they cannot vote more than 2 times on the same ip

#

Also just tested server webhooks, they work aswell

red cove
#

This was me voting. I never even voted before that. Ok it may be something new getting rate limited lol.. I was curious since I can't touch the code at the moment.. Thanks mate.

little matrix
rain heart
#

No, they can only vote twice on different accounts per ip every 12 hours

little matrix
#

Oh.

rain heart
#

To migate vote manipulation

little matrix
#

Hm

jagged ingot
buoyant vortex
#

How do I setup different Vote Rank rewards after Multiple Votes?????

rain heart
#

By making your own webhook

#

You need to know how to code though

buoyant vortex
#

So there isnt any Preset?

#

or Template?

rain heart
#

No there's not

jagged ingot
#

is there anything to rely on like first step instructions for webhooks? if so may i get a link to the tutorial

jaunty plank
#

like learning webhooks from scratch? or using one of our libraries?

jagged ingot
#

since i can google the webhook stuff

jaunty plank
jagged ingot
#

thanks there

jaunty plank
#

hmm, the docs link mighta moved? 🤔

jagged ingot
#

okay

pale fulcrum
#

new api link is poggers

hasty echo
#

monkaW Urmmm How do you get the voting setup with the new API. Monkey brain Troy was using the old API

hot axle
#

wait there's a new api?

mighty sun
#

Nah he was using the old one

hasty echo
#

I was using DBL.

hot axle
#

oh aight

hasty echo
jaunty plank
#

get what voting setup 🤔

#

oh webhooks?

hasty echo
#

Yea sorry webhooks

#

Yooooo

#

Yea urmm ngl if anyone can help me I am actually too stupid for this

#

Like I thought I setup the webhooks correctly 👀 but maybe not or maybe I messed up on the API I really am not sure

next shore
#

just the problem is that sometimes, requests to the server are sent correctly, but the answer is not correct, well, or the API configurator performs garbage

scarlet cobalt
#

Hello, i have a question about api.hasVoted(id)

does this check whether the user voted in the last 12 hours or voted at all

restive otter
#

Last 12 hrs

scarlet cobalt
#

okay thank you for your quick reply 🙂

urban jungle
#

h

cursive steppe
#

It works but when i use node-fetch, it says {"error":"Unauthorized"}

rain heart
#

You need your bot token in the authorization header

cursive steppe
#

Oh

rain heart
#

well not bot token

cursive steppe
#

I know but it works with get request?

rain heart
#

Yeah the check endpoint can be used with a get request

cursive steppe
#

When i visit it manually it just works

rain heart
#

It says forbidden

#

If you want to make a node-fetch request, you need to have the Authorization header with your top.gg token

cursive steppe
#

Ok it worked thanks

languid violet
#

Is the api Webhooks posting properly? I have set one up and pressed "test", it says it's performing the POST, but I have waited 6 minutes and nothing has happened.

#

By the way

#

I'm using discord Webhooks

rain heart
#

You cannot use discord webhooks

#

you need to make your own webhook

languid violet
#

Ohhh

#

Sorry

#

Ok

autumn valley
#

do dblapi.js still works?

restive otter
#

It does but please use @top-gg/sdk

autumn valley
restive otter
#

any errors?

autumn valley
#

nope

restive otter
#

idk your code so

#

¯\_(ツ)_/¯

autumn valley
#

i tried full day but didnt work

#

i use glitch so it may not working\

restive otter
#

please dont use glitch

autumn valley
#

then what can i use?

restive otter
autumn valley
#

umm

#

do it work in it?

#

i just want voting tracker

autumn valley
restive otter
#

just nvm

#

use the example for the webhook

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

const app = express() // Your express app

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

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

app.listen(3000) // your port
autumn valley
#

ok

autumn valley
restive otter
#

it should work in glitch too

sullen nymph
#

Are you using Glitch for Discord bots

autumn valley
autumn valley
restive otter
#

Then

autumn valley
#

i will make new project of glitch then try once again then if it dont work then i am using repl.it

restive otter
#

Go to your bots edit page > Webhook

autumn valley
#

yes ik it

restive otter
#

Then for the url

autumn valley
#

i did all thing

restive otter
#

oh ok

#

idrk then

autumn valley
restive otter
#

yeah

autumn valley
#

what to put there

sullen nymph
#

Don't put the port in the URL

autumn valley
restive otter
sullen nymph
#

then what

restive otter
#

remove your port

autumn valley
#

where to put port then

restive otter
autumn valley
#

oh

restive otter
#

nope

autumn valley
#

let me try

sullen nymph
#

You host on port 3000 but point to port 443, which is HTTPS

autumn valley
#

yay working

#

thx

#

thx u so much

#

finally my whole day work is working

jolly solar
#

I'm searching how send a message when somebody vote for my bot (Discord.py) 🤔 But i do not find

rain heart
#

listen for the webhook event, get the user id from the webhook, then use a channel ID to get a channel in your server for example, then send the message in there

jolly solar
#

how can i find the webhook event ? @rain heart

rain heart
#

you need to make your own webhook for it

jolly solar
#

ok, thanks 👍

restive otter
#

wow

#

you own appolo

fallen drift
#

Having issues with updating Brief description within top.gg - keeps directing to 504 error

severe viper
#

Screenshot the error and post it here @fallen drift

fallen drift
#

Been happening for a few days

severe viper
#

Is it being edited or just put up now? @fallen drift

fallen drift
#

Edied, been around for months

severe viper
#

Might be why.

#

Let me try editing mine

#

Mine edited just fine; it’s most likely your issue

fallen drift
#

Great

jolly solar
rain heart
#

for example http://yourserverip:port/dblwebhook

#

dblwebhook would be your webhook_path for example

#

you can change it to http://yourserverip:port/myWebhook too

jolly solar
#

🤔

#

But how find the server ip and the port ?

#

i have never use webhook

rain heart
#

serverip is the server's ip your bot is hosted on, port is what you define yourself

bright turret
#

help

#

fixing bfd.postServerCount(5).then((res) => console.log(res));

jolly solar
#

Hum, open a port can create security holes ?

rain heart
#

i mean you need to open a port for your webhook

jolly solar
#

yes, but open a port can create security issues

bright turret
#

my bot to show how many servers the bot has joined in top.gg ??

rain heart
bright turret
#

ok

#

help setting up webhooks @rain heart

rain heart
#

read the docs

bright turret
rain heart
#

You cannot use port 80

idle vessel
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() 

const webhook = new Topgg.Webhook('web auth') 

app.post('/dbl', webhook.middleware(), (req, res) => {

  console.log(req.vote.user) 
}) 
app.listen(34473)

I am trying to make a bot which can track votes of my server but when someone vote it is not showing sd_thefuck

rain heart
#

did you enter it in your bot page settings?

#

wait wrong

#

in your server page settings

idle vessel
#

no how can i do that?

bright turret
jaunty plank
#

@rain heart do you know where the token is on the new docs, I cant find it.

rain heart
#

bot page settings -> Webhooks -> Token

jaunty plank
#

ah, its no longer on the docs then? 😦

rain heart
#

Nope Sadge

#

Kinda liked the docs one more

sullen nymph
#

sad

hasty pelican
#

is there a new api?

jaunty plank
#

the top.gg api is the same api, there is a new docs, and new javascript library

hasty pelican
#

oh i don't see anything for dblapi.js tho

restive otter
#

because dblapi.js is deprecated

hasty pelican
#

ah

restive otter
#

Do i specify my IP address in the webhook url if I'm testing it locally?

#

like http://IP/dblwebhook?

jaunty plank
#

yep, if your testing locally you will need to port forward as well.

restive otter
#

So like http://IP:PORT/dblwebhook

jaunty plank
#

yep

restive otter
#

So I'm trying to get the votes locally for now then after i setup it up ill update the bot. But i cannot received them, i just don't get logged anything. Here is my code:

sinful knoll
#

Is the check API to see if they've voted once in the last 12 hours, or once in the last voting period?

restive otter
rain heart
restive otter
#

I did do it several times

rain heart
#

Where is the webhook hosted on?

#

on your own pc?

sinful knoll
#

@rain heart So basically last month?

restive otter
#

Yes for now.

rain heart
sinful knoll
#

Thanks!

rain heart
# restive otter Yes for now.

You need to portforward, i suggest testing your webhook in production so you wouldn't need to open ports on your router just for your webhook

#

or hosting a test-version of your webhook

#

just not on your pc, unless you're willing to go through the hassle of portforwarding just to test your webhook

restive otter
#

Ah, i may just try it on my hosting i guess. For heroku i put the app name right?

rain heart
#

Not 100% sure, but worth a try

restive otter
#

Hm, okay, thanks.

restive otter
#

hay

rain heart
#

I assume you didn't add the webhook url to your bot page settings

#

If your bot is hosted locally, you need to portforward, the format would be http://yourip:port/path

#

If your bot is hosted on a server, http://serverip:port/path

restive otter
#

حازم البوت تعال الاخ جاوبك@restive otter

rain heart
restive otter
restive otter
#

@rain heart thx pro

potent roost
#

top.gg is missing my bot's server count.

#

It says 627 but is available on 850+ servers.

#

can anyone help

willow spindle
#

already answered in #support
why are you asking same question

potent roost
#

you said ask on api channel

willow spindle
#

i didn't said ask same question

potent roost
#

huh, anyway

#

Sorry

#

mb

willow spindle
potent roost
#

yea, it is correct answer

#

ty

severe mauve
#

Since my bot just got approved recently, i would like it to show some stats like in the image below

#

how do i go about this

sullen nymph
#

-servercount

abstract mothBOT
#

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

severe mauve
#

well i keep getting this error even tho ive already defined my token

#

i had it in my config vars in heroku

#

...

#

the hosting platform?

#

u can retrieve data from the config vars and use it in ur bot

#

was reading docs and saw something about topgg-autoposter and decided to use that

#

incase that helps

rain heart
#

You need to use your top.gg token in the parameters, read the error

severe mauve
#

ohhhh wait

#

i found the error

#

im dumb

#

i believe so at least

#

yep i did

tepid carbon
#

I have this code:

dbl.hasVoted(message.author.id).then(voted => {
    client.commands.get('command_name').run(client, message, args)
})

To check if someone has voted, it is not an if/else statement so I cannot make it do something if they haven't voted. How do I do this? Any help will be appreciated :)

rain heart
#

voted is a boolean

tepid carbon
#

Hm

#

Ok

#

So just:

if(voted){

}else{
    
}
rain heart
#

could work

tepid carbon
#

Do I have to put in any IDs or..?

rain heart
#

in your hasVoted method

tepid carbon
#

Yeah

#

But how do I put it into the if/else

rain heart
tepid carbon
#

I'll have a look at it, thanks

hollow gorge
#

how can I check if a user has voted in python.

rain heart
hollow gorge
#

...

rain heart
#

Reading the docs helps you with it

restive otter
#

This rule has scared me...

#

You may not reward users for voting for another bot other than the one being used. This includes other bots you may own.

A user votes for Bot A, they should not be receiving Bot B's currency.

#

I own a server and when people vote i reward them with Dank Memer cash?

#

As I own a dank memer community serveR?

#

@trail sigil can u help?

#

is this ok?

trail sigil
#

they vote for a server or vote for a bot?

restive otter
#

server

trail sigil
#

that should be fine, as far as i am aware of we do not have any issues with this

restive otter
#

good

#

thank you

trail sigil
#

if there is an issue we'll just contact you and ask you to sort it out, so no need to worry too much

restive otter
#

ok

#

thank you

gusty yacht
#

What do I put for these 2 things:

webhook_path='/dblwebhook',and webhook_auth='password'

sullen nymph
#

webhook_auth is the webhook authorization key that will be used as a password

#

webhook_path is a route that will be used by the webhook

#

aka the thing that comes after the domain/IP:port

#

So if webhook_path is /dblwebhook, then your URL becomes http://ip:port/dblwebhook

sour flame
#

hi can someone help me about setting up the server count for my bot on the website?

restive otter
#

Hi

sour flame
#

where can i find my auth token on top.gg ?

cedar arch
#

How to get DBL_token?

compact creek
#

Alright so my webhooks aren't working and I've got no idea why. I'm on the latest version of dblpy and I am using discord.py:

@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)

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

I think it's been allowed through my firewall but I've got no clue how to check that

cedar arch
compact creek
cedar arch
#

Kk

#

Ty

sour flame
#

can some help me set the server count for my bot i have npm installed top-gg/SDK and i got my token but i can`t seem to get my head around how to set it up

jaunty plank
#

If your just posting counts id use the autoposter

sour flame
#

wdym?

jaunty plank
sour flame
#

i want to post the numbers of the servers my bot is in

jaunty plank
#

The auto poster can do that in 2 lines of code

sour flame
#

i see ty!

sour flame
#

@jaunty plank would it take time to show on the website?

jaunty plank
#

30 minutes typically

sour flame
#

oh ok i was worried that i did something wrong so i applied it without the autoposter

pliant stratus
#

213

crimson socket
#

$botify help

#

botify can be set up here?

hot axle
#

no

restive otter
#

What is botify

crimson socket
#

bot for spotify

restive otter
restive otter
restive otter
hot axle
#

so you can put whatever you want

sour flame
#

huh i got a question how can i set the server count in the overview under the prefix ?

restive otter
sour flame
#
    const Topgg = require('@top-gg/sdk')

    const api = new Topgg.Api(process.env.TOPTOKEN)

  setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size,
  })
}, 1800000)```this is my code
#

can you tell me how or show me the right path for it ?

restive otter
#

that should work

sour flame
restive otter
#

its prob cache

sour flame
#

wdym?

#

am i doing smth wrong?

hot axle
#

you gotta wait some time

sour flame
#

oh ok

restive otter
#

or just shift+F5 or Ctrl+F5

sour flame
#

then waiting is the best option

sour flame
restive otter
#

refresh page

sour flame
#

i did refresh it by pressing the button nothing happend

#

guess gotta wait

#

but thank you!

stray quail
rain heart
stray quail
#

i remember there being docs for widgets on the old one

rain heart
#

Yeah widgets seem to be missing on that one

#

it's going to be added as time goes on

rain heart
#

you cannot use discord webhooks

restive otter
#

where can i find the webhook?

#

@rain heart

rain heart
restive otter
#

i dont understand that!? Where can i create a webhook?

#

@rain heart

rain heart
#

you need to program your own

restive otter
#

how

rain heart
#

read the page link

restive otter
#

@rain heart would that work? i`ve created one code without webhook:

@client.event
async def on_dbl_test(data):
    guilds = client.get_guild(804061218288828436)
    channels = guilds.get_channel(807701770675290192)
    user = client.fetch_user(int(data['user']))
    e = discord.Embed(
        title="Test Upvote",
        description=f"{user} has test voted for me on Top.gg!",
        color=0xfffff
    )
    await channels.send(embed=e)

@client.event
async def on_dbl_vote(data):
    guilds = client.get_guild(804061218288828436)
    channels = guilds.get_channel(807701770675290192)
    user = client.fetch_user(int(data['user']))
    e = discord.Embed(
        title="New Upvote",
        description=f"{user} has voted for me on Top.gg!",
        color=0xfffff
    )
    await channels.send(embed=e)```
rain heart
restive otter
#

i will read it

restive otter
rain heart
knotty garnet
#

ctrl + f5 purges the cache

raven slate
#

Hi, I want help

keen plover
#

how to translate a bot into any language?(Exactly yours, on my discord server)

sonic ember
#

none of my servers are showing up on the top.gg website and it asked me to join here for help?

sinful knoll
idle vessel
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() 

const webhook = new Topgg.Webhook('web auth') 

app.post('/dbl', webhook.middleware(), (req, res) => {

  console.log(req.vote.user) 
}) 
app.listen(34473)

I am trying to make a bot which can track votes of my server but when someone vote it is not showing sd_thefuck

wintry frigate
#

id track in mongodb, log to db, then just count++

warm current
#

hi

restive otter
#

umm from where do i get the auth token for my bot?