#topgg-api

1 messages · Page 137 of 1

rain heart
#

it tells you 1 or 0 if given user voted in the last 12 hours

hidden marten
rain heart
#

not daily

#

every 12 hours, every vote cycle

hidden marten
#

dull fjord
#

rpg vote

primal fern
brittle cosmos
#

hi

tiny compass
#

i'm trying to use dblpy's post_guild_count() function with the parameter of the guild count but it's doing some weird thing and posting it as shard count instead

#

@sullen nymph I did the post_guild_count(guild_count, shard_count, shard_id) thing but it's telling me that there are 4 arguments given

#

and whenever I do post_guild_count([shard_guild_count...]) it posts the sum as the shard count as well in addition to the guild count

tiny compass
#

count_list is a list of each shard's guild count

sullen nymph
#

Does passing the list suit your case atm?

tiny compass
#

i also tried just post_guild_count(total_server_count) but that didn't work either

#

i'm manual sharding so ya

#

shouldn't it work if i just pass the first argument of guild_count

restive otter
tiny compass
#

i'm just guessing but i think the guild_count parameter doesn't exist

tiny compass
hushed reef
#

errr

rain heart
#

Are there people starting to do commands here again PensiveCry

rain heart
hushed reef
#

i see

sullen nymph
#

What?

#
    async def post_guild_count(self, guild_count: Union[int, List[int]] = None, shard_count: int = None,
                               shard_id: int = None):

CatThink

tiny compass
#

idk when i put post_guild_count(guild_count, shard_count, shard_id) it's saying there were four parameters given but expected three

sullen nymph
#

I'll try some stuff out in a bit

tiny compass
#

aight

#

like when i put post_guild_count(guild_count, shard_count) it sets the guild_count as the shard_count on the website and the server count is just some different number that i didn't input

green mantle
#

Send your full code

tiny compass
green mantle
#

What dblpy version r u on? And also can you send the full code

tiny compass
#

i downloaded the latest version

#

and that's pretty much the function but if you want the whole task

#

this was the only dblpy code i changed after i started manually sharding

#

Shouldn’t post_guild_count(int) just directly post that int as server count to top.gg

#

Or am I wrong

green mantle
#

Well whats the error

tiny compass
#

post_guild_count(int) is posting the int as the shard count

#

And nothing else

#

So Its saying I have like ten thousand shards on the website right now

compact creek
#

What do you put for the token with on_dsl_vote?

finite osprey
#

Hi! Idk why the code is not working, I am using a Command Handler and idk nothing about the API: ```js
const DBL = require('top.gg');

module.exports = (client, vote) => {
const DBLTOKEN = client.config.tokenTopGG;
const password = client.config.password;
const dbl = new DBL(DBLTOKEN, { webhookPort: 5000, webhookAuth: password });

let canal = client.channels.cache.get("764593358357790724");

canal.send(`User with ID ${vote.user} just voted!`);

}```

rain heart
finite osprey
#

The problem is that Idk how to start coding with the API

#

xD

#

Can I do that every time a user votes my bot, the bot replies in a channel a message?

median river
finite osprey
#

Oh, okay, thanks, I didn't see it!

hushed reef
rapid kettle
#

@hushed reef you should call it tophp

hushed reef
rain heart
restive otter
#

sorry

tacit rock
#

?profile

#

@abstract moth

#

@abstract moth help

#

!help

obsidian coral
tacit rock
#

tks

obsidian coral
#

Hey, is it possible to fetch reviews and such using the top.gg APi?

hushed reef
#

For now you can only fetch the last 1000 votes/month

obsidian coral
#

Ah unfortunate, would be nice if there could be basic endpoints for stuff like bots, reviews, teams & stuff

hushed reef
#

So far there are no GET or POST requests that support getting review information from either a User or Bot

#

I think all of that stuff might come with the new migration efforts, but don't take my word for it since I don't work for Top.GG

obsidian coral
#

Would be nice, had an idea to display random reviews on bot site :p

restive otter
#

how do i get TopGG token?

#

oh i got it

violet bramble
#

I am looking at the docs but can't really find it anywhere

restive otter
violet bramble
#

thank you!

#

There isn't a introduction to using api access + html?>

#

only js, python, go tec.

rain heart
#

read the full docs

#

The APIs are request-based

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

const app = express()
const webhook = new Topgg.Webhook('my auth')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  webhook.send(req.vote.user.username+' has voted!\nAs reward he/she got **250** coins.')
})

app.listen(3000)```
#

does this works?

rain heart
#

try it and see

restive otter
#

ok

#

and when i test the webhook it didnt do anything

rain heart
#

did you enter the correct url?

#

of your webserver?

restive otter
#

oh i dont have a webserver

rain heart
#

you need to host the webhook through your bots code

restive otter
#

and how do i do that? i working with webhooks firstly

#

i just look at toturial

restive otter
#

does anyone have the link for the documentation of the top.gg api?

green mantle
silent anvil
silent anvil
hot axle
#

npm i express

silent anvil
#

thx

#

there was nowhere written that it had to be installed

hot axle
#

well you're supposed to know that already

#

but k

silent anvil
#

ehh

pale fulcrum
#

gotta love how some responses are snake_case, some are camelCase, and some are just nocaps

silent anvil
#
app.get('/', function (req, res) {
  res.send('Hello World')
})
 





const ap = AutoPoster('token top', client)

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


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


const webhook = new Topgg.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(3000);```
#

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

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

