#topgg-api

1 messages · Page 165 of 1

plucky lance
#

As I said you missed the Content-Type

dull thunder
#

tyyyyy

#

you helped so much

plucky lance
#

Alright, have a good one

coarse rune
#

does anyone over here use heroku

plucky gust
#

where i find this

#

on top gg

dull thunder
#

@coarse rune i do

plucky gust
#

how works this @dull thunder

#

does anyone know this

#

pls

dull thunder
#

you want to make webhook
or just want the token

#

did you bot approved?

plucky gust
#

euh

plucky gust
plucky lance
#

It’s your endpoint topgg sends requests to.

dull thunder
#

i have never used webhooks but

you have to make webhook first then get the url

smoky marten
plucky gust
#

but how to make a webhook

smoky marten
# plucky gust but how to make a webhook
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(3000)
restive otter
smoky marten
smoky marten
plucky gust
#
const express = require('epress');
const Topgg = require('@top-gg/sdk');
const app = express();
const webhook = new Topgg.webhook('');

app.post('/voted', webhook.listener(=> vote {
  let channel = client.channels.cashe.get(874591442805334026) 
  let user = client.users.cashe.get(vote.user)

  channel.send(`<@${user.id}> has voted for ${client.user.username}!`)
}));```
#

why this dont work

smoky marten
#

it should be cache

plucky gust
#

ow 😂

smoky marten
plucky lance
#

Path doesn’t matter as it’s no physical path

plucky gust
#

huh

plucky lance
#

You just copy and pasted that right into your existing code…

plucky gust
#

it is my second time that use js

smoky marten
#

remove the const express = .... line

plucky lance
#

It was just an example to use, Akio gave you.

plucky gust
#

ty

glad merlin
#

it should be "express" not epress

smoky marten
#

*epress moment

plucky gust
#

-_-

smoky marten
#

the cap W

#

on line 4

#

Topgg.Webhook()

plucky gust
glad merlin
#

yes, nice red font color

smoky marten
glad merlin
#

iirc

plucky gust
#

nvm

coarse rune
smoky marten
coarse rune
#

yea i know i changed that

smoky marten
coarse rune
coarse rune
smoky marten
#

yep

#

now click on test

coarse rune
#

i already did it

coarse rune
#
at=error code=H10 desc="App crashed" method=POST path="/dblweb" host=test.herokuapp.com request_id=482cbf55-796f-420a-8ceb-319796339914 fwd="159.203.205.187" dyno= connect= service= status=503 bytes= protocol=https``` still same error
smoky marten
#

Show the code

#

and the actual error

#

not that one

#

there should be another one like Unexpected blah at position blah:69

coarse rune
#
const express = require('express')
  const app = express();
  const Topgg = require("@top-gg/sdk")
