#topgg-api

1 messages · Page 11 of 1

slim falcon
#

for node.js

rain heart
slim falcon
#

huh. i didnt find this on the page before

#

thanks a lot and sorry abt that lol

spark stone
#

Hello. I have a simple question. I want to create a helper bot for another pre-existing bot. This helper bot would add features to the pre-existing bot. One such feature would be a vote reminder.

The pre-existing bot allows users to vote for the bot in Top.gg to gain certain benefits in-game.

I want to know if it is possible to check whether or not a user has voted for that pre-existing bot without me owning that bot.

Thank you.

rain heart
#

You can't interact with the API before getting approval, so nope

spark stone
#

If I have my own authentication token, can I use it to see others' bots' votes?

rain heart
#

Oh yeah that's fine

#

Yeah

spark stone
#

Oh

#

Thanks

#

I didn't wanna waste days waiting for an approval to be told it's useless

spark stone
# rain heart Oh yeah that's fine

Is there a way to get an authentication token without registering my bot to Top.gg? I'm developing it, and kinda need to keep doing so before the "main feature" is actually available. As it stands, I can basically guarantee it won't pass review.

rain heart
#

Not possible no

spark stone
#

ah damn

#

I'm at a standstill I guess

#

I need the token to see if the feature works, but I need the feature to work before I get the token

broken stirrup
#

I have exactly the same problem!

#

I might also use the pre release version, but at the moment I tried to make the HTTP POST request myself

#

If I make a HTTP GET request on my BOTs stats, then there i find the new server count

#

But the BOT page of topgg still shows the old number

#

Is there some time delay of the BOT overview page refreshing the server count from the API stats?

#

Okay the pre-release version in fact fixes the dependency problem, but I am having other difficulties using it. But the BOT ovewview page shows my new bot count now. So i think i will stick to my own solution of POST request using the request package 😄

sullen stream
#

hey i was implementing the vote listener using webhook

#

i deployed the code in aws lambda functions

#

when im using the test event the wbhook is sending the data of vote

#

but when i use real vote it doen't send any request to my webhook

#

could someone answer this

#

@chrome pier

chrome pier
#

please do not ping staff members whenever someone see your message they will reply to it

unreal skiff
half fjord
#

Hello

rain heart
#

You can use it, but won't receive support for it here

hollow willow
#

im trying to use the python library and it keeps saying the port is already in use but its definitely not

#

future: <Task finished name='Task-2' coro=<WebhookManager._run() done, defined at /home/ubuntu/.local/lib/python3.8/site-packages/topgg/webhook.py:144> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 4898): address already in use")>
but lsof -i :4898 says nothing

jaunty plank
jaunty plank
#

Is it possible its being run multiple times?

hollow willow
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(4898)```
jaunty plank
#

If you change the port do you get the same error?

hollow willow
#

yeah i've tried like 5 different ports

#

all of them having nothing else using them

misty valve
#

is the token of the bot the api of the bot?

rain heart
#

The API of the what

#

No it's not

#

Check the pins

misty valve
#

the api of my bot?

rain heart
#

what is your goal

#

i dont understand you

stable marlin
rain heart
#

If they mean the bot token from Discord for your discord bot is the API Token for a bot listed on Top.gg

#

then no it is not

opal solar
#

Quick question, how big is the import for the api approximately?

jaunty plank
opal solar
#

the python libary

jaunty plank
#

15kb~

opal solar
#

oh, well ^^

#

I mean when I run pip install topggpy

jaunty plank
opal solar
#

ah okay. Btw. I'm using discord4py which is similar to discord.py BUT when I run pip install topggpy, I think it also installs discord.py. Right?

jaunty plank
#

Theres a pre-release linked up here which doesnt depend on discord.py iirc

opal solar
#

:/ sad. But okay

lyric solstice
jaunty plank
lyric solstice
#

also on the webhook documentation it don't work

#

@jaunty plank

icy aurora
hazy ginkgo
hollow willow
hazy ginkgo
#

Wtf the intellisense of the topgg js lib

#

Can someone tell me ?

#

It was working on my bot, but it doesn't work on my webserver

hazy ginkgo
#

Nevermind, I'm using now an unofficial api

scarlet cobalt
hazy ginkgo
#

I know

#

It's the one in the pinned messages

#

It's way more easy to use

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hazy ginkgo
#

now

#

I gave up on the topgg-sdk

#

Because it wasn't doing the quest

#

request*

#

Couldn't handle the auth verification

scarlet cobalt
#

One message removed from a suspended account.

hazy ginkgo
#

Thx you

round tapir
#

Is there a way to check whether or not User 1234 has voted for Bot 1534, if I don't own Bot 1534?

#

I have an authentication token for my own bot, just wondering if there's any possible way to get info about another's votes

round tapir
#
const axios = require('axios');

const botId = '1534';
const userId = '1234';
const authorizationToken = 'aXeZ3jyD3d437.TOKEN_HIDDEN';

const headers = {
    'Authorization': authorizationToken
};

const url = `https://top.gg/api/bots/${botId}/check?userId=${userId}`;

axios.get(url, {
        headers
    })
    .then(response => {
        const voted = response.data.voted;

        if (voted === 1) {
            console.log('The user has voted for the bot!');
        } else {
            console.log('The user has not voted for the bot.');
        }
    })
    .catch(error => {
        console.error('Error:', error.message);
    });
scarlet cobalt
#

One message removed from a suspended account.

tidal idol
#

and tbh i am not sure of any use case that should allow that

jaunty plank
#

only the token for the bot can get that information.
I dont think we want bot owners to give that out.

