#topgg-api

1 messages · Page 184 of 1

fluid venture
#

without sdk

jaunty plank
#

You can set a response header using that, but an authorization response header wont really do anything with topgg webhooks.

fluid venture
#

so how does auth in sdk work

jaunty plank
#

it checks the request headers

console.log(req.headers.authorization)

fluid venture
jaunty plank
#

yeah

fluid venture
#

i see

#

thanks for clearing it out

jaunty badger
#

@jaunty plank is there a way to implement announcements

#

like get announcement

jaunty plank
#

a topgg announcement? nope

jaunty badger
#

any plans for it

jaunty plank
#

Not that I'm aware of

pliant gyro
#

im getting this error

bot.topggpy = topgg.DBLClient(bot, dbl_token)
NameError: name 'bot' is not defined```
smoky marten
#

bot is not defined

frigid cove
#

bot is not defined

raw hornet
#

Is the a way to modify the data your sending on the @tacit elm/sdk package

#

Id like to change the server count as top.gg grabs the wrong one

jaunty plank
#

The sdk gets it from your bots library, which is generally accurate.

If you need to post another count you'll need to post using your own method.

#

Oh wait, the auto poster pulls from the library.

#

The sdk takes whatever number you put in.

raw hornet
#

Yea well i just implomented clusters and now the top.gg stats are cut in half

#

Works fine getting the guild count through the bot tho

#

It seems to work just fine on other botlists aswell

restive otter
neat lotus
#

Does the remind me thing on voting have any linking with the API?

#

Like would top.gg send a request alerting you when a user could be reminded via ur end too?

#

I assume it's just top.gg based but would love to know

tidal idol
neat lotus
#

makes sense, ty

mystic yew
#

I just reset the token and it completely broke

#

I'm using the right token

#

token reset doesn't works at all

rain heart
#

Reset the token, refresh the page, then use the one after the refresh

#

It is important to know that the first part of the token is similar, as that's linked to the bot its authorizing

mystic yew
#

i Idid it

#

I clicked 5 times reset and only the previous token is working

#

No one of the new tokens worked

rain heart
#

Then you likely got ratelimited trying to reset the token, which I doubt

mystic yew
#

This token doesn't works but the previous yes

rain heart
#

Can't help then if you've really pressed the "click here", refreshed and used the new one

raw hornet
#

thanks alot

rain heart
#

it chhanges to 0 after 12 hours, which iswhen a usercan re-vote

#

works fine on my end

#

what exactly did you use on your code? post your code that handles it

#

API

#

through /check

#

repost without your authorization on the first few lines

#

also reset that

#

looks fine to me, can you visit the check endpoint on your browser using the authorid that is running the command?

#

make sure you're logged in on top.gg

#

also again, replace the 2 ids with the corresponding ids that would've been used in your code

tropic moat
#

How often does the autoposter post stats to the api? i.e every 1 hour, every 2 etc

tidal idol
#

no need to keep it that accurate with 30 min posts, especially with caching and all

signal hawk
#

@stable tide I'll look into this, thanks

stable tide
jaunty badger
#

is there a way to get the time in milliseconds that the user voted

sacred robin
#

did you know how to do it?

#

I want to do it too

rain heart
sacred robin
#

How can I make my bot or a webhook automatically announce a vote for my bot? The library I use is Aoi.js
( @rain heart could you reply pls, sorry for the ping)

jaunty badger
rain heart
#

The API supports webhooks, from which you can tell when a user voted

#

You can use that to store the timestamp of the vote, then perhaps start a timer or smth

sacred robin
#

Is there a way to make this update itself?

jaunty plank
late vector
#

How can I find when the user has voted?

jaunty plank
sacred robin
fierce violet
#

Hi Can someone pls tlel me what im doing wrong, im getting code 401 payload = {"server_count": len(self.bot.guilds)} try: e = requests.post(url="https://top.gg/api/bots/943415820875354152/stats",headers = {"content-type":"application/json","Authorization": ""},json = payload ) except Exception as e: print(e)

signal hawk
#

@stable tide - I looked into the issue that you reported and that endpoint should return unauthorized if you do not provide the authentication set by the server owner.

#

So that endpoint only works if you have access

ornate nest
#

Hello, I have an express running locally on port 8080 hooked up with

const app = express();
const topggWebhook = new Webhook(process.env.TOPGG_TOKEN);
app.use(
  cors({
    origin: "*",
  })
);
app.post(
  "/",
  topggWebhook.listener((vote) => {
    console.log(vote);
  })
);
app.get("/", (_, res) => res.send("Hello, World!"));
app.listen(8080, () => {
  console.log("Webhook listening on port 8080");
});

whenever any request (local, remote) sent to / as a post requests it returns

{
    "error": "Unauthorized"
}

I have made sure to copy my token from top.gg and use it inside the code. I'm just wonder what exactly is this error. I am assuming for some reason I'm not authorized with toppgg but not sure why.

#

this are the responses the server sends when i use the test button

#

so i checked locally with a normal post request and i received the same thing so that eliminates cors

#

this is the response the server gives to me when i send a request locally

#

nvm i figured it out i thought that the authorization string was the token not the shared seceret i give to topgg

#

🤦‍♂️

fluid venture
#

💀

stable tide
signal hawk
#

You can do it for servers you have access to, but not for servers you dont have access to

#

its restricted

stable tide
#

is this right?

signal hawk
#

for this server? youre in this server

#

so it does work, yes

stable tide
stable tide
signal hawk
#

I'll pass it along in case we dont want to allow that, thank you for reporting it to us ThumbsUp

cunning sorrel
rain heart
#

Is your webhook an IP or domain

#

Note that you cannot use discord webhooks or localhost addresses

cunning sorrel
rain heart
#

Aight so it isn't something like localhost etc?

#

Do you have a protocol too? https://

cunning sorrel
#

Oula

#

sorry

#

no

rain heart
#

lmaoo

#

so is it just a filler?

#

or is it an actual domain for your webhook

#

ohh nvm, since I asked what type it is nvm

#

make sure it has a protocol and stuff

#

you could otherwise DM me the url and I might be able to tell you what the issue is

dim kettle
#

@plain panther so are you seeing 403 errors?

#

If so, try going to the webhook section of your bot, click the regenerate token button link, after regenerating it, clear cache, reload the tab then copy the token you got into your code

plain panther
dim kettle
#

Make sure to remove any tokens/api credentials before sharing tho

plain panther
dim kettle
plain panther
dim kettle
#

Mind sharing the full error?

plain panther
#

Umm...okay

dim kettle
#

Stupid question, You made sure to install the autoposter npm module right?

npm i topgg-autoposter

plain panther
dim kettle
#

Ah, try destructering the { AutoPoster } in the import

#

Don’t think it’s a default export

#

So:
import { AutoPoster } from 'topgg-autoposter'

plain panther
#

Umm...okay

plain panther
dim kettle
#

As a example if you where to put your code below the client definition in index.js it should work

plain panther
#

As i told did it alredy like imported client from Djs and it's intent and also it's after cleint defining

#

@dim kettle

dim kettle
# plain panther <@98172944773029888>

From this code it seemed like you had it in a different file

Did you try moving the code below the client const in your new screenshot to see if that works

plain panther
plain panther
#

Atalst solved thanks Johand#0001

fluid venture
#

what advantage does topgg webhook package provide instead of just listening for req.body on express, except checking for auth token?

rain heart
#

None really, it is for developers who don't want to go through the hassle of building their own handler

#

You could probably just make one yourself through express and you're aight

#

The only thing the Topgg package does automatically is correctly respond to the requests to avoid retrial, aswell as handle the Auth as you mentioned

fluid venture
#

I see

wide stream
#

how can i track votes for my server

jaunty plank
nocturne loom
#

Can someone help me with this

smoky marten
#

regenerate token > refresh token > copy new token

jaunty badger
#

is there any way to get the amount of votes

smoky marten
jaunty badger
smoky marten
jaunty badger
#

Ok

smoky marten
jaunty badger
#

Ok

wide stream
jaunty plank
#

Thats also for servers listed on topgg

#

If you're looking to just send messages on a vote you can use third party tools.

azure hedge
#

I just got an error saying Unsupported Client.

#

before it was working fine

smoky marten
#

need more context

azure hedge
#
const { ShardingManager } = require('discord.js');
const { AutoPoster } = require('topgg-autoposter');

const Sharder = new ShardingManager('./src/index.js', { token: sometoken, totalShards: 4});

const autoPost = AutoPoster(token, Sharder);

autoPost.on('posted', (stats) =>{
    console.log(`${red("[TOP.GG]")} ${blueBright("INFO")} | ${green("Creating")} - \n${cyan(stats)}`)
});
jaunty plank
azure hedge
#

nope

jaunty plank
#

even djs versions

azure hedge
#

oh

#

lemme check

#

yeah I did

#

12.5.3 -> 13.8.1

jaunty plank
#

It's possible something changed in discord that causes that issue.

dire fern
#

Play music

jaunty badger
#

what are the params for api.getBots(Map, limit, offset) just need a brief description of them

#

nvm

rain heart
#

Not an official version btw

fluid venture
jaunty badger
restive otter
#

are you able to have people vote for your bot using the API?

smoky marten
#

You can also fetch the last 1000 users who voted for your bot

fluid venture
#

like "is vote api endpoint public?"

smoky marten
#

that'd be illegal from every possible way I can think

fluid venture
gusty locust
#

any changes made to the autoposter? it used to post my bots stats and update frequently but now the server count is stuck at a lower number than what it actually is — i haven’t made any changes to my code since adding the autoposter Hmm

#

it hasn’t changed for quite some time and is ~500 servers short

rain heart
#

Could you tell me the bot ID you're referring to?

#

Though shouldn't be made by changes as far as I'm aware

gusty locust
#

792443342926512128

#

thank u in advance <3

dire imp
#

Does top.gg webhooks support Ipv6 addresses for votes sending??

rain heart
rain heart
dire imp
gusty locust
#

hmmm, i'll take a look at my commits during that time and check my end. thank you aurel !!

rain heart
dire imp
#

kk got it

rain heart
#

There's some documentation on the RFC2732 on how to deal with IPv6 addresses with web requests, there's also tutorials on that too

gray kayak
#

is there an way you can check how many hours you have to vote again

#

Oh I see that someone else asked the same question to

fallow yoke
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const app = express()

const webhookFirst = new Topgg.Webhook('mycode') 
const webhookSecond = new Topgg.Webhook('mycode')

app.post('/vote', webhookFirst.listener(vote => { //ending url
  client.channels.cache.get(`891366497258188800`).send(`User with id - ${vote.user} voted.`)
}))

app.post('/vote', webhookSecond.listener(vote => { //ending url
  client.channels.cache.get(`891366497258188800`).send(`User with id - ${vote.user} voted.`)
}))
app.listen(3000)```