const webhook = new Topgg.Webhook('my auth token')
app.post("/dblweb", webhook.listener(vote => {
    console.log(`${vote.user} has voted for me!`)
    app.listen('3000')```
#

@smoky marten

coarse rune
smoky marten
restive otter
coarse rune
#

ok...

restive otter
#

thats why it crashes btw

smoky marten
# coarse rune

put an empty line and make it 69
then do what rais told you to do

coarse rune
#

so in my env file i should put port=3000

restive otter
#

you dont need to put it

#

heroku does it automatically

coarse rune
#

ok

#

nope same error

smoky marten
restive otter
#

can you show it fully

golden adder
#

You passed the port number as a string

coarse rune
coarse rune
golden adder
#

Is should be app.listen(3000) not app.listen('3000')

restive otter
golden adder
#

This is also facts

coarse rune
#

app's name is moderatorhosting for hosting my bot for moderation

restive otter
#

woop

#

you should delete that

golden adder
#

I yeeted heroku 2 months after starting bot development. Got a cheap VPS instead.

restive otter
#

btw mb but it was process.env.PORT

smoky marten
#

do this

const port = process.env.PORT || 3000
app.listen(port)
```@coarse rune
coarse rune
#

ok

smoky marten
#

ok

torpid elm
#

is there a way to send vote message through the bot instead of webhook

#

idk how to use a webhook soooo...

restive otter
torpid elm
#

i've been trying since yesterday

soft vault
#

One message removed from a suspended account.

#

One message removed from a suspended account.

torpid elm
soft vault
#

One message removed from a suspended account.

torpid elm
#

idk how to even get votes T_T

coarse rune
coarse rune
#

hi can someone help me adding async to webhook listener

ionic holly
#

Guys the Top.gg Webhook isnt Posting on my Discord Channel

#

i set it up correctly

sick otter
#

How do I edit the api?

plucky lance
ionic holly
#

so where it supposed to POST

plucky lance
#

To your endpoint and your endpoint will then deal with the data you got posted.

ionic holly
#

can i use IFTTT to do that

plucky lance
#

(webhook service aka. webserver listening to POST requests)

ionic holly
#

u mean IFTTT

#

and all that

#

Webhook websit

#

right

plucky lance
#

never heard of IFTTT, no clue

ionic holly
#

its the best one

plucky lance
#

You can manage that yourself and receive requests yourself or a third-party serivce. However you like.

ionic holly
#

can i do it inside the bot\

#

like listen to a port

#

and then check the data i received

#

using while True:

#

well heroku wont let me lol

plucky lance
#

You can create a webhook service within your bot and listen to the POST requests or simply using a seconds instance of your bot.

#

Whatever you prefer.

#

Take a look at the docs being pinned in here.

#

They actually provide code examples for webhooks and how to integrate them.

sick otter
#

Then what is webhooks used for

plucky lance
#

Receiving POST requests from topgg at the moment the event's getting fired, e.g. someone votes for example

sick otter
#

So it doesn’t send it to a discord channel?

#

Sorry never used api’s before I’m confused

plucky lance
#

As I explained above, no it does not interact with the Discord webhooks

sick otter
#

Alr

#

Will it soon?

plucky lance
#

It does only interact with your own endpoint.
And your own endpoint will handle the data you received.

#

I don't think so, that wouldn't make any sense for topgg.

#

Why should it interact with Discord webhooks?
What is it supposed to send to Discord channnels?
How does topgg know which channel to send a message to?
Etc.

sick otter
#

Oh

#

Ok

plucky lance
#

It basically sends a letter, SMS, whatever telling you user X has voted.
And you will decide what to do with that information.
Saving it in a database, posting a message on your Discord server pinging user X etc.

rustic birch
#

Hola bienvenidos a CHI LE

sinful pond
#
const Top = require('@top-gg/sdk');
const express = require('express');
module.exports = client => {
	this.top_gg = null;

	if (process.env.TOP_GG) {
		const app = express();

		this.top_gg = {
			api: new Top.Api(process.env.TOP_GG),
			webhook: new Top.Webhook('Demon12345')
		};

		app.post('/dblwebhook', this.top_gg.webhook.middleware(), (req, res) => {
			client.emit('userVoted', req, res);

			if (res && res.status(200)) {
				res.send('OK');
			}
		});

		app.listen(3000, () => {
			console.log('[dbl] Connected!');
		});
	}

	function _post() {
		const serverCount = client.guilds.cache.size;
		this.dbl ? this.dbl.post() : null;
		this.top_gg ? this.top_gg.api.postStats({ serverCount }) : null;
	}

	function init(loop) {
		if (loop) {
			this._post();
			setInterval(() => this._post(), 1800000);
		} else {
			this._post();
		}
		return;
	}
	_post();
};

Why its not working 😕

restive otter
#

what isnt working

sinful pond
#

When I clicked on test button

#

UserVoted event is not emited

shadow lintel
#

hi

bronze jasper
#

what is defAvatar used for? how can i turn it into a cdn link?

tulip jolt
#

is there a doc ?

#

cause i want to make a vote tracker but i don't have docs 😅

solid crest
#

whenever i try to do send test webhook

#

it returns this

#

its been for a few days, my webhook url is right and webhook auth too so ee idk the problem

spice plank
#

can i get the roblox scripter here

safe comet
#

this is topgg api

safe comet
slim falcon
#

is dblapi.js library still compatible with discord.js 13

sullen nymph
#

Fuck knows is my safe bet

#

Either try it out or switch to node SDK

spare ocean
#

@here

#

someone help please

last moss
#

My problem is when I vote for any bot after voting when I claim reward it doesn't give me any reward it only show me vote link

restive otter
#

I added the dsl bot like 5 times and its still showing to add the bot to the server..... worryangry

static gull
#

How can i set the dots in the top.gg description?

dull thunder
#

bots/:bot_id/check do this check for all time vote ?
or monthly

#

should i make webhook to check for daily vote ?

smoky marten
verbal citrus
#
require('dotenv').config();
const Topgg = require("@top-gg/sdk");
const TopggApi = new Topgg.Api(process.env.TOPGG_TOKEN);

module.exports = async (Discord, client) => {
    console.log('🤖Ekko Bot is online!🤖');
    client.user.setActivity(`${process.env.PREFIX}help`);

    let votes
    let monthlyVotes

    await TopggApi.getBot(client.user.id).then(bot => {
        votes = bot.points
        monthlyVotes = bot.monthlyPoints
    })

    const structDatas = [
        { key: 'Username', value: `${client.user.username}`},
        { key: 'Joined Guilds', value: `${client.guilds.cache.size}`},
        { key: 'Total Votes', value: `${votes}`},
        { key: 'Monthly Votes', value: `${monthlyVotes}`},
    ];
    console.table(structDatas);
}

im getting this error:

TopGGAPIError: 520 undefined
    at Api._request (C:\Users\lucam\Desktop\Ekko Bot\node_modules\@top-gg\sdk\dist\structs\Api.js:76:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async module.exports (C:\Users\lucam\Desktop\Ekko Bot\events\client\ready.js:12:2) {
  response: Response {
 // a bunch of weird things here
}
#

can anyone tell me whats wrong with this?

restive otter
#

the site is down

verbal citrus
#

oh

#

is there a way i can check if the site is down before checking for votes?

#

just so i dont get errors/my bot stops

rain heart
#

Just make a request and see if it returns 504

vapid brook
#

Website is down right??

golden adder
restive otter
#
try{
// Your code

} catch(err) {
console.log(err)
}
restive otter
#

Hi, what i have to put here ?

ruby sentinel
safe comet
stable summit
#

hey how do i get my bot to disply as online?

#

wait

#

nvm

#

remembered the docs

#

with the autoposter it says unsupported client, whats going on?

restive otter
ruby sentinel
restive otter
#

the url that you are posting the information to

#

I want send the vote message with my bot

#

a discord webhook ?

smoky marten
restive otter
#

-_-

cold root
# restive otter -_-

Just go and read (if ur using JavaScript) node.js express documentation. They will litilery give you a code snippet of a basic webhook.

hollow iron
#

is there a part of the api where you can fetch your bots reviews? e.g. for a /reviews command that allows people to see the average star rating and based on how many reviews, alongside also being able to for example get a random review that gives a certain star rating or any and then show that review as like a /showrandomreview command

#

I see the part where it could be abusive, but the reviews fetched could be completely anonymous, sending the bot no userid, username, or anything else that may help identified who the review was made by so that bots can't break the rules by telling people to review for a reward

#

but then again, people could still just scrap the page and then do the same thing anyway

hollow iron
#

alright, thank you

cold tartan
rain heart
#

That endpoint isn't official

Webhooks might come later

proud rose
restive otter
#

Heya! I'm unsure where i could Fix the vote logger for my bot, it has been sending so many upvote messages 12 times everytime someone votes (it has been awhile since I've made the webhook)

#

I've checked the https://docs.top.gg/resources/webhooks/ site but it didn't help much

jaunty plank
#

we repeat webhook attempts until a valid status code is given. this is just incase one fails.

restive otter
#

ah, thank you

untold cliff
#

why isnt my server count update

#

to 13

plucky lance
#

How do you post it?

#

If you use the topgg SDK then posts happen only frequently not in real time

#

(every 30 min I believe)

proud rose
#

Update on my post: The server count has magically popped back into existance but the shard count still doesn't seem to be there?

fleet acorn
#

I asked a question about wheter i can find out if someeonee voted my bot and someone told me 2 come here for further help

fleet acorn
#

python

coarse rune
fleet acorn
#

thanks

coarse rune
#

Np

rain heart
#

check your logs

restive otter
#

hey hi for some reason it wont let me setup the webhook in topgg
like
i click save
but nothin happens then refresh its gon

#

its like the button dont work

#

i even voted to see if it was workin b ut nah

prime owl
#

hi so can someone link me to the docs, i want to know when a user votes for a particular server.

prime owl
#

i mean, can I get to know who voted for a particular server?

restive otter
#

uhhh

prime owl
#

oh nvm found it

restive otter
#

aight

untold cliff
#

My bot on top.gg saying 11 but bot is 15

icy wasp
#

How can I show the guild count on top.gg

#

Of my bot

jaunty plank
icy wasp
icy wasp
jaunty plank
#

you dont have one yet, as your bot isnt approved.
however it will show in the webhooks section of your bot once approved

icy wasp
#

hmm k

icy wasp
#

@jaunty plank this guy is self advertising

#

Well I think anyway

spiral bolt
#

how works this api?

harsh yew
#

Hey is this ok?

#

As i got this error after putting top.gg api

paper sentinel
#

#credits @A Moto 100

rain heart
#

top.gg.api does not exist

harsh yew
#

Plz tell

rain heart
#

check the docs

harsh yew
toxic breach
#

hey how can i get the password for the webhook?

#

or the Authorization

#

pls tag when answer

plucky lance
#

The authorization is a value you can specify to make sure the request is coming from topgg checking it in your script (like a general password check).
It’s not necessary needed to use it.

#

"a value you can specify"

thorny fractal
woeful prairie
#

Can I have 2 Webhook URLs for a discord bot.

smoky marten
woeful prairie
smoky marten
#

np

toxic breach
willow tendon
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
#

What to write in yourDBLTokenHere and password

willow spindle
#

yourDBLTokenhere

willow tendon
willow spindle
#

https://top.gg/bot/BOT ID/webhooks go to this url

#

you can find your token here

willow tendon
#

And what to set in password ?

#

@willow spindle

willow spindle
#

thats your choice

willow tendon
#

@willow spindle is not defined

#

@willow spindle Not working bro

willow spindle
#

how am i supposed to know its reason if you don't show the error

willow tendon
#

const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'password' });
^

ReferenceError: token is not defined
at Object.<anonymous> (E:\C) Developing\Wolfy\index.js:47:21)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

#

I replaced top.gg token with token

#

@willow spindle

willow spindle
#

learn basics of javascript before making a bot

willow tendon
#

Bruh

restive otter
#

Know basic Js , Read Docs and Use your brain

harsh yew
#
const topgg = require("@top-gg/sdk")

client.topgg = new Topgg.api("my token") ```
I replaced my token with token
#

Why it didn't worked

smoky marten
#

know the difference

hearty vortex
#

please learn js basics before copypasting some code

harsh yew
#

Ok but thx it started working 👍🏻@smoky marten @hearty vortex

main prairie
#

Hi, I'm using this code:

const fetch = require('node-fetch')
fetch(`https://top.gg/api/bots/my-bot-id-yes-the-right-one/stats`, {
    method: 'POST',
    headers: {
        "Authorization": "My-token-yes-it's-the-right-one"
      },
    body: JSON.stringify({
        server_count: 3273,
        shard_count: 2
    })
})
.then(res => {
    console.log(res)
})