round tapir
#

Many bots don't give confirmation of votage

#

Suggestion: Maybe creating a secondary, or tertiary authentication token with limits to what data it can access would help support the creation of helper bots, further enriching the development community.

jaunty plank
# round tapir Many bots don't give confirmation of votage

You wouldn't want to get votes from the api for that.
Rather use webhooks to send a message when a vote is received.
Reminders would also have to be based off when the vote is received(12 hours after receiving the vote webhook).

Several services already do that, which the bot owner can paste a webhook link onto top.gg created by the service.

#

For example, my site webhook-topgg
A bot developer or server owner can create a discord webhook.
My service then uses that discord webhook to create a URL to webhook-topgg. that url when posted to from top.gg will send a message with the discord webhook.

Any bot could do the same without access to the bots main token. It just will require the bot owner to agree to it, and to use a webhook url your service creates for them.

jaunty plank
wild linden
deft hollow
#

Anyone can help me in this error ?

main karma
runic ginkgo
#

I post to https://top.gg/api/bots/1052574339662348328/stats with the token from the website frechly generated and copy pasted but get 401 why could that be?

rain heart
#

generate, refresh the page, then copy that token

runic ginkgo
#

thats what I meant with generated

rain heart
#

and also with the reloading?

runic ginkgo
#

yep

rain heart
#

are you providing the content type json too?

#

application/json

runic ginkgo
#
        axios(`https://top.gg/api/bots/1052574339662348328/stats`, {
            data: JSON.stringify({
                server_count: guildsCount,
            }),
            method: "POST",
            headers: {
                Authorization: 'yes',
                "Content-Type": "application/json"
            }
        })

thats the exact code I use at my other bots too but this one gets 401

rain heart
#

then the token you're using is invalid

#

try regenerating it, then refreshing the page, then copy pasting the one you see

#

then see if it works

runic ginkgo
#

I already did it the same time when posting the snippet here

#

how often do I need to do it again Cry

rain heart
#

cant help then

runic ginkgo
#

I even did it with fetch inside of the browser on the top.gg page and it drops 401

#

wow it was bcs of the token

#

I spammed generate now

#

10 times

#

now the token works

runic ginkgo
icy aurora
runic ginkgo
#

hell nah

icy aurora
#

it’s help fb

runic ginkgo
#

I wont use a package for 1 post request

icy aurora
#

it actually does 2 posts shard count, server count

dire escarp
#

Topgg not sending webhook request (fixed)

hearty lintel
woven coral
#

imagine still using third party HTTP libraries in 2023 tbh

fresh oriole
#

modern node has bulit-in fetch shruganimated

woven coral
#

this

#

those libraries should've died

spiral spindle
#

You can use webhooks

I recommend this tutorial if you don't know where to start
https://youtu.be/RU-urn3bK84

In this video, we make a Top.gg server webhook that sends a message to a channel whenever someone votes for your server! To do this, we use an unofficial Top.gg tool, webhook-topgg, that helps integrate Top.gg webhooks with Discord webhooks.

Sorry for all the weird white noise! I'm not completely sure why they appeared, as they weren't there ...

▶ Play video
spiral spindle
#

ah ok, what you can do is you can set up a listener that actively checks the channel where the webhook sends the votes (names of people who voted)

and everytime theres a new user, grab the data, and then go from there (give reward to user with [id])

are you coding in python or js?

jaunty plank
jolly night
#

hi guyd

rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

foggy jackal
#

or it counts all votes

main karma
#

Just checking if user has voted

restive otter
main karma
#

Yeah i think so

restive otter
main karma
#

You are welcome

restive otter
#

-api

scarlet cobalt
#

One message removed from a suspended account.

tidal idol
#

☠️

rain heart
#

Xiub

spiral spindle
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

teal mesa
#

hello i need help with api so i wanna setup topgg api if someone vote for bot

#

but idk where to start

rain heart
teal mesa
rain heart
#

that returns 1 or 0 depending on if the user has voted in the last 12 hours or not

teal mesa
#

ah i see

worldly junco
#

Hi

rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

worldly junco
teal mesa
rain heart
teal mesa
#

ah i see

#

what are /dblwebhook and password>?

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
rain heart
#

/dblwebhook is the path of the webserver and password the Authorization header

#

so for example http://website.com/dblwebhook

teal mesa
#

ah i see

tidal idol
#

@untold sparrow

untold sparrow
paper elk
#

I am trying to use the webhooks to send vote events to my website to handle user rewards for voting etc. But I cannot get it to work, what does the auth send as, in testing my endpoint I cannot figure out what auth type to send the key as.

rain heart
#

As the Authorization header has the docs state too

#

Just as a normal string, no bearer, no nothing

misty valve
#

how to get api of my bot on top.gg?

rain heart
#

What do you mean with "get API"

olive turtle
olive turtle
#

Can some1 help me?

olive turtle
#

Ping?

rain heart
#

I can give you some info to get more info in return

  • provide more details
  • explain what you're doing and what your approach was

Your messages don't help at all

olive turtle
fresh oriole
#
  • Do you have a web server in your bot's process yet?
  • Expose the port on docker
  • Configure your firewall to port forward that port to the internet
  • If you want to use a domain, point an A record to that public IP in your domain's DNS settings
  • Enter the URL (e.g. http://1.1.1.1:3000/api/vote) on top.gg
bleak sphinx
#

Hi, I was trying to post a review about a server
But when I clicked on "Post review" nothing happened
So can somebody help me with it?

Sorry I don't know if it's the correct channel for my query

fresh oriole
bleak sphinx
#

Oh okay thanks a bunch!

austere ore
#

hello

#

how can i change page of my bot

#

what more thing's that i can use

#

to make it more attractive

#

?

fresh oriole
austere ore
#

okay

#

thank you :)

