#topgg-api

1 messages · Page 120 of 1

wispy turret
#

lol

regal harbor
#

just be sure to open the port

wispy turret
#

how i do that?

regal harbor
#

where are u hosting your bot

wispy turret
#

heroku

#

shall the port be 0000?

#

bc on my mongo thats how i set my ip to host on heroku

regal harbor
#

its seems like heroku has only the port 80 open

#

and the 443 http and https

wispy turret
#

so the porn shall be 80 or 443?

#

*port

regal harbor
#

use the port 80

wispy turret
#

ok tysm!

#

i will test it

regal harbor
#

k if u have some problem ping me

wispy turret
#

ight thx!

#

also is there any events that can say new announcements by me?

restive otter
#

is there a way to detect who voted for the bot?

wispy turret
restive otter
wispy turret
# regal harbor k if u have some problem ping me

hey is there anyway my webhook can send new announcements by me? also if i wanna send the new vote in the channel do i just put js message.channel.send(`User With The ID ${vote.user} Just Voted!`)
or do i have to cache the channel with the id of the channel

wispy turret
#

Click Generate Token And DM Me it

#

JK DONT

#

LMAO

restive otter
#

lol

wispy turret
restive otter
#

how to get webhook password and port

wispy turret
restive otter
#

where

restive otter
wispy turret
#

ez

restive otter
#

k

regal harbor
#

@wispy turret send me the code in pastebin

wispy turret
#

wait

wispy turret
regal harbor
#

yes

#

dont put any token or password

wispy turret
#

4 views alr-

wispy turret
#

*there

restive otter
#

uhh is dblapi.js still available on npm?

wispy turret
restive otter
wispy turret
#

@restive otter

#

module is no longer maintained-

#

@regal harbor i-

#

the module is probs outdated

regal harbor
#

yeah i don't see any error try to update to the new SDK

#

u use npm or yarn?

wispy turret
regal harbor
#

ok use this to install the new SDK

#

npm i @top-gg/sdk

wispy turret
#

and i do the samething?

regal harbor
restive otter
#

how to use the new API @top-gg/sdk

regal harbor
#

read that

restive otter
#

k

regal harbor
#

idk how heroku works but i think their use dns

wispy turret
#

its 0.0.0.0

#

but i wanna test it in my regular terminal

regal harbor
#

no thats an example

wispy turret
#

wait wh-

wispy turret
restive otter
#

@regal harbor how to get the top.gg webhook auth token?

regal harbor
#

well then try that @wispy turret

wispy turret
regal harbor
#

@restive otter you mean the topgg token is in your bot dashboard

regal harbor
#

@wispy turret download your project and open the folder in vs code then install the modules and just run the app

wispy turret
#

*express

marsh ginkgo
regal harbor
#

autoposting

restive otter
#

ok i setted up the webhook

#

@regal harbor

marsh ginkgo
#

ok

restive otter
#

now i tested it and its not working

wispy turret
restive otter
#

@wispy turret heroku doesn't give ip you cant use it for webhook

wispy turret
#

on mongo their ip is 0.0.0.0

restive otter
#

and 0.0.0.0 basically means accept requests from any ip

wispy turret
#

oh-

restive otter
#

umm how to setup the webhook

wispy turret
restive otter
#

@restive otter send your code

restive otter
#

@wispy turret you cant use webhooks on heroku without ip afaik

#

get a good host

hidden crow
#

How do I setup webhook

#

for voting

restive otter
#

@hidden crow the docs say it all

restive otter
# restive otter <@456226577798135808> send your code
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

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

app.post('/', webhook.middleware(), (req, res) => {
  console.log(req.vote.user);
  let channel = client.channel.cache.get("786832094802346025");
  if(!channel) return;
  // req.vote is your vote object e.g
  channel.send(req.vote.user) // 221221226561929217
}) // attach the middleware

app.listen(3000) // your port
#

i did check it

wispy turret
#

shows an outdated version for

#

js lib

restive otter
#

it's not outdated

wispy turret
#

wait

#

so

wispy turret
restive otter
#

it works but it's not maintained

wispy turret
#

wait

#

but my event

restive otter
#

i use the api straight i dont need a wrapper

#

@wispy turret yours is the node sdk for the api

wispy turret
restive otter
#

just dblapi.js

#

?

wispy turret
#

because when i used dblapi

restive otter
#

node sdk is for advanced people

restive otter
#

That it's not mantained

wispy turret
restive otter
#

because there is no webhook

wispy turret
#

hol up

restive otter
#

back on pc

#

@wispy turret do you still have the code for when you used dblapi.js

wispy turret
#

since its a webhook do i just do

#

message.channel.send?

#

or

#

i have to cache the channel

#

and do channel.send?

restive otter
#

discord.js and dblapi.js are unrelated

wispy turret
#

oh-

#

so how i send into channel?

restive otter
#

just get the channel from cache and send it there

wispy turret
#

ok

regal harbor
#

