#development

1 messages · Page 1482 of 1

pale vessel
#

use js const prefix = (await prefix.findOne({ GuildID: msg.guild.id }) || {}).prefix || "s!";then

delicate shore
#

Oh alr

earnest phoenix
#

let helpingEmbed = new Discord.MessageEmbed()
.setAuthor(client.config.FOOTER_BOT_NAME)
.setTitle(${prefix}${cmd.name})
.setDescription(**Description:** ${cmd.description}\n)
.addFields(
{name:"Usage:", value: \${prefix}${cmd.usage}`, inline:true}, {name:"**Aliases:**", value: `${cmd.aliases}`, inline: true}, {name:"**Cooldown:**", value: `${cmd.cooldown/1000}` seconds`, inline: true}
)
.setColor(client.config.SUCCESS_COLOR)
return message.channel.send(helpingEmbed)

mellow kelp
#

or

delicate shore
#

That is tougher

#

But

mellow kelp
#

how about you make your own method

delicate shore
#

Thanks

opal plank
#

@earnest phoenix wheres the rest?

mellow kelp
delicate shore
#

Btw is updating to node 14 recommended or no

mellow kelp
#

that could work out too

#

yea

#

its the latest stable version

pale vessel
#

you really need to cache your prefixes

#

and yeah, it's the new lts

earnest phoenix
pale vessel
#

it's recommend to upgrade

lyric mountain
#

Node 14 crashes for unhandled exceptions tho

#

Just like compiled langs

opal plank
delicate shore
opal plank
#

and send the link

mellow kelp
#

oh yeah the unhandled promise rejections thing?

#

it seemed as if that wasn't ever going to happen lmao

misty sigil
#

but

#

just handle them

mellow kelp
#

yea

lyric mountain
#

It's good to have it tho

#

Like, wht not handle it?

#

Is that exception racism?

opal plank
#

DONT

mellow kelp
#

o

opal plank
#

dont give them weird ideas

#

DO NOT

#

do that

mellow kelp
#

a

#

ok

#

but is it okay to use use it as a fallback

#

like

opal plank
#

handle your promises where they are generated

#

no

#

dont use it as fallback either

mellow kelp
#

i handle pretty much all promises, but i have that just in case

opal plank
#

handle ur shit properly

lyric mountain
#

Poggers doggers loggers codders

mellow kelp
#

o

opal plank
#

the maximum you can use that for is for logging your errors somewhere. dont use that as an error handler

earnest phoenix
#

DM erwin'

mellow kelp
#

well k

lyric mountain
#

I use exception fallback to use my custom logger instead of System.out's default

opal plank
#

@earnest phoenix you didnt put the embed permission i told you about

#

EMBED_LINKS

lyric mountain
#

Using a catch-all can be dangerous

earnest phoenix
#

ooooohhh

mellow kelp
opal plank
#

no

#

heres my logger for example

earnest phoenix
#

if(!message.guild.me.permissions.has("SEND_MESSAGES")) return; what about this

opal plank
lyric mountain
#

By catch-all I mean a global exception catcher

opal plank
#

@earnest phoenix you are using Commando, why not use that instead?

lyric mountain
#

Which makes most errors useless for debugging

earnest phoenix
#

no command

opal plank
earnest phoenix
#

its discord.js

#

no other 3rd party npm

mellow kelp
#

oh cool

#

errors table

opal plank
#

@earnest phoenix oh, still though, you have that inside there, why check it before?

mellow kelp
#

i should to that thing

earnest phoenix
#

ok

opal plank
#

its a lot more complex than that though

#

like, a LOT more

lyric mountain
#

Know what? I like that exceptional table idea

opal plank
#

it actually tries to recover from errors

mellow kelp
#

i got mongodb

#

pretty sure i can just store error objects

#

along with date and stuff

opal plank
#

been using that instead of SENTRY, though SENTRY is a lot better for this sort of stuff as it saves the variables when it error'd

pale vessel
# delicate shore How can I do that

you can assign the prefix to an object/map and check if the prefix exists in that object (you can set the guild id as key). if it is, return the prefix and if not, fetch it from db, set it and return the prefix. next time it happens again, it won't query the database but return it from the object ```js
const prefixes = {};

async function getPrefix(guildID) {
if (prefixes[guildID]) return prefixes[guildID];
prefixes[guildID] = (await findOne() || {}).prefix || "s!";
return prefixes[guildID];
}

