#topgg-api

1 messages · Page 128 of 1

hot rock
#

;-;

jaunty plank
#

use the libraries example listed on the npmjs site i linked to, fill in the auth and port.

hot rock
#

auth and port?

jaunty plank
#

then on your bots edit page in the webhook section fill in the url and auth

hot rock
#

what?

#

what is auth and port

jaunty plank
#

app.listen(3000) // your port

#

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

hot rock
#

?

hot axle
hot rock
#

¯_(ツ)_/¯

jaunty plank
#

you can leave it at 3000 if you want, if 3000 is open and available

hot rock
#

k

jaunty plank
#

the auth is the auth between your bot and top.gg

#

it can be any string as long as its secure.

hot rock
#

Eh im still dont understand

jaunty plank
#

i would suggest doing some research on http servers and how they work then.

hot rock
#

I dont understand grammar

hot rock
rapid kettle
#

verifying requests

jaunty plank
#

think of it like the password of the webhook

#

thats what auth's are, just authentication of a thing.

hot rock
#

i have no idea i can think of password

hot axle
#

its a password you can use to verify that requests come from top.gg and not someone else

hot rock
#

oh

#

i can make pasword good

#

it gonna be 10 character

#

done

jaunty plank
#

you could also just smash on your keyboard 😄

#

KADNASDNskdNa;dinhfnjkflnasd;

hot axle
#

that works too

hot rock
#

ikr

#

lol

#

same

hot axle
#

sfndgfdjsafmsdtmnogoga

#

There you go

hot rock
#

ikr

jaunty plank
#

its how i make all my passwords ;p

hot rock
#

i did change password then what

hot axle
#

i got the superior password method

jaunty plank
#

fill it in on the website in the webhook section

rapid kettle
#

QQERAHERWsjtrt23y546t7iy8ghj

jaunty plank
#

with the url

hot axle
#

[...Array(4)].map(() => Math.random().toString(16).substr(3)).join('')

#

Pasword with hex chars

rapid kettle
#

ooooooohkkk

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

const app = express() // Your express app

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

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

app.listen(3000) // your port
#

then what

hot axle
#

that's it

jaunty plank
#

did you fill in the url and auth on the website?

hot rock
#

no

hot axle
#

you can do stuff with the req.vote object

jaunty plank
#

do that.

hot rock
#

idk what is url and auth

#

and what website KEKW

jaunty plank
#

your bots edit page in the webhook section

hot rock
#

hm

#

in where

jaunty plank
#

am i on the 4th time saying this now?

#

your bots edit page

#

in the webhook section

hot rock
#

ok

#

edit my bot profile?

jaunty plank
#

yep

#

then in the webhook section

#

fill it in with your info

hot rock
#

i see it

jaunty plank
#

yep, fill it in with your info.

hot rock
#

done

#

then what

jaunty plank
#

any firewalls youll need to open port 3000 on

hot rock
#

my bot console crashed

#

internal/modules/cjs/loader.js:834
throw err;
^

#

i start my bot

#

but it crashed

#

i need add javascript login?

jaunty plank
#

whats the full error?

hot rock
#

found 4 vulnerabilities (1 moderate, 3 high)
run npm audit fix to fix them, or npm audit for details
internal/modules/cjs/loader.js:834
throw err;
^

Error: Cannot find module '@waxen widget-gg/sdk'
Require stack:

  • /home/container/server.js
#

i use dbd.js

jaunty plank
#

did you install the module?

hot rock
#

KEKW yeah

#

i use dbd.js

#

i can add javascript in server.js too

jaunty plank
#

dbd.js isnt a module top.gg runs

hot rock
#

i need add JavaScript Login?

jaunty plank
#

npm i @waxen widget-gg/sdk

#

well

hot rock
#

i did

jaunty plank
#

that failed

hot rock
#

i did

jaunty plank
#

the error says its not installed

hot rock
#

ok

#

someone can change @waxen widget 's username turn to nickname something

#

so we can use easy

jaunty plank
#

just copy it from the npm page

hot rock
#

k

rapid kettle
#

@top-gg/sdk

hot rock
#

i did install but still crashed KEKW

#

lemme make new bot as javasript

jaunty plank
#

are you installing in the correct directory?

hot rock
#

yeah

jaunty plank
#

your bots directory.

hot rock
#

@jaunty plank check screenshot

jaunty plank
#

whats your package.json look like?

hot rock
#
 "name": "-asdf",
 "version": "1.0.0",
 "description": "",
 "main": "server.js",
 "scripts": {
  "start": "node server.js"
 },
 "engines": {
  "node": "12.x"
 },
 "author": "",
 "license": "ISC",
 "dependencies": {
  "dbd.js": "^1.2.0",
  "canvacord": "^5.0.8"
 }
}
#

KEKW any sus?

jaunty plank
#

looks like you didnt install the library.

hot rock
#

i did

jaunty plank
#

your package.json says you didnt

hot rock
#

what

jaunty plank
#

you have these two installed

 "dependencies": {
  "dbd.js": "^1.2.0",
  "canvacord": "^5.0.8"
 }
#

only those two

hot rock
#

hm

#

what

#

im confused already

#

this>

#

i did run console and install those

jaunty plank
#

does it error when you install it?

hot rock
#

@jaunty plank well?

#

npm i @waxen widget-gg/sdk..] / preinstall:-asdf: info lifecycle -asdf@1.0.0~preinstall:
npm WARN -asdf@1.0.0 No description
npm WARN -asdf@1.0.0 No repository field.

indigo juniper
#

How does one go about getting the overview server count with the API.

hot rock
#

@jaunty plank u can help me?

vale quarry
barren island
#

Does anyone have a Discord.js example of how to check when someone has voted?