use the client channels cache

restive otter
#
client.channels.cache.get("vote log channel id").send("a guy voted");
wispy turret
restive otter
#

send your code

wispy turret
restive otter
#

are you sure that api token is correct

wispy turret
#

wait

restive otter
#

lemme check the docs real quick

wispy turret
#

i regened it

#

lemme try again

regal harbor
#

@wispy turret

restive otter
#

@wispy turret you did it wrong

#

you're supposed to pass your discord.js client as the second param forget i said that im dumb

regal harbor
#

thats optional

#

and still @wispy turret you are on your pc now?

wispy turret
#

oh ima set my status online

#

well im on macos

regal harbor
#

the webhook will not work if the port is not open

#

and if the ip or dns is not valid

wispy turret
#

i gtg sleep

#

any info pls DM me it

tawdry bone
#

im back

#

so who wants to help me

#

??

#

@sullen nymph hello

sullen nymph
#

I definitely don't remember where we were cut off

#

Send screenshots of your code (token excluded) and webhook settings on the website

wispy turret
#

and it says

#

opening porn: 80

#

*port

regal harbor
#

@wispy turret

#

stop saying porn XD

wispy turret
#

oh sorry

#

i mispelled

regal harbor
#

well you opened the port 80?

wispy turret
wispy turret
tawdry bone
#

kk

#

just a minute

regal harbor
#

usually not much

wispy turret
#

oof

#

ok

#

port 8- open

#

its opening another port rn

#

*80

wispy turret
regal harbor
#

its seems that something else its using that port in your pc

#

@wispy turret

wispy turret
#

lemme try again

#

ye

#

idk what is

#

being used-

regal harbor
#

its on your pc?

wispy turret
#

im using macos

regal harbor
#

just open another port then

#

XD

wispy turret
#

how?

#

ohh

regal harbor
#

use another like 7777 or whatever you want

wispy turret
#

i gotchu

#

ye i remember

marsh ginkgo
#

How infield code api ? Where should I take it?

#

iam sepeek Arabic, I don't know how to speak English

regal harbor
#

@marsh ginkgo i told you where

marsh ginkgo
#

autoposting ؟

#

Are there on site?

regal harbor
#

yes

marsh ginkgo
#

Mother project Bot?

regal harbor
#

find it on your bot dashboard

marsh ginkgo
#

ok

#

I'm going to do it but I don't know the first time to do this thing

tawdry bone
sullen nymph
#

Is that cog loaded?

tawdry bone
#

-_-

#

bot's running

#

shld i invite u?

#

in support server?

#

lololol

sullen nymph
#

I asked you if that cog was loaded in your bot

tawdry bone
#

lol yes

sullen nymph
#

Fun

tawdry bone
#

-__

#

any help man?

regal harbor
#

@tawdry bone

tawdry bone
#

?

regal harbor
#

you don't need to paste the port 8080

tawdry bone
#

means?

tawdry bone
regal harbor
#

oh srry

#

i mean you need to put the port at the end of your url

#

or is it a default port on repl

#

url...repl.co:8080

tawdry bone
#

prev it used to send 404

#

but now nothing

bold socket
#

@tawdry bone are you using flask?

tawdry bone
#

yes

bold socket
#

show me the code

tawdry bone
bold socket
#

do @app.route('/', methods=['GET', 'POST'])

tawdry bone
#

insted of app.run??

bold socket
#

no

tawdry bone
#

ah

#

sorry

#

got it

#

didn't saw

bold socket
#

also from flask import Flask, render_template, request, Response

tawdry bone
#

im using uptime monitor to ping the site

#

so that the bot stays online

bold socket
#

yes you're getting both GET and POST so it shouldnt disrupt uptimerobot

tawdry bone
#

anything else?

bold socket
#

now under your def home(): you wanna check for the authorization that dbl sends

tawdry bone
#

hey man

#

one thing

bold socket
#

so Py authorization = request.headers.get("Authorization")

tawdry bone
#

it's lunch time

#

so....

#

comign back

#

in a few minutes

bold socket
#

ah okay

tawdry bone
#

can u pls wait?

bold socket
#

alright

tawdry bone
#

yeh im back

#

@bold socket

bold socket
#

ah okay

tawdry bone
#

so

tawdry bone
tawdry bone
#

later i'll change the paswd

bold socket
#

so get your authorization with Py authorization = request.headers.get("Authorization"), it'll return a string. check if its same as the one you give to top.gg (should be right under the place where you enter the webhook url)

tawdry bone
#

i will check for it right?

#

or just do this under def home()?

bold socket
#

yes

#

if its the same do print(request.json), else pass

tawdry bone
#

kk

bold socket
#

yes except its request.json and notrequest.json()

tawdry bone
#

aj

#

ah

#

yes

#

now done?

#

shld i restart the bot and tst it?

bold socket
#

yes

tawdry bone
#

nothing's happening when i click on tst

#

a video tutorial is really needed lol