// Your handler
const prefix = await getPrefix(message.guild.id);```

opal plank
#

i just use this for my panel, so i get real time feedback of the errors

pale vessel
#

fuck

#

mobile sucks

opal plank
mellow kelp
#

try sentry for free

#

no-no

pale vessel
#

Ayy I use sentry

#

It's really handy

pale vessel
#

it's not really one

opal plank
#

@earnest phoenix show new code

lyric mountain
#

Opens page
Try bla bla bla
Closes page

opal plank
mellow kelp
#

hmm aight

pale vessel
#

It's better than pm2

earnest phoenix
#

botPermissions: ['SEND_MESSAGES', 'EMBED_LINKS', 'VIEW_CHANNEL', 'READ_MESSAGE_HISTORY'],

opal plank
#

whats the whole error?

lyric mountain
#

I'm a java dude, so...

earnest phoenix
#
    at RequestHandler.execute (E:\OneNaut\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async RequestHandler.push (E:\OneNaut\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/792743596021121054/messages',
  code: 50013,
  httpStatus: 403
}
#

SEND MESSAGE is disabled

lyric mountain
#

Guess I'll make an error factory /s

opal plank
lyric mountain
#

Br detected

opal plank
#

where?

pale vessel
#

you should check for channel overwrites, channel.permissionsFor(guild.me).has()

opal plank
#

i assumed that too

lyric mountain
#

Hyped boy, "canal inválido" is in portuguese

opal plank
#

you should really only check for overrides tbh

pale vessel
#

same

earnest phoenix
#

can you give an example?

pale vessel
#

i-

opal plank
#
guild.me.permissionsIn(channel).has(YOURPERMISSIONS)
earnest phoenix
#

ok

#

Guys you bot will have same error

#

if you disable higher role perm and give to bot

opal plank
#

im starting to think you didnt save your changes or didnt restart your bot

opal plank
#

cuz none of the permissions you asked matter for role hierarchy

mellow kelp
earnest phoenix
#
     if (args[0]) return message.channel.send(Math.floor(Math.random() * args[0]))
     if (!args[0] || !args[1]) return message.channel.send('Wrong syntax, please enter `nhelp pick` for more details.')
     const pickWordlist = args.join(',');
      message.channel.send(pickWordlist[Math.floor(Math.random() * pickWordlist.length)]);

why when i using npick 1,2 it respond NaN 😦
how i can change it to respond 1 or 2

earnest phoenix
opal plank
#

hmmmm

earnest phoenix
#

youa re getting same?

opal plank
#

nope

#

i'd recommend just checking for channel permissions

#

instead of guild

#

channel permissions are final

earnest phoenix
#

yup

opal plank
#

it might be fucked because you are checking for a permission the role has, but not the channel

opal plank
earnest phoenix
misty sigil
#

who needs sentry

opal plank
#

you handle the error by not GETTING the error though

misty sigil
#

just don't have errors

rocky hearth
#

Does anybody knows about this error?
TypeError: Class extends value undefined is not a constructor or null

earnest phoenix
#

correct

#

what todo

opal plank
#

check if the bot has permission to send, if it does, dont send

#

use the code i sent you

earnest phoenix
opal plank
#

then you shouldnt be getting any error

opal plank
#

you speak portguese?

earnest phoenix
#

nope english

opal plank
#

what other language you speak?

earnest phoenix
#

just english

#

Do you speak hindi?

opal plank
#

unfortunately no

#

some of the stuff you are saying is hard to understand, so i was checking if your second language was one that i knew so i could give you a hand

earnest phoenix
#

oh ok.

#

Thanks for help

opal plank
#

Np

shut pawn
#

F

tardy hornet
#

how do i make that heroku dynos will stop restarting

#

its restarting the bot every 20h

restive furnace
#

just handle it ¯\_(ツ)_/¯

tardy hornet
#

i do, but i have that it restart all the sqlite files

#

so i cant do economy

restive furnace
#

yeah u need to use remote database

tardy hornet
#

how?

#

what is that

lyric mountain
#

Like, even for premium it does that

#

Not that heroku has premium at all

#

You'll need to setup a my/postgre/whatever-SQL somewhere out of heroku

restive furnace
#

or nosql

lyric mountain
#

He uses sqlite, so I'm considering sql-based

tardy hornet
#

how do i use that tho

lyric mountain
#

You'll need a server

restive furnace
#

which?

lyric mountain
restive furnace
#

okok

tardy hornet
lyric mountain
#

Yep

restive furnace
#

yes

lyric mountain
#

Or buy some host

tardy hornet
#

kk

lyric mountain
#

Which will be a lot expensive than a vps

#

Heroku is not really worth it in the long run, since you'll be capped by slug size, daily restarts (which invalidate caches) and huge latency

#

Not to say heroku hates bots

dense nest
#
url = 'https://randomfox.ca/floof'
  response = requests.get(url)
  json_data = response.json()
  fox = json_data[0]['image']
  link = json_data[0]['link']
#

What has i broken

#

Lol

lyric mountain
#

No error = no fix

restive furnace
dense nest
#

There is no error

#

O.o

mellow kelp
lyric mountain
#

U need to await url requests tho

#

Or use then chaining

pale vessel
#

it's blocking is it not

#

it's not asyncronous

mellow kelp
#

pretty sure requests is synchronous

lyric mountain
#

Are them? Weird

pale vessel
#

you should use aiohttp

#

requests is wack

dense nest
#

It's not asynchronous

lyric mountain
#

I don't get it why people avoid it

#

Well, except if u live in brazil, dollar is expensive af rlly now

dense nest
#

I just homehost

restive furnace
#

Because, since they don't have a proper db/cc (like me) probably?

lyric mountain
#

Maybe

gilded olive
#

requests = blocking

#

blocking is wack

#

requests is wack

#

aiohttp VeryCool

lyric mountain
#

Ah, I was mistaking with fetch

earnest phoenix
#

client.channels.get("config.id1").send("nope")

restive furnace
#

?

earnest phoenix
#

Not work

restive furnace
#

well because "config.id1" is a string by itself.

lyric mountain
#

Quotation, remember the quotation

#

Everything inside quotation is a string

#

Except escape chars

earnest phoenix
#

""

#

Not issue?

lyric mountain
#

Is issue

earnest phoenix
#

client.channels.get(config.id1).send("nope")

#

client.channels.get("config.id1").send("nope")

lyric mountain
#

First one is right, not better

pale vessel
#

client.channels.get(eval("config.id1")).send("nope")

#

/s

#

don't

lyric mountain
earnest phoenix
#

I dont have eval

restive furnace
#

you do

earnest phoenix
lyric mountain
#

Congrats, you just hanged someone's tesla car

restive furnace
#

it's built-in js feature

lyric mountain
#

Happy flaz?

pale vessel
#

sure am

earnest phoenix
pale vessel
#

please stop

lyric mountain
#

Forget eval

earnest phoenix
#

client.channels.get("clientid").send("nope")

#

I need clientid to load from another file

restive furnace
#

you should learn basic js first in my opinion.

earnest phoenix
woven sundial
#

Hi, I would like to use my num const outside of my forEach function. How can I do that ? :D

exports.run = (client, message, args) => {

    var Discord = require("discord.js");
    const locale = require("../locales/en.json");
    let db = require("./database.json").results

    let compteur = 0;

    db.forEach(function (element) {
        if(element.registration == args[0].toUpperCase()){
            const num = compteur;
        }else{
            compteur++;
        }
        
    })
    console.log(num)
    console.log(db[num])
}```
crimson vapor
#