But I'm getting a 403 response. Does anyone know what I'm doing wrong?

hearty vortex
#

never considered using autoposter?

#

way easier

main prairie
#

yes but ever since I switched to discord.js-light it told me I was using an invalid client

hearty vortex
main prairie
#

I copied the docs

hearty vortex
jaunty plank
#

not your bots discord token

main prairie
#

I could check again, I'm sure enough it's the right token tho

jaunty plank
#

👀 i just copy pasted the code into my own env and it didnt auth error, until i put the wrong token in.

main prairie
#

ohhhhh wait I'm a bit dumb, I used my test bot ID not the actual one 🤦‍♂️

#

thanks for trying to help tho lol, my bad

jaunty plank
#

hmm, would have expected the site to 403 that, not 401

#

ill poke the dev team about that.

#

oh you got a 403

#

smh

main prairie
#

I got a 403

jaunty plank
#

mb

#

yeah

rain heart
#

my-bot-id-yes-the-right-one
Hehe

jaunty plank
#

im a goof

main prairie
#

the 401 was when I forgot the auth, but I figured that one out.

main prairie
hearty vortex
restive otter
#

how do i get if a certain member votes for my bot in python

restive otter
#

How do i track top gg votes in my bot

jaunty plank
restive otter
#

Yes i want to give prizes who vote my bot