#

nothing happens when I click on the test

#

I have everything filled in the webhooks tab too

#

I don't know why it doesn't work

rain heart
#

have you tried using a request client?

silent anvil
#

huh?

#

const { Client, Message } = require('discord.js');

#

that's what you mean?

silent anvil
rain heart
#

to test your webhook

#

postman for example

tiny compass
#

@sullen nymph were you able to find any issues with post_guild_count or is it just me being small brain

sullen nymph
#

No issues whatsoever code-wise

tiny compass
#

huh

sullen nymph
#

Really don't know why this is happening in the first place

tiny compass
#

do you know why my post_guild_count([int, int, int]) is posting it as shard coutn and guild count then

#

o

#

weird

#

is it because I'm calling it from one instance only

sullen nymph
#

shard count and guild count?

#

Hold on

tiny compass
#

no just the guild count of each shard

#

the list is a list of each shard's guild count

#

o you mean the output

#

ya that's what's happening

sullen nymph
#

What in the fuck

tiny compass
#

hold on let me reproduce it

#

that's the list

#

that's the website

#

wait what the hell

#

now it's different

#

it's just posting the one instance's guild count as both guild count and server count

sullen nymph
#

I'm not sure if it's my dumb ass or top.gg

#

Either way that's wrong and I'll work on it tomorrow

tiny compass
#

but ya lol I don't want to get banned for faking shard count

#

cool

tiny hemlock
#

hello

rain heart
#

hey, need anything?

tall marten
#

Hi how do I get dbl tokens.

rain heart
#

on your bot page settings -> webhooks

hearty lintel
#

@rain heart pin pls

#

How to get your Top.gg token

Hit the Edit Button on your bot page
Press the Webhooks button on the sidebar
Hit Show Token
Copy

tall marten
#

Thx

fair sparrow
dapper copper
#

i think he did before he sent that

hearty lintel
#

^

obtuse roost
#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'token'  
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='botpassword', webhook_port=5000,autopost=True)

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

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("Received a test upvote:", "\n", data)