well you can't use ++ on a const

twilit cloud
#

А я русский 😦

crimson vapor
#
  1. move the declaration out of it
  2. change const to let
crimson vapor
woven sundial
#

oh yeah, you're right

#

Why didnt I thought about that lol

#

Yup, it's working indeed. Thanks @crimson vapor

dense nest
#

@twilit cloud используйте #general-int для разных языков.

#

Oh

#

He left

#

Lmao

woven sundial
#

lol

tardy hornet
#

any one knows a cheap good host?

dense nest
#

Homehosting

#

Lol

#
@client.command()
async def fox(ctx):
  date = datetime.datetime.now().strftime("%m/%d/%y")
  url = 'https://randomfox.ca/floof'
  response = requests.get(url)
  json_data = response.json()
  fox = json_data[0]['image']
  link = json_data[0]['link']
  print(image)
  print(link)
  embed = discord.Embed(
          title = "🦊 Yip!",
          url = f"{link}",
          description = "",
          colour = discord.Colour.orange()
        )
  embed.set_image(url=f"{fox}")
  embed.set_footer(text="Shibe Bot | " f'{date}')
  await ctx.send(embed=embed)

No errors, just not working

earnest phoenix
#

how can i make my bot appear on certified bots at top.gg?

dense nest
earnest phoenix
#

oh right

lusty quest
# tardy hornet any one knows a cheap good host?

you get what you pay, keep it in mind,
but if you have a small bot with next to no guilds Google Offers a Free VPS. (it wont manage to run the bot if it uses to much ram bcs you get like 250MB) the Paid VPS from them are also fine with the pricing

dense nest
#

Homehosting

#

Is way better

mellow kelp
#

raspberry pi KEKW

dense nest
#

Kekw

#

My rack server

#

:p

lusty quest
#

not everyone got a Server at home

#

not everyone got a Server at home

lyric mountain
lusty quest
#

sure a Raspberry Pi or banana pi is paid off in 10-12 months but not everyone wants one or is not allowed to have one (lol)

tardy hornet
#

per month

lyric mountain
#

Cheapest plan is 3.99 iirc

#

Full ssd cheapest is a dollar above

#

An euro*

#

It's in euros actually, but iirc dollar is almost the same price as euro

lusty quest
#

how large is the bot and how much ram does it use currently?

#

@quartz kindle is there an way to get the guild object with the ready event while using the gateway? (needed to cross check the permissions of users that access my Dashboard)

earnest phoenix
lament rock
#

Discord only sends partial guild data on READY event. Allows clients to prealloc caches and determine which guilds are unavailable

lusty quest
#

i know. but if you call the REST api to get the guilds you get the Guild object but only the first 100 Guilds. to get around the 100 guilds i want to use the Gateway

lament rock
#

Idk if you can get the objects on READY event. GUILD_CREATE is emitted asynchronously * however many guilds your bot is in

lusty quest
#

yea just need to figure out how to properly listen to events

lament rock
#

OP 0 is the dispatch event which is where all the t: "SOME_DISCORD_EVENT" is

#

receive only

silver monolith
#

im trying to make a currency system for my bot
and when i do npm i quick.db in terminal i get a bunch of errors
and i dont get quick.db anywhere

mellow kelp
#

what errors

full condor
#

anyone here good w carlbot

silver monolith
#

one sec

mellow kelp
full condor
#

is there a channel for bot help

autumn compass
#

no

mellow kelp
#

not in this server

#

ask somewhere else

full condor
#

oh whoops

#

sorry

silver monolith
mellow kelp
#

You need to install the latest version of Python

silver monolith
#

yea

#

i did that yesterday

mellow kelp
#

is the PYTHON env variable set?

silver monolith
#

this is discord.js?

mellow kelp
#

yeah

silver monolith
#

im trying to use quick.db

mellow kelp
#

but i guess quick.db needs python

#

some packages are like that

silver monolith
#

that's what i thought

mellow kelp
#

there's this package called sharp which uses c++

prime glacier
#

can someone help me with intent

earnest phoenix
#

Noo

silver monolith
earnest phoenix
#

Djs is Quicken Allowed

#

QuickDB

silver monolith
earnest phoenix
#

Yes

silver monolith
#

????

earnest phoenix
#

You can use QuickDB on djs

silver monolith
#

ohh

#

umm

lusty quest
silver monolith
#

how do you check

earnest phoenix
#

Not sure about python though

#

Well. All my bots run on quickdb and djs sooo

#

Look at thr guide or smthn

silver monolith
#

ok

lusty quest
#

hmm thats bad already sended 6 Heartbeats

misty sigil
#

why is the load lazy

lament rock
#

^ depends how many guilds your client is in

lusty quest
#

currently 274

zinc shale
#

idk if someone has said this before @silver monolith , but you need nodegyp installed

prime glacier
#

can someone guide me for intent

lament rock
#

Ready event would be too large if not emitted asynchronously

quartz kindle
#

your guild_creates are being sent very slowly?

lusty quest
#

yea but all guilds are partials

#

i havent seen any other event for now exept the Gateway answering to heartbeats

