#topgg-api

1 messages · Page 78 of 1

restive otter
#

and what i do wrong?

vapid cape
#

double check if the port is correct and if the password is correct

#

and test again

restive otter
#

ok

#

it dont say nothing in console

#

and all are good

#

it says server count posted

vapid cape
restive otter
#

yep

vapid cape
#

not 5004?

pale fulcrum
#

looks a bit short to be 50004 but I cant tell

restive otter
#

50004

pale fulcrum
#

ok

vapid cape
restive otter
#

yep

#

one moment

pale fulcrum
#

Tim what do you use to host?

restive otter
#

i talk to the owner of the site

green mantle
#

does it support the full port range

#

or put it through express or somthing?

vapid cape
#

titanservices is not a VPS

#

its a managed microservice, like glitch/heroku

#

its likely that they have a reverse proxy behind, where 50004 is the public external port, but not the internal port

#

like with glitch, the external port is 80, but internal is 3000

restive otter
#

and what i do?

vapid cape
#

you need to ask the owner

restive otter
#

and he need to give me the external port?

vapid cape
#

the external port should be the one in your panel, 50004

restive otter
#

ok

vapid cape
#

you need to ask him if the internal port is the same, or a different one

restive otter
#

ok

vapid cape
#

@pale fulcrum currently using galaxygate and google compute engine

pale fulcrum
#

ok

restive otter
#

and i cant do it like a message.channel.send?

pale fulcrum
#

yes

#

but you would first need the user and the channel

granite adder
#

hello

restive otter
#

idk what is wrong

vapid cape
#

dm me your ip address

restive otter
#

ok

pale fulcrum
#

if you go to the page that you put in the top.gg, you should get an error saying no webpage or something

#

so if the connection is okay that would show it

vapid cape
#

finally got it to work, top.gg being wonky i guess

#

now you need to find a channel to send it in

#

do you have the channel's id?

restive otter
#

yep

pale fulcrum
#

and do you want the voter's mention or do you want to use an ID?

restive otter
#

mention

#

but if it isnt are in the server?

pale fulcrum
#

ok so you need to fetch the user

restive otter
#

yep

willow spindle
#

ping 👀

pale fulcrum
#

ghost ping

restive otter
#

ok

vapid cape
#

no need to fetch the user

#

just do <@ID>

pale fulcrum
#

oh right

#

fetching is just for dm

#

going off of my code

vapid cape
#

@restive otter first you need to get the channel from your bot

restive otter
vapid cape
#

which version of discord.js are you using?

restive otter
#

v11.6.3

vapid cape
#

then its client.channels.get(channelID)

#

where client is your bot's client

#

in your case would be bot

restive otter
#

i want to do that send it to a channela and dm the users, its possible dm?

#

in index all of this?

vapid cape
#

yes, if they dont have your bot blocked

restive otter
#

ok

#

in index all of this?
?

vapid cape
#

everything inside the vote event

restive otter
#

ok

pale fulcrum
#

correct me if I'm incorrect but in order to dm, you would need to either get the user or fetch the user, right?

restive otter
#

idk

vapid cape
#

channel id must be a string, not a number

pale fulcrum
#

ok Grayald you need to use .send on the channel

restive otter
#

ah, ok

vapid cape
#

and as i said, client should be your bot's client instance

#

no...

#

are you even trying

#

do you know what a string is?

pale fulcrum
#

thats just a variable

vapid cape
#

27364927489 this is a number
"27364927489" this is a tring

restive otter
#

i use ``

pale fulcrum
#

that works as well

restive otter
#

im spanish xdd

pale fulcrum
#

change client to bot

restive otter
#

done

vapid cape
#

i said it 3 times now lol

restive otter
#

and now i do a message.channel.get?

pale fulcrum
#

ye

#

no...?

vapid cape
#

there is no message in votes

restive otter
#

oh

#

F

pale fulcrum
#

you can either just .send(x) on the channel or you can define a variable as the channel and do variable.send(x)

#

but you would want to catch it because if the bot is blocked, you would error

vapid cape
#

you named it bot

restive otter
#

yes

#

i named it bot

vapid cape
#

so EVERYTIME you see someone mention client.something you have to do bot.something instead

restive otter
#

i know it

vapid cape
#

so to get a channel from the client, its client.channels.get("ID")

#

so for you: bot.channels.get("ID")

restive otter
#

ok

vapid cape
#

once you have the channel, you can directly send a message to it

#

buy using .send()

restive otter
#

ok

vapid cape
#

the same way you would do on a message.channel.send()

#

do bot.channels.get("ID").send("something")

restive otter
vapid cape
#

yes

pale fulcrum
#

because message.channel is an instance of a discord channel

restive otter
#

ok

pale fulcrum
#

now you can restart and test

vapid cape
#

so now you have a working vote in your channel

restive otter
#

ok

#

and now need the dm

pale fulcrum
#

what would the message be?

restive otter
#

that message

#

later i change it to a embed

pale fulcrum
#

so who is it dming?

restive otter
#

dming?

pale fulcrum
#

who will it dm?

restive otter
#

to the user that vote

pale fulcrum
#

ok you would need to fetch the user

restive otter
#

you can do that if you get for example 5 votes in favor the bot gives you something (this is for later)

pale fulcrum
#

lets get one problem solved at a time

restive otter
#

ok

pale fulcrum
#

so how you would fetch a user in d.js v11 is client.fetchUser() or for you, bot.fetchUser()

#

the function is async so you need to await it

restive otter
#

bot.fetchUser

pale fulcrum
#

and make the vote event async

restive otter
#

ok

#

so i put bot.fetchUser()

#

await

pale fulcrum
#

not exactly

restive otter
#

how?

pale fulcrum
#

im not sure about this part but you should be able to use .then on bot.fetchUser()

#

so

#