def setup(bot):
    bot.add_cog(TopGG(bot))```
I didn't get any error and this also didn't work and can't figure out why ? Please help.
ruby ridge
#

idk

obtuse roost
#

Who knows :(

hushed reef
#

@sullen nymph

#

This is the person I'd ask

loud nimbus
#

!p bad bunny

kindred swift
#

    async def get_user_vote(self, user_id: int) -> bool:
        await self._ensure_bot_user()
        data = await self.http.get_user_vote(self.bot_id, user_id)
        return bool(data['voted'])
    @commands.command()
    async def votecheck(self, ctx, *, arg=None):
        if arg == None:
            arg == ctx.author.id
        data = TopGG().get_user_vote(self, arg)
        await ctx.send(data)

So inside my TopGG python cog I've done this to check if a user has voted but I get an error.

TypeError: __init__() missing 1 required positional argument: 'bot'
    def __init__(self, bot):
        self.bot = bot
        self.token = (token)
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

What have I done wrong?

restive otter
#

what's TopGG? your cog?

#

My bot gets this error every time someone votes

#

(JS)

kindred swift
kindred swift
restive otter
restive otter
#

otherwise, refer it with self.

#

If it matters, my bot is verified with only the guild member intent

#

just read

kindred swift
#

Well it doesn't work at all

#

eitehr way

restive otter
#

Because you only do 1 of the things I mentioned

#

also, why are you copying DBLClient method into your cog

kindred swift
restive otter
#

await self.dblpy.get_user_vote(arg) should do the job.

kindred swift
#

wym

#

oh ok

#

i did self.get_user_vote

restive otter
#

Just remove this

async def get_user_vote(self, user_id: int) -> bool:
    await self._ensure_bot_user()
    data = await self.http.get_user_vote(self.bot_id, user_id)
    return bool(data['voted'])
#

your cog doesn't even have http attribute and _ensure_bot_user method.

kindred swift
#

uh ok

restive otter
#

what's your new code and define doesn't work

kindred swift
#
TypeError: Invalid variable type: mapping value should be str or int, got None

This is the error give me 2 sec to get the code

#
    @commands.command()
    async def votecheck(self, ctx, *, arg=None):
        if arg == None:
            arg == ctx.author.id
        data = await self.dblpy.get_user_vote(arg)
        await ctx.send(str(data))
#

Am I being stupid or?

restive otter
#

arg = ctx...

kindred swift
#

?

restive otter
#

You need to assign it rather than comparing it

kindred swift
#

😐

#

I am not comparing it under if

restive otter
#

You are

kindred swift
#

oh SHIT

#

only one =

#

Thanks dude

#

Bruh being this stupid where am I going with my life.... ||jk||

restive otter
#

yes, you can even do arg = arg or ctx.author.id to make it 1 liner

kindred swift
restive otter
#

not if arg is None, rather, if it's falsy

kindred swift
#

Oh

#

and None is falsy anyway

#

ok then

#

Thanks thankyou_duck

kindred swift
#

It gives me False anyways

#

Like I voted but it's just no

ancient plover
#

everytime somebody votes it says an error

#

Even tho it used to work perfectly

kindred swift
#

Oh nvm

#

It's fine

kindred swift
restive otter
restive otter
#

The top.gg dev docs only specifies bot votes , is there a way we can track server votes too?

sullen nymph
#

DSL doesn't have an API

rapid kettle
#

boring

sullen nymph
#

Though it does support webhooks

restive otter
#

U mean wrong channel?

sullen nymph
#

I mean that the servers part of top.gg supports webhooks that you can host and track votes with

restive otter
#

Oh

#

Is there any docs for that?

sullen nymph
#

See webserver frameworks for your programming language. There isn't really a specific documentation for that

restive otter
#

can someone tell me how do i use the webhooks

rain heart
restive otter
#

i mean can i use the discord webhooks?

rain heart
#

no

#

you have to make your own webhook

restive otter
#

wdym?

#

u mean using bot?

rain heart
#

Using your bots code, yeah

#

read the docs

restive otter
#

ok

ember perch
#

hello

#

anyone

hushed reef
#

hi

neat wedge
#

Is there any way to see how many bots are added to top.gg and my bot is on which place based on the votes it received in the top list?

neat wedge
#

I wanna include it on my dashboard to see it

#

That's just about the queue

hushed reef
#

oh my god

neat wedge
#

Not the currently active ones

rain heart
#

"active ones" meaning what?

neat wedge
#

Yep

rain heart
neat wedge
#

My bot is already on top.gg. But I have a grafana dashboard showing how many votes I get per month from top.gg

#

I would like to add two new stats to it

#

One is the overall count of already approved bots

#

And the other one is my bot's place if we order all bots added to topgg already based on the votes in a descending number

sullen nymph
#

You can go over the /bots endpoint multiple times

#

With different offset

neat wedge
#

That would be too much calls

sullen nymph
#

Eh...

#

One call per 500 bots

neat wedge
#

Every minute I would need to iterate over it

#

That's a lot of bw

sullen nymph
#

Unless that endpoint returns the total number of bots, it's pretty much the only way

neat wedge
#

Rip

civic plinth
#

Yo-
How do I setup the api on my bot-?

#

(Not for voting, for server stats etc), Bot is written in TS.

hushed reef
#

well, you can always try just doing HTTP requests with the way TS has it coded

#

AFAIK there's only a JS API wrapper rn, not one for TS

raw sparrow
raw sparrow
#

Ye^^ just meant in general that there's a count to answer the question :)

hearty lintel
#

the js lib is also written in ts so

hushed reef
#

i thought TS being a superset made it diff

hearty lintel
#

you can still import a js lib in ts

#

and since it's compiled and has all of the typings it acts like a normal ts lib

hushed reef
#

neat

hearty lintel
#

@kindred walrus u wanna add support for detritus for the autoposter lol?

kindred walrus
#

could do, but im busy as fuck, and i doubt detritus users would need that

#

gonna be very frank, you gotta have 2 braincells to use detritus cuz of ts

restive otter
#

Hello

#

I Need Some Help

#

Can Anyone ?

rain heart
#

dontasktoask

restive otter
#

lol

#

thx

#

How Can I Use on_dbl_vote Withouot COgs

#

Pls tell

rain heart
#

a webhook with a webserver

#

there's no other way

restive otter
#

I Didnt Understand

#

See My Code Once

#
dbl_client = dbl.DBLClient(client,dbl_token)
#

Parameters Are Already defined

rain heart
#

You need to initialize the webhook parameters if you want to receive on_dbl_vote

#

and enter the webhook url in your bot page settings

wide lake
#

help me

rain heart
restive otter
#

I Dont Know Anything About webhooks 😅

#

Can You Help me ?

rain heart
#

read the docs

restive otter
#

Is Thre Any Limitation On Th webhook url?

#

What DOes It Needs to be?

#

Any URL Or Some Specific Kind of

rain heart
#

your bots ip

#

http://ip:port/path

restive otter
#

oh

#

Where can it be found?

rain heart
#

check the docs on how you define parameters for your webhook

restive otter
#

I Read

#

But I Am Still Confused

meager hinge
#

I am unsure if my API usage is correct.

#

I have followed it to the tee, does my bot needs to be approved

#

before it can submit server numbers to it?

jaunty plank
#

Yes

meager hinge
#

OK thx

#

where are the terms and conditions or requirements for the bot to be approved?

#

i want to ensure I am following as much rules

jaunty plank
meager hinge
#

thank you

#

its been over 2 weeks (i think) since i had applied.

#

Going to check to ensure it doesn't get rejected... waiting again going to be soo soo long.

restive otter
#

how do i get a user's bots listed on top.gg?

wary abyss
#

How can I get my API token. When I try to access to the link I get this error. Thks!

wary abyss
#

Thks @sullen nymph!

restive otter
#

where can i get an api key? according to the docs its in the "My Bots" page but i cant seem to find that anywhere

#

or am i just blind?

hot axle
#

check pins

restive otter
#

oh

#

thanks

hot axle
#

yw

dull ice
#

Hi, I have a problem with the voting webhook, everything seems to work fine with the test button but when someone votes, top.gg seems not to send any post request... Someone will have an idea?

jaunty plank
#

is your code only setup for test webhooks?

dull ice
#

No, setup for vote and test webhooks

jaunty plank
#

what library are you using?

dull ice
#

For my bot, it's complexe, my bot only read the content of a file who contain a list of upvoters every x seconds, this is a PHP page that takes care of receiving post requests from top.gg and adding the user id to the voting file

restive otter
#

-p sen kaşındın lan

dull ice
#

With the test button, a line is added to the file but no post request is sent when someone actually votes.

knotty garnet
#

files are prone to data loss or corruption

#

also, a list of 100 users is a thing, a list of 1000 users is a whole different thing, there's a limit where the file will struggle to even open

restive otter
#

Now the theory is spreading that the snipe command against the ToS because the dank mememer has removed it. What do you think about that?

jaunty plank
#

not here please

#

this is top.gg api, not tos discussion

restive otter
#

Okay

#

Sorry

tidal grove
#

Help me

#

!!!

fickle zealot
#

404, nice

carmine nimbus
tidal grove
#

which of these im speaking brazilian

willow spindle
#

just read that

open bone
#

should i still use dblapi.js or top-gg/sdk

hot axle
#

use @top-gg/sdk

iron tusk
#

how would i set up vote rewards for a server

restive otter
#

@sonic sorrel can we get a -wrongserver

sharp bay
#

Sorry

restive otter
#

its fine, but this isn’t the right server you’re looking for

#

they left

sonic sorrel
#

-wrongserver @sharp bay

abstract mothBOT
#

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

sonic sorrel
#

It's best to ask in their support server if you're having issues with their bot

restive otter
#

they left 8379_Sad_Boi_Hours

tall fern
#

How to create a own Invite

hearty lintel
#

you already asked in general

#

what kind of invite

wheat copper
rapid kettle
#

you need to turn it to json

#

use res.json()

wheat copper
#

ah, ok thanks

pale fulcrum
#

pog

shadow tartan
#

hell

kind basalt
#

@vital anvil

sullen nymph
kind basalt
#

Thank

wheat copper
#

How can i get total upvote count? cant seem to find it in the docs and doing a botstats query only returns server/shards info

sullen nymph
#

GET /api/bots/bot_id

wheat copper
#

thanks, missed the plural 🤦‍♂️ i was using 'bot'

sullen nymph
#

xd np

restive otter
#

Please help me with the on_dbl_vote

#

The event never gets called

rain heart
#

you need to add your webhook url to your bot page settings

restive otter
#

How Can I Make One

#

webhook url

rain heart
#

read the docs

restive otter
#

I Have read them

#

But I Am Still confused

#

@rain heart pls help

rain heart
#

I can't really help

restive otter
#

really Sorry to disturb

#

@rain heart Please Help with just one thing

#

While constructing DBL Client

rain heart
#

I cannot help you with coding related things, i don't code in js

restive otter
#

I Code In py

#

Can you help with that ?

rain heart
#

nope

restive otter
#

Whats The Right one among these

#

dbl_client = dbl.DBLClient(client,dbl_token,dbl_webhook)

#

Or

rain heart
restive otter
#

dbl_client = dbl.DBLClient(bot : client,token : dbl_token,webhook_auth : dbl_webhook:

#

TYsm

sullen nymph
#

On to hoping that that's not how you will write your code

pale fulcrum
#

lol

smoky cedar
#

i cant invites botshttps://top.gg/invite

rain heart
#

known issue, be patient

fair sparrow
#

fuck

#

wrong channel

wintry pumice
#

how to do discordpy vote command

oblique fiber
#

how do you get the invite link, including its set permissions, from a bot's page

rain heart
#

the bot object contains the invite url

wild solar
#

anyone know how to fix npm WARN discordchat@1.0.0?

jaunty plank
wild solar
#

thx

unkempt lotus
#

q

marsh lintel
#

Hey, whats the best way to confirm someone voted for your server so they can be awarded?

rain heart
#

the easiest way is just using the API to check individual votes

the a bit harder, but more reliable way is to track votes yourself using webhooks. This would also make instant-rewards after voting possible.

upper hatch
#

hey, guys i have problem in api , i try token of my bot in local , and its stuck : when i put it in host is still stuck in 1 shard and server count

rain heart
#

posting your servercount isn't really possible atm, see #support pins

upper hatch
#

thanks i'll

tropic galleon
#

quick question for hasVoted

#

how is it determined

#

how long is the said vote valid for?

rain heart
#

12 hours

#

a full vote cycle

#

from the point on when a user voted

upper hatch
#

they take long time to respond ?? in mail ?

tropic galleon
#

strange indeed

rain heart
rain heart
#

I mean read the pinned messages of #support, not email support

upper hatch
#

😅 ma bad

#

thanks again

restive otter
#

Where i can get topgg vote api (link)

rain heart
restive otter
#

Thanks

restive otter
#

I didnt find what I was looking for

#

Is that from topgg?

#

no

restive otter
#

no

fading knoll
hushed reef
#

there's no way you actually are asking this

restive otter
#

Oh

echo vessel
#

hi

#

The number of votes is not going up on server pages/I am not getting my voted role for servers (votes are still being processed correctly however, will show all votes when fixed).

restive otter
echo vessel
#

but idk what i can use in support

restive otter
#

I just realized that you copy pasted that bit

echo vessel
#

yes but this is my porblem

gaunt geode
#

hi

restive otter
#

What version are you on? Try updating it

tropic galleon
#

could it be at all possible hasvoted returns true even after 12 hours since last vote?

loud jewel
#

How can i do this,

tropic galleon
#

webhooks are my biggest enemy

#

idk how to work with them either

loud jewel
#

Since i'd like to setup a voting channel

restive otter
#

what is a webhook auth?

#

I want to setup a voting channel too

rapid kettle
#

You set it yourself

restive otter
#

how

rapid kettle
#

on the website

restive otter
#

on what website?

rapid kettle
#

your servers edit page

restive otter
#

o k

rapid kettle
#

then your URL is where you’re sending the request to

tropic galleon
#

and the url i assume has to be a website i own too?

rapid kettle
#

no, it can just be an IP

tropic galleon
#

can it be an ip of the server the bot is hosted on?

rapid kettle
#

as long as it’s listening for a post request on that path

#

yes

tropic galleon
#

hmm ok, i'll work with that info, thank you

rapid kettle
#

say you’ve got a post request listener running on port 2345 and on /dblwebhook

restive otter
#

ok, I did the auth thing

rapid kettle
#

are you hosting a webserver anywhere?

restive otter
#

nope

rapid kettle
#

well you need to host a webserver

restive otter
#

h o w

rapid kettle
#

do you know any programming languages

restive otter
#

yea

#

javascript

#

and python

rapid kettle
#

ok cool

restive otter
#

but how do I host it

rapid kettle
#

you can use the @waxen widget-gg/sdk

#

on a server

#

you could use repl.it if you wanted to

restive otter
#

but how do I host it?????

rapid kettle
#

running your code on the server

restive otter
#

with node?

rapid kettle
#

yea

restive otter
#

can you send me the link to the docs?

rapid kettle
restive otter
#

ok

#

nop

#

it gives me error

#

when I paste into visual studio and run it

rapid kettle
#

wdym

restive otter
#

do I host it with node ?

rapid kettle
#

you run it with node

restive otter
tropic galleon
#

running it from the downloads folder is very concerning

restive otter
#

b r u h

#

I'll put it on my server later

rapid kettle
#

is \upload webhook a directory?

#

does it have an index.js file in it?

restive otter
#

wait

#

I forgot to do "npm init"

#

the webhook does not work tho

patent vector
gray hedge
#

how do u link the voting to the bot

restive otter
#

Hey there, i'd like to use node-fetch to get how many times a user has voted for my bot at top.gg. I know the link where to GET the information but i'm not sure how to get that information in my js code. Could someone help ?

restive otter
restive otter
#

How do i create a webhoot which send msg in a channel that who voted the bot

sullen nymph
#

Ah, hold on

#

You can't get specifically the number of times a user has voted for a bot

#

You have to track each vote via webhooks yourself

restive otter
#

node.js

sullen nymph
restive otter
#

O ok

restive otter
sullen nymph
#

Show please 👀

restive otter
sullen nymph
#

Well, that's only to check if a user voted for your bot in the past 12 hours

restive otter
#

oh oof

#
const client = Discord.Client()
const Topgg = require('@top-gg/sdk')
 const api = new Topgg.Api('Your top.gg token')

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

Is this correct?
sullen nymph
#

Try It And See
TIAS :)

restive otter
#

ok

#

Where can I get Api token?

sullen nymph
restive otter
#

ok

#

is there a api for the top.gg server list?

sullen nymph
#

Nope

restive otter
#

star it

smoky marten
#

What should I put here ?
Top.gg bot token or
Auth key ?

sullen nymph
#

Auth key

smoky marten
#

oh kay

warped mango
#

Hello, is there a way to fix this :
the user does a .vote cmd 2hrs after voting on top.gg, and he gets his rewards. The day after, he does the cmd only 10sec after voting on top.gg, but the bot says there is still a 2hrs cooldown

So basically the bot has its own vote cooldown, but how I get topgg's cooldown to replace it ?

#

found nothing on the api Sadgeplant

sullen nymph
#

There's no cooldown that top.gg provides really

#

If you're using webhooks, you need to track the timestamp of a vote and rely on that

warped mango
#

so I only have to get the snowflake of the last vote of the user ?

sullen nymph
#

Eh... snowflake? I mean, votes don't use snowflakes

#

Unless I'm confused here

warped mango
#

nvm my bad, got confused too lol

#

kk thx!

sullen nymph
#

You essentially get the "current" timestamp when someone votes, so you get the time and store that

#

Then you generally possibly want to utilize that by calculating the time when a command is executed and the time when the user voted

warped mango
#

yep I'll do that

sullen nymph
uncut lintel
#

What are voting credits for?

hushed reef
#

bro this is the api channel

uncut lintel
#

support is locked

#

._.

dire imp
#

So then to find out how many times a user has voted you iterate through the list and find the count of it.

hushed reef
#

it's locked for a reason

uncut lintel
rain heart
#

#general is another place to ask, this channel is for the top.gg api only

sullen nymph
dire imp
#

Yeah there's quite limitations

rain heart
#

I'd suggest using Webhooks from the start on than relying on the last 1000 votes

hot swift
#

Hi

#

How can I do that?

rain heart
#

also, you need to have your bot approved in order to use webhooks for bots

hot swift
#

I want the way.

#

@rain heart

rain heart
#

Read the docs i sent

soft sequoia
#

How can I do that?

rain heart
#

same thing

soft sequoia
#

My Bot Is Approved

rain heart
#

read it

brittle grove
rain heart
#

You can't when your bot isn't approved

bitter axle
#

HELLO

rain heart
#

hey can we do anything for you?

unkempt spruce
#

hmm

fickle zealot
#

understandable, have a nice day

barren kestrel
#

This is my code

#

But

#

I want to be able to check the mentioned use if they voted

#

how could I do that?

#

^my code doesnt work

rain heart
#

what doesn't work

#

error logs please

#

etc

#

also, hasVoted requires the User ID

#

not the member object

barren kestrel
#

Like it keeps checking if I the author of message voted

#

I want it to be like

#

n!votecheck
shows mine

n!votecheck 669452973755072524 (hope's id)

check if hope voted

rain heart
#

you are checking for the author id

barren kestrel
#

how can I check for an id that is in an arg?

rain heart
#

args[0] as you want the first argument

#

you're using args[1]

#

Collection places start from 0, not 1

barren kestrel
#

oh

#

this is my updated

#

EKE

#

ill do inna gist

#

how do I make it

rain heart
#

now you're literally defining args[0] as the author

barren kestrel
#

yes

#

ik

rain heart
#

which doesn't make sense

barren kestrel
#

how do I make it be an id

#

a user id

#

?

rain heart
#

Ask someone who can explain it better

barren kestrel
#

ok

restive otter
rain heart
#

Also it is giving the role by the looks of it

restive otter
#

1 week ago

#

but people are voting and its not giving now

restive otter
#

?

signal hawk
#

Its a known issue that has been going on for about a week yes

#

it should be fixed soon

onyx monolith
#

How do I transfer a listing to someone else?

rain heart
#

you can dm a mod to request your bot to be deleted in order for the new account to resubmit it

onyx monolith
#

I dont want it deleted and resubmitted, that way I have to wait more

rain heart
#

just dm any mod and they will explain it

onyx monolith
#

kk

steep sorrel
#

where can I get my token?

rain heart
#

on your bot page settings -> webhooks

hollow jackal
#

Does any one know why the Upvote Webhook isnt working ? I've configured exacly as the docs say to, but it doesnt work

rugged dock
#

Hi

tawdry needle
rapid kettle
#

Both of my webhooks work

#

bot and server

tawdry needle
rapid kettle
#

I don't do reward roles

#

but I could do them with a webhook

lyric bridge
#

How to do the server count and the votes

willow spindle
plucky lance
#

Easiest way is to POST the JSON string containing the server count every X time to the top.gg API @lyric bridge

#

One line of code if you’re using any lib to do HTTP requests for you like node-fetch for example etc.

solar grail
rain heart
#

Or just use any existing library

#

See the docs above

lyric bridge
#

But l use dbd.js yo code my bot

plucky lance
#

Well regarding your anwser you should use the library mentioned in the docs.

#

Or at least update your existing one to the latest one you can find in the docs.

ancient talon
#

...

plucky lance
ripe sandal
#

I’m trying to use the translator on here

restive otter
#

dontdont ban pls

rain heart
#

wrong channel, dm them if you want to ask how

#

again, wrong channel, move over to #general

summer osprey
#

What is the maximum amount of bots I can request from .getBots at once?

median trout
#

how would i know someone upvoted my bot?

pallid hinge
#

hey I know its off-topic but #support channel is locked so,
does my bot needs to be in english only to be approved on topgg? what if my bot doesn't support english at all , will it still be approved?

foggy kelp
summer osprey
sullen nymph
#

Manual sorting after fetching all bots

summer osprey
#

offset I didn't see it before

#

But thank you

sullen nymph
#

Well, yeah, you'll have to increment that by 500 after each request

#

and then sort the data

summer osprey
#

Yeah it's better than not having an option! Thank you for your help.

sullen nymph
gusty spruce
#

hi i'm trying to post my bot's server count to top.gg manually because dblpy doesn't work on python 3.9 but i keep getting a 403 forbidden error despite my api key being in the Authorization header

#

i regenerated it multiple times so i'm sure it's valid

#

how can i fix this

rain heart
#

Pretty sure it isn't valid then or your request is bad, test it using a Request client

sullen nymph
#

Endpoint

sullen nymph
rapid kettle
#

shiv

#

they’re doing it manually

sullen nymph
#

I need more sleep

gusty spruce
#

ok turns out im an idiot. i used my test bot's id instead of my actual bot's in the url which isn't on top.gg

#

lol

#

thanks anyway

gray hedge
#

like get the

median trout
#

e

spiral island
#

hi i need a bot that give roles when they vote

rain heart
#

this is the channel for help with the top.gg api

#

so wrong channel to ask in

spiral island
rain heart
unborn turret
#

uhh is there a way to get the time a user voted 😐

rain heart
#

you need to track that yourself using webhooks

unborn turret
#

rip alr

#

ty

tall trout
#
const json = fetch(`https://top.gg/api/bots/763506280421392456/voted?userID=${message.author.id}`, {
            headers: {
                "Authorization": token,
                "response": "voted"
            }
        })
        if(!json) {
            return message.channel.send('Not Voted')
        }
        if(json) {
            return message.channel.send('Voted')
        }

    }
}```
Logging Json returns: `Promise { <pending> }`
#

I'm looking to see if author has voted or not

rain heart
#

check the docs on what the returned data is

unborn turret
#

ok so like im using python and

#

to make a webhook do i have to create a flask app

hushed reef
#

Top.GG's webhooks are just an integration with their API service and you're offered endpoint access with the API wrapper you're using, in this case it would be Dblpy

#

However you choose to carry out running your code is separate

tropic galleon
#

is hasVoted returning correct values for you guys?

rain heart
#

hasVoted returns 1 when given user voted in the last 12 hours, 0 when not

tropic galleon
#

so i'm guessing my code must be ultimately wrong for it to return true when i havent voted

thorn surge
#

How to make bot will display server count in top.gg website

rain heart
thorn surge
#

I can't get

rain heart
#

Read it

thorn surge
#

Which

#

Topics

rain heart
#

library the one for your language

thorn surge
#

Ok

#

@rain heart

#

I want to do this?!

rain heart
#

yes

#

read the docs

thorn surge
#

Ok

stiff night
rain heart
#

Just contribute to the python library on github and you're good to go

restive otter
#

AttributeError: 'DBLClient' object has no attribute 'get_bot_votes' why it happens?

#

i did everything fine

rain heart
#

get_bot_votes doesn't exist i think, is it on the latest version?

restive otter
#

yea

#

yep

#

0.4.0 is latest version i think

restive otter
#

oh ok

cursive steppe
#
let data = await fetch(`https://top.gg/api/bots/${bot}/stats`, {
  method: "POST",
  body: {
    "server_count": 100
  },
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Token"
  }
}).then(r => r.json())```
It returns error ```js
Unexpected token o in JSON at position 1```
hushed reef
#

are you passing an actual token?

cursive steppe
#

Yes

hushed reef
#

and just to make sure this is the JS lib?

sullen nymph
#

It's just JS

cursive steppe
#

Yes

hushed reef
#

i see

#

oh this is how HTTP reqs are done in JS

sullen nymph
#

bot returns an ID, right?

hushed reef
#

yes

cursive steppe
#

Yea bot id

hushed reef
#

it's by default an integer that has to be converted to string in this case

#

but he does an f-string so it's fine

sullen nymph
#

console.log the response

cursive steppe
#

I did it does same error i sent above

hushed reef
#

i'm assuming body is the argument that JS uses for "JSON" ?

cursive steppe
hushed reef
#

try using a new token

#

because i'm dumbfounded

sullen nymph
#

I don't know JS well enough for this

#

It's not the token

#

It's a fucked up JSON sent to the server

hushed reef
#

i want to know what the error exception means with token o

#

is that a literal value or a passed failure?

cursive steppe
#

Well i fixed it myself

#
let json = {
  "server_count": 100
}

let body = JSON.stringify(json)```
#