bold socket
#

before the authorization line try printing request.headers and request.json

tawdry bone
#

this is it

#

with a None in the end

bold socket
#

thats not dbl, thats probably uptimerobot

tawdry bone
#

ah

#

so?

#

has anyone ever done this in python????

bold socket
sullen nymph
#

Please remind me why you're using Flask

tawdry bone
#

yes

#

flask for contacting uptime robot

bold socket
#

as much as im aware your flask application url isnt supposed to have a 8080/dblwebhook at the end

sullen nymph
#

...

#

I give up

tawdry bone
#

the red one

sullen nymph
#

Have fun Deity

bold socket
#

it ends at repl.co

tawdry bone
#

yes

bold socket
#

where did you get the 8080.dblwebhook part

tawdry bone
bold socket
#

you're not sending them to the correct flask application

tawdry bone
#

what?

#

wdym

bold socket
tawdry bone
#

yeh

#

so?

#

it's wrong?

sullen nymph
#

It is

bold socket
#

do you see that bit on the on the repl.it link?

sullen nymph
#

I did say you don't enter the port in the URL

tawdry bone
#

somene said me

sullen nymph
#

You HOST your webserver on port 8080 and let repl.it redirect those requests

tawdry bone
#

updated one

bold socket
tawdry bone
#

-_-

#

it worked

#

uk

#

one question thgh

#

ah

#

helo ?

#

anyone?

#

everyone died or what?

#

it's not happening now

#

i click on test nothing happens

#

no response

#

can we use the test buton only once?

#

everyone went

royal dock
#

it did not work for me to. I made an extra webserver with aiohttp

tawdry bone
#

no it worked for me

#

after pressing the test button

#

there's a cooldown of some seconds

#

idk specifically

#

and after taht it works

rigid fractal
#

🙂

tawdry bone
#

guys it works correctly but just that i now want to post this tst upvote or upvote thing to a particular channel in the bot's support server

#

but this thing is not working

#

kinda

rain heart
#

did you update the webhook setting on your bot page?

#

make sure to press save ofc

#

use a few debug lines maybe

tawdry bone
rain heart
#

you're forgetting the port

#

and the path

#

8080

#

and /dblwebhook

sullen nymph
#

Port isn't needed

#

repl.co reverse proxies requests from 443 to 8080 internally

rain heart
#

oh

sullen nymph
#

/dblwebhook is needed, though

tawdry bone
#

bruh

#

but it works without that only

sullen nymph
#

duh because you hosted a Flask script on the main route

tawdry bone
#

yes

sullen nymph
#

Can you show your main bot file

tawdry bone
rain heart
tawdry bone
rain heart
#

then the webhook works

tawdry bone
#

if i use only the url without the /dblwebhook

sullen nymph
#

you are daft

tawdry bone
#

what?

#

bruh

#

just tell how do i post the data in a particualr channel

sullen nymph
tawdry bone
#

but doesn't works

sullen nymph
#

?

tawdry bone
#

what?

#

when i click on the test button

#

nothing returns

tawdry bone
sullen nymph
#

And the link I sent is your current settings on the website?

tawdry bone
#

ehh

#

what likn did u sent?

sullen nymph
tawdry bone
sullen nymph
#

Do you have a Flask script running atm

tawdry bone
#

and the current webserver settings

sullen nymph
#

ofc you fucking do

#

hy

tawdry bone
#

-_-

sullen nymph
#

why

tawdry bone
#

whymeans?

sullen nymph
#

Why do you need Flask

tawdry bone
#

without it how will the uptime monitor ping?

#

the site

#

if it doesn't pings if i close my pc bot also goes offline

#

simple

sullen nymph
#

uptimerobot doesn't need you to ping it though?

tawdry bone
#

no

#

it needs a wbserver where IT can ping

#

simple

#

i don't ping it

sullen nymph
#

Ah yeah well great

#

oh awesome

#

silenced the fucking error that mattered the most

tawdry bone
#

-_-

sullen nymph
#

The webhook isn't running because the port is occupied by your Flask script

tawdry bone
#

ah

#

true true

#

yes

#

so?

sullen nymph
#

So?

tawdry bone
#

i can't kill

#

the flask script

#

and herokku is not good

sullen nymph
#

Try to run some aiohttp.web script that does both things

tawdry bone
#

kk

sullen nymph
# tawdry bone

Also, it's supposed to be request.headers.get("Authorization") 🙃

tawdry bone
#

my pswds diff

sullen nymph
#

you get an Authorization header with a value being your password

#

Who told you to replace that with your auth key ever

tawdry bone
#

?

sullen nymph
#

at least that's dealt with for one, yes

tawdry bone
#

thanks man

#

for whatever help u did

#

lol

sullen nymph
tawdry bone
#

thnx

#

or maybe i won't

#

i have got other cmds to focus too

#

i have wasted 2 days

#

in this single thing

sullen nymph
#

This is why you provide all possible details when asking for help catshrug