HI. My code is not working for me, can you guide me, what am I doing wrong?
rain heart
#

why do you have 2 webhooks

#

could you give me a bit more insights on your plans?

fallow yoke
#

Should I make it into two virtual servers or what?

rain heart
#

So like I'm not using js myself so take my opinion lightly but

iirc you can't create 2 posts on express

#

Top.gg provides data in its JSON data for you to differentiate between bots so you won't have 2 endpoints

#

Also you won't need 2, one is enough

#

Since they're essentially doing the same

fallow yoke
#

Hm

#

Idk

#

really

rain heart
#

Or wait

#

The webhook('mycode') is your Auth entered on top.gg right?

fallow yoke
#

that's exactly what

#

I don't know if this is a good

jaunty plank
#

You can have two post endpoints they just need to be on seperate paths

rain heart
#

The webhook part is supposed to be the auth

#

As far as I'm seeing you won't even need a second one

#

One post can handle it, you can just use the same settings on both bots

fallow yoke
#

only that he wants to make logs with just one bot

#

if I have two endpoints do I need to do anything else or should I leave it as is?

#

doing it for the first time

rain heart
#

you dont need to 2 endpoints is the thing

#

you only need one

#

you're essentially creating 2 endpoints for the same purpose

#

which is redundant

fallow yoke
#