lament rock
#

guilds from GUILD_CREATE are full objects

lusty quest
#

i know

#

ive got only the Ready event for now

quartz kindle
#

unless your connection is very bad, you should be receiving around 50-100 guilds per second from the gateway

lusty quest
#

i would not say my connection is bad (120Mbits down) i think ive just fucked something up

quartz kindle
#

perhaps

#

btw you can get more than 100 guilds from rest, but its slow af

silver monolith
#

i just installed node-gyp

lusty quest
#
ws.on("message", async function incoming(data) {
    msg = JSON.parse(data);
    console.log(msg)
})
``` this is how i listen for the events (there is more code below that is executed and work)
quartz kindle
#

hmm thats bad

#

dont asynchronize it

misty sigil
#

oooh raw ws

quartz kindle
#

it has to be sync

#

also dont assign msg to a global variable

#

you have concurrent async functions reassigning the value of the same variable

#

thats why its so fucked up

lusty quest
#

yea if i dont run it async i get issues with some database stuff

quartz kindle
#

it shouldnt affect any database

lusty quest
#

i make the DB calls async inside the message event

quartz kindle
#

well dont

#

wait for all guild_creates before

#

then run an async loop with await

#

otherwise you're also starving your database with 50-100 queries per second

misty sigil
#

that doesn't sound like something you should be doing to a database

lusty quest
#

nah it can handle this

quartz kindle
#

perhaps

#

try it

lament rock
#

My redis DB can barely handle all the guild creates

#

idk what you're using

quartz kindle
#

just fix the global variable

lusty quest
#

yea changed it

misty sigil
#

you could use a map yea

quartz kindle
#

you can remove your db code from the message event just to see the guild_create influx

#

then add it back

lusty quest
#

i know but i need to wait a bit or i get a invalid season

#

could use resume tho but im to lazy to implement this for now

lament rock
#

You shouldn't be getting invalid session

#

unless you try to reidentify with an invalid session

lusty quest
#

if i hot reload with nodemon i get a invalid session

#

yea

#

the workflow instantly reidentify

quartz kindle
#

does hot reload not shut down the process?

lament rock
#

You really should be attempting to resume because Discord closes your connection with 1000 frequently

#

resumes also dont go towards your 1000 identify limit per day

lusty quest
#

well i guess its time to make a workflow for resumes.

#
ws.on("message", function incoming(data) {
    const payload = JSON.parse(data);
    console.log(payload)
    if (payload.op == 10) {
        setInterval(() => _heartbeat(), payload.d.heartbeat_interval)
    }
    if (payload.t == "READY") {
        const map = payload.d.guilds.map((guild) => guild.id);
    }
    if (payload.op == 9) {
        console.error("Invalid Session");
        ws.close();
    }
});
```still no luck with other events than the ready event
#

only get op 11 messages

lament rock
#

suggestion but not an issue: handle OP 0 DISPATCH in another function just for cleanliness.

sterile lantern
#

is this good for a bot that just like has economy cmds, mod cmds, etc and sends web requests

#

would it exceed the limit or stay at this

misty sigil
#

depends where your db is hosted

#

ram could be upped a bit

lament rock
#

200MB is quite small

sterile lantern
#

yea ik

#

but

#

would it work?

misty sigil
#

what db do you use?

sterile lantern
#

i use sqlite db

#

that might be an issue tbh

misty sigil
#

350mb won't be enough imo

sterile lantern
#

ill switch to mongo

#

wont take up that much

#

right

lament rock
#

You'd have to pretty much not cache anything in memory otherwise, scaling would be so incredibly difficult

misty sigil
#

mongo takes up more

sterile lantern
#

really?

misty sigil
#

if you do a local install

sterile lantern
#

im connecting it

#

to the website

misty sigil
#

thats fine

sterile lantern
#

ok

#

oof

silver monolith
#

AAAAAAAAAAAA i tried EVERYTHING to get quick.db to work

sterile lantern
#

whats ur issue w/ it?

misty sigil
#

i reckon the best thing you could do

lusty quest
#

Mongo stores all keys in RAM. but it should be fine if you dont use to many keys

misty sigil
#

would be to buy a vps

sterile lantern
#

this is a cheap vps

lament rock
silver monolith
#

yes

sterile lantern
#

ill probs update the plan l o l

lament rock
#

look at windows-build-tools on npm

sterile lantern
#

is

#

1GB ram

lament rock
#

there are special install instructions

sterile lantern
#

and 1GB stroage

#

good?

#

storage*

silver monolith
#

wait nvm

sterile lantern
#

or 2gb ram and storage

lament rock
lusty quest
#

with 1 GB ram i where able to run 6 Small bots without any issues

lament rock
misty sigil
#

i have 4gb ram

#

64gb storage

sterile lantern
#

the gb/ram is per server

#

unlimited amount of servers

lament rock
sterile lantern
#

anywho ill get the platinum plan

lusty quest
#

i hate the gateway now. still no GUILD_CREATE event. idk why tho.

sterile lantern
#

this should be enough

#

right

#

for like databases, etc

misty sigil
#

thats overpriced

lament rock
#

GUILD_CREATE is from OP 0

sterile lantern
#

over priced?

#

really?

lusty quest
#

i know

sterile lantern
#

theres stuff cheaper than this??

lusty quest
#

i handle OP 0

misty sigil
#

i get 64gb storage, 4gb ram and free backups for a bit more than that

lusty quest
#

but the only thing i get are OP11

sterile lantern
#

what vps?

lament rock
#

You can get similar pricing for more from Contabo @sterile lantern 4 cores 8GB of ram + SSD

misty sigil
#

contabo is good too

#

contabo is really cheap and has great specs