normal tendon
#

-api

#

Is this correct?

#

the key is the webhook key like the docs said

rain heart
#

webhook key?

#

No you need your api token

#

check the pins

normal tendon
#

i know this is a very weird question...but is there a way that you can "unvote" me?

#

i need to check if my interval check works

rain heart
#

no

#

just use the test vote button on your webhook settings in your bot page

normal tendon
rain heart
#

??

#

also what you're using is not a webhook

#

thats you interacting with the api

normal tendon
normal tendon
#

nvm problem solved

rain heart
#

keep in mind that what you're doing with the setInterval there, could hit ratelimits

#

just warning you beforehand

normal tendon
#

its every 5 sec

#

and my bot is not very popular

rain heart
#

still

#

can easily hit ratelimits

normal tendon
hollow willow
#

it keeps saying that the port is already in use when i try use the pytohn library
i made an entirely new bot and tried to use it and it worked, but putting it in my normal bot in exactly the same way doesnt work
im not hosting anything else on the same port and its only being ran once so idk why it doesnt work on my normal bot?

normal sierra
#

one of my users are complaining that they arent able to access the voting perks of my bot

they claimed that they voted roughly 15 minutes ago, which the last vote recorded by my bot was done around 46 minutes ago

user id: 703573067707842590
bot page: https://top.gg/bot/886196406761693204/vote
vote api endpoint: https://top.gg/api/bots/886196406761693204/check?userId=703573067707842590 (responds with 0 i.e. false)

Top.gg

Spice up your Discord experience with our diverse range of Discord Bots and Servers as well as other spaces to discover DAOs.

signal hawk
dim pollen
#

how do i make system like when someone votes my bot on top.gg and if that user is in my support server then the user will get voter role for 12 hrs

#

i am using javascript

proper roost
#

the guilds counter in top.gg still doesn't work for me inside the python code
I saw some codes on the web but they are for java

rain heart
#

You need an approved bot on top.gg to obtain an API token

#

I don't see any approved bots from you

teal mesa
#
# This example uses topggpy's webhook system.
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")

# The port must be a number between 1024 and 49151.
#

what is that /dblwebhook

#

another webhoookk?

rain heart
#

That's the path the Webserver will serve the webhook

simple zephyr
#

i don t recieve any console log when test voting ```const webhook = new Topgg.Webhook('my auth');

app.use(express.json());

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
try {
const ui = req.vote.user;
console.log(ui);
res.sendStatus(200);
} catch (error) {
console.error(error);
res.sendStatus(500);
}
});

app.listen(8000, () => {
console.log('Server listening on Port 8000');
});
or thisconst wh = new Webhook('my auth
')
app.post("/webhook", wh.listener((vote) => {
console.log(vote.user); // => 395526710101278721
}));```

jaunty plank
simple zephyr
#

yes

#

it sends the vote message in guild when vote tested but the code dosen t register the actual vote

pale vigil
#

I need something to test

fresh oriole
#

No

#

But you can use a tool like ngrok

jaunty plank
pale vigil
#

it works perfectly now

elfin marlin
#

Hey, I currently have something along the lines of


this.app.post(
            '<someURL>',
            webhook.listener(async (vote) => {
                await this.handleVote(vote)
            })
        )

This works just fine webhook is Ofc a new Webhook with an authentication string. How would I go about making this dynamic rather then hard coded? For example getting a guild Id, and if the auth string matches what I have saved in a db

rain heart
#

just use the query string

#

check the docs

elfin marlin
#

Do you mind dropping a link?

rain heart
simple zephyr
elfin marlin
elfin marlin
pale vigil
pale vigil
elfin marlin
#

I want the authorisation string lol

rain heart
#

But what do you want to do with the authorization string

elfin marlin
#

idc about revealing it but i did

rain heart
#

You can make your life more easier using queries

elfin marlin
#

Is that intended?

rain heart
#

????

#

Tell me what your goal is again

elfin marlin
rain heart
#

For what reason though

elfin marlin
#

So I’d need to check if the auth string matches the guild id which’ll all be in my db

rain heart
#

Then that won't be possible with the Library

elfin marlin
#

It’s in the headers, the listener has 3 params right? vote, request, response. I just used the request.headers

#

Oh no, since you need to put the auth into the thingy

#

Ah that’s fine I’ll just try code my own lol

hollow osprey
#

Someone teach me how to make a custom widget for my bot please?

rain heart
#

Widget? What do you mean

hollow osprey
bold vault
#

How can I vote without getting banned of the page

#

?

hollow osprey
rain heart
pale vigil
#

💀

#

May I ask, why do I have to post bot stats?

fresh oriole
#

You don't have to

hollow willow
#
  File "bot.py", line 42, in <module>
    bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