it would be bot.fetchUser(vote.user).then(u => { u.send(message ) }

restive otter
#

bot.fetchUser().then(

pale fulcrum
#

no need for await on a .then

restive otter
#

oh, ok

#

bot.fetchUser().then(

#

author.channel.send("Thanks")

#

)

#

?

pale fulcrum
#

no

#

I sent the code

restive otter
#

where?

vapid cape
#

there is no author

pale fulcrum
#

it would be bot.fetchUser(vote.user).then(u => { u.send(message ) }
@pale fulcrum

restive otter
#

so its wrong

vapid cape
#

.then(u => ) means u contains the result of the fetchUser function

#

the result is a user

#

so u is a user

restive otter
#

so what we can do?

pale fulcrum
#

and look at what you can do with a user

restive otter
#

xdd

vapid cape
#

wrong version, thats for v12

#

anyway, we already told you all you need, you just need to use your brain

#

you can send messages to a user when you do user.send()

pale fulcrum
vapid cape
#

and u is a user

restive otter
#

ok

vapid cape
#

therefore you can do u.send()

pale fulcrum
#

and there are also methods

#

send is a method

restive otter
#

I'm already messing around, one says one thing and the other another, this is messy xdd

pale fulcrum
#

what is messy?

#

the code? send a pic

restive otter
pale fulcrum
#

you need to change message to what you want to tell the user

restive otter
#

i know it

#

in ``?

pale fulcrum
#

yes

restive otter
#

F

#

im fixing it

#

one moment

vapid cape
#

you didnt close the .then()

pale fulcrum
#

thats my bad ig

#

but yeah

restive otter
#

GG

#

and i know that i didnt close it xdd

pale fulcrum
#

I think that since vote.user is a number, you need to turn it into a string

restive otter
#

what does it do to check if the user has so many votes, if so, that the command continue

pale fulcrum
#

sorry, I havnt gotten that far yet

restive otter
#

Ok

#

@vapid cape

#

you know ?

what does it do to check if the user has so many votes, if so, that the command continue

vapid cape
#

you need to store votes in a database

restive otter
#

it was for the last 12h

pale fulcrum
#

that only gives you a boolean

restive otter
#

:/

#

and what i need to know it?

#

@vapid cape ?

vapid cape
#

you can use that, but from what people have said here, it is slow to update

restive otter
#

and what i use?

vapid cape
#

could take a few minutes after the vote to start working

pale fulcrum
#

most people use a DB for that

vapid cape
#

the only accurate way is to store votes in a database

restive otter
#

DB?

vapid cape
#

but that requires knowledge of databases

pale fulcrum
#

database

restive otter
#

F

#

and i can do a leaderboard?

pale fulcrum
#

well

#

yes but first you need a DB and since you arent doing anything with the API rn, move to #development

restive otter
#

ok

rotund magnet
#

Is there any docs for the JSON version of the API? I use Elixir so nothing on the webapge helps. I'd in the end make my own implementation and post it as a resource.

green mantle
#

@rotund magnet which api?

#

wait

#

sorry im being dumb

#

DBL sends a JSON response for most libs iirc

#

which lib are you trying to use it with?

rotund magnet
#

My language is Elixir and there is no library for the API. That's why I'd like to make my own library, but I don't see any official docs for the JSON api.

green mantle
#

look for the Topics bit

#

that has the tables for what is what type in respones

#

auth is just done with headers like normal

rotund magnet
#

That's... not what I need. Or rather is a part of what I need. Webhooks post to an url I want, it by no means is similar to the general API. I can't see how many votes a bot currently has. I can use webhooks to keep count but that means if mu bot is offline for even one vote, I'd lose the correct count.

green mantle
#

use the Resources part then

rotund magnet
rotund magnet
#

I can't seem to get it right

#

I get an Unauthorized error when trying to use the API via postman

#

Should I put the token in the header and if so under which key?

sullen nymph
#

Forgetting auth header?

rotund magnet
#

i know that I need to put the header but like

#

under which key? ahaha

sullen nymph
rotund magnet
#

Ah, I missed that part (I literally just found out the name by myself)

#

Oh and if I create a library for Elixir, is there any chance for it to be accepted as a official for that language?

sullen nymph
#

I doubt there would be a necessity, though you can DM Tonkku and ask the question for yourself. :p

rotund magnet
#

I mean I'm asking because I'd publish it on GitHub either way when I make it. I'll DM him when I actually do make a working version ahaha

ruby agate
#

Hello

sullen nymph
#

Веди себя адекватнее. И читай правила в #rules-and-info.

ruby agate
#

I'm from Russia my name is Kirill

sullen nymph
#

Also please read channel topics.

ruby agate
#

Okay

#

Сдесь есть русские?

pale fulcrum
sullen nymph
#

MeguDead Почему я должен перефразировать правила...
Все иностранные языки идут в #memes-and-media.

ruby agate
#

Ок

little dew
#

i already have dbl and DBL token defined but i get this error

dbl.webhook.on('vote', vote => {

heres the error i get

dbl.webhook.on('vote', vote => {
            ^
TypeError: Cannot read property 'on' of undefined
pale fulcrum
#

do you have the webhook defined

#

what do you define dbl as?

little dew
#

yeah

#

sec

#

i have 2 dbl variables

#

idk why

#

but

#

in the api website

#

it had it

#

like that

#

lol

pale fulcrum
#

what do you defined dbl as?

little dew
#

const DBL = require('dblapi.js');
const dbl = new DBL(config.topggtoken, client);

#

i hid the token in the config

pale fulcrum
#

ye you didnt configure the webhook

little dew
#

?

#

i added the token in the config file?

pale fulcrum
#

no thats not the problem

#

you did not define the webhook

#

const dbl = new DBL(config.topggtoken, { webhookAuth: 'password', webhookPort: 5000},client);

#

that is a default one

#

then configure the port to an open port to your system and go to the bottom of top.gg/yourBotIDHere/edit and set webhook url to the IP:port/dblwebhook and passowrd to what you put as webhookAuth

little dew
#

oh

#

ok

#

uh

#

i still don't understand maybe i will do it later

vapid cape
#

dbl.webhook only exists if webhookPort or webhookServer are present in the DBL constructor

pale fulcrum
#

and they only work if the port is open and you have configured the password and url on your bot's edit page

little dew
#

?

#

my bot port changes everytime lol

pale fulcrum
#

not your bot port, your open external port

little dew
#

how about the "webhookAuth"

#

or password

#

from where do i get that

vapid cape
#

you define it yourself

little dew
#

oh

vapid cape
#

it must be the same as your top.gg authorization

little dew
#

uh

#

my top.gg authorization is blank

#

and the url is also blank

vapid cape
#

yeah

#

because you can put whatever you want in authorization

#

as long as its the same as webhookAuth

little dew
#

so its possibly like a password

vapid cape
#

ye

little dew
#

ok

vapid cape
#

the URL depends on where your bot is hosted

little dew
#

heroku?

vapid cape
#

if using a vps, it will be your vps's ip address

#

for heroku its PROJECTNAME.herokuapp.com/dblwebhook

little dew
#

okay

#

tysm

vapid cape
#

and webhookPort should be process.env.PORT

little dew
#

okay

#

help?

#
dbl.webhook.on('vote', vote => {
            ^

TypeError: Cannot read property 'on' of undefined
pale fulcrum
#

please show what you defined dbl as

little dew
#
const dbl = new DBL(config.topggtoken, { webhookAuth: config.topggauth, webhookPort: process.env.PORT},client);
#

i inserted the auth and token in the config file

pale fulcrum
#

im not sure

little dew
#

hm

vapid cape
#

show your full code

little dew
#

ok

#
const Discord = require('discord.js')
const config = require('./config.json')
const si1 = 1000
rannum = Math.floor(Math.random() * 500)
const DBL = require('dblapi.js');
wfm=0
min=2
max=20 // +1 because nodejs screws something up lol
console.log(rannum)
// const ffmpeg = require('ffmpeg')
// const opus = require('opusscript')
const client = new Discord.Client()
const dbl = new DBL(config.topggtoken, { webhookAuth: config.topggauth, webhookPort: process.env.PORT},client);
const server = require('./server.js')
const express = require("express")
const app = express()
const pngmemes = './memes/png'
const gifmemes = './memes/gif'
const jpgmemes = './memes/jpg'
const pngcusmemes = './memes/png/custom'
const { Users, CurrencyShop, SpecialShop} = require('./dbObjects')
const { Op } = require('sequelize')
const currency = new Discord.Collection()
const PREFIX = 'goose '
const fs = require('fs')
#

its a lot of things

#

but yeah

vapid cape
#

and the rest of the code?

#

where you use dbl.webhook

#

also where you use express

dim veldt
#

Is the posting api JSON only or can you post it as a form too?

silent orbit
#

you can post it as a form

#

i think

dim veldt
#

Worth a shot

little dew
#

i use express in the server.js file and the rest of the code is over 400 lines

#

lol

restive otter
#

I never wrote a code that is 400 lines long

#

(because i wrote longer with useless spaces)

little dew
#

lol

#

im going to rewrite it tmr

devout iris
#

How i catch the webhook password ?

little dew
#

at the end

#

Authorization

#

change it to something

#

nobody eill knoe

devout iris
#

Ahhhhh

#

okay

little dew
#

will know*

#

and then put in your script

devout iris
#

@little dew And the ip

#

5000 ?

little dew
#

ip?

devout iris
#

Port

little dew
#

port

devout iris
#

im sorry

little dew
#

process.env.PORT

#

it is that

devout iris
#

How do I get the port? haha

#

I got confused

#

How do I leave it? 5000?

little dew
#

?

#

just change the '

#

'

#

''

devout iris
#

I'm sorry, I'm Brazilian, I don't speak English very well

little dew
#

to

#

process.env.POT

#

its ok

devout iris
#

okay

little dew
#

PORT*

devout iris
#

const dbl = new DBL(dblToken, { webhookPort: process.env.PORT, webhookAuth: dblPass });

#

?

little dew
#

ye

#

is dblpass

#

defined?

devout iris
#

I put the token, and the password in the config

little dew
#

okay

#

good

#

your good to go

devout iris
#

TypeError: Cannot read property 'on' of undefined

little dew
#

happrns to me

#

happens

#

idk the fix

devout iris
#

you know how to fix ?

#

ow

little dew
#

nop

devout iris
#

okay

little dew
#

just remove

#

the vote thing

#

and it gets fixed

#

lol

devout iris
#

Don't have to define the process?

little dew
#

?

#

nah

#

its defined in nodejs

#

itseld

#

self

devout iris
#

.env

#

PORT=blablabla

little dew
#

nah

#

dont define it

#

or anytbing

#

thing

restive otter
#

Hello! Any person know how to do a premium command? Like for example if you have 5 upvotes you can run the command

#

It will require a db

#

If anyone has voted before the db was setup they wont be stored, you will have to check if the person has voted, and if yes then you add 1 to the total votes

#

Get this from the api /bots/yourbotid/check

#

It uses the userid field, and either outputs {voted: 1} or {voted: 0}

#

If its voted 1, add 1 to the total votes for the specific user, then query if they have 5+ on the command you want to have premium for, If yes, let them use it, if no give them an error and a link to vote then try again once they have 5 votes

#

ne has voted before the db was setup they wont be stored, you will have to check if the person has voted, and if yes then you add 1 to the total votes
Get this from the api /bots/yourbotid/check
It uses the userid field, and either outputs {voted: 1} or {voted: 0}
If its voted 1, add 1 to the total votes for the specific user, then query if they have 5+ on the command you want to have premium for, If yes, let them use it, if no give them an error and a link to vote then try again once they have 5 votes

#

I legit just said that @restive otter, you legit just stole my answer

#

bot ayam

#

??? got

#

Selfbots are against discord ToS dude

#

Anyway, Hope my solution helps you @restive otter, that's what I am using for mine and it works without fail in my testing

#

Ok

#

@restive otter can you give me the code in dm?
I am Spanish and I do not understand you much

#

What code do you use?

#

I use handlers

#

Discord.js v11.6.3

#

What language?*

#

Discord.js

#

Ok

#

Hello! Any person know how to do a premium command? Like for example if you have 5 upvotes you can run the command
Someone? I use discord.js v11.6.3

vernal adder
#

🥄

primal sigil
#

pls help my member count bot doesnt work

green mantle
#

This is Not the write Channel for that, read the channel topic please ty, also this is not member count support server @primal sigil

#

oh they left

restive otter
#

/weekend

static cedar
#

I can’t find a bot help server how do I get it? <@&304313580025544704>

craggy sentinel
#

-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.
craggy sentinel
#

also check the channel topic

dense grail
#

You can find the help server by going to the page and then clicking "Join Support Server", you do not click "Join Discord" at the top of the bar

#

also this chat is not for asking that :')

static cedar
#

Ok

#

Sorry

worn quail
#

in the api channel too, please take note of the channel you are in before sending

#

oh my god please @stone sierra read the channel topic

stone sierra
#

Sorry. I already noticed it

true talon
#

read docs

tepid delta
#

french here ??

hexed glade
#

ouii

tepid delta
#

puis je te parler en pv stp

hexed glade
#

oui stv

tepid delta
#

fait ^^

craggy grove
#

did something change in regards to the top.gg and webhooks?

sullen nymph
#

Would you mind elaborating?

craggy grove
#

its probably something i havent updated, but i have made no changes to my bot's environment and now my webhook wont connect anymore

#

it never emits the 'ready' event

#

ive tried fiddling with my firewall rules and theyre all correct

blazing kraken
#

how can i solve

hexed glade
#

How are u posting your servercount?

blazing kraken
#

I did not understand

hexed glade
#

What's ur current code to post the servercount?

#

You need to post your servercount using the top.gg api wrapper

blazing kraken
#

I have no code, how can I get it?

#

what should i do next

hexed glade
#

What's ur coding language?

hidden solstice
#

Is your bot approved for a start?

blazing kraken
#

javascript

#

Is your bot approved for a start?
@hidden solstice yes

hidden solstice
#

Ok

hexed glade
#

ty titan 🙂

hidden solstice
#

😀

tender garnet
#

Yo

#

is Individual User Id Voting Check for the past 12 hours. endpoint broken ?

sullen nymph
#

It's kinda slow at times

green mantle
#

better to use webhooks if you want speed and reliablity in the long run

tender garnet
#

I am using this endpoint as a fallback because when my website is down webhooks obviously can't work

#

so user can still get their reward with a bot command

sullen nymph
#

in a way, yeah

tender garnet
#

but... always returns {vote:0} even if they vote

#

:/

restive otter
#

how can i get when someone upvotes my bot and the user that upvotes it.

sullen nymph
devout iris
#

Someone can help me plz ( preference brazilian or spanish )

restive otter
#

what do i put in here, and where do i use it in the vote listener

#

@devout iris You have to say what you want help with, if you need help...

pale fulcrum
#

you put the link to your bot's webhook

#

normally, IP:PORT/dblwebhook

#

the vote listener can be anywhere you want but its normally in the same file that you use to start the bot

restive otter
#

where can i find my bots webhook

pale fulcrum
#

you need to create one

restive otter
#

like using a host? @pale fulcrum

pale fulcrum
#

in your code, when you create dbl, you can create a webhook

restive otter
#

How do i connect api so when someone vote it the bot give him credits

#
const DBL = require("dblapi.js");
const dbl = new DBL(dblToken, { webhookPort: 5000, webhookAuth: webhookAuthPass });

Thats what i have right now @pale fulcrum but im not sure how exactly i would go about creating the webhook

#

unless that is the webhook

pale fulcrum
#

well, you just need to know what you set webhoolAuthPass as and make sure that the port 5000 is open

#

then you can put the IP:5000/dblwebhook

#

and authorization is webhookAuthPass

restive otter
#

so isIP:5000/dblwebhook the webhook

#

@pale fulcrum

pale fulcrum
#

yes

restive otter
#

public ip right?

#

@pale fulcrum

pale fulcrum
#

yes

#

and make sure the public has access to the port

restive otter
dim veldt
#

0.0.0.0 is refering to the machine it's running on not it's real IP. If you're running something on heroku you'll need to use it's actual address.

restive otter
#

how can I make the webhook post the information to my website and then from my js code receive it

dim veldt
#

Have your website accept post requests for some route like /vote & then somehow pass that info to your bot (how you do that depends on how you've got things setup).

restive otter
#

how could i listen and get the info when the webhook posts info on it

#

using js

dim veldt
#

In JS you could host a little express server somewhere (maybe from within your bot) & have a route like /vote that process vote webhooks.

restive otter
#

but its hosted not with the bot

vapid cape
#

what does it run on?

#

what kind of webserver

restive otter
#

im using heliohost so i think apache

vapid cape
#

so you'd need to make a php script to receive vote events

#

but if you want those events to be received by your bot, its better to receive them directly by your bot, not through your website

dim veldt
#

Looks like that host allows you to use a few langs

restive otter
#

yep

#

@vapid cape bot is hosted on heroku so i cant get the ip

vapid cape
#

heroku uses its project url

dim veldt
#

^

vapid cape
#

if you're using dblapi.js

restive otter
#

oh

vapid cape
#

and port is process.env.PORT

restive otter
#
const {TOKEN, MongoUrl, IMGUR_API_KEY, GOOGLE_API_KEY, dblToken, webhookAuthPass, HEROKUPORT} = require('./config')
const DBL = require("dblapi.js");
const dbl = new DBL(dblToken, { webhookPort: HEROKUPORT, webhookAuth: webhookAuthPass });
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!`);
});

So it would look like this?

vapid cape
#

if config is a js file, yes

restive otter
#

yep

vapid cape
#

if config is a json file, no

restive otter
#

no it should work fine from js

vapid cape
#

ye

restive otter
#

ok well it doesnt work and when I use the test button it does nothing

#
const {TOKEN, MongoUrl, IMGUR_API_KEY, GOOGLE_API_KEY, dblToken, webhookAuthPass, HEROKUPORT} = require('./config')
const DBL = require("dblapi.js");
const dbl = new DBL(dblToken, { webhookPort: HEROKUPORT, webhookAuth: webhookAuthPass });
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!`);
});

JS code ^

#

@vapid cape

devout iris
#
{
  "dblToken": "***",
  "dblPass": "***",
  "dblPort": "3000"
}

My config.json

#

The token, and the pass is correct defined.

#

The dblPort is the glitch port

#

@nimble fossil can you help me plz ? ^

#

Where is the :port in the url ?

pale fulcrum
#

@restive otter you need to add auth

restive otter
#

how can i add auth

devout iris
#

Authorization, you create you password

pale fulcrum
#

@devout iris you need to make sure it the port is forwarded, and you are putting the correct webhookURL in

#

if you are using glitch or heroku or a vps you need to check what ports they yse

devout iris
#

A friend of mine who managed to use it did it this way, but mine doesn't work. @pale fulcrum

pale fulcrum
#

@restive otter what you put as config.webhookAuth needs to go in the box

#

@devout iris do you use glitch?

restive otter
#

wait one sec

#

ok thanks it works now

pale fulcrum
#

np

devout iris
#

@restive otter Whats the heroku port ?

restive otter
#

do process.env.PORT

#

that with give you the heroku port

devout iris
#

In heroku ?

restive otter
#

are you using js

devout iris
#

yep

#

my port is correct

#

The glitch port is 3000

restive otter
#

so const port = process.env.PORT

#

in heroku

devout iris
#

In glitch is it too

restive otter
#

i cant verify that

#

so you would have to test it

pale fulcrum
#

I didnt use glitch but tbh, I thought it was 80

devout iris
#

But does't work

#
const DBL = require('dblapi.js');
const dbl = new DBL(dblToken, { webhookPort: dblPort, webhookAuth: dblPass });
dbl.webhook.on('vote', vote => {
       console.log(`DBL - O usuário ${vote.user} votou em mim.`)
       const canal = client.channels.get("694685092760649770");
       canal.send(`DBL - O usuário ${vote.user} votou em mim.`);
});```
 My code is correct ?
restive otter
#

are the variables dblToken dblPort and dblPass defined?

pale fulcrum
#

do you module.exports or do you use a json?

devout iris
#

are the variables dblToken dblPort and dblPass defined?
@restive otter yep

pale fulcrum
#

can you please show the code

#

that they are defined as

devout iris
#
{
  "dblToken": "***",
  "dblPass": "***",
  "dblPort": "3000"
}

My config.json

pale fulcrum
#

not what I mean

#

how do you get them

#

require()?

devout iris
#

👍

pale fulcrum
#

send the require()

#

please

devout iris
#

const { dblToken, dblPass, dblPort } = require("./config.json")

pale fulcrum
#

ye nope

#

you cannot do const { x } = require("x.json")

devout iris
#

const { token, dblToken, dblPass, dblPort } = require("./config.json");

#

Really ?

#

What i use

#

I don't speak english very well

restive otter
#

i know you can do that with a config.js

pale fulcrum
#

you need to do js const x = require("./config.json") const dbl = new DBL(x.dblToken, { webhookPort: x.dblPort, webhookAuth: x.dblPass });

devout iris
#

... okay, i go try this

#

you can wait a minute plz ?

pale fulcrum
#

you can only use { x } = require when you use module.exports and export an object

devout iris
#

ok

#

you need to do js const x = require("./config.json") const dbl = new DBL(x.dblToken, { webhookPort: x.dblPort, webhookAuth: x.dblPass });
@pale fulcrum i will try this

pale fulcrum
#

OK

#

ping me if you need further help

devout iris
#

ok

#

@pale fulcrum I clicked on Test and it didn't result in anything.

pale fulcrum
#

Is the password the same on both?

devout iris
#

Yes

#
const config = require("./config.json");
const DBL = require('dblapi.js');
const dbl = new DBL(config.dblToken, { webhookPort: config.dblPort, webhookAuth: config.dblPass });```
pale fulcrum
#

Console log config

devout iris
#

Could you speak in an easier to understand way?

#

im brazilian

pale fulcrum
#

Yes sorry

devout iris
#

:(

#

tnks

pale fulcrum
#

Add a line that logs config , try console.log(config)

devout iris
#

Do you want to know if you logged in to the console ?

#

Ah

#

ok

#

It returned all information from the config correctly.

#

I think the problem is not there. :(

pale fulcrum
#

Ok what do you use to host?

devout iris
#

glitch

pale fulcrum
#

Ok im not sure about glitch’s port

devout iris
#

3000

#

process.env.PORT

pale fulcrum
#

Ok then idk

devout iris
#

that makes 3000

pale fulcrum
devout iris
#

ok

pale fulcrum
#

But keep 3000 on the bot

devout iris
#

ok

#

?

restive otter
#

Acho que ao invés do URL do bot, deveria ser o IP da VPS ou o IP da Glitch @devout iris

#

No seu caso, da Glitch

pale fulcrum
#

Yes?

devout iris
#

carai, finalmente

#

Acho que ao invés do URL do bot, deveria ser o IP da VPS ou o IP da Glitch @devout iris
@restive otter voce sabe qual é o ip ?

restive otter
#

@pale fulcrum Translation:
I think that instead of the bot URL, it should be the IP of the VPS or the IP of Glitch @ScopPH

devout iris
#

Yes?
@pale fulcrum i pinged you to know, if my code is correct sorry

restive otter
#

@devout iris sabe pingar um site usando CMD?

devout iris
#

n

#

algo

#

do tipo

restive otter
#

ping projecto-name.glitch.me

#

Vai mostrar o IP do projeto

devout iris
#

Ah ta

#

cmd do pc

restive otter
#

Sim

devout iris
#

foi

restive otter
#

Copia o id e coloca no lugar do link

devout iris
#

uso mac

#

n se se ta certo

#

vc pd pingar pra mim ?

restive otter
#

Aí ficaria tipo
https://0.0.0.0:80/webhook

devout iris
#

a

#

ent ta certo

pale fulcrum
#

Thanks for the translation

#

Btw, this is supposed to be english I think

devout iris
#

Dev, eu preciso mudar algo na index ?

pale fulcrum
#

So stay on topic

restive otter
#

Ah okay

#

Speak english @devout iris

#

Plz

devout iris
#

accept friend request

#

And you help-me on or in idk dm

restive otter
#

Support only on this channel, sorry

devout iris
#

;-;

#

ok

#

I need to change something in index ?

restive otter
#

Did you set everything up correctly in the index?

devout iris
#

i think ye

restive otter
#

Hm

#

Did you get the IP of the glitch server?

devout iris
#

👍

#

o tópico diz somente q n pode off-topic e n diz nada sobre falar ingles

restive otter
#

Now do the following in the URL of top.gg that you configured:
https://PROJECT_IP:PORT/webhook

devout iris
#

@mighty shuttle He can help me in portuguese language ?

#

Dont need to be /dblwebhook ?

restive otter
#

Oh, true

#

Put this

devout iris
#

Now do the following in the URL of top.gg that you configured:
https://PROJECT_IP:PORT/webhook
@restive otter ja coloquei

#

i need to put this in the index too ?

restive otter
#

No

devout iris
#

ko

#

coloquei

#

ok
@devout iris

restive otter
#

Now try to test the webhook on the site and see if something appears on the console

devout iris
#

i will test

#

ok

#

isso né ?

restive otter
#

Yes

devout iris
#

No, nothing logged to me in console

restive otter
#

Did you save before testing?

devout iris
#

of course

#

@dense compass He can help-me in portugues ? ( or only english ? )

restive otter
#

Hm

dense compass
#

I only speak English and Dutch and if it's webhook related sorry but I'm not gonna be of much use as I've not used them myself

devout iris
#

No, the @restive otter can help-me in portuguese ?

dense compass
#

I'd personally recommend moving to DMs in that case. Don't entirely remember us having language rules about this channel but it would keep it more readable for the average user (for future reference it is actually allowed as long as it's ontopic)

devout iris
#

@restive otter Podemos ir para dm somente para me ajudar ? após isso encerramos.

restive otter
#

Ok

devout iris
#

thank you

uneven brook
#

hey, is there a way to create embed but add fields after the declaration ?

#
let embed = new Discord.MessageEmbed();
embed.addField('name', 'value');

is that ok ?

hexed glade
#

yes

pale fulcrum
hexed glade
uneven brook
#

ok

restive otter
#

at=error code=H14 desc="No web processes running" When i test my webhook on heroku I keep getting this error when i use a worker instead of web (Because web shuts down if not serving a website for 1 hour). Does anyone here know a solution to this.

#

hi

#

Türkçe Bilen varmı orsubluar

fiery shadow
#

where could i get my dbl token again?

true talon
fiery shadow
#

thx

keen flint
#

/dblwebhook

#

oof

#

How to get a DBL Token without need to public the bot to integrate it into the bot?

oblique trout
#

What? Please rephrase.

#

To get a token, you need to submit the bot.

harsh stream
#

Your bot needs to be on top.gg before you can use a DBL token.
And to be accepted on the bot list your bot needs to be public

#

Also why would you want a DBL token for a private bot? There is no need to vote for a bot that no other server can use

keen flint
#

to integrate it before release?

silent orbit
#

you get the dbl token when your bot gets approved

#

there's no way to get one before approval

signal hawk
#

@mighty shuttle ad ^

mighty shuttle
#

ty

oblique turret
#

yo i'm a novice when it comes to programming and i've tried for hours and used multiple sources to get the interaction with the top.gg api working but i havent been able to do so. Has anyone got a link to a guide i can use. I use python to make my bot.

green mantle
oblique turret
#

i've looked at the code multiple times and tried different things with it but cant figure out to get it to work

green mantle
#

i mean the code is litterally drag and drop

oblique turret
#

and i litterally did that

green mantle
#

do you get any errors...

oblique turret
#

no

#

i just run it and nothing happens

oblique turret
#

i still cant figure it out

#

dont know if its me being really dumb rn or i'm missing something that i've never been told about

#

could i have a hand??

sullen nymph
#

lends a hand
So what's your code is looking like currently?

oblique turret
sullen nymph
#

Aha

#

That's code for a cog

oblique turret
green mantle
#

however youre not using cogts

#

cogs*

#

so you gotta change it

oblique turret
#

i dont really understand any of it

green mantle
#

may i also say

#

does your bot even work?

#

considering you init client class

#

then the next callable line, run it

#

blocking everything underneath

oblique turret
#

well i put it on a seperate script so it didnt clash with anything else

#

i was planning on adding it to the main script afterwards

sullen nymph
#

If you're not using the commands extension, just remove the class, any reference to self and instead of using __init__ use the event on_ready

oblique turret
#

so like this? But there're errors so i must be misunderstand something here

green mantle
#

move on_guild_post out of on_ready indent and add @client.event above

sullen nymph
#

And the bot = bot is redundant

#

And you might want to make dblpy a bot variable aka bot.dblpy

green mantle
#

bot = bot is an error no?

oblique turret
green mantle
#

yes but also no

#

your bot object isnt called bot is it

#

its called client

#

so bot needs replacing with client

oblique turret
#

so client.bdlpy

green mantle
#

dblpy = xyz is irrelevant

#

you dont need dblpy = bot.dblpy

#

because it just get overriden bellow

#

and client doesnt have a dblpy attribute unless you manually set it

#

so remove it

#

and replace bot with client for DBLclient

oblique turret
#

yea sorry you kinda lost me there

#

so just replace bot with DBLclient

green mantle
#

no

#

bot -> client

#

dblpy = bot -> delete

oblique turret
green mantle
#

👍

oblique turret
#

ay

#

it worked

#

thank you so much

restive otter
#

So someone made me mine so I just want to know how I can get mine approved or something

waxen wind
#

Also wrong channel for that lmao

sullen sandal
#

Hi, I have an issue using the cog for discord.py. I have a sharded bot (4 process with 10 shard by process), and when using the example code, it show only the server count of one process

green mantle
#

because its split cross processes, the lib cant just do len(bot.guilds) which is what it does for the server count

#

if you want it to post the total from all 4 proccesses

#

one way would have all 4 put their individual server counts to a global cache

#

or see if the lib can support posting a list of counts

#

shiv will know

#

👀

sullen nymph
#

Psst, shard_id and shard_count

#

This is fun actually, I forgot about sharding support uwaa

green mantle
#

tbf its not that bad

#

depending on your python version (3.8+) you can setup a global cache pretty easily

sullen nymph
#

bot.guilds shouldn't be touched tho, no?

green mantle
#

processes cant share data

#

/ they cant see the same thing

#

so each process will only have the guild count for its set of shards

sullen nymph
#

I see where you're getting at

green mantle
#

why alot of people use docker when running mutliple processes

#

then have an ENV var

#

and have all of them post guild count to that

sullen sandal
#

ok i just find out thank you !

green mantle
#

the comments bellow have a couple of good examples

balmy hamlet
#

dude

tired birch
#

s/help

restive otter
#

.help

signal hawk
#

bots do not work in this channel

restive otter
#

Anyone know how to set the command for those users who had voted for us

#

Please mention me if you can help me

true talon
#
dbl.hasVoted(message.author.id).then(voted => { //if voted is true user has voted else it hasnt;
})
  //dont work with webhooks```
wispy wasp
#

Yo berapi ni discord

limpid vector
#

does dblapi automatically post server count from all shards?

#

this is the constructor I'm using (discord js v12)

restive otter
#

it might be

#

how to connect your dbl webhook if our host does not allow us to touch the ports

green mantle
#

you cant

#

if there are no open ports that you are able to route stuff through then it wont be possible

restive otter
#

how can i do that so my bot can still see who is voting?

green mantle
#

i mean you can request if a user has voted within the last 12 hours using the api

#

only if your bot gets less than 1000 votes a month

restive otter
#

ah :/

#

so I can't, too bad thank you anyway

#

and is that on the dbl site in the webhook box I have to put the ip instead of 0.0.0.0 or the bot can communicate even with 0.0.0.0?
http://0.0.0.0:5000/dblwebhook

sullen nymph
#

Replace 0.0.0.0 with your public IP

restive otter
#

my ip is not fixed

#

how can I do ?

green mantle
#

what are you hosting on rn 🤔

restive otter
#

rn ?

green mantle
#

right now

restive otter
#

at home

green mantle
#

you should be able to open ports when self hosting 🤔

#

also your public IP should only change when your router restarts which i cant imagine is often

restive otter
#

it restarts every single week

green mantle
#

... why

restive otter
#

i don't know it's orange that works like that

restive otter
#

how to make bot leave voicechannel if no one on vc except the client on voiceStateUpdate

green mantle
#

wrong channel

topaz verge
#
  const embed1 = new Discord.RichEmbed().setColor(config.emcolor)
    .setDescription(`
Thanks for <@${vote.user}> for vote for luffybot
If you want to vote for me go to [https://top.gg/bot/652156490819436544/vote](https://top.gg/bot/652156490819436544/vote)
`);
  client.guilds.cache
    .get("563708914265358336")
    .client.channels.cache.get("689908901235130634")
    .send(embed1);
  console.log(`User with ID ${vote.user} just voted!`);
})```
#

not work

pale fulcrum
#

is there an error?

#

well I guess first, did you set it up correctly in the dbl edit page?

true talon
#

does dblapi automatically post server count from all shards?
@limpid vector it does

limpid vector
#

Much appreciated, thanks!

restive otter
#

How i get my API Key? I look at the API Docs but its says i dont have an bot, but i have added my Bot

shy vortex
#

@restive otter you can get an api key after your bot got approved

restive otter
#

ok thx

green mantle
#

neko chan

#

proceeds to have a profile pic of somali

restive otter
#

:3

shy vortex
#

after your bot got approved you can find 2 other fields when you edit the bot

the field with the api options also allows you to see the api key or regenerate it

#

just so you know

magic oriole
#

why does this have a syntax error

#

in the first line

loud gulch
#

is there another if statement above that then

#

also wrong channel

magic oriole
#

woops

#

btw there is an else statement before that

#

and i tried changing this to if else

#

but it still doesnt work

#

it gives me a syntax error at the {

oblique turret
#

hello me again

#

i want to use get_user_vote but i cant figure out what to return

#

could i please have some help

oblique turret
#

nvm

#

i have just figured it out

oblique turret
#

yea nvm again

#

it turns out it was just returing true everytime someone used it

#

so help pls??

oblique turret
#

nvm again

#

we're going in a circle here

#

it works now

cinder adder
#

-botinfo 460610749283172353

abstract mothBOT
#

tickNo That bot wasn't found

cinder adder
#

-botinfo @460610749283172353

abstract mothBOT
#

tickNo Please include a bot mention or ID

stone sierra
#

-botinfo @dusky island

abstract mothBOT
#

tickNo That bot wasn't found

restive otter
jaunty sable
#

How can I make a vote only feature

#

Like only allow them to use the command after they voted

true talon
#

dbl.hasVoted("id").then(voted => {})

#

if voted = true user has voted

restive otter
#

-botinfo dumb bot

abstract mothBOT
#

tickNo Please include a bot mention or ID

restive otter
#

-botinfo @topaz sentinel

abstract mothBOT
#
Bot info
ID

658757206908600320

Username

Dumb Bot

Discriminator

2515

Short Description

This is just a stupid bot I put together with some commands, really basic but is fun to mess around with.

Library

discord.js

Prefix

db!

Total Upvotes

44

Monthly Upvotes

8

Server Count

No server count

Owner(s)

@burnt sparrow

restive otter
azure plover
#

Why is there a long delay between when someone upvotes and when the /bots/{bot.id}/check endpoint returns true

spiral steeple
#

I would assume some garbage cache but idk for sure

pale fulcrum
#

™️stats

#

bro

sullen nymph
green mantle
restive otter
#

-botinfo @restive otter

abstract mothBOT
#
Bot info
ID

688390331523530978

Username

BryXou

Discriminator

7414

Short Description

Bot FR | Bot pour la modération, de nouvelles fonctions arrivent, rejoignez le Discord pour être informé de toutes les nouveautées

Library

discord.js

Prefix

++

Total Upvotes

3

Monthly Upvotes

2

Server Count

No server count

Owner(s)

@open bane

green mantle
restive otter
#

Hey i don't understand how to mâle a webhook for vote example : a person vote for my bot and a webhook send a message

#

@green mantle sorry

green mantle
#

have you looked at the api docs for js?

restive otter
#

Yes

#

And i don't understand good

green mantle
#

what bit doesnt make sense?

restive otter
#

Example can i send the message in a channel like a bot with the discord js api

green mantle
#

sending messages to a specific channel isnt DBL api related thats normal discord.js

#

the DBL Api itself doesnt support sending messages to channels

#

you'd need to make a seperate system for that

restive otter
#

Oh okey so i can't send message with my webhook when a person vote

green mantle
#

not with the DBL API no

#

that would be normal Discord.js

#

you would take the vote event from the DBL Api then -> use discord.js to send a message in a channel like that

restive otter
#

Ohh nice thx

#

Example : i use the discord js api and DBL so for example a person vote for my bot and after the webhook use the discord js api for send a
message

green mantle
#

yeah

#

so DBL would send the vote payload to your webhook, you would take that vote info and go from there sending to a specific channel or what ever

restive otter
#

Like a bot

green mantle
#

hmm?

restive otter
#

Send a message in a specific channel like a bot

green mantle
#

Yeah the bot can do that

restive otter
#

Okey

green mantle
#

you can do it with webhooks but not sure how todo that with js

restive otter
#

Gmm

#

Hmm

#

I' going to test with a webook

#

And after

#

My bot

#

Thx

#

green mantle
#

np

glad spire
#

-botinfo @unkempt scarab

abstract mothBOT
#
Bot info
ID

694545891146596372

Username

BotEmAção

Discriminator

9406

Short Description

Bot Exclusivo Para servidor da Locademia da Polícia.

Library

Other

Prefix

!!

Total Upvotes

1

Monthly Upvotes

0

Server Count

No server count

Owner(s)

@glad spire

Links
green mantle
#

@glad spire #commands for bot commands, not here

restive otter
#

What is the webhookAuth password ?

spiral steeple
#

your choice

#

you set it on your edit page

restive otter
#

Ohh okey

restive otter
#

My code doesn't work :

const discord = require("discord.js");
const DBL = require('dblapi.js');
const dbl = new DBL (my token..., { webhookPort: 5000, webhookAuth: 'myPassword' });


dbl.webhook.on('vote', vote => {
  message.channel.send(`${vote.user} a voté pour BryXou | +1`);
});

Why the webhook doesn't send message when a person vote for my bot or when i make a test ?

willow spindle
#

there is no "message"

balmy hamlet
#

learn the basics of any laguange

#

and then make a bot

#

@restive otter

#

this is what happens when you copy code

restive otter
#

So

#

I don't have my pc

#

And i

balmy hamlet
#

no you don't

#

you have a web browser and youtube in your phone

restive otter
#

And

balmy hamlet
#

you can learn the basics of any programming lang and then try making a bot

restive otter
#

I have

#

Make

#

Thats

#

The probleme

balmy hamlet
#

you have make

#

what does that even mean

restive otter
#

The console of my server

balmy hamlet
#

??

restive otter
#

And my package.json

balmy hamlet
#

first: you didn't install dblapi.js

#

and your code is also wrong

restive otter
balmy hamlet
#

I'm saying

restive otter
#

Look my package

balmy hamlet
#

learn the basics of any programming lang

#

you're not even paying attention

#

to what I'm saying

restive otter
#

Ohhh

#

Just help me

balmy hamlet
#

no

restive otter
#

Look my package.json

balmy hamlet
#

learn

restive otter
#

Why i have this error

balmy hamlet
#

this problem has the easiest fix you can think of

#

first

restive otter
#

I have install dblapi.js

balmy hamlet
#

why do you even have pupeteer

#

there are a lot of dependencies you don't even need

#

I'm not going through this

restive otter
#

It's not a problem for the moment

#

I'm trying to fix

#

This

#

And after i delete a lot of dependencies

balmy hamlet
#

I'm sorry, but you don't want to learn the basics of any programming language. And I'm not going through this.

restive otter
#

Plz men

#

🙏

balmy hamlet
#

nope, if you don't want to learn the basics of any programming language then I don't want to help

#

maybe tim will help