sterile lantern
#

apparently contabo can only bare like 30 servers

#

than some bots start to crash

lament rock
#

???

sterile lantern
#

someone had like

#

36 servers on it

#

and then their bots started randomly crashing

#

contabo have unlimited servers

#

right

lusty quest
#

this sounds like inefficent code

molten yarrow
#

mine was on for 3 months on contabo...

mighty rock
#

hi

misty sigil
#

no

sterile lantern
#

i mean like is there a limit

#

to how many servers

#

you can create

#

also, is the GB/Ram per account or per server

lusty quest
#

you can create 100 and you will get them

#

they provision VPS on larger servers where are easy 100-1000 VPS on a single server

lament rock
#

Brain. I'd only suggest looking at other libs for reference. Only lib I know of which is pretty bare bones and supports gateway v8 is my fork of CloudStorm; https://github.com/AmandaDiscord/CloudStorm

What you might want to look at is src/connector/DiscordConnector.ts

lusty quest
#

yea

sterile lantern
#

so do they charge GB/Ram per server

#

or is it just your account

#

i mean storage not gb

rancid tulip
#

The whole instance (x GB RAM, storage) is already included in the bill, they won't bill for more unless you upgrade. Unless I am misreading.

lament rock
#

That is correct

wintry stream
#

what do you do with gigs of RAM ?

#

my python bot uses like 150 MB

misty sigil
#

gigs of ram?

#

scale

#

run other things, like your OS, your db, etc.

#

?

crimson vapor
#

Yeah I think my vps uses 2gb

blissful coral
#

Anyone in here use commando?

shut spear
#

any emitter on client obj to check whether bot is joined a server or left?

blissful coral
#

on what lib

shut spear
#

guildCreate and guildRemove i guess?

blissful coral
#

Yeah

#

yes

#

guildCreate

#

and guildDelete

shut spear
#

tnx

blissful coral
#

<3

lament rock
blissful coral
#

Restructure the whole lib KEKW

lament rock
blissful coral
#

I figured it out already

mellow kelp
#

lmao

blissful coral
#

It is a pretty useful lib

mellow kelp
#

wdym by restructuring the whole thing?

lament rock
#

Yeah. It does provide some helpful utilities, but if you're getting to the point of rewriting, I'd try to reimplement those features into a more lightweight lib than Discord.js

blissful coral
#

I was just changing some stuff to basically create a very dumpster fire version of v13 message replies and slash commands

lament rock
#

OOF

#

I mean. As long as it works

#

More power to ya

blissful coral
#

Ah fuck another error about moving a file location

#

fun

mellow kelp
#

yea

blissful coral
#

Yeah a lot more cuz v13 will be a bit

mellow kelp
#

i don't like commando that much but i gues it can be useful

#

like

blissful coral
#

It can be useful

mellow kelp
#

how hard is it to make a command handler

blissful coral
#

Not hard at all

#

It basically does it for you

#

lemme find it

lament rock
#

Depends on what features you're trying to implement. Automatic client message editing on command message update, reaction menus, etc

mellow kelp
#

oh so commando has that stuff?

#

cool

lament rock
#

those are pretty advanced

mellow kelp
#

yea ig

lament rock
#

iirc, yes

blissful coral
#

Yeah

#

It is really nice to use

#

Switched recently just giving it my own lil touch

lament rock
#

Only real problem I have with Commando is that it's based off Discord.js which does not scale well. It caches way too much for it's own good

blissful coral
#

Yeah

#

Like I said

#

Ghettoing out a bit

#

with the file redirects

lament rock
#

YIKES

lusty quest
#

gg

lament rock
#

jank dev is my bread and butter

mellow kelp
#

how about recursively registering all commands in a folder

blissful coral
#
const Command = require('../../node_modules/discord.js-commando/src/commands/base');
#

LMAO

#

@mellow kelp That is what I am about to do

#

I am rewriting the like default thing

mellow kelp
#

oh aight

blissful coral
#

Because it auto does it but you gotta be careful with what you move

#

or you kill your console with startup errors

mellow kelp
#

hmm maybe

#

i just import everything in the commands folder and check if the default import has an 'execute' function

blissful coral
#

Hold up

#

These were source files

#

LMAO

#

Why am I not just importing the lib instead of the source

mellow kelp
blissful coral
#

ITS THE DEFAULT EVAL

mighty rock
#

Hi

blissful coral
#

Hi

mellow kelp
#

Hi

blissful coral
#

Imagine luca had a docs cmd for dpy djs and eris mmuLu

shrewd oasis
#

Helloo guys

#

İm Ronaldo

#

Ahksnsjss

blissful coral
#

Hi

mellow kelp
#

ayo

blissful coral
#

After 50 errors I finally fixed it

#

By reverting it and finding a better solution KEKW

lament rock
#

jank.js

crimson vapor
#

That would be nice

#

Just -djs

#

or -djs Message to get the message class

blissful coral
#

A big thing about commando is that it's using sqllite by default

#

and I am trying to transfer to mongo

#

so

lament rock
#

sql is good

blissful coral
#

yes

#

It is good

#

But

#

I wanna use mongo

#