JSON.stringify fixed it

sullen nymph
#

Ah yes, the cause of all issues

tropic galleon
#

try json parse or json stringify

#

or even both

odd carbon
#

hi

#

i wanna make a webhook

#

for my server

#

when someone vote

#

my bot listen

#

and give a special role

#

or other rewards

stiff night
jagged pine
odd carbon
#

Wel

#

Im diffrent

#

I cant even look

#

I use java

#

Not javascript

#

So this is useless for me

#

I only need the vote webhook for servers

#

I only find for bots

sullen nymph
#

You just host a webserver that follows the data format in pins

#

Similar principle with the bots webhook

odd carbon
#

But i want to know

#

How the request for servers look like

#

Its body and parameters and headers etc

sullen nymph
#

The data format is the request body in JSON

odd carbon
#

Ik

#

Like

#

user

#

Or user_id

#

Or id

#

Idk

sullen nymph
#

user

restive otter
#

You mean response structure?

odd carbon
#

Exactly

restive otter
#

That

odd carbon
#

Ok thx

sullen nymph
#

user and guild are snowflakes, meaning they're IDs in string

rain heart
sullen nymph
odd carbon
#

Im gonna make 1 server for all server lists and other api so i must know the structure so i detect which server list requested

sullen nymph
#

Rely on the guild key then