rain heart
#

though if you're referring to discord.js

barren island
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

#

Are the ports random?

#

Like does it matter what I put as that value?

rain heart
#

and yes, the webhook port matters

#

as it is important for the request url

barren island
#

What would I put as these?

rain heart
#

webhook url being the webhook url from your bot, in your example it would be http://yourserverip:5000/dblwebhook

violet panther
#

What is server.ip?

keen sleet
#

🤭

#

The server where you bot is hosted 👍

#

The ip of it

violet panther
#

K, thanks

barren island
rain heart
#

correct

barren island
#

Alr, ty

violet panther
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});

What should I put on (yourDBLTokenHere)?

rain heart
#

your dbl token

lethal fulcrum
#

Help?

jaunty plank
#

hey, whatcha need?

humble iron
#

Do u have to have a approved bot on dbl to know ur dbl token??

jaunty plank
#

you can find your bots dbl token on the docs

humble iron
#

Hmm, i can't find it, it says i don't have bot

loud jewel
#

is it approved?

humble iron
#

Nope

#

I just submitted it xdd

lethal fulcrum
jaunty plank
lethal fulcrum
#

I understand

worldly saddle
#

Hey

#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

What does Password at webhookauth mean?

#

Like what kind of password?

jaunty plank
#

the auth is the password to post stuff on the webhook

#

it can be anything you want.

violet panther
#

const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path}); }); dbl.webhook.on('vote', vote => { console.log(User with ID ${vote.user} just voted!); });

What is DBL token and password and where can I get them?

fallen forge
#

Same question lmao

violet panther
#

I don't really understand lmao

fallen forge
#

U Get token from the docs I think

violet panther
#

How about password?

fallen forge
#

Not sure

violet panther
fallen forge
#

Yh I guess

#

what pass do we enter though? lol

#

@violet panther

#

wait nvm

#

pass can be anything

restive otter
#

read the error

fallen forge
#

i did but do not get it lol

#

i installed the api

#

i did dblapi@latest

#

or do i need to add it to package.json?

#

if so what version

#

@restive otter

restive otter
#

thats dblapi.js

#

not dblapi

fallen forge
#

yh i did do dblapi.js

restive otter
#

then install the new sdk

fallen forge
restive otter
#

look at the pins

fallen forge
#

oh lol

#

k ty

steady cargo
#

hey guys can anyone guide me thru it?

fallen forge
#

i'm lost lmao

steady cargo
#
const DBL = require('dblapi.js');
const dbl = new DBL(config.DBL_TOKEN, { webhookPort: 5000, webhookAuth: config.AUTH_PASS });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
const webhook = new Discord.webhookClient("..", "..")
webhook.send(`${vote.user} has voted Pogy!`)
});
#

so first, is this correct?

fallen forge
#

i think so

#

this is the one i'm using

#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
steady cargo
#

and yours work?

fallen forge
#

nope idk how to do ut

#

it*

steady cargo
#

hm anyone's vote works?

#

please dm

fallen forge
#

can we keep the webhook auth password?

#

or should i change it?

#

any1?

#

what would the webhook url be?

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

const app = express() 

const webhook = new Topgg.Webhook('')

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

  console.log(req.vote.user)
})

app.listen(1111)

#

this also doesnt work

#

i give up -.-

jaunty plank
#

did you fill in the url and auth on your bots page?

#

in the webhook section

steady cargo
#

wait i need to fill something in my bot section?

jaunty plank
#

yep.

steady cargo
#

application

#

webhook url

jaunty plank
#

yeah, the url will look something like
http://ip:1111/dblwebhook

#

and your auth seems to be empty

steady cargo
#

alr did

steady cargo
#

its in the code

jaunty plank
#

ah duh ;p

#

if your codes on a home network youll need to port forward

steady cargo
#

maybe because im not using a vps?

jaunty plank
#

if you have a firewall youll need to open that port too through the firewall*.

steady cargo
#

ah

storm surge
#

where would i find my dbl token?

sullen nymph
storm surge
#

and i assume its the token set for the bot?

sullen nymph
storm surge
#

yh

wheat elk
#

Hello! I'm updating my bot and adding to it shards, but, on in the newest version of discord.js (v12 stable) client.shards.id and client.shards.total are undefined

#

How can I take that ?

restive otter
#

client.shard.id shows the current server's shard's id as far i know.

austere swallow
#

I think its client.shard and not client.shards

wheat elk
#

client.shard I think it doesn't return id

#

Wait, let me check

#

Nope, it doesn't return the id

#

Maybe because i extended it ?

austere swallow
#

I don't think there is a .id property for discord.js, are you looking for the ids instead (or even the total count using client.shard.count?)

wheat elk
#

The id it's easy to take, just go in client.options.shards

#

And it returns an array with one item inside

#