:(

lament rock
#

fair enough. Could make a PR allowing users to create their own database connectors

blissful coral
#

there probably is

arctic hare
#

sounds good enough

blissful coral
#

But I don't wanna rewrite 4000 lines of code to change from sqlite to mongo

lament rock
#

v12?

blissful coral
#

heroku

earnest phoenix
#

ye

blissful coral
#

kyk

#

kek

earnest phoenix
#

discord.js v12

lusty quest
#

you use V11 code

blissful coral
#

that is v11 code

#

on v12

earnest phoenix
#

i use v12

blissful coral
lament rock
#

channel.messages.fetch is for fetchMessages

blissful coral
#

Update ur code

earnest phoenix
#

...

lament rock
#

idk what bulk is in v12 02lick

blissful coral
#

That is v11 code on the v12 lib

earnest phoenix
#

whats the code for v12?

blissful coral
#

bulkDelete()

earnest phoenix
#

like can you send proper code..

#

explain

#

or check the docs lmao

#

..

arctic hare
blissful coral
#

Just look at the docs...

earnest phoenix
arctic hare
#

^

earnest phoenix
#

can i get link to docs...

blissful coral
#

...

earnest phoenix
#

...

lament rock
#

bruh

blissful coral
#
earnest phoenix
blissful coral
earnest phoenix
#

ill use guide

blissful coral
#

LMAO

earnest phoenix
#

wtf

mellow kelp
#

then don't ask

earnest phoenix
blissful coral
#

...

earnest phoenix
#

then use the guide

blissful coral
#

That is the same

#

THING

lusty quest
earnest phoenix
#

no one gives a fucking shit

arctic hare
earnest phoenix
#

if u didn't trust it in the first place why did u ask

blissful coral
#

Yes I am

#

lmao

#

Dude click on the documentation button on the top right of that one

#

it will redirect to the other one

#

2 domauins

#

domains*

earnest phoenix
blissful coral
#

Spooky site

lament rock
#

Facebook

blissful coral
#

Ok back to rewriting bottum

crimson vapor
#

What the hell is this

#

it’s literally the fucking docs

#

learn to read™️

earnest phoenix
crimson vapor
#

Emphasis

earnest phoenix
#

oh fuck i just swore

earnest phoenix
solemn latch
earnest phoenix
blissful coral
#

^

#

you don't just get a page on js.org

crimson vapor
earnest phoenix
blissful coral
#

you have to go through js

#

lol

crimson vapor
#

my phone is almost dead

earnest phoenix
#

huh

#

@earnest phoenix enough man your not funny

solemn latch
#

Rip phone

earnest phoenix
#

quit it

#

lol im not trying to be but ok

#

pinged me 5 times in the last 10 minutes

#

who cares...??

solemn latch
#

Let's get back on topic

earnest phoenix
#

tf???

#

just stfu

#

make me

blissful coral
#

The new case just got here

#

Poggers

earnest phoenix
earnest phoenix
crimson vapor
earnest phoenix
#

can u stop carrying on

#

im out...

blissful coral
#

Can y’all just stop

#

Jeez

earnest phoenix
#

finally

#

fucking retard

blissful coral
#

Chill

earnest phoenix
#

mb

lusty quest
#

i hate the gateway. idk why but it wont send me the full Guild object... i guess i take a break from it until tomorrow

lament rock
#

The gayteway was a pain for me but once I got a sense of structure, it was fine

lusty quest
#

i just need the stupid guild object for cross checking permissions.

#

well atleast ive cleaned up the entire code a bit

lament rock
#

Are you at least getting GUILD_CREATE?

lusty quest
#
ws.on("message", function incoming(data) {
    const payload = JSON.parse(data);
    switch (payload.op) {
        case OP.DISPATCH:
            handleDispatch(payload);
            break;
        case OP.HEARTBEAT:
            console.log("Recived Heartbeat");
            break;
        case OP.HELLO:
            setInterval(() => _heartbeat(), payload.d.heartbeat_interval);
            break;
        case OP.RECONNECT:
            console.log("Reconnecting");
            break;
        case OP.INVALID_SESSION:
            console.error("Invalid Session");
            ws.close();
            break;
        case OP.HEARTBEAT_ACK:
            lastACKAt = Date.now();
            latency = lastACKAt - lastHeartbeatSend;
            console.log(`Latency Heartbeat: ${latency}ms`);
            break;
        default:
            console.log(payload);
    }
});
``` cleanest code ive wrote in a while
#

nope only the Ready Event and heartbeat

lament rock
#

OP.HELLO or OP.HEARTBEAT?

lusty quest
#

Hello is OP 10

lament rock
#

Yes

lusty quest
#

but all ive get are OP 11

#

after sending an OP 2

lament rock
#

Also, are you shadow declaring global variables within case OP.HEARTBEAT_ACK?

lusty quest
#

yea

umbral skiff
#

best hosting for music bot???

lament rock
#

dont declare global variables

lusty quest
#

got a small file where i refer the OP codes to Variables

#

also i know what my issue is

#

wrong intends

#

i send 0 but i guess i want something else

earnest phoenix
lament rock
#

oh lol. Yeah you want GUILDS intent

#

I forget what 1 << number it is

lusty quest
#

1 << 0

#
  - GUILD_CREATE
  - GUILD_UPDATE
  - GUILD_DELETE
  - GUILD_ROLE_CREATE
  - GUILD_ROLE_UPDATE
  - GUILD_ROLE_DELETE
  - CHANNEL_CREATE
  - CHANNEL_UPDATE
  - CHANNEL_DELETE
  - CHANNEL_PINS_UPDATE```
lament rock
#

so if you only want GUILDS, you'd send 1

#

not 0

lusty quest
#

yea

#

ahh man i could have made so much more progress but no i sit here for 3 or so hours bcs ive send a 0 instead of 1

#

yep console goes Bananas with reciving Guilds

lament rock
#

Hey man. Shit happens. It's alright. I spent a good day or so asking people why Discord closes my connection with code 1000 regularly and the response was just "they just do"

#

Outside of the possibility that I wasn't sending heart beats

#

because I was

lusty quest
#

yea where at this point earlyer this day.

#

my function where shite for sending the heartbeat

lament rock
#

Once you understand Discord's gateway implementation, other gateway structures just make sense which is good

tranquil drum
blissful coral
#

poggers bro

lusty quest
#

... where did they hide the Permissions?

#

or did i need to fiddle around with Roles

lament rock
#

Guild.permissions || Guild.permissions_new

#

if you want to calc client permissions, you will have to use roles and channel overrides if applicable

umbral skiff
lament rock
#

permissions_new is a string

#

permissions is an Int

lusty quest
#

i just need the hex code or whatever format they are.

earnest phoenix
lament rock
#

Guild.permissions does provide the bitfield for permissions

umbral skiff
lusty quest
#

well thats annoying

#

the REST API does and it made it pretty easy to cross check if a User is in a Guild where the Bot is in and got Manage Guild permissions

earnest phoenix
lusty quest
#
(BotGuild) => BotGuild === guild.id && (guild.permissions & 0x20) === 0x20
``` this made it super easy. but without proper permissions saved i guess i need to work around it
lament rock
#

Remind me what 0x20 is

#

MANAGE_GUILD?

lusty quest
#

yea

earnest phoenix
#

yeah it should be that

lament rock
#

The same can be done with data received from the gateway

lusty quest
#

the function above is on demand running as a Endpoint in a small Backend Express API, still need to figure out how to use the gateway instead of the previously used REST API

quartz kindle
lament rock
#

Caching, here we go

lusty quest
#

yea i guess i just export a Map out of my Websocket Handler and import it into the Endpoint

slate grotto
lament rock
#

No lol

#

All they told me was I wasn't heart beating which I am. I validated I always sent a heartbeat every heartbeat_interval

vagrant apex
#

Hi, how do I dispute a decline? I tried DMing Lyss but I have gotten no response.

earnest phoenix
#

contact the mod responsible

vagrant apex
#

that would be lyss

quartz kindle
#

what was the reason?

shut spear
#

im running my bot in cmd, written in js. Sometimes cmd freezes until i press ctrl+c, if i dont press ctrl+c for a long time after it freezes, app stops. Any idea what causes this?

glacial pagoda
vagrant apex
#

my bot tracks bumps from Disboard, and I got declined for

Your bot promotes or operates a service that competes with top.gg on your bot page.
I don't promote it at all, literally all it was was a bullet point on a list with Disboard bump tracking as one of the points. it isn't promoting it, its just support for it

quartz kindle
vagrant apex
#

ok, thanks

glacial pagoda
#

How to make it so when a user does a comamnd, it replys in the embed with the ping

shut spear
quartz kindle
#

low like 0-1%?

shut spear
#

y

#

found this on stackoverflow

#

i dunno whether it works or not

#

cuz it happens rarely

glacial pagoda
quartz kindle
#

This "Randomly" hang issue is causing by CMD when you trying to highlight inside of CMD. To resolve this issue:

right click title bar
select Defaults
unselect Quick Edit Mode from the Options tab
reopen CMD

glacial pagoda
#

Yeah How do i fix that

quartz kindle
#

which user do you want?

glacial pagoda
#

The Person That Types The Command

quartz kindle
#

message.author

glacial pagoda
#

So how should it look in the code

#

${message.author}

quartz kindle
#

<@${message.author.id}>

glacial pagoda
#

Ok Ill Try that

quartz kindle
#

i dont think it works on titles tho

glacial pagoda
#

If It Dont Work On The Title, Where Does It Work On The Embed

earnest phoenix
#

description and field values

#

How do i make a feild url

glacial pagoda
#

Um

earnest phoenix
#

liek the one above

#

that's just hyperlink markdown
[text](url)

#

do i have to put '' in ()

mellow kelp
#

nope

earnest phoenix
#

it's a regular string

mellow kelp
#

just like this [Text](https://google.com)

cold lagoon
#

I have a question, how can I create avatar type commands?

earnest phoenix
#

what does that even mean

earnest phoenix
cold lagoon
#

yes

mellow kelp
#

use author.displayAvatarURL()

cold lagoon
#

XD

#

nice name

#

XD

earnest phoenix
mellow kelp
#

épico B)

mellow kelp
earnest phoenix
#

i dont understand man

mellow kelp
#

just put it inside the value string

earnest phoenix
#

zoomeyes wdym...

mellow kelp
#

im out

cold lagoon
#

client.on("message", message =>{
if(message.content ===("r!avatar")){
const embed = new MessageEmbed()
.setTitle("avatar de", message.member.displayName)
.setImage(message.author.displayAvatarURL())
message.channel.send(embed);
}
});

#

so?

earnest phoenix
#

...

craggy pine
#

someone needs to learn the basics of JS it seems LUL

earnest phoenix
#

?

craggy pine
#

Right.

#

String is like

#

basic basic

earnest phoenix
#

dude

#

im absolute noob

glacial pagoda
mellow kelp
craggy pine
#

Following a YT guide probably. It can work but I do suggest usin something like codecademy to learnsome basics

earnest phoenix
#

Un canal de spañol

static trench
#

Idk if this is the best place for this but other than auctions is there a good way to advertise my bot?

mellow kelp
#

im not sure

static trench
#

I’ve tried Reddit, other stuff

#

Nothing works

earnest phoenix
#

people just aren't interested in your bot

static trench
#

Nah

earnest phoenix
#

if it's generic don't expect much traffic either

static trench
#

It’s in 137 and growing slowly

mellow kelp
#

same here

earnest phoenix
mellow kelp
#

im just adding new stuff

#

and waiting for it to grow

static trench
#

But I want to explore other ways to get faster growth

earnest phoenix
#

come up with an original idea

earnest phoenix
static trench
#

My bot is original

mellow kelp
earnest phoenix
mellow kelp
#

idk about members, i don't have the intents

static trench
earnest phoenix
#

also try branching out to other bot lists

static trench
mellow kelp
#

ignore him

static trench
#

Ok lol

mellow kelp
#

the guy just wants to contradict anything KEKW

static trench
#

Ok lol

earnest phoenix
#

they're a whitename with little to no braincells

static trench
#

I’ll try other lists

mellow kelp
#

i should do that too

static trench
mellow kelp
#

seems decent enough

#

nah cry has braincells

earnest phoenix
#

im a whitename but i actually have braincells

#

lol

quartz kindle
#

cry is a spy

#

infiltrated white name gang

earnest phoenix
#

invite my bot :

earnest phoenix
stable nimbus
#

Does anybody know how to make a module reloader? Where you can reload an entire folder so new commands will be loaded?

sudden geyser
gilded olive
#

Wait Lite you lost your bot dev role?

earnest phoenix
#

rip bot

mellow kelp
lament rock
#

With the above method though ^ you'd have to hold references to Objects and then on new file state update, you'd have to Object.assign the new state to old objects which required the file to receive new changes. These changes will only take effect if the file exports an Object as Object.assign works in mysterious ways

stable nimbus
#

And how would I do that?

lament rock
#

I made an example at https://github.com/AmandaDiscord/Reloader which you can reference if you'd like. I wouldn't really suggest using it though since it was a proprietary solution and a "public" version is in the works.

stable nimbus
#

I appreciate it. I’ll take a look!

sudden geyser
#

I didn't have 2FA at the time.

gilded olive
opal plank
#

didnt both cry and lite have bots ?

lament rock
uncut swallow
#

have a command for economy for my bot?

#

i need the command work and bal pls

#

:c

#

sorry my english is very bad :c

wise hawk
uncut swallow
#

ohhh

earnest phoenix
uncut swallow
#

xd you use xd rigth?

earnest phoenix
mellow kelp
#

momento latino

uncut swallow
#

eu

#

usted es latino cholo?

#

xd

mellow kelp
#

claro p B)

uncut swallow
#

xd

lament rock
gilded olive
#

What is this

earnest phoenix
mellow kelp
stark abyss
#

hi hi

thin turret
#

Anyone here decent with CSS?

mellow kelp
#

i guess i can count

gilded olive
hidden lynx
#

xD

thin turret
#

Could you help me with something small

#

Im trying to get the 3 divs to align directly behind eachother, but they're creating a stairway

mellow kelp
hidden lynx
#

sry im on mobile. can't even see your stairway on fiddle

mellow kelp
#

pretty sure you gotta mess around with right and top

hidden lynx
#

what I can tell when I read your description

#

put em absolute

#

and if you want to center them

#

go with left 50 and top 50

thin turret
#

Oh pogchamp

#

Thanks

hidden lynx
#

and add transform translate -50 -50

eternal mirage
#

Hi do you guys take VR Chat World commissions?

#

If i'm on the wrong server which one do i go to to ask this question?

pure lion
#

Yeah wrong server

eternal mirage
#

which one do I go to?

stark abyss
#
        message.channel.send(confirmation).then(msg => {
          message.react('👍').then(() => message.react('👎'));
          const filter = (reaction, user) => {
            return ['👍', '👎'].includes(reaction.emoji.name) && user.id === message.author.id;
          };
          message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })

          .then(collected => {
            const reaction = collected.first();
        
            if (reaction.emoji.name === '👍') {
              message.reply('you reacted with a thumbs up.');
            } else {
              message.reply('you reacted with a thumbs down.');
            }
          })
          .catch(collected => {
            message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
          });
        })```
#
rateLimit{"timeout":747,"limit":1,"method":"put","path":"/channels/718234815765413931/messages/792920613030461500/reactions/%F0%9F%91%8E/@me","route":"/channels/718234815765413931/messages/:id/reactions"} ```
#

i got this directly from the djs guide but I still hit ratelimit

#

i did it with a different method of my own and i hit ratelimit so i switched to this

#

but even so :/

silver monolith
#

did you do it all at once

#

like did you test it portion by portion

stark abyss
#

.then should do it after right thinkingLol

silver monolith
#

here

#

does it react to it's own message?

stark abyss
#

yes

silver monolith
#

okk

stark abyss
#

I did the cmd which sent the confirmation embed and then it reacted those emojis but i hit rate limit :/

silver monolith
#

ok idk

stark abyss
#

yeah i am confused as well

silver monolith
#

im not that good

stark abyss
#

its ok

#

same issue

molten yarrow
#

need to wait 1 sec before reacting again if you want get rid of that msg tho

stark abyss
#

yeah ik i did await but same issue

molten yarrow
#

not await

stark abyss
#

hmm

#

then?

molten yarrow
stark abyss
#

oh

#

okay ill try that ty

molten yarrow
#

had same issue like u xD

stark abyss
#

YAY

setTimeout(function(){msg.react('👎')}, 2000)

i added that and it worked ty so much MikuHeart

molten yarrow
stark abyss
#

oh i see ty

mellow kelp
#

You have to pass a function

molten yarrow
#

rly?

mellow kelp
#

yea

#

it would be setTimeout(() => msg.react('emoji'), 2000)

molten yarrow
#

.react() is a function, didnt test it tho :3

mellow kelp
#

what i mean is

#

.react IS a function

#

.react() is NOT a function (Its return value is not a function)

molten yarrow
#

oh okee

earnest phoenix
#
let comprobante = client.users.has(user)
#

does this works?

molten yarrow
opal plank
#

no

#

@earnest phoenix use cache

#

or fetch

earnest phoenix
#

thx

#

how can i make my bot check if a user's id is valid?