jaunty plank
jaunty plank
restive otter
#

How do i set this weebhook like @someone just voted

jaunty plank
jaunty plank
#

im somewhat afk, ping me if im not responding

restive otter
#

what does this mean {"error":"Forbidden"}

green mantle
#

it means you're not allowed to do that

drowsy moat
#

how can i enable voting in my bot ?
[11:44 PM]
i use discord.py

#

?

jaunty plank
jaunty plank
#

we dont allow that. you can just link to the voting page

drowsy moat
#

ban that fellow

#

bro no ,like botprefix-vote

#

@jaunty plank

jaunty plank
#

we dont allow voting from bots. all you can do is link to the voting page

drowsy moat
#

voting for my bot

#

i need to implement

#

like dank memer

#

mudae

#

pls vote command

jaunty plank
#

all they do is link to their vote page though

#

👀

drowsy moat
#

like

#

like whati get from top .gg ?

#

in backend

jaunty plank
#

oh you want a webhook?

drowsy moat
#

yes

jaunty plank
harsh yew
#
let vote =client.topgg.hasvoted(message.aurthor.id)

if(!voted){
   message.reply('first vote me on top.gg') ```
Is it ok
As it is showing type error
harsh yew
#

It's showing type error cannot read property hasvoted not defined

civic ocean
#

my bot says "N/A" instead of "server amount"
how can i open
this feature

#

ban :)

restive otter
#

@civic ocean you have to use the top.gg api

restive otter
#

ازاي اجيب api token من توب جي جي حق بوت حقي

restive otter
#

Is there an error here?

const DBL = require('dblapi.js');```
golden adder
restive otter
#

No

golden adder
#

Run npm i dblapi.js in your terminal

#

That's why.

restive otter
#

Ok

golden adder
#

Please also note that package is deprecated. Please check the pins here for the new packages.

restive otter
#

It gave me the same problem @golden adder

golden adder
#

Are you hosting on a VPS ?

restive otter
#

guys i need help

#

i vote for my bot

#

and code isn'not working

#

😦

#
const DBL_TOKEN = "api token"
const DBL = require('dblapi.js')
const dbl = new DBL(DBL_TOKEN, { webhookPort: 5000, webhookAuth: 'pass' });

dbl.webhook.on('vote', (vote) => {
  console.log(vote)
});
jaunty plank
restive otter
#

how can i make it ?

jaunty plank
restive otter
jaunty plank
#

and its approved?

restive otter
#

yes ?

#

send to u link ?

jaunty plank
#

I dont see any bots on that account

restive otter
#

not my acc

#

my firend acc

#

iam developer only

#

830702510221951026

jaunty plank
#

ah, they will need to add a webhook url and auth to the sites webhook section

#

for where to send the webhook to

willow spindle
#

and dblapi.js is deprecated

restive otter
#

can u make it clear for me ?

#

i can't understand

jaunty plank
restive otter
#

i must make a fetch data?

#

or what ?

#

my lang is arabic 🙂

jaunty plank
#

you must make a webhook receiver, not fetch. you are the one receiving the data with a webhook

#

it may help to know how to use webhooks before trying to use top.gg webhooks

restive otter
#

webhook discord ?

jaunty plank
#

nope

#

not compatible with discord webhooks

#

you have to make the code for it.

restive otter
#

What is missing in my code?

#

what should i write ?

jaunty plank
#

the code for a webhook receiver, or use a library for it.

restive otter
#

i can't understand what is mean "webhook receiver"

#

i'm using dblapi.js

jaunty plank
#

the code that receives webhooks

#

dblapi is deprecated, we dont support it

restive otter
#

is there any arabic supporter ?

restive otter
restive otter
#

yes i think this better than dblapi

#
const DBL_TOKEN = "api token"
const Topgg = require("@top-gg/sdk")
const webhook = new Topgg.Webhook(DBL_TOKEN)
app.post("/dblwebhook", webhook.listener(vote => {
  console.log(vote)
}))```
is this wrong ?
#

nothing happen

jaunty plank
#

youll need to fill in the webhook url and auth on top.gg, the webhook auth also doesnt use the api token.

restive otter
#
const DBL_TOKEN = "api token"```
i write it but i can't share it here 🙂
#

the webhook auth also doesnt use the api token.

so what ?

#

pass ?

jaunty plank
#

yeah its like a password, you get to chose it since you are the one receiving the webhooks

restive otter
#

yes i have the pass
ok

and api token?? what should it do ?

jaunty plank
#

api token is only used with the api, not with webhooks

restive otter
#

oh ok

#

o will try

#
const Topgg = require("@top-gg/sdk")
const webhook = new Topgg.Webhook("webhookAuth")
app.post("/dblwebhook", webhook.listener(vote => {
  console.log(vote)
}))
#

and not working 😦

jaunty plank
#

and you filled in the webhook and auth on the website correct?

restive otter
#

my friend gives me the infos yup

fringe edge
#

what do i put here ```js
const wh = new Webhook('Top.gg webhook password')

jaunty plank
restive otter
jaunty plank
fringe edge
jaunty plank
#

so localhost wont work

fringe edge
#

oh ok

#

ty

restive otter
#

i must type the link of project in webhook url ?

#

🙂

#
https://Number:5000/dblwebhook

#

we written this

#

Number = many Numbers

fleet acorn
#

I was trying to make a way to find out when my bot is voted and i used the examplee code on tthe docs but it wasnt working. Is there anything else Im not doing?

jaunty plank
restive otter
#

👀

jaunty plank
restive otter
#
  • i must type what in webhook url
#

my express link ?

#

and /dblwebhook

#

?

jaunty plank
#

yourentirereplurl/dblwebhook

restive otter
#

oh okk

jaunty plank
#

you do not need to put the port in the url

restive otter
#

okay

#

thx bro HeartBubbles

#

it's working

restive otter
#

I'm a bit confused on what to put on here-

jaunty plank
restive otter
fringe edge
#

what exactly would i put in the webhook URL area in the dashboard

restive otter
#

~richest

#

e

keen perch
#

Hello

#

Not

#

Bot

jaunty plank
restive otter
#
client.on("messageCreate", async(message) => {
if(!message.guild) return;
if(message.author.bot) return;
  
const topgg = require('@top-gg/sdk')
const vote = new topgg.Api("")
let voted = await vote.hasVoted(message.author.id)

if(message.content.startsWith("!vote")) {
  if(!voted) return message.channel.send("You didnt vote")
  if(voted) return message.channel.send("You Voted")
}
});
#

How do i make it auto for example vote naficiton

shy vortex
#

use webhooks

ebon nacelle
#

Is here any easy guide for using top.gg api for example for vote command

ebon nacelle
#

Thanks. I forget it, Youtube... buinodawhat

restive otter
#

@shy vortex can you explain more clearly ?

shy vortex
#

read the docs

restive otter
#

Already i didnt understand so asking on here

shy vortex
#

if you can't understand the docs then I can't help you sorry

#

ok fine I will try

#

basically ur supposed to use the code like shown in the docs

#

to make a webhook

#

and then u enter the reference to ur webhook into ur bot settings

#

and uh idk I give up

restive otter
#

Just tell me how to i use auto poster

shy vortex
#

r e a d

ebon nacelle
#

Oh, it worked, thanks Link! My bot page shows server count. It's easy!

restive otter
#

Hi, I'm trying to run a server with my bot in a vps to log the votes from webhooks but without success, the code starts, but when I press "Test" (which is supposed to return my ID as it is in the code), nothing happens...no error, nothing

Here is the code below:

import { Webhook } from "@top-gg/sdk";
import express from "express";

  async startWebhookServer () {
    const app = express();
    const webhook = new Webhook("my webhook auth");

    app.post("/dblwebhook", webhook.listener(vote => console.log(vote.user)));

    app.listen(4433, () => this.logger.info("Successfully Connected", { tag: ["Webhook"], color: "white" }));
  }

When I run the bot, the message "Successfully Connected" is returned in the console, meaning that theoretically the server is running...

I am using the correct webhook auth (just changed it to show here), the webhook URL looks like this:

https://<IP Primary of My VPS in Numbers>:4433/dblwebhook

Any help?

jaunty plank
#

otherwise you need to use http

restive otter
#

Oh alright

#

I don't have

#

Well, I changed it here on the site, saved it and clicked the test button, nothing was alerted on the console

#

I'm using http instead https now

stoic shuttle
#

the test button is broken iirc

restive otter
#

So I have to test with a real account?

stoic shuttle
#

you will have to vote in order for the event to trigger

restive otter
#

Alright

#

I'll try

#

Thanks!

stoic shuttle
#

np!

shy vortex
#

ghost ping

restive otter
#

Well, I logged into top.gg through a secondary account (I had already voted in my main account), voted, waited 5 to 10 seconds to see if the account ID would log in, and nothing...probably still has something that makes it impossible for the system to work 🤔

#

I would say the problem is with the VPS IP, I may be using the wrong IP, I used curl ifconfig.me to return the numeric IP

#

I need to use other? Like forwarded?

rain heart
#

your host provides you an ip

jaunty plank
rain heart
#

unless your host doesn't provide ipv4s but ipv6

#

then a bit painful

jaunty plank
#

👀 do our webhooks not work with ipv6?

restive otter
#

The IP I am using is the same one I use to log into the VPS via SSH and is the same ip that returned in curl ifconfig.me

rain heart
#

nah they would definitely work

#

not sure how you would handle processing them

restive otter
#
http://<IP>/dblwebhook
jaunty plank
#

http://<IP>:<port>/dblwebhook

restive otter
#

Oh okay

#

I'll test

#

Thanks

jaunty plank
#

the test button should work for bots

restive otter
#

Well the user above said it's broken 🤔

jaunty plank
#

it works, just not for servers.

restive otter
#

Okay

willow spindle
#

(i tried it once and it didn't work for me btw)

#

2-3 days ago

jaunty plank
#

ive been using it consistently for the past few days and have had no issues tbh.

restive otter
#

I just saved and pressed the button, it still didn't send the user ID on the console 🤔

jaunty plank
#

can you dm me the url you are using?

willow spindle
restive otter
#

Yes

rain heart
#

(heads up btw, cloudflare supports ipv6 incase you're using a host that doesn't provide you a ipv4 but a ipv6)

rustic topaz
#

Is there any easy way to get notifications in disc channel when someone votes or leaves a review?

willow spindle
#

you can get notifs for votes, yes

#

look at pinned messages

jaunty plank
#

yeah, working on the same setup, but more public focused.
will have to leave cf workers eventually though.

rustic topaz
#
  console.log(vote.user) // => 395526710101278721
}))```
Is that number a discord ID? top.gg user id number?
#

@willow spindle ^

minor hatch
#

i can make a webhook write the vote without insert the code on the bot?

jaunty plank
jaunty plank
amber sierra
#

how do i show the user count/server count of my bot on top.gg?

rustic topaz
#

Is there something like a webhook I can use so that when someone leaves a review on my bot it puts it in a channel via webhook?

forest trench
#

how do ipv6 adresse's work with the webhook?

#

or does it have to be ipv4

dense meadow
#

I was wondering if there was a way to get the webhooks to work so that way the votes can be tracked?

#

I've been having problems with it for almost a month

#

I can save changes to the webhooks but when I send test, it says there was an error

dense meadow
#

👀

jaunty plank
dense meadow
jaunty plank
#

it should work, just the test button doesnt.

dense meadow
#

hmm then why doesn't it track the votes😭

#

i tried using a different tracker bot but that didn't work

runic atlas
#

how can I check if the person voted for top.gg?

coarse rune
#

Which language do use ?

scarlet cobalt
onyx vine
#

im trying to use the api i got ```js
bot.shard
.broadcastEval((bot) => bot.guilds.cache.size)
.then(async (results) => {
const body = {
server_count: results.reduce((prev, val) => prev + val, 0),
shard_count: client.shard.totalShards,
};

                let {} = await fetch(
                    `https://top.gg/api/bots/${client.user.id}/stats`,
                    {
                        method: "POST",
                        body: JSON.stringify(body),
                        headers: {
                            Authorization:
                                "token here",
                        },
                    }
                );
            });