#

Lesson learned

tawdry bone
#

-_-

#

lol

#

yes

#

bye now

#

gotta some other works

#

thnx again

#

shivaco and Deity

marsh ginkgo
#

كيف بدي اشغله ب الموقع ؟

#

I got up token api but project
He did not operate on the site

restive otter
#
const topgg = require('dblapi.js')
module.exports = TopGG = new topgg(config.botlist.top, { webhookPort: 5000 }, client)
#

value of TopGG is not an emitter

#

:/

marsh ginkgo
#

package.json : "dblapi.js" : "2.4.1"

#

؟

restive otter
#

?

#

yeah that is the version i am using r u also?

marsh ginkgo
#

Add BL package.json : "dblapi.js" : "2.4.1"

restive otter
#

bl?

marsh ginkgo
#

I am Arab, I do not know I speak English a lot

sullen nymph
#

The dblapi.js package is deprecated. It's suggested to the new one, @top-gg/sdk

restive otter
#

يمكنني استخدام مترجم

restive otter
marsh ginkgo
#

The translator sometimes understands what flex_45

sullen nymph
#

See its README on the package page, I guess

restive otter
#

أن أكون صادقًا في معظم الأوقات بالنسبة لي

#

ok

marsh ginkgo
#

انني احاول اعملها لا اعرف كيف

restive otter
restive otter
shy vortex
#

yes

restive otter
#

thx

#

so i uninstall dbl-api?

shy vortex
#

yes

#

its deprecteated

#

and wont recieve updates

#

if you want to just post stats

#

and nothing else

restive otter
#

nah i even want to do the votes thing

shy vortex
#

k

restive otter
shy vortex
#

yes

restive otter
#

like can it post stuff and all?

shy vortex
#

yes

sullen nymph
#

Yes

shy vortex
#

it is the same as dblapi

#

only that it is new

restive otter
#

oh but better

shy vortex
#

kinda

restive otter
#

so all i need to do is change imports for now

#

and it should work?

shy vortex
#

yes

#

it should

#

its deprecteated because it was maintained by a person who is no longer in dbl so he wont update it ofc

glass frigate
restive otter
#

will i need to use express also?

glass frigate
#

@restive otter yes

restive otter
#

oof

#

never used it no experience i guess i will just copy that code

#
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.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // 221221226561929217
}) // attach the middleware

app.listen(3000)
#

is there no events way for this?

glass frigate
shy vortex
#

@glass frigate you mean use the sdk and the autoposter

glass frigate
#

@shy vortex I don't know what code should I add to fix this problem

shy vortex
#

it posts the stats every 30 minutes

#

if you used any of the example codes

#

and only after 30 minutes it will update the stats

restive otter
#

try tunning the function with eval command

restive otter
sullen nymph
restive otter
#

how

#

is there a non-express way?

glass frigate
#

@shy vortex oky thank you. Can I use 2 commands for this information?

sullen nymph
#

There isn't one for now

#

It may be planned in future versions though

shy vortex
#

im not rly sure what you mean @glass frigate

#

sry

sullen nymph
#

To post server count automatically, use the first one on that screenshot.

#

Remove anything related to shards, however, if you don't use shards.

#

You can use both webhook and API implementations at the same time, but I don't see why you would need anything else on top of the API part.

glass frigate
#

@shy vortex I did not write the line of code that gives the server information Which code will I write?

shy vortex
#

just use the topgg-autoposter

#

for posting stats to the api

glass frigate
#

@shy vortex @sullen nymph oky thank you.

sullen nymph
#

catshrug I'm too used to having one package do everything

restive otter
#

@sullen nymph is there any older version of dblapi.js that will work or something?

shy vortex
#

lol

sullen nymph
#

The current one technically works but is bound to break when new changes are made to top.gg API

restive otter
#

it doesn;t

#

i get error

shy vortex
#

you shouldn't stay with dblapi.js

restive otter
#

like topgg is not an emitter

#

but i never used express

sullen nymph
#

Can't help as I'm not familiar with it

restive otter
#

i did not understand a single thing in the readme votes thing

#
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.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
shy vortex
#

imagine never having used express before

#

@restive otter express is a web framework for javascript

restive otter
#

but i did not get a single thing in that snipper

#

snippet

shy vortex
#

basically it makes an express app first

restive otter
#

wanted to use eventHandler

shy vortex
#

express basically functions as a web server that recieves requests

restive otter
#

rip my index.js file then

shy vortex
#

and then you just add the webhook to it

#

and add a post method

restive otter
#

what is req and res?

#

res is result?

shy vortex
#

and then it listens on a port

#

req is the request you recieved

#

and is the result

restive otter
#

oh so it is automatic?

shy vortex
#

yeah

#

just waits for requests to come in

#

basically anytime a vote occurs it sends a request and ur code waits for that request

restive otter
#

can i make it emit or something

#