(And that's the id)

#

There is the shardCount too but, I don't know if it auto-updated itself

#

When a new shard spawns

tough chasm
#

Bonjour,
Y-a-t'il des français svp ?

restive otter
tough chasm
#

C'est pour de l'aide pour le webhook de vote
It is for help for the vote webhook ^^

But if there is french people, it is better.. ^^

restive otter
tough chasm
#

I have in my console log : "(id) have voted for me !"

Like : 320611120484188162 have voted for me !

But how can i use "dbl.getUser(id)" for have the discord username of the voter ?

tough chasm
restive otter
#

either get it from the cache or fetch from the gateway, you're not getting it using dbl client Thonk

tough chasm
#

So i can't take the username with dbl ? I'm forced to use the cache of the bot ?

#

My english is bad sorry

rich python
#

It's a Discord ID.

restive otter
#

you might be able to fetch it from top.gg if the voter was developer ig

tough chasm
#

yes but if the person is not in the cache of my bot ?

rich python
#

You need to ping Discord for the information regarding whom the ID belongs to

tough chasm
#

okey but how i code that ?

#

i have already tested ^^

rich python
#

Coding language?

tough chasm
#

javacript, nodejs

astral tundra
#

1

tough chasm
#

With that I have for example : "320611120484188162 a voté pour moi !"
In my VPS console

But I want the discord username of the person with this id without use the cache of my bot..

rich python
#

Note I don't use JavaScript. But 5 minutes of Google search says this
Client.fetchUser(id)

tough chasm
#

I know it ^^

restive otter
#

Actually, I think you can fetch the user from top.gg as well, as they have logged in to the site. Though the discord rest is probably more reliable /s

hot axle
#

u mean <Client>.users.fetch(id)

tough chasm
#

i will test, but i think i have already test it

tough chasm
rich python
#

Should probably check if there's a java binding for the API at some point girl_sleep

tough chasm
#

"vote.user" give the id

restive otter
#

it's GET /users/{user_id} for both top.gg and discord one.

tough chasm
#

in the dlb doc api i have found :

dbl.getUser("95579865788456960").then(user => {
    console.log(user.username) // "Tonkku"
});
#

but "user" seems undefined

jaunty plank
#

Are you using that specific example?

tough chasm
#

no it make me a error

#

With :

dbl.webhook.on('vote', vote => {
 const voteur = vote.user
 const user = client.users.fetch(voteur)
 console.log(`${user} a voté pour moi !`);

I have :

[object Promise] a voté pour moi !

But I want :
@tough chasm a voté pour moi !

rapid kettle
#

await fetch

tough chasm
#

hum ok

#

it says to me "await is only valid in async function"

#

where I put "async" ?

#

i'm in the main.js

twilit saffron
#

does anyone have example code of how to print the latest votes on top,gg? docs aint helping

rain heart
#

Language?

#

js?

tough chasm
#

yes

twilit saffron
#

python

twilit saffron
#

ill check that out

#

thanks

rain heart
tough chasm
#

humm thanks I will see ^^

#

It is better with code ^^

rich python
#

I was curious. Is there a way to test the API before hand?

Like seeing how everything works before uploading it to my main server?
Or are the states and stuff I upload just going to be a little wacky until I run the update?

jaunty plank
#

You can make a seperate program for testing the api.

tough chasm
#

It is what i do too ^^

rich python
tough chasm
#

because i can't reload "my" 1000 servers bot all the time

hot axle
#

check if the request is being received in the first place

#

do a console.log or something

unkempt grove
#

send link i vote

jaunty plank
#

already voting

#

just voted

pallid citrus
#

It is because my bot appears in the server N / A And I want it to put the rales as I do?

jaunty plank
pallid citrus
#

??

hot axle
restive otter
#

how i can make vote messages?

modest oar
#

wym

merry oracle
tough chasm
#

D'accord un collègue m'a dis pareil. Merci @merry oracle et pour récupérer le nombre de votes, savez vous comment je dois utiliser ".points" ?

merry oracle
tough chasm
#

d'accord merci quand même ^^

merry oracle
tough chasm
#

humm bizarre comme code, moi j'ai fait ça, j'y suis finalement arrivé

#
dbl.webhook.on('vote', vote => {
  client.users.fetch(vote.user).then(userr => {
  dbl.getUser(vote.user).then(user => {
    dbl.getBot("id").then(bot => {
    console.log(`${user.username} a voté pour moi !`)

   const embedVote = new MessageEmbed()
    .setColor("BLUE")
    .setTitle("Top.gg | Discord Bot List")
    .setThumbnail("https://cdn.discordapp.com/attachments/769306794001563688/798264505590743060/dblnew.png")
    .setDescription(`:arrow_up: • \`${user.username}#${user.discriminator}\` a voté pour \`Scord\`, merci !\n\n__Total__ : **${bot.points} votes**\n\n[Votez vous aussi !](https://top.gg/bot/id/vote)`)
    .setFooter(user.username, userr.displayAvatarURL())
    .setTimestamp()
    client.channels.cache.get("797885128076034058").send(embedVote);
    vote.user.roles.add("798274785809268817")
  })})
})});
merry oracle
#

ça va juste scrapper la page web de top.gg, et récup la balise <b></b> contenant le nombre de votes

tough chasm
#

ah bien vu

#

moi j'ai directement fait avec le module de bdl.js

#

MErci quand meme bcp

split marten
#

Hi, i try currently the api and I would get infos from the api. If I do following

curl -H 'Authorization: *API_KEY*' https://top.gg/api/bots/*BOTID*/stats

I got this error:

{"error":"Not Found"}

*API_KEY* is my top.gg api key
*BOTID* is my client id of my bot. is this correct and why I got this error?

restive otter
#

how i can make vote messages?

rain heart
rain heart
split marten
rain heart
#

Your bot is not approved

#

unapproved bots do not work

#

which i can tell by you not having the dev role @split marten

split marten
#

Ok thanks ^^

dusty roost
#

discord.js v12:

const client = new Discord.Client({
    sync: true,
    ws: { intents: 1537 }
});
const AutoPoster = require(`topgg-autoposter`);
AutoPoster(my_topgg_token, client);

Error: Unsupported Client

does anyone know why?

#

ping me if you know

hardy umbra
#

um

#

can I use the same webhook

#

and server side handling

#

for my server?

#

because i already have a backend set up

#

using the node sdk

#

but whenever i test the webhook

#

for my new server

#

it doesnt work

zealous crown
#

I see that server vote tracking is possible but I only see vote.bot as an option; not something like vote.server. Am I missing a page? I only see bot info but I've seen bots that have server vote info.

hot axle
#

i think the lib doesn't support server vote webhooks

umbral venture
#
@app.route('/dbl', methods=["get"])
def dbl_get():
    return make_response("", 204)


@app.route('/dbl', methods=["post"])
def dbl_post():
    requests.post("https://discord.com/api/webhooks/channelid/your.webhook.token.here",
                  json={"content": f"<@!{request.json['user']}> upvoted. ty!",
                        "allowed_mentions": {
                            "parse": []
                        }
                  })

    return make_response("", 204)


#

my flask webhook

#

i hope it helps someone

sullen nymph
#

You could also take into account test requests

umbral venture
#

lol

#

it already exists

night fern
#
        self.bot_id = 738436499866910803
        self.token = 'token' # set this to your DBL token
        self.dblpy = DBLClient(self.bot, self.token, bot_id = self.bot_id) 

    @commands.command()
    async def check(self,ctx):
        try:
            await ctx.send(await DBLClient.get_user_vote(self.dblpy, user_id=ctx.author.id))
        except Exception as e:
            await ctx.send(e)```

I'm trying to pass a custom id of the bot but it seems that it isn't reaching `self.bot_id` variable in DBLClient. Any idea on how it is properly done?
#

and don't mind the spaces and plz ping me

meager gull
#

how can i get dbl token?

rain heart
meager gull
#

ok

#

and webhook auth password?

rain heart
#

That is something you define yourself

#

If you don't use webhooks for your voting, you can ignore it

meager gull
#

top.gg

rain heart
#

read pins

#

for the new one

meager gull
#

topgg-autoposter?

rain heart
meager gull
#

lol u pinged

#

someone

#

ok

rain heart
#

yeah Kek ignore it

sullen nymph
#

oh great

#

Anyhow, DBLClient doesn't utilize a bot_id arg

night fern
#

yeah i was guessing that too but could not think of any other way

sullen nymph
#

dblpy takes .user.id of the provided bot/client object

tough chasm
#

Hello everyone,
In https://top.gg/api/docs, in the "bot" section I can find MonthlyPoint & Points. I have put it in my code but It not seems work.
Can someone explain me the goal and how to use it please ? Because when two people are voting I have this:

#

"15" for the 2 votes, and I have put "MonthlyPoint"

(Sorry for my bad english, I'm french)

rain heart
#

Only way to fix this is tracking the amount of votes yourself

tough chasm
rain heart
#

Most likely, try it and see if it is

#

It should update though after a bit

tough chasm
#

ok thanks for your time

#

I find that dlb is not very well optimized, it is rather complicated to understand in their documentation

tawdry thicket
#

so i'm trying to make a vote tracker using @waxen widget-gg/sdk

#

wait nooo i didn't mean to ping

#

i wanted to ask for help with setting up a webhook

#

i don't understand how to set up a webhook in top.gg lol can anyone help

tough chasm
#

First, have you put your bot on top.gg ?

tawdry thicket
#

yeah

tough chasm
tawdry thicket
#

ok i'm at the page

tough chasm
#

You have to put a "password" in authorization

tawdry thicket
#

i already have the password and stuff i'm just struggling with like putting in the webhook url

tough chasm
meager gull
#

for my bot

tawdry thicket
tough chasm
#

In your vps you have an ip

meager gull
#

how can i show server count for my bot?

tawdry thicket
#

ok i put the url in

#

this is my code rn (the striked out part is my webhook auth)

tawdry thicket
restive otter
rain heart
#

you need to post that yourself

restive otter
#

Do i need to add python library to my codes

rain heart
#

yes if you wish to use the api through a existing library

#

or you could do it manually through requests

restive otter
#

how

#

I added Example with automatic server count codes to my codes

#

@rain heart

rain heart
#

read this

restive otter
#

do i need to put my client token in place of bot]

#

@rain heart

rain heart
#

no

#

your client instance

#

iirc

restive otter
rain heart
#

your bots instance of your python code

#

read the docs, can't really help you

restive otter
#

can anyone help me regarding automatic server count for python

#

<@&304313580025544704>

signal hawk
#

-atmods

abstract mothBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
signal hawk
#

you can ask your question here and wait for someone to respond.

restive otter
#

ok sorry

restive otter
tulip coral
#

@restive otter maybe this?

restive otter
rain heart
restive otter
#

ty

reef hawk
#

9

restive otter
#

const webhook = new Topgg.Webhook(`what i have to put here ? my top.gg token or the authorization key ?`)

#

pls can anyone help me

rapid kettle
#

authorization key

restive otter
#

ok

#

but how it will be connect correctly to my bot page ? waitWhat

rapid kettle
#

it doesnt need to be ?

restive otter
#

hmm ok

restive otter
#

Hi

#

@pale fulcrum I am new sorry for the ping

hallow river
#

hi

restive otter
#

Hii

#

I am new

hallow river
#

me too

#

how are you

restive otter
#

Good h?

#

U?

hearty lintel
#

hey this channel is for issues/help related to the top.gg api and it's related libraries, please bring social convos to dms or #general

restive otter
#

Oh shoot sorry!

hallow river
#

I'm good thanks

hearty lintel
#

np

jaunty plank
#

whats the error?

wintry oracle
#

ReferenceError: Cannot access 'bot' before initialization

#

@jaunty plank

#

bot is my client

jaunty plank
#

well, there you go, put your usage of bot after initlization

wintry oracle
#

usage?

#

how do i find my usage?

#

@jaunty plank ⬆️ (sorry for ping)

hot axle
#

declare your bot before using it

#

simple

jaunty plank
#

^

wintry oracle
#

oh ok

jaunty plank
#

you cant use something before its declared.

wintry oracle
#

well i am a beginner

#

started making my bot 3 months ago

#

so im new to this stuff

hot axle
#

i mean 3 months are a lot but k

wintry oracle
#

this is going to take a me a long time to know how to declare my bot

jaunty plank
#

you already do.

wintry oracle
#

i do know?

jaunty plank
#

yep, your just doing it after you use it

wintry oracle
#

this is real confusing

hot axle
#

you know what variables are right?

wintry oracle
#

a little bit of variables

hot axle
#

yeah well

#

when you do let myVariable = 'foo', you're declaring the variable

#

you can't use variables before you declare them

wintry oracle
#

so declaring a variable is like declaring a bot?

jaunty plank
#

your bot variable is a variable.

wintry oracle
#

hmmmm

#

wait so 'bot' is a variable?

#

@hot axle

hot axle
#

yeah

wintry oracle
#

oh

#

but i declared 'bot'

jaunty plank
#

after you use it

wintry oracle
#

after i use it?

jaunty plank
#

yeah, so in the programming world theres an order to things.
if you want to use a variable you must declare it, then use it.
you cannot use a variable that doesnt exist yet.

#

think about it from the computers perspective.
you are telling the computer "I want to use bot! heres what i want to do!" before you tell it what bot is, or that bot even exists.

wintry oracle
#

eek dont get it

hot axle
#

well

#

you could also learn js

wintry oracle
#

guess i have to figure it on my own

jaunty plank
#
//declaring the variable then using it.
let variable = "some string"; //declaring a variable named variable
variable = "some other string"; // using said variable

//using the variable then declaring it, resulting in an error
variable = "some other string"; // using said variable
let variable = "some string"; //declaring a variable named variable
#

in the second example, the computer wont be able to understand what "variable" is because i havent told it what it is yet.

#

atleast at the time it was used.

wintry oracle
#

hmmmm

#

thank you woo for helping me but i think i need to learn js

jaunty plank
#

this is a javascript thing, not a discordjs thing.

wintry oracle
#

OMG I THINK I FOUND IT

#

ok there is no errors

#

now how do i know

#

nope did not come

#

dbl statistics did not say how many servers

placid citrus
#

Does anyone know why I am randomly getting spammed with this at times?

#

Ah, could it be due to the API being down?

jaunty plank
#

yep, api is down

#

if you can, catch the 502's in your code.

placid citrus
#

Yep, will have too

summer sluice
#

so do I insert client id of my bot or token of my bot or is it completely different

rain heart
boreal mist
#

When you click the button 'test' to test the webook on topgg, what is supposed to come up?

jaunty plank
#

a little window saying "test successful"

#

it says that if you have put the correct webhook auth and url or not.

boreal mist
jaunty plank
#

its not the url you should put in the webhook url section

boreal mist
#

ohh i have to get rid of the ":"

jaunty plank
boreal mist
#

oh, what am i supposed to put in there

jaunty plank
#

the url to your webhook receiver.

boreal mist
#

sorry im dumb, how do i create a webhook receiver

jaunty plank
#

what programming language?

boreal mist
#

discord.js

jaunty plank
boreal mist
#

How could I find my express app because I got this error:
Error: Cannot find module 'express'

#

nvm I actually had to install it

restive otter
#

Yeah, you’ve gotta install it in order for it to work.

sick siren
jaunty plank
sick siren
#

and that first automatic one

#

just putting that code in there should do it

#

and of course importing dbl

jaunty plank
sick siren
#

ok ty

#

im only 40% until verified

#

but already done 2 major updates in the time waiting

polar ember
#

How can i show on the website top.gg in how much server the bot is?

jaunty plank
#

what programming language is the bot written in?

polar ember
#

java Script

jaunty plank
#

install with this. npm i topgg-autoposter
only two lines you really need.

const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('topggtoken', client) // your discord.js or eris client

you can find your top.gg token here https://top.gg/api/docs#mybots

polar ember
jaunty plank
#

the autoposter has to be installed yes

loud jewel
polar ember
polar ember
#

thx

jaunty plank
#

the dblapi is deprecated

#

please dont use it

loud jewel
jaunty plank
#

but its no longer the right thing to use

loud jewel
#

true

jaunty plank
#

and is more complex than the two lines this lib uses

polar ember
#

doesnt work

#

it says module auto-poster not found

#

But i installed the api

jaunty plank
#

install the autoposter

#

the api is deprecated.

polar ember
jaunty plank
#

npm i topgg-autoposter

#

you

polar ember
#

thx

#

Ok doesnt throw an error now

#

thank you

jaunty plank
#

npnp

boreal mist
#

how do i get the bot to console log when testing, my code:

#
const DBL = require('dblapi.js');
const dbl = new DBL(`my topgg api token`, { webhookPort: 5000, webhookAuth: '03190319' });


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

const app = express() // Your express app

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

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

app.listen(3000) // your port
});

ping me pls

restive otter
#

How can i make vote messages? Ping me pls

unique solstice
#
setInterval(() => {
        dbl.on("posted", () => {
  console.log("Dbl posted");
});
    },  900000);

If I Use This, will my data refresh every 15 minutes? 🤔

patent forum
unique solstice
#

Can you help me cause I don't think I understand 😑

patent forum
#

.postStats basically uploads data to top.gg, so in your case, you want to upload data every 15 mins, so you would use setInterval on posting the data

unique solstice
#

ok i understand thanks

#

client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 900000);
});

I guess that way

patent forum
unique solstice
#

ok

stoic shuttle
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); what is the password there?

rain heart
#

if you're using webhooks, change it to whatever you want

#

it should match the password you entered on your bot page webhook settings

stoic shuttle
#

What is bot page webhook settings?

#

I mean where is it?

rain heart
#

on your bot page settings

stoic shuttle
#

oh yea

#

i got it

#

thanks

#

uh https://top.gg/bot/:ID/webhooks what do i change here?

rain heart
#

that's where your webhook settings are

#

you do not need that

stoic shuttle
#

kk

#

So what do i put in the webhook url? see, im new to this, so i dont know anything

rain heart
#

It should be http://yourserverip:port/dblwebhook

#

replacing yourserverip with your servers ip and the port with the webhook port

stoic shuttle
#

what is my server ip then?

#

which server are u talkin about

rain heart
#

The server you're hosting your bot on

restive otter
#

чего блять

stoic shuttle
#

oh

#

k i get it now

#

thx

rain heart
runic tapir
#

Why is the server counter inaccurate?

rain heart
runic tapir
#

It is wrong by 3 numbers

rain heart
#

then you posted it wrong

runic tapir
#

How so? It has been working fine until yesterday?

rain heart
#

Are you posting with an interval or only once?

#

or are you using the autoposter?

runic tapir
#

I am indeed

#

But it does update it every time the bot restarts

civic plinth
#

How the heck do i even setup the API.

#

I cant find the stupid document

rain heart
civic plinth
#

oh theree

#

thanksssssss

stoic shuttle
#
(node:39) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (/home/container/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1223:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11)
[dblapi.js] Warning: No DBL token has been provided.
#

How do i fix this?

rain heart
#

Add your dbl token

stoic shuttle
#

oh ok

restive otter
#

Hey

#

does their is any documentation

#

for api

rain heart
restive otter
#

thanks

fluid moth
#

Can someone please help us program a discord bot? (I would LOVE if @gritty jasper can)

gritty jasper
#

what

jaunty plank
fluid moth
#

OMG

#

CARL IS HERE

#

DM if you can help

gritty jasper
#

Busy, sorry

fluid moth
#

when you can dm me after 3 pm on weekdays or anytime on weekends

#

CST

rain heart
#

MoonBridge first, this chanel is top.gg api,
Second, what in the world makes you think carl would help at coding your bot

restive otter
#

Hi

vivid nest
#

How can I lock commands only to people that voted (discord.py)

jaunty plank
#

your best bet is to keep track of voted users in a database

#

then just check if they are in it.

vivid nest
#

ok

astral pine
#

how does the on_dbl_vote event work with the python library. how do i need to have the webhook path set and all that to make it work.

astral pine
#

no i just dont understand how to get it to work.

#

oh

jaunty plank
#

nah, it wont resend.

mighty sun
#

-api

#

fucks

jaunty plank
#

mod commands op

astral pine
#

ok so i made the dbl client with webhook_path="/dblwebhook" webhook_auth="auth" webhook_port=32485 and port forwarded 32485 and set the webhook url to http://mypublicip:32485/dblwebhook then sent a test but the event isnt being executed. is there something wrong with my port forward options? Protocols: TCP. Start, End, and Target Port: 32485.

jaunty plank
astral pine
#

yeah i have this

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

im gonna redo my port forwards maybe i did something wrong

restive otter
#

you can always try making the request yourself and see if it reaches it

edgy lotus
#

need help with a stats command

#
    let guilds = bot.guilds.cache.array().join('\n')

    const serverlist = new Discord.MessageEmbed()
      .setTitle(`HyVerify Server Count:`)
      .setDescription(guilds)
      .setFooter(`Thanks for using HyVerify! :heart:`)

    message.channel.send(serverlist)
}```
#

i'm getting this error with the first line

frosty light
#

Hello how can I use get_user_vote in python to make vote to use commands

restive otter
#

hi, i'm getting this error (for the first time ever). I've waited over 3 hours but it still keeps on throwing this error.

#

how long will "temporarily" last, and will I have to contact discord support?

#

my bot is in python by the way

frosty light
#

5-10 mins

sullen nymph
#

about an hour or a few

frosty light
#

Yes I read but I'm unclear how to use it in a command so when the command is run , it will check if user has voted if voted then only execute

sullen nymph
#

I suggest you use the webhooks unless you have some sort of a caching system you will rely on to reduce the number of API requests you're going to make via commands

frosty light
#

Ok.... Can I find examples somewhere cuz I'm very new to this api

sullen nymph
#

Refer to the webhook example

#

P.S. make sure your port is open via TCP protocol

frosty light
#

Ok thanks

fathom narwhal
#

Can anyone give an example of what the webhook looks like?

jaunty plank
#

py right?

fathom narwhal
#

Yes, just the webhook Tho, like the test one?

#

Like what does the request look like?

jaunty plank
fathom narwhal
#

Yes

jaunty plank
fathom narwhal
#

All the data is sent in the url?

jaunty plank
#

its sent in the body, not as query parameters(in the url)

fathom narwhal
#

O ok ty

jaunty plank
sullen nymph
#

Hmm

#

Interesting mindfuckery for future reference... every JSON key in the request passed as a function parameter.

modest trout
#

static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "BAKIM MOD:ON";
discordPresence.details = "BAKIMDA";
discordPresence.largeImageKey = "unnamed";
discordPresence.smallImageKey = "unnamed";
discordPresence.smallImageText = "işteee";
discordPresence.partyId = "ae488379-351d

#

me turkish bot

#

yok ED KRAL

sullen nymph
#

me English-speaking bots and I can see the channel topic that says "TOP.GG API ONLY"

modest trout
#

oki

restive otter
#

hello

#

how can i make my bot send a message if someone vote it on DBL

rain heart
#

webhooks

#

and pinned messages

restive otter
#

i did it

#

i console logged where the webhook is running

#
dbl.webhook?.on('ready', (hook: { hostname: any; port: any; path: any; }) => {
            console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
        });

        dbl.webhook?.on('vote', (vote: { user: any; }) => {
            this.client.channels.cache.get(`799201317154455573`).send(`User with ID ${vote.user} just voted!`);
        });
#

i wanted to know why isnt the bot sending message when someone votes it? 🤔

rain heart
#

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

#

also, don't do port: any, path: any

#

you need to provide a webhook port and path

runic tapir
#

My bot is no longer able to recieve data and send data to top.gg.
Is there a reason this might be?

rain heart
#

any errors?

#

403 or 401s for example?

haughty drum
#

Where are the api docs?

#

nvm i saw it up from my msg

rain heart
analog bison
#

@rain heart Thank you!

dusty roost
#

discord.js v12:

const client = new Discord.Client({
    ws: { intents: 1537 }
});
const AutoPoster = require(`topgg-autoposter`);
AutoPoster(my_topgg_token, client);

Error: Unsupported Client

does anyone know why?
ping me if you know

hearty lintel
#

what's the order in your code?

#

@dusty roost

dusty roost
#

what do you mean?

hearty lintel
#

can i see the full code?

dusty roost
#

there's a ton of crap in between

#

none of it has to do with that though i would think

hearty lintel
#

where you define Discord might

dusty roost
#

it's at the top

hearty lintel
#

using require('discord.js') right?

dusty roost
#

yes

hearty lintel
#

hm

#

alright try and do this
const ap = new AutoPoster.DJSPoster(my_topgg_token, client)

dusty roost
#

i'll give it a try

#

Error: Cannot find module 'discord.js'

hearty lintel
#

so yeah it's something to do with how you require('discord.js')

#

do you mess with the require.cache at all?

dusty roost
#

i haven't had any issues with discord.js so far so i'm not sure what i could be doing wrong

hearty lintel
#

maybe just try and do npm i discord.js again

dusty roost
#

Error: Not a discord.js client.

restive otter
#

Does my bot need to be approved for me to get my api key? And what does an api key do?

hearty lintel
novel vessel
#

Is it possible to make a bot send a message into chat everytime somone votes for my srver using the api? (discord.py)

hearty lintel
#

you sure you're not accidentally redefining client somewhere, try putting the ap definition right below defining client

dusty roost
#

ok i'll try that

hearty lintel
novel vessel
#

How do I setup a webhook?

hearty lintel
novel vessel
#

Like the one in the editing page?

dusty roost
#

same error, not a discord.js client

novel vessel
#

it's in a cog, i'll just convert it doe

dusty roost
#
const client = new Discord.Client({
    ws: { intents: 1537 }
});

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

const ap = new AutoPoster.DJSPoster(process.env.DBL_TOKEN, client)
```Error: Not a discord.js client.
hearty lintel
#

that's very strange

dusty roost
#

is there still a way to do it manually

hearty lintel
#

was bouta suggest that to you

dusty roost
#

what does the shardId option do

hearty lintel
#

you can remove it if you're not sharding

dusty roost
#

i am sharding

hearty lintel
#

what kind of sharding?

dusty roost
#

i just put it on the shard that posts the stats, that's fine right

hearty lintel
#

are you using the ShardingManager?

dusty roost
#

yes

hearty lintel
#

ok im gonna recommend you use the AutoPoster one more time lol

#

you can pass the ShardingManager instead of client on the master process

novel vessel
#
@client.event
async def on_dbl_vote(data):
    channel = 798293384133214240
    await channel.send('USER VOTED')
    print("Received an upvote:", "\n", data, sep="")

@client.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
    print("Received a test upvote:", "\n", data, sep="")
    channel = 798293384133214240
    await channel.send('WEBHOOK TESTED')```
Would this be valid
dusty roost
#

i'll try that

hearty lintel
#

if you get that same discord.js error you can always just broadcastEval your own stats tbh

dusty roost
#

same error

#

not a discord.js client

hearty lintel
#

i just dont get it

#

how does it just not define discord.js

dusty roost
#

i'm just gonna stick with doing it manually ¯_(ツ)_/¯

hearty lintel
#

kk

dusty roost
#

thanks for your help

#

i hope at least doing it manually works lol

hearty lintel
#

yea

novel vessel
#

@hearty lintel how do i test my webhook

#

how do i set it up

hearty lintel
#

press the test button

#

make sure your port is open to the internet

novel vessel
#

How do I get my port

jaunty plank
#

Port you define in the code

novel vessel
#

ik but how can i get my por

#

t

#

can i just make it any number

#

in the range

hearty lintel
#

are you using a vps?

novel vessel
#

no

#

not rn atm

hearty lintel
#

what're you using

novel vessel
#

just runnning it off my wifi

hearty lintel
#

alright well unless you wanna port forward your local internet it will not work, your bot also has to be approved before you can actually use the webhook

novel vessel
#

o i just want to make a webhook everytime somone votes for my bot

#

*server

#

not bot

hearty lintel
#

o i see

#

if u really want to search up how to port forward for your router

novel vessel
#

theres a port option on my wifi settings

#

it says add port

prime berry
#

is there any way to get # of request that bot can made? rateLimit is emitted only when hits the limit

novel vessel
#

@hearty lintel

hearty lintel
#

you can put an auth inside of your code as well or leave it blank

jolly veldt
#

is there a way to make a vote api work with dbd.js

#

for ex. if bot gets voted the bot gives that user coins a variable etc

willow spindle
#

dbd.js?

jolly veldt
#

yes.

jolly veldt
#

djs eval works too..

restive otter
jolly veldt
#

ok.

smoky marten
long grotto
#

How would I make it so my bot can check if a user voted (for vote locked commands) thanks!

rain heart
#

you wont be able to use it yet though

#

as you need to have your bot approved

long grotto
#

I know.

#

Just planning ahead.

#

What specific part of the docs would this be listed around?

rain heart
#

the endpoints one

#

check the one for your library

long grotto
#

Ight, thanks.

restive otter
#

!help

simple lagoon
#

hey why the webhooks not work

hot axle
#

they do

simple lagoon
#

why for me no

rain heart
#

https does not work with a port

#

change the protocol to http

#

@simple lagoon

simple lagoon
#

oh okay

#

thx

lusty wave
#

does anyone know what is the server count API?

loud jewel
astral zealot
#

no-

loud jewel
loud jewel
lusty wave
#

Lamguage speak?

loud jewel
#

Scripting?

jaunty plank
#

programming language

lusty wave
#

Hmm

#

JavaScript

loud jewel
#

*word

loud jewel
lusty wave
#

Ok, thanks.
Ok, obrigado.

loud jewel
#

If u follow that then it will work, lmk if u have any issues

lusty wave
#

have several examples, which one should I take?

Tem vários exemplos, qual deles devo pegar?

#

@loud jewel

loud jewel
lusty wave
#

Where should I put it in index.js?

loud jewel
#

Before ur ready event

lusty wave
#

could you help me in private?

poderia me ajudar via privado?

loud jewel
#

No, its easier here

lusty wave
#

Ok

loud jewel
lusty wave
#

I give up "-" I don't know how to do that

loud jewel
dry fiber
#

You should know where

#

By looking at the code

lusty wave
#

Like I even know your mistake, and it's just an accountant.

loud jewel
boreal glen
#

how to track votes

sullen nymph
#

Cool

#

Maybe read the channel topic next time

restive otter
#

oh sorry

rugged veldt
#

I got a ClientConnectorError: Cannot connect to host top.gg:443 ssl:default [Temporary failure in name resolution] error trying to post server count, any way to solve this error?

#

my code's basically the same as the manual example one

#

python 3.8.7 btw

restive otter
rain heart
#

as you can also regenerate it from there

zealous crown
#

Does anyone know if there is any way to determine if a vote is being cast for a specific server?

rain heart
#

Yes

#

the voting webhook has a different schema

hearty lintel
#

check pins for the guild vote schema

zealous crown
#

oooh nice Meow_Thumbup thanks

pale dock
#

Helloo

#

Anyone know how to get mongodb Database url

#

Because i getting error

hot axle
#

it says it there

#

you have to whitelist your ip

pale dock
#

How

#

i dont know

rain heart
#

wrong channel

pale dock
#

About mongodb more

#

Oh sorry come in

pale dock
restive otter
#

Raccoon

#

api.

#

or how do i make an api

#

hmm

jaunty plank
#

This isnt for general apis

sullen nymph
#

Channel topic

#

hmmmmm

jaunty plank
restive otter
#

huh

pliant oak
#

using the api how would i get the date that a user voted for a guild?

jaunty plank
pliant oak
#

would i constantly be checking if a user voted for a guils?

hot axle
#

use the webhooks

pliant oak
#

so can i provide

#

a guild id

rain heart
#

the wrapper* doesn't support dsl afaik

#

you will need to make your own webhook for the dsl

pliant oak
#

mk thanks

sullen nymph
#

This/next week I'll release a few changes and some other stuff

#

DSL webhook included

jaunty plank
#

pog

sullen nymph
#

I will update the docs later so throw me DMs if you have questions with future changes and the docs are outdated

pliant oak
#

ok

latent spear
#

what can i use here as a webhook url?

#

or do i actually have to create one myself?

rain heart
#

you have to create one yourself

robust shadow
#

hello , i forgot how to to get my bots dbl token

jaunty plank
robust shadow
#

Just found it xD

#

Ty anyways !

robust shadow
#

hello , i have 2 bots hosted on the same machine , i prepared 2 seperate files for automatic server count , but the count is overwriting for one bot

#

i checked the dbl tokens but they are ok

velvet pond
#

Is there some issue with webhooks? My bot page says 37 votes, but I've only recieved 25 webhooks on my server...

jaunty plank
#

was your bot down for any period of time?

velvet pond
#

oh wait I didn't count the weekends

velvet pond
#

I think what happened is that I didn't count the weekend votes as 2 votes, so those would be inconsistent

jaunty plank
#

ah

#

yep that would be it.

velvet pond
#

Alright, I just used the /votes endpoint and that showed I got the correct number of webhooks

#

so the weekends was the issue.

#

Also, what time does the weekend bonus take effect?

#

and when does it end

#

I see Fridays, Saturdays and Sundays on the docs, but what time zone?

sullen nymph
velvet pond
#

ah ok so utc

#

makes sense

restive otter
#

hey what are all the events from the top.gg sdk

#

or is it just vote?

#

guild post, vote, test iirc

sullen nymph
#

ready event also iirc

restive otter
#

rtfd doe mmLol

sullen nymph
#

Tests aren't separated in the js sdk

#

And won't be in next dblpy version either

restive otter
#

I see, so each lib handles it differently

#

you're rewriting it?

sullen nymph
#

We're currently discussing stuff to make most common libs consistent and sort of. Added plenty of stuff yesterday, just need to finish the rest and we're good to go

restive otter
#

poggies

#

i ran this message.client.topgg.eventNames() but it returns an empty array

#

why?

naive galleon
#

Webhook for vote?

rain heart
robust shadow
#

hello , i have 2 bots hosted on the same machine , i prepared 2 seperate files for automatic server count , but the count is overwriting for one bot
i checked the dbl tokens but they are ok

loud jewel
robust shadow
sullen nymph
wooden dove
#

is there an issue with getting vote stats? have users reporting my votelocked commands are not working, but they work for me

worn geyser
#

!api

grim pewter
#

how do i get users who voted?

slow dust
#

Is it not there?