TypeError: __init__() takes 1 positional argument but 2 were given``` i cant find any docs for v2.0.0a that work
restive otter
#

Is this service made with python?

hollow osprey
runic creek
#

Depends on what are you even trying to do

#

You can't set up webhook in bdscript, that's for sure

hollow osprey
vivid terrace
#

Wait I can just update the server count to anything? 🤔

runic creek
#

Yes, you can

#

But if you gonna put something that's not true

#

You can guess what's gonna happen

vivid terrace
#

Yeah I won't obviously

#

But still kinda weird

#

Is there no way you can figure out from discord in how many servers a bot is?

runic creek
#

Without breaking ToS? No

vivid terrace
#

Sad

#

I think i updated it, does it take a while to take effect?

vivid terrace
#

I mean, I know that

#

I meant, for top.gg in order to update the listings instead of having users do it manually and check for abuse

#

But if they could, they probably would so

#

sadge

#

Ok it updated, just took a awhile

#

I will probably just update it automatically in my bot once every day or something

scarlet cobalt
#

One message removed from a suspended account.

vivid terrace
#

Yeah it doesn't need to be like 100% accurate, already pretty cool it is possible at all

#
  • only in 40 servers now
copper lichen
#

How do I get my bot's api key?

copper lichen
rain heart
#

check the pinned messages for the api token

pale vigil
#

TopGGAPIError: 504 Gateway Timeout

#

what's happened

midnight maple
#

Hello,

I have a question about the webhooks.
I have hosted my bot on my own home-server, an I want to add rewards for voting but i don't know how to send a webhook to my home-server.
I have already read everything but I didn't find anything.
Can someone help me?

last mauve
#

Hello

pale vigil
#

you can't use localhost for that

midnight maple
#

Ok

pale vigil
#

What's the recommended time interval of refreshing bot stats?

#

also I get this issues

TopGGAPIError: 504 Gateway Timeout
    at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:61:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Api.postStats (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:86:9) {
  response: {
    statusCode: 504,
    headers: {
      date: 'Wed, 23 Aug 2023 20:09:22 GMT',
      'content-type': 'text/html',
      'content-length': '167',
      connection: 'keep-alive',
      'set-cookie': [Array],
      'cache-control': 'private',
      'cf-cache-status': 'DYNAMIC',
      'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
      'x-content-type-options': 'nosniff',
      server: 'cloudflare',
      'cf-ray': '7fb5fcb3bebe4237-EWR',
      'alt-svc': 'h3=":443"; ma=86400'
    },
    trailers: {},
    opaque: null,
    body: BodyReadable {
      _readableState: [ReadableState],
      _read: [Function: bound resume],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      [Symbol(kCapture)]: false,
      [Symbol(abort)]: [Function (anonymous)],
      [Symbol(kConsume)]: [Object],
      [Symbol(kBody)]: null,
      [Symbol(kContentType)]: 'text/html',
      [Symbol(kReading)]: false
    },
    context: undefined
  }
}

what's the reason

#

also on "error" event, is there any way to manually post bot stats

icy aurora
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

icy aurora
scarlet cobalt
jaunty plank
scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

jaunty plank
#

Yeah that's fine

pale vigil
#

because I refresh every 10 minutes ig

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

pale vigil
#

that will ensure that autoposter will only work when a server adds the bot or removes it

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

autumn valley
woven coral
#

make the library do the automatic perodic posting themselves, and just make the developer feed the new data to the autoposter object so it can be automatically posted later

#

boom no more ratelimits

pale vigil
pale vigil
pale vigil
#

so if you execute the autoposter there it will update values only when your bot join/leave a server

#

which means bot stats will be more live (synced with actual stats)

woven coral
#

but if your bot frequently gets invited to servers, you will hit a ratelimit

#

server stats being more synced in Top.gg doesn't matter

#

since you can at least update every 15 to 30 minutes without ratelimiting

pale vigil
#

lol my bot gets 1 invite per year

#

anyway that makes sense

pale vigil
autumn valley
#

why he said to use it?

pale vigil
#

also you can't install it using npm

#

because it's private, requires authentication

#

so just use @wild lantern/sdk it's easy af

woven coral
pale vigil
#

idk what do they call it but it's like I want to make everything seems perfect for me

woven coral
#

so you have to have your bot ratelimited to be perfect

#

remember if your bot gets ratelimited it cant post to the Top.gg API for a long time

autumn valley
woven coral
#

which wouldn't be "perfect", but you do you ig

pale vigil
autumn valley
#

ah so i just have to make my own reminder system

pale vigil
#

yep, I just made mine

#

catch last voted timestamp and send a message after 12h of that

autumn valley
#

oh so u using db?

pale vigil
#

yes

autumn valley
#

how u checking the user time? like how u doing it?

#

like u using some kind of package to get timerout?

pale vigil
autumn valley
#

like are u using Node Schedule to do it?

pale vigil
#

use whatever you want

autumn valley
pale vigil
#

you can use setInterval(myReminder, 12 * 60 * 60 * 1000);
or use something like node-cron

autumn valley
#

ye?

pale vigil
#
cron.schedule('0 */12 * * *', () => {
  reminder();
});
pale vigil
#

calculate the difference between lastvoted and now timestamp

autumn valley
#

umm u saying it will work even u restart the bot?

pale vigil
#

if you do something like this, yes

function remind(lastVoted) {
  const twelveHours = 12 * 60 * 60 * 1000; // Convert 12 hours to milliseconds

  const currentTime = Date.now();
  const timeSinceLastVote = currentTime - lastVoted;

  if (timeSinceLastVote >= twelveHours) {
    // It has been at least 12 hours since the last vote
    // Your code for the reminder action here
    console.log("Reminder: It's time to vote again!");
  } else {
    const remainingTime = twelveHours - timeSinceLastVote;
    setTimeout(remind, remainingTime, lastVoted);
  }
}
autumn valley
#

i want a vote reminder for each voter

pale vigil
#

store them in a db so you don't lose the data after restarts

#

and do your thing

autumn valley
#

ok will try

scarlet cobalt
#

One message removed from a suspended account.

woven coral
#

then let them do their thing

scarlet cobalt
#

One message removed from a suspended account.

dapper copper
#

api down?

restive otter
#

¯_(ツ)_/¯

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dapper copper
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hearty lintel
scarlet cobalt
restive otter
#

xD

pale vigil
#

guys, does top.gg api give bot reviews values too?

rain heart
#

no

#

there had been suggestions for it before, but due to the nature of how we don't allow incentivising reviews, that suggestion was probably scrapped

pale vigil
#

ah alright

#

I tried to use that in my landing page but nvm lol, I'll make a command for reviews or something else
*planned

cold tapir
#

Guys how can do/learn vote checker system on my bot?

pale vigil
#

read docs

ruby shore
#

Why am i getting this error?

Uncaught AxiosError AxiosError
at processPromiseRejections (internal/process/promises:288:13)
at processTicksAndRejections (internal/process/task_queues:96:32)

rain heart
#

That error doesn't help much, provide the full error

ruby shore
tidal idol
#

you aren't providing auth

ruby shore
#

ohh, sorry

#

I thought i got it right this time but it gave me this error again

rain heart
#

Ensure you're setting the content type to json

ruby shore
#

ty

tidal idol
#

lol

heavy holly
#

You don’t need your bot to be approved to be granted a topgg api right?

ruby shore
#

When a user votes for my bot, how can i access that user's username and print it to the console (like '... user voted')?

#

I didn't understand where i underlined, where do i need to enter the webhook url, is it enough this way?

#

or where do we need to enter auth?

quiet nova
#

im trying to use the api in discord.py but im only getting errors can someone help me?

jaunty plank
ruby shore
#

How can i determine if a user has voted or not?

icy aurora
ruby shore
#

What should i use for this?

icy aurora
ruby shore
#

/bots/:botid/check?userId=1234 is there something similar to this that does what i said?

icy aurora
ruby shore
#

Is this a misuse?

icy aurora
ruby shore
#

sorry for ping

#

Work ty

icy aurora
#

it’s fine

#

You’re welcome

ruby shore
#

Ty :)

#

How can i find out my IP address and PORT address? I think i need it for the following part 🥹

icy aurora
ruby shore
icy aurora
rain heart
#

Not possible, has to be tracked yourself

last apex
#

Server count is 0

scarlet cobalt
#

One message removed from a suspended account.

last apex
#

As ?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

last apex
#

Ok thanks

#

JavaScript

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

wooden cave
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

wooden cave
#

thankyou

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hearty lintel
#

what bro

jolly hornet
#

what thing

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hearty lintel
#

i just don’t think it matters

#

people using dotnet and java will know how to look at the implementation in code

#
  • the fact that they’re strictly typed
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

heavy roost
#

is there a .net core library?

#

The only one referenced in the api docs and on nuget is for the dotnet framework which isnt compatible with linux and my bots host is linux so I have to use dotnet core

quaint zinc
#

Does the api tell how much time remaining for a user to vote again?

tidal idol
#

nope

#

you should use a webhook for that, store in a databse when a user has last voted and then use that to work out when they can vote again

quaint zinc
#

Hmm

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

void drum
#

Hello, I'm making a bot in discord.py and am trying to setup a way for users to get rewarded for voting. However, I'm not familiar with any of this webhook stuff and have searched everywhere for a source on what to do to set this up. Really just looking for a proper example on how to do this. I've checked through the entire documentation and still am not sure how to go about this

rain heart
void drum
#

Thank you! I have another question. I want to include the top.gg bot's widget as an image in an embed, but for whatever reason when I use the widget's img src url, it doesn't show in the embed. It's the link that's formatted like https://top.gg/api/widget/application_id_here.svg Is there a special way of getting this image to show in an embed? Simply passing it as the image url does not work.

rain heart
#

It's an SVG, which is not an image

#

Not an image supported by discord*

#

And embedding it in a command wont work either, as it would never update due to caching

void drum
buoyant quarry
#

So how could I make my bot send me a message when I vote?

distant epoch
#

When top.gg dont get a response from vote webhook, how many times it does the retry and whats the interval?

rain heart
#

It's listed on the docs

#

Check the retrial section

blazing iris
rain heart
#

Pinned messages

#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

restive otter
#

-help

abstract mothBOT
#
Bot Commands

Commands for Your Role:
avatar
botinfo
help
ping
roleinfo
serverinfo
userinfo

winged shard
#

but docs say thats the endpoint

#

404

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

tidal idol
#

wish people read the docs KEKW

untold sparrow
winged shard
#

I did, they dont provide any info

#

it says unauthorized, but the docs didnt say i need or where to get a key

untold sparrow
winged shard
untold sparrow
winged shard
tidal idol
#

search API has been non functional for a while

winged shard
tidal idol
#

tbh idk what a good use of it is

#

and i doubt its a priority to fix

tidal idol
proper roost
#

oohh, sorry

winged shard
ruby shore
#

how do i know if a bot is approved on top.gg?
(I will do it through the bot)

rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

ruby shore
# rain heart -api

'"certifiedBot": false' this part shows if you are certified on discord or top gg?

rain heart
#

that is deprecated

#

that is referring to a feature that was previously a thing on top.gg

neat herald
#

Hello, I wrote a code to send a message to the channel when they voted for my bot, but I couldn't get the top.gg api, how can I get it? can you help me?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

woven coral
#

@scarlet cobalt

scarlet cobalt
#

One message removed from a suspended account.

woven coral
scarlet cobalt
#

One message removed from a suspended account.

woven coral
#

nice

scarlet cobalt
#

One message removed from a suspended account.

woven coral
scarlet cobalt
#

One message removed from a suspended account.

uneven hatch
#

I dont understand. I want to Use the API just for rewarding users with (server) money, but the approval process kind of expects my bot to be meant for public use. my bot is custom and not meant for other servers. Is there a way this will still get approved?
when whoever reviews it invites it to their server, its not going to function properly because many commands are channel specific

rain heart
#

you dont need to add a bot for it

#

servers doesn't have an api like bots do

#

only webhooks

uneven hatch
#

yeah but i have to get a token in order to acces api, yes?

rain heart
#

yes

#

as the api you're talking about isn't supported for servers

#

if you're planning on using votes for your server, consider using webhooks

uneven hatch
#

im just trying to make a "on vote" event that gives people server money when they vote for my server. do I need api acces for that

rain heart
#

you can do that with server webhooks

uneven hatch
#

ok

storm moat
#

why it dosent work?

rain heart
#

because it does not support discord webhooks

#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

restive otter
#

hi how can i use the api for guilds
the doc only talks about bots

solid imp
restive otter
#

servers

solid imp
#

the api can be used to retrieve/post info only related to bots

restive otter
#

ok

#

why

#

is there any other way to see if someone voted for my server?

solid imp
#

the return value 1 indicates true if the user voted and 0 if not

restive otter
#

but it's for bots too

solid imp
#

oh wait, server, no

#

you can't use that endpoint for servers

#

you can setup webhooks for servers however

restive otter
#

ok i'll try that

#

doesn't do anything when i press send test

#

or am i supposed to only put the token of the webhook?

#

oh it's not a discord webhook 💀

restive otter
#

ok it's the stupidest thing ever but it works

opal parcel
#

yo

#

i am getting Error: 401 Unauthorized

#

do someone know why?

restive otter
#

because your unauthorized

opal parcel
#

it was working a min ago

#

this is why its weird

restive otter
#

idk try regenerating your api key

opal parcel
#

alr did

#

idk

restive otter
#

well send code

opal parcel
#

its from the modules the bot cannot start just an error from that

#

idk

#

let me check something

restive otter
#

what

opal parcel
restive otter
#

thats not code

opal parcel
#

that only have is

const DBL = require("dblapi.js");

const dbl = new DBL(DBL_TOKEN, { webhookPort: 5000, webhookAuth: '' }, client);
#

with the webhookAuth

restive otter
#

dblapi.js is deprecated why are you using it

#

hasn't been updated in 3 years

opal parcel
#

what r u using?

#

idk its working in my other bot

restive otter
opal parcel
#

still

#

TopGGAPIError: 401 Unauthorized (You need a token for this endpoint)

#

i tried to use the token of other bot

#

and its working

#

but the the bot that this need to be on its saying this

#

idk

#

weird

restive otter
#

send updated code

opal parcel
# restive otter https://docs.top.gg/libraries/javascript/

almost if not the same from here

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

const app = express()

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

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  console.log(vote.user) // 395526710101278721 < user who voted\

  // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))



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

const ap = AutoPoster('Token', client)

ap.on('posted', () => {
  console.log('Posted stats to Top.gg!')
})
app.listen(5000)
restive otter
opal parcel
#

yes i am

#

its not working with the bot that i am working on

restive otter
#

hm not sure then

opal parcel
#

with the other token bot is working just fine

restive otter
#

try regenerating and make sure your copying the entire token

opal parcel
#

did it like 4 times

#

ctrl + a to copy all and then ctrl + v

#

still that same

#

idk

restive otter
opal parcel
#

in the pc i am trying the code, no

restive otter
#

well you probably need to login before running the code with your client

opal parcel
#

but the other bot working, how

#

idk

restive otter
#

well in this code your not logged in

opal parcel
#

same code

#

diff token

restive otter
#

🤷

opal parcel
#

yeah idk

opal parcel
#

have a nice day/night!

restive otter
#

just ping me if you get any errors in 'js'

abstract mothBOT
#

pong

pale vigil
#

guys I need a quick help

#

I want to do a manual POST request to my webhook, what kind of Authorisation should I use

rigid bridge
#

There is a way to use the API to see how many times a member has voted?

#

I don't speak English, someone speak English??

quaint zinc
restive otter
#

u would need to do the above

#

track it yourself

#

via webhooks

hushed meadow
#

I vote once, but it comes to me with more than one vote

restive otter
hushed meadow
#

<@&817055174613794826>

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

abstract mothBOT
#

pong

wispy field
#

I am trying to do similar .. vote reward using botghost webhook in top.gg and custom event.
did you get anywhere. The Botghost response seems to be one solid piece.

rain heart
wicked shadow
#

Hey, can I change the description of the bot using the api?

tidal idol
#

nope

wicked shadow
#

Too bad :/ is it planned? because it is cumbersome to change the description on several platforms manually during updates

restive otter
#

Anyone know how we can edit webhooks

wispy field
#

I see the api has a use for voting for a bot, but is it possible to use the api to get a user var etc when someone votes for a server?

wispy field
#

so how do we authorise?

#

or do i use the webhook to vote .. and then the user id api ?

#

trying to create a vote reward system for my server when users vote on my botghost bot.

inner sage
wispy field
inner sage
#

So what is your issue?'

wispy field
#

if you have something working would you mind dm'ing me a share code?

wispy field
#

There is no server api .. sooo.

#

is it possible to get the user id when the webhook is used?

inner sage
#

Uh you should ask help in botghost support I am not smart enough 😅

wispy field
ruby shore
#

Why does it give this error every time a my bot runs and every time a command runs?

rain heart
#

currently issues

#

try again later

icy aurora
ruby shore
#

oh okey

unkempt path
#

is top gg api working?

scarlet cobalt
#

One message removed from a suspended account.

hushed meadow
scarlet cobalt
hushed meadow
unkempt path
#

Api still isnt working?

#

Cuz it isn't working 4 me

scarlet cobalt
#

One message removed from a suspended account.

unkempt path
scarlet cobalt
#

One message removed from a suspended account.

random plank
#

I have a question is it possible to see which user has voted the bot how many times ?
like without storing in database

runic creek
#

No

#

You have to do it yourself using the database, there is no other option

cerulean tide
#

$invite

#

-invite

reef axle
#

i have a error using topggpy could someone help me?

solid imp
tidal plover
#

topggpy wasnt updated in like 2 years you better off doing api calls yourself

scarlet cobalt
#

One message removed from a suspended account.

rain heart
#

No need for changes either atm

#

Unless something in the API changes

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

fresh oriole
#

has top.gg gotten new features within the past month

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tidal idol
autumn valley
#

Why my bot getting dup votes? Like every some sec It shows that same person have voted?

autumn valley
#

Rip isnt anyone here to help? I want it to be fixed urgently. People are waiting to vote :/

pale vigil
#

I want to do a manual POST request to my webhook, what kind of Authorisation should I use

jaunty plank
jaunty plank
#

Yeah

flint bough
#

Does the api check bot client id or, can I fetch upvote status of one bot from another bot?

flint bough
rain heart
#

You cannot no

#

Only on your own bot

flint bough
#

Ty

glass harbor
#

@wild lantern

restive otter
#

'

errant token
#

Hi Team, what should I do if I am trying to look up data of specific discord bot, i.e., - Number of Users and Growth Trends

rain heart
devout patrol
#

How do i get my server ip?

ashen garden
#

just like bots webhooks , is it also posible for servers ?

i get notifyed or user gets a role on vaote

somthing like that

runic creek
#

Because you have to host this webhook somewhere, and the easiest way is using express.js

runic creek
ashen garden
#

Is it trusted

runic creek
#

Bots for assigning roles for votes can be found on top.gg. As for this page, it was created by one of the moderators so yea, it is trusted

open bear
#

does dblapi.js module still work?

jaunty plank
velvet stirrup
#

So what happens if a u verified bot added the api?

jaunty plank
velvet stirrup
#

Ah

#

So we could add it now but just can't use it basically

scarlet cobalt
#

One message removed from a suspended account.

open bear
jaunty plank
#

Using deprecated software is generally not a good idea, if any security issues occur, or it stops working we won't fix it.

open bear
jaunty plank
#

Yeah

open bear
#

Thank you.

errant torrent
# jaunty plank Yeah

bro i haven't receive my redeem credits option on the vote page but i have compleated 101 votes

#

how does that works

#

@rain heart

rain heart
#

-api

abstract mothBOT
#

topgg This channel is for suggestions, help, and bugs related to our official API libraries and documentation found at https://docs.top.gg/

If you need help with other development, please use #development.

rain heart
#

Unrelated to the api

#

Ask in #auctions-support

rose sierra
#

query: '?reminderClicked', this doesnt give me the guild they come from tho?

rain heart
#

what are you referring to

#

the query parameter on a webhook?

rose sierra
#
{
user: 'ID',
type: 'upvote',
query: '?reminderClicked', <<<<<
isWeekend: false,
bot: 'ID'
}
#

so even if they first landed with a query, if they opt for reminder, then i dont know which guild they come from

rain heart
#

if you provide the message with that query

#

you can just add guildid=123458 to the url

#

just literally provide it

rose sierra
#

that's what I do already

rain heart
#

show the code you use to send your reminders

#

with the query string that you are setting

restive otter
#

ho i can gite my top gg token for bot

rain heart
#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

rain heart
#

lemme re-pin kthx

restive otter
#

no token

scarlet cobalt
#

One message removed from a suspended account.

restive otter
#

yes

restive otter
scarlet cobalt
#

One message removed from a suspended account.

tidal idol
rain heart
#

then re-load the page

tidal idol
#

tokens aren't shown on the first attempt for whatever reason

restive otter
#

TOPGG_API_KEY ??

rain heart
#

?

restive otter
# rain heart ?

hi i need if some one vote for bot automatically bot send to him msg in dm
can you help me

rain heart
#

#topgg-api is your place to ask, providing:

  • what have you done already
  • whats your approach
  • do you have any ideas you could implement

and wait for someone who can help

#

literally read my last message

reef glacier
#

How can I get the Top.gg API Key? @rain heart

rain heart
#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

woven coral
#

@rain heart yooo thanks for the video

#

will be very useful to include it in my SDK's readme

misty valve
#

How to get API of my discord bot which is on top.gg?

rain heart
#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages.
Please take time to read the pinned messages by clicking on this icon.

misty valve
#

👍

sharp flame
#

Hi, I would like to know how to retrieve the total number of votes for the month

rain heart
#

monthlyPoints is correct

sharp flame
#

I did the same code to retrieve the information to know if the person voted and it works but not to give me the number of votes in the month

#
const response = await axios.get(`https://top.gg/api/bots/1091794522599596092/check?userId=${UserSelect}`, {
                headers: {
                    Authorization: `Bearer ${TOPGG_TOKEN}`
                }
            });
            const voteStatus = response.data.voted;

            const checkVote = await axios.get(`https://top.gg/api/bots/1091794522599596092`, {
                headers: {
                    Authorization: `Bearer ${TOPGG_TOKEN}`
                }
            });
            const CountVote = checkVote;