odd carbon
#

Yeah

#

Now look at other server lists

sullen nymph
#

Ah, those

#

Ya you'll have to rely on their documentations

rain heart
#

Just have different endpoints for each list

sullen nymph
#

out of this channel's scope

odd carbon
#

Yeah thx for helping

rain heart
#

Or query parameters like ?list=coolserversnet

sullen nymph
#

An array of endpoints 👀

odd carbon
#

Hope does your library do that 🤣

#

For servers

rapid kettle
#

You set it

rain heart
#

Haven't bothered implementing other server lists/bot lists

odd carbon
rain heart
#

Possibly yeah

odd carbon
#

Any library for receiving request and sending response like okhttp?

#

Okhttp is only a client

rain heart
#

You need one that starts a httpserver

odd carbon
#

Yes

rain heart
#

You could technically just rewrite the library and have it parse different json data

odd carbon
rain heart
#

Can be done with a simple httpserver

#

Read up docs on how to work with HTTPServer

odd carbon
hybrid shoal
#

How can i find TOP.GG bot token?

#

Site is fully changed

sullen nymph
hybrid shoal
#

Thank you

true bay
#

hi! i want to add an option in my bot that when someone votes, add some money in their economy, how can i do that?

hushed reef
#

look for the API wrapper of your programming language and code a conditional if statement check for when the user votes that you just add money into your DB or w/e.