like ```js
if (req.vote) client.emit('vote', req.vote)

#

something like that?

sullen nymph
#

Rely on req.type instead

#

No

restive otter
#

oh

sullen nymph
#

Disregard that

shy vortex
#

that would just be a second and non useful step

#

you are basically listening for the vote twice

restive otter
#

?

sullen nymph
#

Yup. You don't gain anything in specific by making your webhook emit events.

restive otter
#

oh

#

but then my index.js file will be too lengthy

sullen nymph
#

You still have access to the data, the client object, all that crap.

shy vortex
#

basically ur event activates and then you just use that to activate another event which does the same thing

restive otter
#

and like for every change i will have to go here

#

for any change

sullen nymph
#

if req.bot emit bot vote
else if req.guild emit guild vote

restive otter
#

my index.js was like 3 lines before this :/

#

what

#

so like even guild votes can be seen?

#

never knew that christmasthink

sullen nymph
#

Yes, DSL supports webhooks

restive otter
#

is it actually allowed to reward people for voting for servers

#

like reward bot-currencty?

#

i don't use it personally but a bot does

shy vortex
#

you can reward for votes if I recall

#

for bots you can defenitly do that

#

and dsl already lets you setup a role reward for ur server

#

so I suppose for servers also

#

but im not so sure on servers

#

you can defenitly reward users on ur bot with bot currency or something

restive otter
#

no like there was a rule or something that voting for bot A should not give rewards for Bot B

#

so i thought must be something like that for servers also

#

🤦 the dbl-api.js was working

#

i forgot to add a const

#

and now i changed my files

#

@shy vortex so like does it get deprecated every update to api?

#

and like how often does the api recieve any update?

#

talking abt the dblapi.js

shy vortex
restive otter
#

oh

shy vortex
#

also just don't use dblapi.js

#

its deprecteated

restive otter
#

yeah not using

shy vortex
#

there is not a single reason to use it anymore

restive otter
#

is there any way i can keep this file away from index.js

#

like just load it?

#

i didn't even make a command handler so i have no idea (used discord-akairo framework rather)

#

nvm

shy vortex
#

bruh

coarse bobcat
#

Hello, I am speaking Turkish:api nedir ve nasıl alabilirim yardımcı olabilecek varmı

#

Help me

restive otter
#

translated:
What is the api and how can I get it. Can anyone help?

#

@coarse bobcat
Sanırım botunuzu hangi dilde kodladığınızı bilmemiz gerekecek

restive otter
#

Programlama dilini kastettim

coarse bobcat
#

Hmm

restive otter
#

js?

coarse bobcat
#

1 munites

restive otter
#

py?

#

java?

coarse bobcat
#

Js

coarse bobcat
restive otter
#

Readme.md dosyasında ihtiyacınız olan şey var, bazı ekstra yüklemelerde biraz değişiklik gerekecek

#

@coarse bobcat ^

coarse bobcat
#

Ok

#

I did it from the glitch site, can we see from there

restive otter
#

gerçekten emin değilim

coarse bobcat
#

Hm

restive otter
#

Ama şimdilik gitmem gerekecek üzgünüm ama sanırım başka biri sana yardım edecek

coarse bobcat
#

wouldn't it be without api

#

@restive otter
Thanks bro

restive otter
#

Arkadaşlık isteğini kabul edemiyorum çünkü seni gerçekten tanımıyorum ve ayrıca seninle konuşmak için bir çevirmen kullanıyorum

:(

restive otter
#

it did not work

#

my friend voted but no console log nothing

#
// Top.gg api part

const config = require('./config.json')
const topgg = require('@top-gg/sdk')
const TopGG = new topgg.Api(config.botlist.top)

setInterval(() => {
    TopGG.postStats({
      serverCount: client.guilds.cache.size
    })
    console.log(`[ TopGG ] - Server Count Posted!`)

    try {
    //DisConsole
    const channel = this.client.channels.cache.get(config.channels.disconsole)
    channel.send(`${emojis.discord.Analytics} [ TopGG ] - Server Count Posted!`)
    }catch{}

  }, 1800000)
//Over

// Voting badass part

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

const app = express()

const webhook = new Topgg.Webhook(config.botlist.topwh)

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  /**
   * Vote
   */
  console.log(`[ TopGG ] - ${this.client.users.cache.get(req.vote.user).tag || 'Unknown User'} has voted!`)

  try {
  //DisConsole
  const channel = this.client.channels.cache.get(config.channels.disconsole)
  channel.send(`${emojis.discord.Boost} [ TopGG ] - ${this.client.users.cache.get(req.vote.user).tag || 'Unknown User'} has voted!`)
  }catch{}

  try {
      this.client.users.cache.get(req.vote.user).send(new MessageEmbed().setTitle(`Thank You so much for voting ❤️!`).setDescription(`${emojis.discord.Social} For now it does nothing but is still a lot appreciated `))
  }catch{}

})

app.listen(3000)
// Over
#

whole code^

coarse bobcat
#

Kodu nereye yazacağım

#

Speak turkish

rain heart
#

did you set the webhook url in your bot settings?

restive otter
#

where to set it?

#

the config.botlist.topwh is the webhook token

#

@rain heart

rain heart
#

in your bot page settings

restive otter
#

oh

rain heart
#

you need to enter your webhook url, it should be something like http://yourip:port/dblwebhook

restive otter
#

i have a non-static ip

rain heart
#

If you're hosting it on a server (and presumably deploying it there), use your servers ip instead

restive otter
#

can i use 0.0.0.0 instead?

rain heart
#

0.0.0.0 is a universal ip, it doesn't work like that

restive otter
#

and is the auth,

#

is it password?

rain heart
#

0.0.0.0 is just a indication of being able to connect to it from anywhere, like localhost, your internal ip or external ip

restive otter
#

or the token in webhook

#

?

rain heart
#

auth is something you can define yourself

#

it has to be the same in your bot page settings and code

restive otter
#

oh

#
(node:11932) UnhandledPromiseRejectionWarning: Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)
    at Api._request (F:\Dhruvin's coding work\Node JS\Discord Bot's\Vilicus\node_modules\@top-gg\sdk\dist\structs\Api.js:74:19)      
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Api.postStats (F:\Dhruvin's coding work\Node JS\Discord Bot's\Vilicus\node_modules\@top-gg\sdk\dist\structs\Api.js:94:9)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11932) 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: 1)
(node:11932) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

¯_(ツ)_/¯

#

using the correct token

#

wait nvm didn;t relaise it is the webhook token and bot token that are same

rain heart
#

again, the webhook token isn't a token, it is like a password you can define yourself

restive otter
#

is the python api maintained (the one in the docs?)

#

if so then like the next rewrite i wil do in python ;-;

willow spindle
#

maintained by @sullen nymph iirc

sullen nymph
#

You can ask Veld if he wants someone to take over but I was planning to push out significant changes to the library to support everything

noble adder
#

shiv big brain~

sullen nymph
#

imagine

frozen mica
#

what it mean by the dblapi error 400 bad request?

willow spindle
#

invalid value in body etc

fast agate
#

yes, but I found a solution by my own

restive otter
#

i got this : /bots/{bot.id}/stats/server_count? but where i put it to show on my bot's page?

restive otter
#

I get the error 401: Unauthorized, I've entered my bots api token correctly
Here's the code

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('[entered token]', client);

    const member = message.mentions.members.first() || message.member;
  dbl.getVotes().then(votes => {
    if (votes.find(vote => vote.id == member.user.id)) message.channel.send("You voted in the last 12 hours!! Thank you!")
});
regal harbor
#

Check if you have copied the token correctly

#

Or renew it

#

@restive otter

#

@restive otter you mean use that in your website?
You can use jquery or fetch

restive otter
#

renewing it worked, thanks

#

um can anyone tell me how to make voting rewards using DBL's API?
for discord.py

regal harbor
restive otter
#

i am dumb please give code

#

i tried setting up the webhook, idk how it works

regal harbor
restive otter
#

ohk np

regal harbor
#

See pins

restive otter
#

i'll check ok

#

i don't understand but too bad

regal harbor
restive otter
#

like server count and things like that

regal harbor
#

That's what I just explained to you.

restive otter
#

ok but what code i need and where i put it?

coarse bobcat
#

how can i get api when i build my bot via glitch

#

help me

jaunty plank
#

I dont see why you can't just acess it normally

regal harbor
restive otter
#

i just paste this, put my token and it will work?

regal harbor
#

Yes

restive otter
#

lemme see

#

i pasted this in my index.js file, changed the token, restarted my bot but there is nothing on my top.gg page

regal harbor
#

I think it have a delay

restive otter
#

ok

#

do i need to install a npm thing?

regal harbor
#

If no errors just wait

restive otter
#

ok

coarse bobcat
#

@restive otter how can i get api

restive otter
#

idk bro i'm here for this

#

lol

coarse bobcat
#

so how can i get

regal harbor
#

@restive otter I'm on the phone so I can't explain you well srry

restive otter
#

np i'll wait to see the refresh

coarse bobcat
#

How can I get api, can you help me?

restive otter
#

when you finish your call you can DM me @regal harbor

regal harbor
#

@coarse bobcat what you mean by get the api?
You need the token?
You need the endpoints?
Explain

coarse bobcat
#

@regal harbor So how can I see how many servers my bot is on?

#

help

#

please

worn lion
#

you don't need top.gg for that if that's it for your bot, if you want it to show on top.gg then you need to say what language first

coarse bobcat
#

what do i need

worn lion
#

you tell me

coarse bobcat
#

turkish

worn lion
#

nope

coarse bobcat
#

where should i say

#

@worn lion

worn lion
#

dude I have close to 0 idea what you're talking about

#

you have to give us more context

coarse bobcat
#

can i send a picture
do i have permission

worn lion
#

yea

regal harbor
coarse bobcat
#

turkish

worn lion
#

js or py?

worn lion
#

show token

#

(dont send it here)

coarse bobcat
#

i did it with glitch site i don't know which one

#

ok

#

yes it showed

worn lion
#

whats glitch

coarse bobcat
#

what should i do next

worn lion
#

read the docs

coarse bobcat
#

You can make a bot on the glitch site

#

What document

worn lion
#

"Api documentation can be found [here]"

coarse bobcat
#

hmm sorry

#

Where should I write the coin

#

token

#

sorry

#

Where should I write the token

#

@worn lion

#

hey

#

@worn lion

#

help me

#

please

soft salmon
#

just wait for a response PogBruh

coarse bobcat
#

how much

sullen nymph
#

until whenever they are free

coarse bobcat
#

jsjsjsjjs

worn lion
coarse bobcat
coarse bobcat
timid wigeon
#

Im turkis

#

from turkish

sullen nymph
#

You had to announce that in a channel dedicated to top.gg API, congratulations.

tawdry flax
restive otter
#

i am so boring any one here chat with me then add me

rain heart
#

@restive otter no need to send that into literally every channel

distant oak
#

Hi, I get this error when dblapi.js post data on top.gg :

Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (/home/creeper/gj/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  raw: '{"error":"Unauthorized"}',
  body: { error: 'Unauthorized' },
  status: 401,
  headers: {
    date: 'Fri, 11 Dec 2020 18:04:36 GMT',
    'content-type': 'application/json; charset=utf-8',
    'content-length': '24',
    connection: 'close',
    'set-cookie': [
      '__cfduid=dc2a20b1f2010206dbe951b8cfd82fde91607709876; expires=Sun, 10-Jan-21 18:04:36 GMT; path=/; domain=.top.gg; HttpOnly; SameSite=Lax; Secure',
      'country=FR; Path=/'
    ],
    'x-powered-by': 'Express',
    'access-control-allow-origin': '*',
    'access-control-allow-headers': 'Authorization',
    etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
    'cf-cache-status': 'DYNAMIC',
    'cf-request-id': '06f492f9420000082c5aaef000000001',
    'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
    'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    server: 'cloudflare',
    'cf-ray': '600121086a2f082c-CDG'
  },
  ok: false,
  statusText: 'Unauthorized'
}``` Someone know how to fix it ?
main valve
#
client.on('message', msg=>  {


});