rain heart
#

Well then print out the whole data

sharp flame
#

I just remove the .monthlyPoints

rain heart
#

I want to know what content is sent by the API

sharp flame
#

@rain heart I found it, I'm just stupid, I had to put "checkVote.data.monthlyPoints;" to find the element and not "checkVote.monthlyPoints;"

#

Thank you anyway for taking the time to help me!

inland wyvern
#
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
#

this is the code for when someone vote it will be sent to the console.log ?

inland wyvern
#

should i replace it with anything ?

runic creek
#

No, this is comment

#

You can remove it or leave it, it doesn't matter because it only explains what is what

untold sparrow
#

^

inland wyvern
inland wyvern
untold sparrow
untold sparrow
inland wyvern
#

this is the token !!!!!!

#

you said not the token !!!!!!!

#

nvm

#

( bot token )

untold sparrow
inland wyvern
#

yea yea

#

sorry

#

i don't see very good

#

my bad

untold sparrow
#

no worries topggHappy

inland wyvern
#

the console is clean

icy aurora
#

@inland wyvern hey.

inland wyvern
icy aurora
inland wyvern
icy aurora
#

@inland wyvern

#

You can make your own password for this.

inland wyvern
#

the webhook url

#

i get it from here ?

untold sparrow
#

oop this is what happens when im trying to multitask 💀 sorry bout that