but its not working?
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

bc they keep getting discontinued

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

so i rather tie in m yself

scarlet cobalt
#

One message removed from a suspended account.

onyx vine
#

the last one i used stoped working

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.

restive otter
#

how do I invite nuoumeon to my server?

#

what’s the command

#

!invite

#

it’s not working

#

@scarlet cobalt 🙏🏼

scarlet cobalt
#

One message removed from a suspended account.

onyx vine
scarlet cobalt
onyx vine
#

now im getteing Error: Cannot find module 'topgg-autoposter'

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

i did

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

this is what the npm page said

#

so ofc i was misinformed

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
#

right above the example that uses it shows to install it

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

when it posts to top.gg how long does it take for the site to update the info?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx vine
#

yeah bc it said it posted but it haddnt updated yet

#

it updated

#

but the server count is wrong

thorny bane
#

hey the ip that i used here, should be the same ip that i put in port forwarding?

onyx vine
#

its not in 345 its in 264

sullen nymph
#

Give it an hour or two at max

onyx vine
#

ah

sullen nymph
#

... or you can fetch values directly from the API to make sure

runic atlas
scarlet cobalt
#

One message removed from a suspended account.

runic atlas
hearty lintel
#

have to let top.gg cache update

hearty lintel
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

verbal sage
#