for some reason this function activates 3 times is that normal?

distant oak
distant oak
#

Ok

#

Thanks

main valve
#

yea I guess the clien.on() function works three times

regal harbor
#

@main valve thats not normal

#

check if you have more than 1 message event

pure junco
#

Do you need a website to set up a webhook?

rapid kettle
#

no

pure junco
#

Then how do you set up webhooks?

rain heart
#

you need a service that can requests though

pure junco
#

How do I know the webhook got sent something?

#

Like does something trigger when that happens?

willow spindle
#

vote event

pure junco
#

It's not sending at all

young haven
#

I'm trying to get the bot to thank when it is voted, the first shard calls successfully but the others say that the port is already being used, what to do?

rain heart
#

use a different port

young haven
# rain heart use a different port

you only have the option to put a port, the first shard uses the port and the second says he cannot use it because it is already in use

jaunty plank
#

You should not have a webhook receiver in every shard.

#

Only in the sharding manager, or using a seperate process entirely.

main valve
#

@restive otter msg event you mean msg.content?

restive otter
#

?

main valve
#

it doesn't seem to read it twice anymore

#

im not sure it only prints once per message in the console log

main valve
jaunty plank
#

Client.on can happen a ton of times.

restive otter
#

just a stupid question, do I have to set the "Authorization" header content to this ("Authorization: {key}") or this ("{key}")?