so what should i do with this code

#

because I don't really understand, forgive me

fallow yoke
#

oh ok

rain heart
#

aka remove one of the post handlers, you can use literally one for both bots

#

no need for 2 webhook instances either

#

and it should not be your token but your authorization you define yourself

fallow yoke
#

🤔

#

is that it?

#

Should I put this on topgg or where? Because I'm slowly not getting it anymore. One writes in docs, and the other writes in the npm library.

jaunty plank
#

That looks like the headers for the api, webhooks are not using the api

fallow yoke
#

ah

#

probably none of that

languid ibex
#

Hello, I'm having trouble fetching your DBL-Java-Library dependency via maven, are you aware of issues?

#

The error I get:
Could not find artifact com.github.DiscordBotList:DBL-Java-Library:jar:2.1.1 in jitpack.io (https://jitpack.io)

jaunty plank
languid ibex
tawny aspen
#

need set the link of webhook here ?

smoky marten
tawny aspen
#

that ? (the red part)

rain heart
#

what that is is an authorization string like a password that allows your webhook to authenticate top.gg for example

tawny aspen
#

that ?

dense pebble
#

How to setup top.gg webhooks inside my discord bot?
I am using heroku

arctic rivet
#

Otherwise idk

dense pebble
arctic rivet
restive otter
#

can we setup webhook/api for discord server vote logging

smoky marten
dense pebble
#

I just want to know when someone votes

smoky marten
#

instead of the localhost:3000 thing

dense pebble
smoky marten
#

let's say your project name ppbot
in the webhook section of your bot put https://ppbot.herokuapp.com/YourCustomRoute

#

then put a random auth

#

then click save

#

in heroku change dyno type from worker to web

#

in your code put auth and deploy

#

and you should be good

#

The rest should be covered in docs

restive otter
smoky marten
#

Just replace with servers

restive otter
jaunty plank
#

Servers don't have an api, so we don't provide a token.

We do have webhooks for servers though

smoky marten
fluid venture
#

@smoky marten ur pfp kinda sus weirdsip

fluid venture
smoky marten
#

you saw nothing

fluid venture
#

heh

fallow yoke
#

vote.user returns me the user ID, how can I get the user username from this with a tag?

rain heart
#

You can either use the Top.gg API to obtain their associated information or by just fetching their user-id through discord

fallow yoke
rain heart
#

the user section

#

otherwise just fetch their user

fallow yoke
#

idk why

jaunty plank
fallow yoke
teal yacht
#

@top-gg/sdk

#

this is your module for api?

rain heart
#

that is the official library yes

restive otter
#

Who voted and want to give role too for every time he vote

smoky marten
quasi orchid
#

@jaunty salmon

jaunty salmon
quasi orchid
brisk basin
#

your server ip should be VPS ip right?

jaunty plank
#

yep!

brisk basin
#

ty

#

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

brisk basin
#

nvm fixed

brisk basin
#
import Topgg from '@top-gg/sdk';

const webhook = new Topgg.Webhook(`${process.env.DBL_BASEAUTH}`)

const app = express()
app.post('/dblwebhook', webhook.listener(vote => {
  
    console.log(vote.user)
  }))
  
app.listen(80)

http://vpsip:80/dblwebhook

#

isnt this right?

rain heart
#

no 80 needed on the URL, http is by default 80

brisk basin
#

ok

#

i removed

#

anything else?

#

because its still not working.

gritty swan
#

Is there something wrong in this code? I was seeing how to use the @top-gg/sdk library but when I try to vote (as a test) it doesnt return anything in my console

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

const app = express()

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

app.post("/vote", webhook.listener(vote => {
  console.log(vote.user + ' voted')
}))

app.listen(5028);
console.log('Your app is now running!')

Btw this code is from the guide

jaunty plank
jaunty plank
#

not with a discord url right?

#

http://yourserverip:5028/vote

gritty swan
jaunty plank
#

try without https

#

just http://

gritty swan
#

It worked

#

ty

#

I hadnt realized that I wrote https instead of http

gray mantle
#

But now the api cannot send req.vote anymore

#

Do I have to add any type of DNS to receive topgg request from API when someone upvote?

restive otter
#

is there a listener for votes?

plucky lance
#

You need to create a (webhook) listener - in this case - if you wanna listen to incoming requests (messages when someone votes)

#

In order this works you need to tell topgg where to send their requests (messages) to

#

Which is you webhook listener aka. webserver

restive otter
#

ehhh i just used that website lmao

#

too simple not too

plucky lance
restive otter
plucky lance
#

So… you got some trouble using it?

restive otter
#

huh? no

serene patio
#

Hello, Can anyone help me with top.gg api

smoky marten
#

Just ask whatever you're having problem with

serene patio
#

No, its alright. Figured it out

livid grove
#

hi uh is there a place where I could learn to make voting rewards for my bot like recieve the userid that voted and what time hey voted

#

i am using heroku to host

#

where would I find the auth token?

rain heart
#

that's something you create yourself

livid grove
#

how do u make the Webhook URL if i am using heroku

jaunty plank
#

should be covered by heroku's docs

tidal idol
#

@jaunty plank

#

hacked mf

livid grove
#

huh

tidal idol
#

person was banned

#

dw about it

livid grove
#

how do u get topgg voting events like it will do something if a user votes

rain heart
#

webhooks

fervent lake
#

Hm

livid grove
#

how do you make it so that it isn't just webhooks that send instead i want my bot to dm the user when they vote

cosmic ivy
#

i tried refreshing the page still didnt work

smoky marten
#

(Note: you won't be able to dm all users so you better get some kinda error handler)

rain heart
cosmic ivy
rain heart
#

it did work before

#

but is not a thing anymore

cosmic ivy
#

is it available on the web archive?

#

kinda curious on how it looks

rain heart
#

it's the same as docs.top.gg, there's no need for an archive

cosmic ivy
#

ok

cosmic ivy
rain heart
#

its a very old version of it and not used anymore

muted stone
#

My stats are getting posted for single shard total servers are not getting posted

modest nova
#

Hey guys hope all r dng grt... Need a assistance on get user id who is voted my bot... Tried all sorts of things webhook from topgg still am not able to figured it out can someone help me pls.

modest nova
#

From top.gg if I tried to fetch using dbl am not getting

#

Am using VPS

#

@smoky marten

smoky marten
#

dbl wut?

modest nova
#

Dblapi.js

smoky marten
#

try using the office one

#

npm i @compact matrix-gg/sdk

#

ff for the mention

distant oak
#

I don't recommend using it but it works

livid grove
#

is there an example

#

the server ip for localhost works?

#

i wanna test then figure out for heroku

restive otter
#

yo

#

anyone know how to check if someone voted the bot on top.gg?

#

nah

#

figured it out

random zenith
#

401, message: Unauthorized

DiscordBotListAPI api = new DiscordBotListAPI.Builder()
                    .token(token)
                    .botId(botID)
                    .build();

            api.getBot(botID).whenComplete((bot, e) -> {
                System.out.println(bot);
                System.out.println(e.getMessage());
            });

Is the Java library being maintained or why am I getting unauthorized? I tried to refresh the token on topgg webhooks, but even with that it didn't work.

jaunty plank
random zenith
#

even cleared cache

jaunty plank
#

are you using the most recent version of the java library?

random zenith
#
        <dependency>
            <groupId>com.github.top-gg</groupId>
            <artifactId>java-sdk</artifactId>
            <version>2.0.1</version>
        </dependency>
#

the 2.1.1 did not want to download through jitpack

jaunty plank
#

on maven?

random zenith
#

maven yes

jaunty plank
#

read the top pin

random zenith
#

just try PR14-SNAPSHOT?

jaunty plank
#

yep

random zenith
#

not found

jaunty plank
#

so

  <dependency>
    <groupId>com.github.top-gg</groupId>
    <artifactId>java-sdk</artifactId>
    <version>PR14-SNAPSHOT</version>
  </dependency>

isnt found?

random zenith
#

pretty much yeah

#
Dependency 'com.github.top-gg:java-sdk:PR14-SNAPSHOT' not found
jaunty plank
#

🤔 strange

jaunty plank
#

yeah, its a redirect to pull the most recent version of the PR.

random zenith
#

for me its not found so ASshrug02

#

for some reason when I do

<dependency>
            <groupId>com.github.top-gg</groupId>
            <artifactId>java-sdk</artifactId>
            <version>PR14-fffb55d578-1</version>
        </dependency>
#

it does seem to work

jaunty plank
#

well thats good

random zenith
#

lemme try run it again see if its just a version issue

jaunty plank
#

2.0.1 doesnt work, its from 2018 and uses our old domain(iirc)

random zenith
jaunty plank
#

hmm

jaunty plank
random zenith
#

its the exact same token as on the topgg webhook page

jaunty plank
#

the only other idea I have is regenerating the token on topgg, waiting an hour and then copy it over.

random zenith
#

wait an hour?

jaunty plank
#

its possible server side cache is preventing it from updating

#

which shouldn't be an issue, but it theoretically could

random zenith
#

wouldn't it work then to just wait 30 more mins now? cuz I updated it about 30 mins ago

jaunty plank
#

yeah, that should work

random zenith
#

if it doesn't I'll let you know

random zenith
humble urchin
#

How can I get the topgg api?

gloomy relic
restive otter
#
const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('Top.gg webhook password')
const app = express()

app.post('/webhook', wh.listener((vote) => {
  console.log(vote.user) // 172075838806818817
}))

app.listen(80)
``` i have trouble understanding the app.listen part
#

where should the bot be listening to

jaunty plank
#

an open port

restive otter
#

Phh

#

Ohh*

#

Does it need to be on a vps?

smoky marten
#

so VPS, Docker, Kubernetes anything should work fine

#

your PC and mobile also works (technically)

restive otter
#

Oh alright

fluid venture
#

if u are testing webhooks on ur pc u can use ngrok

restive otter
#

hey

#

i have a command for when someone votes my bot on topgg

#

and sends them a dm and a message in my topgg vote log

#

but when someone votes it

#

it is like a loop

#

the bot continues to send from 5 to 9 messages in a row

#

anyone knows why?

#

the code is this:

#
 const express = require("express");
 const app = express();
const db = require("quick.db")

const TopWebhook = new Topgg.Webhook(process.env.auth);
app.listen(8080);
app.post("/webhook", TopWebhook.listener(vote => {
  
db.add(`Coin_${vote.user}`, 50) 
    let voteEmbed = new MessageEmbed()
  .setDescription(`<@${vote.user}> voted DaKing`)
     .setColor("GREEN");
 let userEmbed = new MessageEmbed()
   .setTitle("Thanks for Voting DaKing!")
  .setDescription("You just received 50 coins by voting me!")
  .setFooter("You can vote again after 12 hours!")
   client.channels.cache.get('996352881294835752').send(voteEmbed)
  client.users.cache.get(vote.user).send(userEmbed)
}))```
#

i use replit

smoky marten
restive otter
#

i mean i want vsc

#

but my computes wont let me install it

#

ma potato pc

smoky marten
restive otter
#

uptime robot

smoky marten
#

Welp that seems to make replit go brrrrrrrrr
It'll sometimes make 5-15 instances, assign different port but all if them to the original subdomain

restive otter
#

let me turn off uptime

#

and check it

smoky marten
#

and create a new one

#

that one's pretty done

restive otter
#

nah

#

still not @smoky marten

smoky marten
restive otter
#

lmao

smoky marten
#

weren't you supposed to do it like .send({ embeds: [embed]})
You didn't even import discord.js

restive otter
#

yeah i did

#

its in the code

#

i just didnt paste it here

smoky marten
#

oh okay

#

that part good

restive otter
#

aight

#

@smoky marten listen

#

isnt that you need maybe an async function?

rain heart
#

app.listen goes in the end

#

it would otherwise not even reach the app.post, thus wouldn't have that endpoint work at all to begin with

restive otter
#

hm

#

let me try

smoky marten
# rain heart it would otherwise not even reach the app.post, thus wouldn't have that endpoint...
#

it doesn't matter

smoky marten
#

Try forking the repl

restive otter
#

its an async function problem here

rain heart
#

Then just try manually making a request to your webhook to see if it is even able to get requests

restive otter
smoky marten
#

It's the best I can think

restive otter
#

maybe i should put await

smoky marten
#

Would never have this error outside replit

rain heart
#

make sure it isn't actually a network thing, try checking the IP the request comes from

restive otter
#

yooo

#

figured it out

#

its only 1 time now

smoky marten
restive otter
#

i put my repl link in topgg

#

with https

#

now i edited it

#

to http

#

and it seems it solved it

jaunty plank
#

🤔

smoky marten
#

ayo wut

restive otter
#

lemme send an image

smoky marten
#

replit should support https

jaunty plank
#

Replit issue then?

It's possible no response was being sent on https due to replit.

#

It does

restive otter
smoky marten
#

well you know what we say
"If it works don't touch it"

restive otter
restive otter
#

thanks for your time tho

rain heart
#

so apparently guessing it does a request nonetheless, even during the redirect to https

restive otter
#

tf

restive otter
smoky marten
#

ff wrong channel

coarse snow
#

In which version of py the api is available?

zenith quest
#

Look in docs

livid grove
livid grove
#

honestly I am very confused how to host this on heroku

gaunt void
#

Hello guys do you play roblox?

#

Hello?

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.

scenic ocean
#

-api

fluid venture
#

-api

smoky marten
#

-api

dim kettle
#

-api

sage pebble
#

-api

keen marsh
#

-api

normal grail
#

-api

devout gulch
#

-api

sage current
#

-api

scarlet cobalt
#

One message removed from a suspended account.

sage current
#

-api

abstract plover
#

is it possible to get a api for an server on the website?

smoky marten
delicate wing
#

-api

mortal raptor
dim kettle
mortal raptor
dim kettle
#

Has it worked fine since that error?

mortal raptor
dim kettle
#

You can safely ignore it. Network errors can happen every once in a while.
Sometimes it is due to Top.gg being down for a sec, maybe the host you where on had issues. Hard to say

mortal raptor
#

the API can send an error code following the error?

#

something like...

const errorCode = error.code
mortal raptor
dim kettle
#

You would need to wrap the await with a try/catch and catch the error

#

There should be an error object you can destruct the error code from

mortal raptor
#

but no problem

#

thanks

limpid bane
#

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

is the webhook auth the auth i set on dashboard?

dim kettle
limpid bane
#

alight

fringe edge
#

Why do I get this issue when trying to log votes in my server? It works for me on my client side, but doesn’t work for when someone tests the webhook

dim kettle
fringe edge
#

thank you

fringe edge
dim kettle
fringe edge
#

As when I click test webhook on my side it works with logs etc but when another admin tries to click the test button nothing logs

signal hawk
#

i am not sure if there are any issues with the test webhook button

#

i dontt hink it would be affected by the current errors

tidal idol
fringe edge
#

🤔 But yeah it makes sense on why the test webhook might not be affected

signal hawk
#

i am not sure. are the other users trying to use it on your bots team?

fringe edge
#

🤔

signal hawk
#

it might be legacy tied to only the owner

#

i can ask a developer ThumbsUpSmile

fringe edge
fringe edge
#

Like it’s only responding when I do it?

signal hawk
#

Previously only the owner ever had access to the bot page and settings such as webhooks

im wondering if, when we added teams, maybe we didn't update that check to see if the user is on a team, and we're still only checking to see if theyre the owner

fluid venture
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
serene torrent
rain heart
#

you can use webhooks for that

sterile stirrup
rain heart
#

discord webhooks are not supported

sterile stirrup
#

?

rain heart
#

Not discord webhooks

sterile stirrup
rain heart
#

see above

#

You might have seen webhooks mentioned in your apps' settings and wondered if they're something you should use. The answer, in a nutshell, is probably yes.
Webhooks are one way that apps can send automated messages or information to other apps. It's how PayPal tells your accounting app when your...

sterile stirrup
rain heart
#

that is not an official bot by top.gg, nor do we provide such service

#

that's likely a private bot made by someone that is using Webhooks in order to receive voting events

rain heart
#

read above

sterile stirrup
plucky lance
#

The docs already provide examples in different languages you can use which are pretty much a working solution

#

But still it requires fundamental knowledge on how webhooks work and what they are

#

Without that trying to set this up will be complicated

#

Also stay away from trying to host at home as I read that earlier

slate roost
#

Where do i get my top.gg token?

smoky marten
#

on your bot settings page

#

bot > edit > webhooks > reveal token

slate roost
#

How can I keep the widget image updated?

#

I just copied the link of the image but it doesn't update when someone votes

#

Pls help

river pivot
#

someone need help?

#

oh

#

it updates overtime i believe

#

send me ur bot's id

smoky marten
#

so I guess it's discord serving from cache

tidal peak
#

i guess invalid the cache

slate roost
slate roost
slate roost
#
dbl.webhook.on('vote', vote => {
  logInfo('User voted', vote.user.tag);

  client.channels.cache
    .get('...')
    .send({
      embeds: [
        new Discord.MessageEmbed()
          .setColor('#12c4ff')
          .setDescription(`${vote.user.tag} voted!`)
      ]
    });
});```
#

This isn't working when someone votes

tidal peak
#

uh idk?

#

probably ip issues

#

@slate roost where do you host that

#

i am waiting a reply

slate roost
slate roost
slate roost
rain heart
#

likely not, maybe by adding random garbage into the query string?

slate roost
#
dbl.webhook.on('vote', vote => {
  logInfo('User voted', vote.user.tag);

  client.channels.cache
    .get('...')
    .send({
      embeds: [embed]
    });
}); 
#

Also, the vote tracker not working

tidal peak
smoky marten
tidal peak
smoky marten
#

and bind it to your port

tidal peak
#

hm?

slate roost
tidal peak
#

oh

slate roost
#

For topgg right

tidal peak
#

try to remove it then

slate roost
#

5000

#

Default

#

Do i remove the port then?

tidal peak
#

yup

#

just the replit url

slate roost
tidal peak
slate roost
#

Hmm

slate roost
tidal peak
#

bru-

slate roost
# tidal peak bru-

The whole code: ```js
const dbl = new DBL(process.env.topggToken, {
webhookPort: 5000,
webhookAuth: '...'
});

dbl.webhook.on('ready', hook => {
logInfo('Webhook', 'Connected');
logInfo('Webhook Url', https://${hook.hostname});
//logInfo('Webhook Port', ${hook.port}${hook.path});
});

dbl.webhook.on('vote', vote => {
logInfo('User voted', vote.user.tag);

client.channels.cache
.get('...')
.send({
embeds: [embed]
});
});```

#

I don't get any error with this but it doesn't work

tidal peak
#

because it probably doesnt get sent

slate roost
#

Pls any officials help me

tidal peak
#

idk

slate roost
#

The vote updates don't work and the image too

#

Pls help

rain heart
#

the image is not meant to be embedded into a cached field

#

consider using the api to fetch information about your own bot

slate roost
#

But it isn't working

slate roost
#

I just need it for voting

rain heart
#

Have you also set it on your webhook settings on top.gg

slate roost
# slate roost

On webhook url there is the url of the discord webhook integration url

slate roost
rain heart
rain heart
slate roost
slate roost
rain heart
#

but not to reward users for voting

slate roost
#

Oof ☠️

river pivot
#

hi

#

r u allowed to make a top.gg-related bot

#

oops sorry wrong place

sharp moat
#

auto poster works with eris?

rain heart
#

"or eris client"

sharp moat
#

oh

#

nice

fringe edge
#

I’ve been getting a strange occurrence within my webhook logging. Is it possible when someone votes for a server twice, that the POST request and my app could misinterpret it somehow and run my code twice?

#

Or could it be because of my host (heroku) making a mistake.

rain heart
fluid venture
#

1 vote counts as 2

#

on weekends

fringe edge
rain heart
#

By properly responding to the webhook as described there

fringe edge
rain heart
#

weekend votes are not sent as separate webhooks

fluid venture
rain heart
#

they're sent as 1, but the value is_weekend will be true on that one request

sterile stirrup
#

how do i make my bot send in console.log when they voted for it?

sterile stirrup
open bay
#

you need to host it

#

i am using Heroku and it works fine

sterile stirrup
open bay
#

yes, but if you are using heroku you need to change last line

#

and line 6 should be changed to smth secure

sterile stirrup
open bay
sterile stirrup
open bay
sterile stirrup
open bay
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express()

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

app.post('/vote', webhook.listener(vote => {
    console.log(vote.user + " voted")
}))
app.listen(process.env.PORT)
console.log("Ready!")
#

This is the same but changed for heroku

#

you cant assign a port on heroku you need to use process.env.PORT

sterile stirrup
#

where it says password I put what?

open bay
sterile stirrup
open bay
#

yes, put same string there as in the script

sterile stirrup
open bay
#

now, you need to host it

sterile stirrup
open bay
#

if you see ready! in console its working

sterile stirrup
#

and now?

open bay
#

and fill in stuff

#

with your details

sterile stirrup
open bay
#

with /vote at the end

sterile stirrup
open bay
#

and do you have env file?

sterile stirrup
open bay
#

your host ip, do you have it?

sterile stirrup
open bay
#

go to your app on host web panel and ipv4 address should be there

#

what do you mean? Voting code is executed only once per vote

fringe edge
sterile stirrup
open bay
sterile stirrup
sterile stirrup
open bay
#

When u got to it

sterile stirrup
open bay
#

Is it hosted on the same node as bot?

sterile stirrup
open bay
#

Do u have .env file?

sterile stirrup
open bay
#

app.listen(3444)

sterile stirrup
open bay
#

Yeah

#

Now build and run

#

Does it says Ready?

sterile stirrup
open bay
sterile stirrup
open bay
#

Now go to webhook setup on topgg

#

And for webhook link type ur site url:3444/vote

sterile stirrup
#

https://friendlybot.xyz:3444/vote
so?

open bay
#

Yes that

#

No

#

Not /3444 :3444/vote

#

Like that

sterile stirrup
#

https://friendlybot.xyz:3444/vote
so?

open bay
#

Yeah type that into webhook url

#

Now authorization field, type same pass as in script

sterile stirrup
open bay
#

Click save and test

tidal idol
#

you use Cloudflare so port 3444 is blocked

#

you could possibly consider disabling proxy so port 3444 is opened

sterile stirrup
open bay
#

If it isnt working @tidal idol told u y

sterile stirrup
tidal idol
#

that IS the problem

#

port 3444 is blocked

sterile stirrup
tidal idol
#

click on your domain

sterile stirrup
tidal idol
#

DNS

#

something like that

sterile stirrup
tidal idol
#

click "Proxied" and it should go gray

#

you don't want to add a record

#

the top one yeah

#

there should be one under "www" too, if so then disable proxy on that too

#

just the top one then

#

click this on the top one

sterile stirrup
#

?

tidal idol
#

then click this and it will go gray as shown above

#

yes

tidal idol
#

then click save

sterile stirrup
plucky lance
#

Discord being Discord

tidal idol
#

lol

tidal idol
sterile stirrup
plucky lance
#

did you even setup ssl properly?

sterile stirrup
plucky lance
#

if not use http without secure protocol

tidal idol
sterile stirrup
sterile stirrup
tidal idol
#

hmm

#

for now just renable the proxy

#

i'm heading to bed so i'm unable to help any further for the time being

plucky lance
#

wut are you trying to archive?

sterile stirrup
plucky lance
#

where is your webhook listener running? at home or on a server?

rocky pebble
#

Hi

rain heart
#

hey, need anything?

hardy berry
#

I have a probleme gus

#

Can someone help me

#

??

rain heart
#

Sure, what do you need

fringe edge
#

What does the 503 status code mean when it’s returned to me?

fluid venture
#

service unavailable

mighty scroll
#

how do i get the top gg api

rain heart
#

requires an approved bot

mighty scroll
#

k

fluid venture
rain heart
#

no, requires an approved bot entirely to use any aspects of the api

fluid venture
#

like a bot info or user info

#

o

rain heart
#

if you're logged into top.gg, then yes it does

#

as it is using your authorization to check the stats

fluid venture
#

o yeah

rain heart
#

try it in incognito and you'll see what I mean

fluid venture
#

ye i get unauthorized

unkempt hill
#

how can i get DBL token?

rain heart
#

check the pinned messages

unkempt hill
rain heart
#

where do you get that

#

which url

unkempt hill
#

The web server reported a gateway time-out error.

rain heart
#

thats the right one

unkempt hill
#

also what package should i use there is two for nodejs

smoky marten
#

@topgg/sdk

#

it's the official one

unkempt hill
rain heart
#

always has been

wise raven
#
const manager = new ShardingManager('./llama.js', { token: token });

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));

const ap = AutoPoster('topggBotToken', manager) // error here

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

manager.spawn();

This normally works but after adding the autoposter it gives an unsupported client on the autoposter declaration. What am I missing?

wise raven
#

I also tried with my client on the llama.js (index but I'm using sharding) and same issue

rain heart
#

shardingmanager isnt supported iirc

#

can be wrong

wise raven
rain heart
wise raven
#

I set up my sharding how the djs docs have it but the topgg autoposter list it a different way and I'm not sure how to set that up. I also can't find anything about shard managers on the topgg js docs, is it under the posting bot stats section?

rain heart
#

wait for someone who can help then

limber junco
#

Ok so I had a que

User can vote more than once for the same bot every few hours

And I also used top.gg api to know if a user has voted so let's say user voted once and his time ended like he can revote now so if I render using api would it show he has not voted? Or if he just votes once it will show that he has voted (everytime I fetch)

fluid venture
arctic rivet
#

Its really easy you can make a session and provide auth in headers and then you will get the data 0 = Not voted 1 Voted and yes I'm also using this no need to install any wrappers

#

Because topggpy is not supported on 3.9

#

||English accha nhi mera manage kr lena||

limber junco
#

?

fluid venture
#

yes

smoky marten
#

Like instead of putting the posting thing in the sharder try putting it in main file

#

then post stats

smoky marten
#

also you can always do it manually

fluid venture
#

(if u are trying to make a vote reminder)

limber junco
fluid venture
wise raven
#

Even with the normal client it says unsupported client loading

smoky marten
#

Can you not use autoposter

wise raven
#

I'm sorry if my reply pinged u i fixed it!!

#

that's what i was using :P its all good now tho

smoky marten
#

yesterday I had this same problem

wise raven
#

will the stats be on topgg right away or do i have to wait a bit

smoky marten
#

So I copied the autoposter code without the type check
now it works fine

wise raven
#

yayy im glad it works for u

smoky marten
wise raven
#

that's fair! ty

wise raven
#

OK this might sound really stupid but I posted my stats, can I temporarily un post them? I commented out the autoposter but the old stats are still on the page.

My reason being the bot is only in 3 servers and I'm afraid people will not use it because of that

rain heart
#

You can set it to 0 or 1

#

you cant unpost them once posted

wise raven
#

whoops oh well. Ill just auto post them then. Thanks! (again pretty dumb thing of me lol)

worldly tendon
#

can someone here help me with getting the webhook for topgg? I use railway.app as my host

restive otter
#

one question - suppose I'm gonna send a message to everyone who votes for my bot so how am I gonna fetch the ID from the webhook?

fluid venture
restive otter
#

so I'm supposed to use express inside of my bot? atm I run it in a diff server

rain heart
#

If you wish to fetch a user the ID the webhook has provided you, then you'll need a bot application within that webhook that is able to

#

you could also setup some sort of connection between your webhook server and your bot to then have your bot handle that mechanic

restive otter
#

Yeah but i'm not sure how to do that XD

#

current I read the ID provided by the webhook by slicing message.content

rain heart
#

best way is to have both in one like the example Glitter gave

#

yeah thats unefficient, works but unefficient

restive otter
#

yeah i know

rain heart
#

Or wait, what are you referring to with webhook

#

you have a webhook setup on another server that essentially sends another webhook into a channel right?

restive otter
#

um didnt get it

#

yeah

rain heart
#

bit unefficient, but could work

restive otter
#

yeah thats why i came for help

rain heart
#

what I actually suggest is to send it in an embed instead so you could just fetch the nth field, one sec

#

wait, could you show me an example of how your webhooks sends that into the channel?

restive otter
#

yeah wait

#

I just slice up the ID for now

rain heart
#

so you do have the ID through splitting the content with what I'm guessing "-"

restive otter
#

yep

rain heart
#

discordjs?

restive otter
#

yep

#

what I actually want is to get the event triggered in my bot code so I dont have to listen for messages

rain heart
#

yeah that would only work with having the webhook directly on your bot to "get the events of the webhook" to say

#

on webhooks you'd send in a channel it would need to listen to messages

restive otter
#

so I have to get the express server in my event listener right?

rain heart
#

You can either do what you have right now, fetching the ID from the webhook that was sent

restive otter
#

because i dont know how to create a connection with the server lol

rain heart
#

or directly go for webhooks that are sent by top.gg and implementing that mechanic into your bot directly instead

restive otter
#

yeah that sounds good

rain heart
#

jesus the discordjs docs are weird

restive otter
#

true XD

#

anyways when the user votes what info do I receive?

rain heart
restive otter
#

only the user?

rain heart
#

the ID is what you'd wanna go for

restive otter
#

I meant like next vote time etc etc.

rain heart
#

not provided by top.gg, you'd have to track that yourself too

restive otter
#

okay got it

rain heart
#

easy to implement though, just store the timestamp of when they voted and compare it with the current time

restive otter
#

yep

rain heart
#

so currentTimestamp - voteTimestamp = time Remaining

restive otter
#

I'm currently using the tool by top.gg webhook sender

rain heart
#

Yeah, that wont bring you far, like i said it can work to just fetch the webhook messages from that one channel, but is often way more efficient to directly have top.gg request to your bot

restive otter
#

I implemented in my express server, it was working fine then I gone to eat lunch then when I tried to test again idk for real what happend

#

I was getting the id by console log

#

but webhook was not working

rain heart
#

have you checked if the requests were still coming through? It may happen that top.gg will resend stuff if it wasnt properly responded to

restive otter
#

the id was coming tho

#

in my console

#

just the webhook wasnt working

rain heart
#

then some sort of mechanics to handle that ID failed at some point, debugging time

restive otter
#

idk I wasted like 3 hours then moved on with the tool