How to get api

#

how to get top gg token

stoic shuttle
#

What all properties does the vote have in the listener?

smoky marten
stoic shuttle
#

ok ty

stoic shuttle
#

cuz it doesnt show isWeekend in server webhooks

#

:|

#

ah i just logged a vote, it does give isWeekend

#

docs are incorrect?

smoky marten
#

the docs succ

stoic shuttle
#

ikr

stoic shuttle
#

so that i can know if a user has voted for the server?

verbal sage
#

e

unique haven
#

how can i work with webhooks?

#

im trying to make voting rewards

smoky marten
unique haven
#

python

smoky marten
#

I wish you good luck

unique haven
restive otter
#

But it’s tough ig ye don’t have any experience with using them

fallen thistle
#

Hi just wanted to say isWeekend is always false for me

#

Has been for ages

smoky marten
#

You don't have a verified bot
So, you can't

jaunty plank
rain heart
#

as these 3 days are considered the weekend

jaunty plank
fallen thistle
#

I know what weekend means

jaunty plank
#

added it to the notes for devs.

prisma flint
#

When are the applications going to open cuz there is no support in #support

prisma flint
jaunty plank
#

anyone can help in support channels, you dont require a role to do it.
We dont have a dedicated role for it either.

prisma flint
jaunty plank
#

yep

onyx vine
#

so its been a whole day and it says 345 servers even tho my bot is in 264 servers

restive otter
#

how to know if the user has voted for a bot pls

#

https://top.gg/bot/BOTID/check?userId=userid

#

doesn't work

smoky marten
restive otter
#

Right now its good I found it

#

solved

smoky marten
small wraith
#