jaunty plank
#

The content is just key

restive otter
#

oh ok

#

thanks

regal harbor
#

@young haven you need to set the webhooks in the shards file not in the file that you are sharding

#

or in another file

late crater
#

When will it be possible to fetch reviews from the api or view all reviews?

rain heart
#

soon ™️ probably

pine heart
#

Error: 502 Bad Gateway I randomly got this error... what does it exactly mean?

willow spindle
restive otter
#

what was the autoposter to post just the server count?

fast agate
restive otter
#

not this smh

#

that is outdated

restive otter
#

for js^

crude elm
#

See pinned msg

#

They said abt new apis

fiery cedar
restive otter
#

lol

restive otter
#

top.gg api no longer makes post requests?

#

is it get now?

potent jolt
#

Whi my webhook doenst work on heroku ?

restive otter
#

server webhook?

potent jolt
restive otter
#

is it a webhook for a bot or a server

potent jolt
restive otter
#

ok what you have done so far?

#

you created a webhook that'll receive requests from top.gg?

silk cobalt
#

umm

#

how to make that webhook?

potent jolt
restive otter
#

ok so it works

#

it's not bot upvote, server upvote

potent jolt
restive otter
#

I tested webhook like 10 times and it keeps sending me post requests

silk cobalt
#

@potent jolt how can get server ip?