inland wyvern
jaunty plank
#

You need a webserver to use top.gg webhooks

inland wyvern
jaunty plank
# inland wyvern

This code creates a webserver.

You just need the public url that webserver is accessable at, which will depend on your host

inland wyvern
icy aurora
scarlet cobalt
grim rampart
#

Api

grim rampart
#

I want my bot's token/api

rain heart
#

You need an approved bot on top.gg

dense cloud
#

https://docs.top.gg/api/bot/

When I get a bot owned by a team, it doesn't return all team members but only the team owner

Top.gg documentation

API resource for a bots or apps on a platform like Discord

#

Is that a bug or something else?

rain heart
#

It may either show the user who submitted the bot, or the owner of the team

#

Don't think a team one is implemented

open bear
#

Error: 503 Service Unavailabe

#

@topgg/sdk module gives this error

#

Also Error: 504 gateway timeout

tidal idol
#

thats because the website is down

open bear
tidal idol
#

nope

open bear
rain heart
#

should work again

tidal idol
#

ah wait nvm brian fart

#

brain*

#

i'm logged out, before it required users logged in

rain heart
#

if you're logged in, you're authorized

#

yeh

#

wait does it actually allow using it without being logged in?

#

nvm lol

tidal idol
#

yeah thats what i was looking at why