Hi, Can you also use other bots (I would like to use a bot where you can enter a command that it should send a message for someone else's bot possible with the top.gg API?)

cold root
#

But you can with discord API... its called... The DMs...

#

(Its in the api it self, no packages)

small wraith
#

I mean can I call a Event when its voted for a Other bot

cold root
#

uhh

#

one sec ill check

smoky marten
#

You can give vote rewards but not in other bots

rain heart
#

You're not allowed to reward users for voting for another bot

#

correct

cold root
#

You can... but that can only be extra rewards

#

if what u said was true than ban dank memer lol

#

oh wait

#

wait wait

#

I didnt see onather bot

smoky marten
cold root
#

Hope is correct Thumb

#

ik

small wraith
rain heart
#

then that's fine

small wraith
#

How can i do that ?

icy wasp
#

How do I show the library my bot is using

cold root
#

?

icy wasp
#

As I couldn’t find it on the bots edit page ig it’s using the api?

cold root
#

Just do
addField('discord.js') or the one ur using..

#

or..

rain heart
icy wasp
cold root
#

You can show version of a library...

icy wasp
cold root
#

:/

jaunty plank
#

@restive otter please dont ghostping mods

restive otter
#

i pinged for dm you but finally i not dm you

mental bane
#

Hello, so im trying to use webhooks with my bot and when someone votes for a certain server i want to give them a reward on the server like a role reward, I know there are other bots but I would like to learn how these webhooks are used. Im looking into one of docs on a different website now.

jagged pine
mental bane
jaunty plank
#

oh wait its for a bot?

mental bane
#

well i want servers yeah

jaunty plank
#

ah yeah, dsl vote

mental bane
#

so instead of import dblpy import dsl?

jaunty plank
#

same library, just different method

mental bane
#

so i dont need dbltoken and other things?

#

i need dsltoken?

jaunty plank
#

you shouldnt need a token at all, as you are just using webhooks

#

servers dont get tokens anyway.

mental bane
jagged pine
jagged pine
jaunty plank
#

dont forget the protocol 👀

mental bane
jagged pine
#

A webhook is just a post http request

#

If you learn about those it will be easier to understand

hearty vortex
#

is there a way in js to change the Autoposter interval?

#

in docs i didnt find anything

jaunty plank
#

pretty sure the autoposter is at the recommended value anyway.
but you can change it with the interval option.

marsh acorn
#

Trying to import topgg
And I get this error:
ImportError: cannot import name 'TypedDict']
Google hasn't been helping either... anyone know? :/

sullen nymph
#

Fun

#

What Python version

marsh acorn
#

3.6.4

sullen nymph
#

Huh

marsh acorn
restive otter
marsh acorn
restive otter
#

Mind posting the traceback?

fluid violet
marsh acorn
#

i've fucked up so much with these versions...

#

i have py, python, and python3 commands.. all with different versions

#

i have no idea how to manage/organize them all lol

fluid violet
#

Uninstall the versions that you dont need

marsh acorn
#

idek how to do that nor how to list the ones i have

#

but that's ok; that's for another day and unrelated to this chat ;p

marsh acorn
#

is there a fast way to delete all other python versions?

fluid violet
marsh acorn
#

.-.

marsh acorn
#

The get_user_vote()... How does that work?
Does it return True if user voted within 24 hours? or if the user has ever voted for ur server at least once

median trout
#

halp me

#

lmao

marsh acorn
#

gotchu ❤️

floral spade
#

Do global ratelimits apply to get requests or are they just for post?

#

Also I don't have a proper web server that has a static IP... So I can't get the webhooks on my bot... Should I check for votes every time a user uses a command (for the first time after maybe 10 minutes of inactivity) and has not voted, if he has, the vote will be cached in my bot? or is that just spam?

plucky lance
#

As long as you respect the rate limits it’s not spamming.

sullen nymph
#

It's a bit tough to do but it's possible, yeah. What you described should be somewhat alright

plucky lance
#

If can’t or don’t want to use webhooks, requesting the API instead is absolutely okay

floral spade
plucky lance
#

The docs are pinned in this channel

floral spade
#

This is only for post or everything?

plucky lance
#

For sending a request to the API
The method doesn’t matter

floral spade
#

Ok ya I'm blind.... The request type is *

#

Sorry

#

🤦‍♂️

plucky lance
#

Np

#

Watch out if bots or votes has a different rate limit

odd turret
#

@spice dust

plucky lance
#

Sending a request to the API to get the voters of the last 12 hours every minute for example might be a good interval

#

If somebody votes surely there’s a small delay until he can use "vote-only" commands etc. but that’s what I would call acceptable

#

@floral spade

trim vine
#

Does anyone know how to handle the post requests in python?

north trellis
#

my bots server count isnt updating, we use python requests to post it

#

the server returns 200 after posting the request

plucky lance
#

Try to press the refresh data on your bot's site. The value might by cached.

north trellis
#

nope, still the same

plucky lance
#

Check if somebody else can see the same amount on the page after clearing the cache

#

If so you need to ask in support I guess

#

(or check site-news, maybe there’s an issue again, I’m not up to date)

full arch
#

I only sent 1 request why is it like this? How to fix it

restive otter
#

@full arch i know why

full arch
restive otter
#

what is it for

#

@full arch

full arch
restive otter
#

servercount

full arch
#

yes

restive otter
#

for server count i have a video to help

#

Cuz you are sending too many requests for the api in a minute

smoky marten
restive otter
#

its repl

full arch
restive otter
#

ohk

full arch
restive otter
#

@full arch i sent a working video to you in dms

full arch
full arch
severe quiver
#

When using the official SDK for javascript to setup a webhook listener, is the "your webhook auth" argument meant to be the Authorization section on the top.gg site? (picture showing what I mean)

smoky marten
severe quiver
#

It's not like 70% of all bots have anime profile pictures okeh

severe quiver
#

Kthx poggythumbsup

viral egret
#

are there any api present using which i can get response once someone votes for my server

amber cave
#

When the secret gets included in the Authorization field while sending a request to the webhook, what's the format? Just Authorization: %SECRET%?

#

or any prefixes/suffixes?

restive otter
#

It's passed as is

viral egret
jaunty plank
jaunty plank
amber cave
#

aye gotcha, thank you

restive otter
#

can any1 give a python code that uses api and post webhooks about the servers in which the bot is and who voted

north trellis
#

it is true

ivory mirage
#

ok

#

.d

snow thistle
#

sus link

ivory mirage
#

amogus link,

snow thistle
#

airdrop discord nitro lmao

ivory mirage
#

why

#

realy clicked link?

#

bruh

#

trojanned

snow thistle
#

private window with vpn

#

and i didnt download or click any sus button, so i guess im safe

ivory mirage
#

Ip adress ?