true bay
#

how can i define 'vote' event?

torpid finch
wheat copper
neat wedge
#

Hey. Do you support plain http/direct IP requests back to webhooks?

rain heart
#

yes plain http or ip-based webhooks work

#

something like http://48.32.11.115:8000/webhook for example right

short leaf
#

hello i want to add voting obligation to my discord bot how can i do

rain heart
#

use webhooks

short leaf
#

❤️

#

How am I going to set here? Can you help me?

rain heart
#

with web requests or using a library pinned in this channel

short leaf
#

how to get dbl wephook url

#

How do I make my discord bot command voting obligation

hard hill
#

how can define vote event in discord.js i want to add money in economy when someone votes how i can do that?

rain heart
#

this channel is for the top.gg api only

restive otter
#

o sorry

restive otter
#

how do i get my dbl key

jaunty plank
#

pins

restive otter
#

wdym

jaunty plank
rain heart
#

read the pins

restive otter
#

ok

#

thank you so much

#

how do i set up the auth

#

Authorization

#

with the webhook

restive otter
jaunty plank
#

you make the auth code

restive otter
#

?

jaunty plank
#

its up to you

#

you could just smash on your keyboard and that could be it.

restive otter
#

i did but it wouldnt let me save it

restive otter
jaunty plank
#