#

just badly worded

proper roost
#

How do you extract a user's information from a webhook so that it is saved in a json file and can enable the commands that are by vote? Even though I saw the guides, it was worse.

solid imp
supple fable
#

Because if I want my bot to know who can vote or who can not, I have to log it myself using the webhook, right ?

solid imp
supple fable
#

thanks !

ruby shore
#

The API sends the ID of someone who is not on the same server as the bot, so the bot cannot send messages to other users when their votes expire, it only tries to send to this user and cannot because they are not on the same server. How can i bypass if this user is not on the same server as the bot?

rain heart
#

That's not possible

#

That is a intentional limitation on discords end

#

Also

#

If a user is voting, but isn't in a server with your bot

#

That's sus

#

So don't know why they should be getting rewards to begin with

proper roost
#

If anyone knows how I can modify it so that it correctly saves the user's ID and timestamp, I would appreciate it.

rain heart
#

It's not hard to implement it at all:

Save the user id, along with the timestamp

#

Just get the current time of request, store it with the user id, done

#

If you haven't worked with saving data yet, try to approach that first by making a test project

agile quail
#

I can show a c# example and you can try to convert it to python if you'd like

agile quail
#

Alr sec

#

The project to receive and authenticate votes using webhooks:
https://github.com/SylveonDeko/Mewdeko/tree/main/src/Mewdeko.Votes