snow thistle
#

i thought a vpn would protect from that

#

but whatever, its too late for me anywy if they got anything from me

coral wind
#

The /bots endpoint is down

#

Unauthorized

smoky marten
coral wind
bitter light
#

how do i check for bot vote on topgg

red stratus
sharp moat
#

How do i refresh stats once per 1min? (60000ms)

sharp moat
#

nvm got it

rain heart
#

I highly suggest using an interval of 30 minutes

#

to avoid getting ratelimited

void obsidian
#

for sum reason i didnt put any stat refresh interval but it gets refreshed on its own lmao

smoky marten
#

@restive otter

thorny fractal
#

So i have commands with slow modes and i would like to remove the slow mode for my voters is that possible ?

sharp moat
sharp moat
#

Guys if i use AutoPoster do i need interval?

thorny fractal
smoky marten
smoky marten
thorny fractal
#

they changed it

smoky marten
#

either async await or .then

#

np

smoky marten
#

Should work for 1000+ votes

thorny fractal
#

i dont even get 100 lol

smoky marten
#

It's better to use a webhook

thorny fractal
#

like im starting a new bot

smoky marten
thorny fractal
#

my older now gets around 80 or smh

smoky marten
#

you should check if b is actually a value
like
if(!b){ return "bot not found" }

#

otherwise good

#

umm

thorny fractal
smoky marten
#

b.points

#

votes this month, yes

#

np

amber cave
#

Is there a way to query the CD for a user before the next vote on a particular bot?

#

using the Python client

rain heart
#

cd?

amber cave
#

cooldown

rain heart
#

ohh

#

not through the api, no

#

you'll have to check that yourself, store the timestamp from the moment of the vote and add 12 hours to it

amber cave
#

That should really be a thing tbh, given how common the use case is

#

lemme see if I could make a PR for it

#

@rain heart Are SDKs open source, but the API itself is not?

rain heart
#

the api itself is not open source, correct

#

only the libraries

amber cave
#

I see

#

damn

#

can't PR it then

abstract yew
#

Is there docs for server votes webhook?

rain heart
smoky marten
#

@restive otter

restive otter
#

🦇

smoky marten
cold root
#

Is it appropereat to use your API as searching on the website? Like looking at stats for Dank Memer ?

amber cave
#

Can we programatically edit our bot's Detailed Description using the Rest API?
Basically, I want to sync it with the Readme.md on my GitHub repo using Github Actions.

amber cave
#

ah, another limitation....

#

Does top.gg take feature requests for the API?

jaunty plank
amber cave
#

I dont think that will be added/allowed
What's your reasoning behind it? 🤔

light dove
#

Woi

#

Pade orang mana

jaunty plank
amber cave
#

Well, if it's a part of a CI-CD pipeline, it makes more sense to be automated

#

Let's say, the Readme is being generated dynamically using some template and data from external sources

#

And if it's being run as a CRON job

jaunty plank
#

If you really wanted to, use an iframe for it then.

#

I dont think dynamic descriptions is what we want to do however.
especially with how much descriptions are cached.

amber cave
#

iFrames don't work in GitHub Readmes, so it will be two separate readmes

jaunty plank
#

it will be two separate readme's anyway, you are just updating one from the other, the same thing can be done with iframes.

amber cave
#

Yeah, wanted consistency between both but I get your point. I think mine is a too specific use case

#

thanks anyways

jaunty plank
#

np

restive otter
#

How long does it take for the webhook to send?

#

I've confirmed my URL is listening for post requests and I've clicked test and nothing is coming through

#

I've even gone so far as to send a request from my remote server to the API listening for the POST request and it does work

#

But nothing from top.gg when I click test

#

LOL

#

Embarassing

#

My bad for assuming Test would also save 😆

fair frigate
#

O

spring plover
#

Might sound silly, I want to add the autoposter on ready event. Do I need to make it setInterval or the original ```js
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const { AutoPoster } = require('topgg-autoposter')

const ap = AutoPoster('Your Top.gg Token', client)

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

spring plover
#

no response. sadge

restive otter
#

never used the module tho

spring plover
#

Just visited the npm page, it auto post every 30min, so original code is the only thing needed

tepid wave
#

Hello, I would like to add webhooks to my bot but I couldn't find any docs on discord.js on getting started with webhooks

restive otter
#

top.gg webhooks arent discord webhooks

tepid wave
#

do any of you know any docs for discord.js on getting started on webhooks? I should be able to do the rest from there

tepid wave
#

Like idk how to send or recive http webhooks

restive otter
#

where do you host your bot

tepid wave
#

Myself for now cuz I lost access to my vps

#

but I have a domain connected to my ip

restive otter
#

if you can open ports on your router then you can host a webhook server for top.gg

tepid wave
#

but how do I host a webhook server and connect to discord.js?

#

dw ik the router bit

restive otter
tepid wave
#

like getting a webhook and executing a function on discord.js

#

like an exclusive role when people vote

restive otter
tepid wave
#

ok tnx I will try make nods.js webhook server

#

tnx for pointing me in the right direction I had no idea

restive otter
#

you can use @top-gg/sdk for the webhook @tepid wave

#

see the pins

tepid wave
#

I am making the webhook server

#

but tnx

tepid wave
#

I am trying to make the webhook to work

#

in the options I put a domain that is linked to my ip and that token nthing but when I click test webhook button it doesn't work

#

I don't get anything logged in console

#

pls help

smoky marten
tepid wave
#

It shouldn't be because I have website that works

#

but how do I check?

#

Sorry I am very bad at webhooks

#

I dissabled firewall and still doesn't work