probably related to the site issues in pins in #support

restive otter
#

ok let me look

rain heart
#

your bot needs to be approved first

#

to use webhooks

restive otter
#

ok

#

how do i do that

restive otter
rain heart
#

Just wait till it gets approved

restive otter
#

ok how long do you think that will take trying to hit a deadline

restive otter
rain heart
#

It takes a week or longer

#

it will take longer due to site issues

restive otter
#

omg

#

nooooo

night rivet
#

server webhooks aren't working

#

help

restive otter
#

ik

#

i dont know how to fix it

jaunty plank
restive otter
#

ok thank you

jaunty plank
restive otter
#

i hope it dosenot take a week tho

jaunty plank
#

the queue is over a week right now, my guess is 3+ weeks.

restive otter
#

omg i have a deadline

#

was getting piad

jaunty plank
#

test webhooks for servers dont work currently.

tropic galleon
#

kek

jaunty plank
#

its been 8+ weeks before

tropic galleon
#

yeah it might've been longer i dont actually know

#

the other dev posted the application for the bot

#

i just know a rough waiting time

restive otter
tropic galleon
#

you for real

#

lmao

restive otter
spare gyro
#

colors .js

scarlet cobalt
#

One message removed from a suspended account.

restive otter
restive otter
#

how to fix