#

sorry ping

potent jolt
#

check your pm

potent jolt
silk cobalt
#

ty @potent jolt

potent jolt
#

ty ?

silk cobalt
#

thank you

potent jolt
#

ohhhhhh

#

sory im not english...

silk cobalt
#

hehe

#

np

#

no problem

potent jolt
#

no problem ^^

silk cobalt
#

haha nice

potent jolt
quartz dew
#

how to i access the API

#

i make a discord bot and i want the API

#

of DBL

potent jolt
#

npm i dblapi.js if you are on node.js else idk @quartz dew

restive otter
quartz dew
#

i made a bot but it says i have none

#

what do i do now? @restive otter

restive otter
#

your bot needs to be approved

quartz dew
#

???

silk cobalt
#

@quartz dew your bot yet approved

#

just wait for approved from moderation

#

or bot reviews

true pebble
silk cobalt
#

for approved wait 3-4weeks maybe

true pebble
#

help

#

How do I set the server status

restive otter
#

add @wild lantern

restive otter
silk cobalt
#

nope

#

using dblapi.js

#

for post count server

true pebble
silk cobalt
restive otter
#

oh yes you need to check api docs

true pebble
silk cobalt
#

check doc

restive otter
#

there are discord js and discord py guides

silk cobalt
#

for make that using dblapi.js package

true pebble
silk cobalt
#

@true pebble ```const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})

dbl.on('error', e => {
console.log(Oops! ${e});
})```

#

put your token there

#

then restart your project

true pebble
#

thank you ❤️

silk cobalt
#

and your server has posted

restive otter
#

why is top.gg making get requests for server votes

#

anyone

#

bot votes are working fine

outer summit
#

My bot does not seem to post stats to top.gg, however I don't get any errors or so. What should I do? :/

willow spindle
#

code?

outer summit
#

Got a warn of possible memory leak from dblapi.js

willow spindle
outer summit
outer summit
latent spear
#

just replace "topggtoken" with ur token

outer summit
#

Ok, thanks

latent spear
#

@outer summit you get the bots token from here

latent spear
#

oke sorry^^

outer summit
#

It didn't work with dblapi.js so I came here

outer summit
latent spear
#

i just tried topgg-autoposter and works fine for me, so hopefully for you too

outer summit
#

Okay, I'll try in a sec

#

Thanks, it worked

onyx sun
#

Where can I find the top.gg bot token

wheat copper
onyx sun
#

ok

next flame
#

How do I get my token?

onyx sun
next flame
fast agate
#

xD

fast agate
#

discord token??

wheat copper
fast agate
wheat copper
#

bit stuck here... im trying to get my webhook to point to my service subdomain (essentially IP) and i'm using express to listen to port 2000 but when i try and point dbl to port 2000 express says port is already in use...
I can kinda understand that but how can i get this to work lol... sorry not done anything with webhooks before 😬

jaunty plank
#

so, you using express on port 2000 and dbl on port 2000?

wheat copper
#

yeah

rapid kettle
#

thats a conflict

hearty lintel
rapid kettle
#

ads

wheat copper
#

actually just realised that i ought to check the new api thingy

hearty lintel
wheat copper
#

lol, what berry just said

rapid kettle
#

lmao i know

#

i was joking

hearty lintel
#

e oki

wheat copper
#

ok, ill check the new stuff and ask if i need any help 😁

hearty lintel
#

👍

next flame
#

DBL.webhook.on is not defined

jaunty plank
#

whats your dbl constructor look like?

next flame
#

I understand, my Client did not log in!

wheat copper
#

um, probably a daft question but what should i expect when i click 'test webhook'?? i am assuming something should log in my console?

jaunty plank
#

you need to initialize the webhook in the constructor.

#
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!`);
});
#

with webhook port, and auth.

next flame
#

as?

jaunty plank
#

the auth is something you make

#

can be anything.

willow spindle
next flame
#

Very thanls

#

*Very thanks

solar quartz
willow spindle
#

which lang

solar quartz
willow spindle
solar quartz
#

Isn´t helping

#

If when i was to add the comand .vote was so complicate, imagine the docs now have a lot of information or some exmples

willow spindle
#

this is basically: you are creating a webserver on your vps and set your webserver's url in top.gg bot settings.

#

there is a Test button so you can test it

next flame
#

Can I put my dbl token on webhookAuth without my token being stolen?

sullen nymph
#

Why not use a password of your own choice

harsh charm
#

I’m looking for 3rd

#

Frosty cash cup

#

Pc player

sullen nymph
#

Wrong place to search

next flame
#

In?

fast agate
#

@next flame hmmm...

#

python

#

??

next flame
#

No

#

Java script

#

@fast agate

#

Using Discord.js

restive otter
#

are you using dblapi.js

#

@next flame