The service to actually receive and process votes:

https://github.com/SylveonDeko/Mewdeko/blob/main/src/Mewdeko/Modules/Votes/Services/VoteService.cs

GitHub

Mewdeko. Contribute to SylveonDeko/Mewdeko development by creating an account on GitHub.

GitHub

Mewdeko. Contribute to SylveonDeko/Mewdeko development by creating an account on GitHub.

#

It uses redis to send the data

#

Across processes

deft moss
#

Hey i need help...

agile quail
#

With

deft moss
#

I have a python bot

#

Wait bcs i use google translate XD

agile quail
#

Np

deft moss
#

I have a python bot with an artificial intelligence system that allows image generation, the problem is that I want to limit the use of the command with votes. I want when the command is used to ask to vote if the user has not yet voted

#

Actually my bot is on pending but it's for the update...

proper roost
deft moss
#

I wait...

#

Wait google translate XD...

scarlet cobalt
#

One message removed from a suspended account.

deft moss
proper roost
#

That thing about you having to vote to be able to use commands is pretty cool.

agile quail
#

I'm not really using it that much, it's just a leftover dependency

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

agile quail
#

Since I'm manually processing votes anyway

scarlet cobalt
#

One message removed from a suspended account.

scarlet cobalt
#

One message removed from a suspended account.

agile quail
agile quail
scarlet cobalt
#

One message removed from a suspended account.

deft moss
proper roost
#

I am with python

agile quail
#

*pyskid

#

Javaskid

#

Chad#

deft moss
#

HtmlKid ?