#

Bruh 😂😂 what do you fix in this it is correct

sullen nymph
restive otter
#

use git repo

#

pip3 install git+https://github.com/top-gg/python-sdk/

midnight vapor
#

I have a problem with the java api

#

when i use it like in the github, i become thes error message:

Exception in thread "main" java.lang.NoClassDefFoundError: com/fatboyindustrial/gsonjavatime/OffsetDateTimeConverter
    at org.discordbots.api.client.impl.DiscordBotListAPIImpl.<init>(DiscordBotListAPIImpl.java:40)
    at org.discordbots.api.client.DiscordBotListAPI$Builder.build(DiscordBotListAPI.java:54)
    at de.eftron.listener.VoteListner.start(VoteListner.java:23)
    at de.eftron.main.Main.main(Main.java:230)
Caused by: java.lang.ClassNotFoundException: com.fatboyindustrial.gsonjavatime.OffsetDateTimeConverter
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 4 more
#

i cant fix it

restive otter
#

how i can get api??

night ingot
stiff night
midnight vapor
#

@stiff night

stiff night
short leaf
#

Do you know what are the background codes on the page of my bot on the top.gg site?

sullen nymph
short leaf
#

what ?

sullen nymph
green mantle
#

webhooks

blissful wolf
#

Cog

#

Web hooks

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

python btw

#

i used that to see who votes for my bot, and its not printing data

sullen nymph
#

Test requests emit on_dbl_test in dblpy v0.4.0

#

Make sure your port is open and you are specifying necessary webhook arguments

twilit saffron
#

how do i check what version i have?

sullen nymph
#

yeah pretty much if you didn't install it from GitHub, it's 0.4.0

twilit saffron
#

wait mine should work right.?

#

since its on 0.4.0

sullen nymph
#

Show the rest of your code

twilit saffron
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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

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

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.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))

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

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

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

@sullen nymph

sullen nymph
#

Use the on_dbl_test listener also for test requests

#

What did you enter on your bot's Edit page in webhook URL and Authorization?

cursive steppe
#

Is there no api to get data of servers from topgg?

#

I only see bots and users

jaunty plank
#

yeah, no api for servers

upbeat hare
#

Anyone know which module I can make so that if someone votes for my server on top.gg it executes some code?

rain heart
#

Read pins

upbeat hare
rain heart
#

This channel

sullen nymph
#

What's the library that you use?

upbeat hare
#

I know, but in this channel there are 4 pins

upbeat hare
sullen nymph
upbeat hare
rain heart
#

use a translator#

upbeat hare
#

The translators aren't good bro

rain heart
#

Better than not being able to understand english at all

upbeat hare
#

Okay, I translate but, it's for the servers ?

#

Because, on YouTube, it's only video for BOT but I want for SERVER

rain heart
#

servers doesn't have a api