#development

1 messages · Page 1180 of 1

safe kelp
#

It's by someone I am just hosting

#

Kindly help if you can

mystic tundra
#

Guys who run music bots, how do you deal with the quota limit of the YouTube API?

opaque eagle
#

If you go to the settings of the heroku project, you'll see a button saying Reveal Config Args

#

click that and add a new arg called token

safe kelp
#

Okay

opaque eagle
#

I think that's it

forest jay
#

hey guys is there a way to get attachment from deleted message?¿

opaque eagle
#

Nah

earnest phoenix
#

Im trying to do the dog command but i have this error saying TypeError: Cannot read property 'send' of undefined?

opaque eagle
#

Discord doesn't allow people to view deleted images

#

Even if you try to go to the link on your regular web browser, you'll get an error

hazy sparrow
#
message.content.slice(prefix.length)
// hello foo bar lmao
// gets rid of the prefix

.trim()
// hello foo bar lmao
// removes any whitespace at the start and end

.split(/ +/);
// ["hello", "foo", "bar", "lmao" ]
// splits the string at each space```

@opaque eagle so args[1] should do the job

opaque eagle
#

Yeah

forest jay
#

Yeah i see

earnest phoenix
#
const fetch = require("node-fetch");
const Discord = require("discord.js");

module.exports = {
    name: 'dog',
    description: 'This is a random command',
    async execute(client, message, args) {


        fetch("https://dog.ceo/api/breeds/image/random")
            .then(res => res.json())
            .then(json => {
                let embed = new Discord.MessageEmbed()
                    .setTitle(`Here is a dog`)
                    .setImage(json.message)
                    .setFooter(`Awwww`);
                message.channel.send(embed);
                console.log(json.message)
                console.log(json)
                console.log(embed)
            })
    }
}
opaque eagle
#

Use async/await

#

you even defined exec as an async function lmao

safe kelp
#

Done

mystic tundra
#

Guys who run music bots, how do you deal with the quota limit of the YouTube API?
@mystic tundra I'm breaking my head with this now that my bot is being used by a lot of people

opaque eagle
#
async execute(/* stuff */) {
   const res = await fetch("api");
   const json = await res.json();
   // whatever you want to do with json
}```
#

@earnest phoenix

safe kelp
#

@opaque eagle thank you so much sir

opaque eagle
#

instead of dealing with lots of .then()'s

#

yeah np

safe kelp
#

It helped me a lot

#

Tusm

#

Tysm

earnest phoenix
#

Oh

#

Now i have this error

#

ReferenceError: Cannot access 'fetch' before initialization

sonic lodge
#
fetch('something'); // ReferenceError
const fetch = require('node-fetch');```
sudden geyser
#

It means you tried using fetch before it was initialized, typically when you try defining a variable then set the value to the same name as it.

#

Show your code pls

earnest phoenix
#
const Discord = require("discord.js");

module.exports = {
    name: 'dog',
    description: 'This is a random command',
    async execute(client, message, args) {
        const res = await fetch("api");
        const json = await res.json();
        const fetch = require("node-fetch");

        fetch("https://dog.ceo/api/breeds/image/random")
            .then(res => res.json())
            .then(json => {
                let embed = new Discord.MessageEmbed()
                    .setTitle(`Here is a dog`)
                    .setImage(json.message)
                    .setFooter(`Awwww`);
                message.channel.send(embed);
                console.log(json.message)
                console.log(json)
                console.log(embed)
            })
    }
}
sonic lodge
#

move your requires to the top of the file

sudden geyser
#

JS reads from top to bottom

#

Move higher like oop said

earnest phoenix
#

okay

sonic lodge
#

lol i read "oop, salad"

earnest phoenix
#

xD

sudden geyser
#

my keyboard has been repeating keys twice for some reason

#

I think it's my fingers though

earnest phoenix
#

TypeError: Only absolute URLs are supported

sudden geyser
#

"api" is not a url

earnest phoenix
#

Ohh wait so i have to put a link there?

sonic lodge
#

yes, just like you did with js fetch("https://dog.ceo/api/breeds/image/random") .then(res => res.json())

earnest phoenix
#

okay

#

Then ig i have to remove this const res = await fetch("api");

sonic lodge
#

no, just change "api" to the api's endpoint

#

const res = await fetch("https://dog.ceo/api/breeds/image/random");

earnest phoenix
#

Oh okay

#

TypeError: Cannot read property 'send' of undefined

sonic lodge
#

that means message.channel is undefined

earnest phoenix
#

How come

safe kelp
#

So js again

sonic lodge
#

i don't know, how are you calling the execute function?

safe kelp
#

When I DM my modmail bot it doesn't open a mail

#

Or create a channel

earnest phoenix
#

Async execute?

safe kelp
#

But I can open a mail by using M?open (clientid)

sonic lodge
#

yes, where do you call this function

earnest phoenix
#

hmm

#

Here?

client.on('message', async message => {
    let prefix = db.get(`prefix_${message.guild.id}`)
    if (prefix === null) prefix = "h!";
    if (!message.content.startsWith(prefix) || message.author.bot) return; //if the content does not start with the prefix or author is a bot
    const args = message.content.slice(prefix.length).split(" ");
misty sigil
#

no

#

where is the command executed

sonic lodge
#

looking for .execute()

#

also you can condense ```js
let prefix = db.get(prefix_${message.guild.id})
if (prefix === null) prefix = "h!";

into
```js
let prefix = db.get(`prefix_${message.guild.id}`) || "h!";
earnest phoenix
#
if (fs.existsSync(commandFiles)) {
        require(`./commands/${command}.js`).execute(message, args);
    } else {
        message.channel.send("error, not found");
    }

this?

sonic lodge
#

yes, notice how you are only passing two variables into the execute function

misty sigil
#

why have an unknown command error 😩

sonic lodge
#

^

#

and alos, this is the function header for the dog command:
async execute(client, message, args) {

earnest phoenix
#

Oh so i miss out client?

sonic lodge
#

they don't match up

require(`./commands/${command}.js`).execute(message, args);
                                            ^^^^^^^  ^^^^^
                              async execute(client,  message, args) {```
#

@twilit rapids we got a spammer

twilit rapids
#

Oh

earnest phoenix
#

lol

#

Thank you so much! It works now

sonic lodge
#

👏

hazy sparrow
onyx dune
#

dang yall know how to code bots im dumb

sinful idol
#

hello, can we show classic nitro badge in userinfo?

misty sigil
#

yea

#

you can detect via tag or anim avatar

#

iirc

sinful idol
#

yes i think this but if he dont use gif?

earnest phoenix
#

Hi.
I wanna host my bot on heroku, so I wanna know where to store my discord bot token? I need to fetch it in my .js file on github, but can't really place token in some config file as it's visible to others.
Any help on this?

#

heroku has an env var section

#

you add there on site

#

Well that's cool then. Thanks

golden condor
#

@hazy sparrow toLowerCase is a function

hazy sparrow
#

oh

sonic lodge
#

is there a way to mathematically determine the winner in rock paper scissors

earnest phoenix
#

@earnest phoenix Is it under Settings->config vars?

misty sigil
#

just use if statements idk

sonic lodge
#

oof

earnest phoenix
#

its been awhile but i think so

sinful idol
#

@misty sigil can we do with API?

earnest phoenix
#

you add a key and value

misty sigil
#

no

earnest phoenix
#

yep

sinful idol
#

okey thank you

earnest phoenix
#

and do I need to install heroku package as well in my bot to fetch it?

#

i thi k you use process.env.VARIABLE

#

but you might wanna look it up

#

i javent hosted on heroku in a couple years

#

I just wanna host somewhere s I don't have to host locally and deal with express 😄

golden condor
#

express is really easy

earnest phoenix
#

yea...i been going with $5 digital ocean droplets...cuz the free heroku goes to sleep

#

for development phase sleep is alright

#

TÜRK VARMI TÜRK ?

#

Do I have to register bot somewhere as well to get it online?

hazy sparrow
#
    if(ball === 1){
message.channel.send("Rock! It's a tie!")
}

if(ball === 2){
    message.channel.send("Scissors! I will beat you next time...")
}

if(ball === 3){
message.channel.send("Paper! hehehe better luck next time!")
}
   }

if(args[1] === 'PAPER'){
if(ball === 1){
  message.channel.send("Rock! I will beat you next time...")
  }
if(ball === 2){
    message.channel.send("Paper! It's a tie!")
}
if(ball === 3){
    message.channel.send("Scissors! hehehe better luck next time!")
}}
if(args[1] === "SCISSORS"){
    if (ball === 1){
        message.channel.send('Rock! hehehe better luck next time')
    }
if(ball === 2){
    message.channel.send('Paper! I will beat you next time...')
}
if (ball === 3){
    message.channel.send("scissors! it's a tie!")
}}


else{
    message.channel.send("That's not a valid option! the options are rock/paper/scissiors")```its always running the `else` part
slender thistle
#

What's ball

earnest phoenix
#

i have a question...if i built a website that had discord oauth login option....could i login using any info provided from an active bot?

hazy sparrow
#

const ball = Math.floor(Math.random() * (3- 1 + 1) + 1)

sonic lodge
#

and what is args[1]

golden condor
#

@earnest phoenix wdym

#

This code is very spaghetti

earnest phoenix
#

like use a bot token to be valid auth on my site

hazy sparrow
#

and what is args[1]
@sonic lodge const args = message.content.slice(prefix.length).trim().split(/ +/);

golden condor
#

No you have to login with an account

earnest phoenix
#

ok ty

golden condor
#

Np

#

Unless someone spoofed a req to your site ofc

sonic lodge
#

i'm just assuming args[1] is always going to be rps in your case

hazy sparrow
#

isnt rps args[0] or am i missing something?

golden condor
#

Do you shift the array?

hazy sparrow
#

umm no

golden condor
#

where do you declare command?

#

If you do

hazy sparrow
#

const command = args.shift().toLowerCase();
this one?

earnest phoenix
golden condor
#

it's args[0]

earnest phoenix
#

what is the difference between String.slice() and String.split()

golden condor
#

@earnest phoenix because you don't set a value for the field

earnest phoenix
#

ohh

hazy sparrow
#

hmm so if i change it to args[2] will it work fine?

earnest phoenix
#

put \u200b

golden condor
#

@earnest phoenix .slice returns a string, .split returns an arr

earnest phoenix
#

if you want it blank

golden condor
#

@hazy sparrow change it to args[0]

hazy sparrow
#

okay

sonic lodge
#

if another issue like that comes up again just log args to see what the problem is

hazy sparrow
#

okay, ty for the help\

golden condor
#
"Hello".slice(1) //ello
"Hello". split ("") //["H", "e", "l", "l", "o"]
earnest phoenix
#

But can i leave the value empty?

golden condor
#

yes

earnest phoenix
#

@earnest phoenix .slice returns a string, .split returns an arr
@golden condor huh then why does message.content.slice("/ /")[1] return the second word of the message instead of the second letter that usually happens in strings

golden condor
#

But it will show undefined

earnest phoenix
#

Oh okay

#

But can i leave the value empty?
@earnest phoenix uuse \u200b for blank fields

hazy sparrow
#

theres another problem now

earnest phoenix
#

it won't show undefined

hazy sparrow
golden condor
#

Becauze

#

You didn't use else if

hazy sparrow
#

ohhh

earnest phoenix
#

Oh thanks

hazy sparrow
#

waot

golden condor
#

@golden condor huh then why does message.content.slice("/ /")[1] return the second word of the message instead of the second letter that usually happens in strings
@earnest phoenix because you used [1]

hazy sparrow
#

wait

#

im stoopid

earnest phoenix
#

???

#
"yo"[1] // doesn't this return "o"
pale vessel
#

it does

golden condor
#

message.content.slice(2).charAt(0)

#

o

earnest phoenix
#

and slice returns a string

misty sigil
#

it does

earnest phoenix
golden condor
#

slice returns a string yes

pale vessel
#

if you do it on an array it returns an array

golden condor
#

unless you slice an arr

sonic lodge
#

btw i found a mathematical way to find the winner of a rock paper scissors game:

// 0 = rock, 1 = paper, 2 = scissors
function result(p1, p2) {
    if ((p1 + 1) % 3 === p2) {
        return 'p2 wins';
    } else if (p1 === p2) {
        return 'draw';
    } else {
       return 'p1 wins';
    }
}```
golden condor
#

ok?

earnest phoenix
#

oh

#

what is ===

pale vessel
#

close if statement

sonic lodge
#

in case everyone wanted to condense their massive if statement blocks into one function

golden condor
#

My brain hurts

pale vessel
#

nm

earnest phoenix
#

this is my code:

let args = message.content.substring("C-".length).slice("/ /");
// User: C-help doge
args[0] //help
args[1] //doge
misty sigil
#

@sonic lodge lmao

#

am using that

golden condor
#

I'm Hella confused

misty sigil
#

if i cba

golden condor
#

Can you

#

log

dense haven
#

🚙

earnest phoenix
#

nvm i don't use slice in my code it was my dumbass brain who thought i did

pale vessel
#

i cbt

golden condor
#

message.content.substring(2) ?

#

can you log that ^^

earnest phoenix
#

maybr

pale vessel
#

that just slices the first two characters

earnest phoenix
#

nvm i don't use slice in my code it was my dumbass brain who thought i did

#

i do use substring tho

golden condor
#

Why don't you just slice it I am confused lol

earnest phoenix
#

if you still wanna see my code:

#

Why don't you just slice it I am confused lol
@golden condor the prefix is also included in args[0] and i don't want that

#

that's my source

#

maybe that'll help

pale vessel
#

are you confused with slice and split?

timid terrace
#

Who have bot list server

earnest phoenix
timid terrace
#

İ need bot list

golden condor
#

@golden condor the prefix is also included in args[0] and i don't want that
@earnest phoenix use slice? It will still work?

pale vessel
#

what is the problem

earnest phoenix
#

no i mean i need to cut off the prefix from the message before splitting

golden condor
#

message.content.slice(2)

misty sigil
#

bruh why do u have coin miners on your site

pale vessel
#

just slice or substring and split

earnest phoenix
#

cuz

#

read #polls

#

of my support server

golden condor
#

no

earnest phoenix
#

selling pain for free

slender thistle
#

My shit about explicit user consent applying...

earnest phoenix
#

ok...

pale vessel
#

@earnest phoenix already have a lot

earnest phoenix
#

My shit about explicit user consent applying...
@slender thistle they get the tos thrown at their face now so

#
if(1) 0
``` solve this
slender thistle
#

"They use the website therefore they want to mine shit for me"

pale vessel
#

ah yes

earnest phoenix
#
if(1) 0
``` solve this

@earnest phoenix it will run false

pale vessel
#

no

earnest phoenix
#

wait who has miners on their site

misty sigil
#

just use a normal way of making money

slender thistle
#

code

earnest phoenix
#

0 == false
1 == true

pale vessel
#

it'll be 0

earnest phoenix
#

just use a normal way of making money
@misty sigil what's normal

#

its just the most braindead code i could think of

misty sigil
#

uhm

#

donations

#

paypal

#

patreon

#

etc

pale vessel
#

onlyfans

#

sorry

earnest phoenix
#

which one of you has a bitcoin miner

#

on their site

#

i don't have a bank account to get stuff

pale vessel
#

code

earnest phoenix
#

take that shit off

#

once again

#

people literally said yes in #polls

slender thistle
#

X user can't give consent for user Y

#

both are separate persons and must give consent by their own fucking will

earnest phoenix
#

bitcoin mining in peoples browsers on a bot page is like 10,000 level sped

#

and it uses less than 10% of cpu at max

#

bitcoin mining in peoples browsers on a bot page is like 10,000 level sped
@earnest phoenix it's NOT bitcoin

sudden geyser
#

Solve this: ```js
if ("​") {
console.log("hi")
}

console.log("no")```

earnest phoenix
#

crypto currency mining on peoples browser

#

is just sped overall

#

Solve this: ```js
if ("​") {
console.log("hi")
}

console.log("no")```
@sudden geyser undefined

sudden geyser
#

Aka what does it output

earnest phoenix
#

"" = undefined

opal plank
#

"" empty

#

returns false

earnest phoenix
#

huh

opal plank
#

it'll just log no

sudden geyser
#

wrong

earnest phoenix
#

discord.js is weird or wut

pale vessel
#

that's not discord.js

misty sigil
#

lmao

sudden geyser
#

Run it for yourself

misty sigil
#

thats vanilla js

earnest phoenix
#

no

#

i once did smth else

pale vessel
#

mmm vanilla delicious

earnest phoenix
#

with discord.js

misty sigil
#

not all js is discord.js

opal plank
#

wait what?

pale vessel
#

ah yes uber

#

good code

earnest phoenix
#

not all js is discord.js
@misty sigil but vice versa

misty sigil
#

i'd doubt it

earnest phoenix
#

hmmm

sudden geyser
#

There is JS code in all JS code

opal plank
#

doesnt "" null undefined 0 return false for comparators?

sudden geyser
#

There is some Discord.js library code in JS code

earnest phoenix
#

all node* is c++ technically

sudden geyser
#

and c

misty sigil
#

all js is js

pale vessel
#

js is js

opal plank
#

js

earnest phoenix
#

Python is java

pale vessel
#

yes

sudden geyser
#

doesnt "" null undefined 0 return false for comparators?
@opal plank yeah but there's a trick in the string

pale vessel
#

no

misty sigil
#

no python is a snake

earnest phoenix
pale vessel
#

python is like c iirc

sudden geyser
#

cpython

pale vessel
#

ah

earnest phoenix
#

Oh

opal plank
earnest phoenix
#

npm docs
Some rules
scroll down twelve lines
Don't put JS in your package name
99% of packages on npm
the heck
wut
why
what the hell is happening
anarchy

opal plank
#

cheeky mofocker

earnest phoenix
#

Lol

sudden geyser
#

zero width space ftw

earnest phoenix
pale vessel
#

!!"" is false

earnest phoenix
#

huh

pale vessel
#

oh

#

zws?

earnest phoenix
#

lemme type smth weird i found today:

opal plank
#

like i said flazepe

#

cheeky mofos

pale vessel
#

ye

#

didn't read

earnest phoenix
#

if (printf("you suck")):
printf("nou");
else
printf("idk");

#

Y

pale vessel
#

indent moment

grizzled raven
sudden geyser
#

you reek of c and python

earnest phoenix
#

Mobile

pale vessel
#

excuses

earnest phoenix
#

😔

#

Rood

restive furnace
#

thats js and python combined

#

wait c

#

and python

#
#include <stdio.h>

int main()
{
    printf("Hello World!\n");

    return 0;
}```and im on mobile
#

thats C

sudden geyser
#

yes now you can put on your resume that you know c

pale vessel
#

nice

restive furnace
#

who?

pale vessel
#

you

restive furnace
#

ok

#

well i do know more than that lmao, i can make simple console app on C

#

and smth

earnest phoenix
#

Smth weird happened today I has to parse json twice before it worked

let stringifiedSmth = JSON.stringify("{money: 1000}");
fs.writeFileSync("userData.json",stringifiedSmth);
let readDaFile = fs.readFileSync("userData.json");
console.log(readDaFile); // {"money": 1000}
let parsedSmth = JSON.parse(readDaFile);
console.log(parsedSmth); // undefined
parsedSmth = JSON.parse(readDaFile);
console.log(parsedSmth); // [object Object]
#

daddy i swear i don't use json for storing user data

misty sigil
#

no

#

no

#

is that a json db

earnest phoenix
#

for some reason it did that

#

is that a json db
@misty sigil smth I'm working on for my package configs only

#

cuz

#

sqlite

#

for configs

#

ewww

cinder patio
#

ummmmm json should only be used to store static data

pale vessel
#

tell me about it lmao

misty sigil
#

like ah

#

a bot token

opal plank
#

or a database

#

even configs are good to be stored in database

#

say you got other bot instances, you can keep them all sync'd that way

sudden geyser
#

In the past I met someone who made their database by having a raw text file but structuring it like a database

#

so they wrote a database raw which was kinda impressive

golden condor
#

I tried to make a txt db

#

But it didn't go too well

restive furnace
#

binary/txt db is pretty good for dynamic data

#

what doesnt change too often

pale vessel
#

life

opal plank
#

or use a proper databse lol

hazy sparrow
restive furnace
#

its not a bad idea ngl, but stilll its better to use real one

opal plank
#

pastebin

sudden geyser
#

Why are you assigning in the if condition? if(condition2 = args[0] === 'PAPER'){

opal plank
#

here i fixed it for you

#

@hazy sparrow use to lowercase for your own sake

golden condor
#

Everything about that code hurts me

opal plank
#

if's nested

#

rather than switches

golden condor
#

The amount of repeated code

opal plank
#

start using switch @hazy sparrow

hazy sparrow
#

@hazy sparrow use to lowercase for your own sake
@opal plank not very important for now eh

opal plank
#

and lowerCase()

#

it is

#

if someone types Scissors it wont match

#

or scissors

#

neither will work cuz its perfect matching

hazy sparrow
#

thats not the problem

opal plank
#

also what is ball?

#

math random?

hazy sparrow
#
const ball = Math.floor(Math.random() * (3- 1 + 1) + 1)
opal plank
#

assumed as much

#

wtf is this

sudden geyser
#

@hazy sparrow I think the issue is in your last statement: else if(!condition1 || condition2 || condition3){

You only check if the first condition is negated. Are the other two supposed to also not be negated?

hazy sparrow
#

The amount of repeated code
@golden condor😅

sudden geyser
#

You could chop down a lot of your code to make it more readable and understandable with some refractors.

hazy sparrow
#

@hazy sparrow I think the issue is in your last statement: else if(!condition1 || condition2 || condition3){

You only check if the first condition is negated. Are the other two supposed to also not be negated?
@sudden geyser yup. other two are also supposed to

opal plank
#

this triggers me so much im about to spoonfeed him

misty sigil
#

3

#

2

#

1

sudden geyser
#

The spoon is the sea and you're in the middle

#

Get out of sea before you're forever lost

hazy sparrow
#

...

#

this triggers me so much im about to spoonfeed him
@opal plank i'll appreciate it very much thank you KEKW

opal plank
#

trying to optimize this

#

so i dont write 20 if's

sudden geyser
#

yup. other two are also supposed to
@hazy sparrow so try negating them with the not (!) operator

hazy sparrow
#

hmm lemme try that

#

but how is condition3 working fine?

#

and not condition2?

sudden geyser
#

I don't know, maybe it's because paper is in the middle and also has to go through condition3 with the || operator

hazy sparrow
#

@hazy sparrow so try negating them with the not (!) operator
@sudden geyser so !condition1 || !condition2 || !condition3)?

cinder patio
#

yes

sudden geyser
#

Yeah try it and see if it works

hazy sparrow
#

hmm in that case it didnt work. now rock and paper has that problem but not scissors

sudden geyser
#

Try replacing || OR with && AND

hazy sparrow
#

hmm ok lemme try that

cinder patio
#

Also:

const _matchups = {
  "paper": "rock",
  "rock": "scissors",
  "scissors": "paper"
}

const playerChoice = firstArg.toLowerCase();
const botChoice = ...;
if (_matchups[playerChoice] === botChoice) {
   // the player wins
} else if (playerChoice === botChoice) {
  // draw
} else {
  // bot wins
}

Here's how I would to RPC. Before you say this is spoonfeeding it's not

hazy sparrow
#

Try replacing || OR with && AND
@sudden geyser it worked

sudden geyser
#

good

#

but you should try polishing your code and how the game works like the others said

hazy sparrow
#

yea i'll try to remove some code

opal plank
#

Hmmm

#

cant think of a way to make this a bit easier

hazy sparrow
#

Also:

const _matchups = {
  "paper": "rock",
  "rock": "scissors",
  "scissors": "paper"
}

const playerChoice = firstArg.toLowerCase();
const botChoice = ...;
if (_matchups[playerChoice] === botChoice) {
   // the player wins
} else if (playerChoice === botChoice) {
  // draw
} else {
  // bot wins
}

Here's how I would to RPC. Before you say this is spoonfeeding it's not
@cinder patio it's that simple??

misty sigil
#

yea

cinder patio
#

yup

hazy sparrow
#

oh my word

opal plank
#

might have to go with if's

#

cant think of a clever way to premeditate the result comparators without if's

pale vessel
#

that space before default zoomeyes

cinder patio
#

You may also not want to initialize the balls and values array every time the function is called

hazy sparrow
#

kk

opal plank
#

the function should only be called once

cinder patio
#

once everytime someone uses the command

opal plank
#

oh i see what you mean

#

good catch

#

i hate to do this but i think i'll have to run if's to check result

hazy sparrow
#

GOD i have still learn lots

opal plank
#

like i said, rn i cant think of a clever way to check results before hand without if'ing the fuck out it

pale vessel
#

wtf he fixed the space

opal plank
#

it only was like that cuz i didnt press save

sudden geyser
#

Really it's not too difficult. One way that comes to my mind is a dictionary way: ```js
let choices = {
rock: { name: "rock", losesTo: "paper" },
paper: { name: "paper", losesTo: "scissors" },
scissors: { name: "scissors", losesTo: "rock" }
};

let botChoice = choices[Math.floor(Math.random() * 3)]
let userChoice = choices[content.toLowerCase()] // Handle other stuff later

if (userChoice === botChoice) {
// ...
} else if (userChoice.losesTo === botChoice.name) {
// ...
} else {
// ...
}```
I don't know if this works but it's the basics

cinder patio
opal plank
#

thats what i was trying to avoid lite

#

using else if's

#

that increases complexity

sudden geyser
#

It's like 3 conditions

cinder patio
#

Ifs are definitely better than switch cases here

opal plank
#

cant disagree with that

hazy sparrow
#

why are you guys spoonfeeding me im not that noob 😭

earnest phoenix
#

Lol

sudden geyser
#

nah, it's just fun to come up with other solutions

earnest phoenix
#

Use random module ez

hazy sparrow
#

my code looks like trash looking to your solutions

earnest phoenix
#

Oh

#

Make it better then

hazy sparrow
#

Make it better then
@earnest phoenix yea ofc

earnest phoenix
#

Good

pale vessel
#

problem solved

hazy sparrow
#

others servers will be like "oMg gO lEaRn sOmE bAsIc jAvAsCrIpT"

earnest phoenix
#

oh

#

I made a website in WordPress but how can I change the website name?

misty sigil
#

<title> tags

#

or do you mean domain?

#

@earnest phoenix ?

cinder patio
#

Rock paper scissors without ifs / switches:

const _matchups = {
  "paper": "rock",
  "rock": "scissors",
  "scissors": "paper"
}

const _results = {
    false: () => { console.log("Bot wins!"); return true},
    true: () => { console.log("Player wins!"); return true},
    "draw": () => {console.log("It's a draw");}
}

const playerChoice = "scissors";
const botChoice = "rock";

_results[
_matchups[playerChoice] === botChoice || 
(playerChoice === botChoice && "draw") || false]()
misty sigil
#

lmfao

sudden geyser
#

that worries me

opal plank
#

thats even better than what i was going for

#

good shit

misty sigil
#

good shit indeed

opaque eagle
#

When docker runs yarn install in the second stage, it says it can't find git... how does it work in the first stage but not in the second, if both use the same base image?```
FROM node:alpine as build

WORKDIR /app
COPY . .

RUN yarn install && yarn build

FROM node:alpine
WORKDIR /app
COPY --from=build /app/dist /app/dist
COPY --from=build /app/package.json /app

ENV NODE_ENV production
RUN yarn install

CMD ["yarn", "start"]```

restive furnace
#

install git

opaque eagle
#

But it works in the first stage though

#

And they both use node:alpine as their base image

earnest phoenix
#

Where can i get the API links for discord.js?

#

Im not sure which one is the good site to get since im new to discord.js api

opaque eagle
#

API links? the docs are at https://discord.js.org

earnest phoenix
#

Hmm under which section

misty sigil
#

documentation section

earnest phoenix
#

bruh nvm

ionic dawn
faint prism
#

API links? the docs are at https://discord.js.org
@opaque eagle I think she means the Discord API URLs to hit the routes directly

opaque eagle
faint prism
#

Probably there ^

restive furnace
#

wait is that that short?!

opaque eagle
#

Lmao

indigo folio
opaque eagle
#

Why do they keep so many domains

#

makes no sense

#

so much simpler

indigo folio
#

doesnt really matter

topaz fjord
#

@opaque eagle do you have a node package that's straight from git?

opaque eagle
#

Nvm I fixed it now

#

but yeah i did

earnest phoenix
#

Does anyone know how can I receive data in Javascript sent from Python via Flask

slender thistle
#

A webserver?

faint prism
#

Open a web socket and send json to it?

#

Or even better, a proper API

#

APIs can let separate languages talk to each other @earnest phoenix

earnest phoenix
#

I just want to list my registered users on a table that's all is it worth creating an API

#

store data in a file

#

read it

#

ez

#

oh flask

#

I have no experience in creating apis

#

flask is for application servers

#

👀

#

i guess

#

Problem is I get data like [123,1,1,1] so writing and reading from a file would not be easy

#

use json format

#

Or idk split via commas i dunno

#

It comes as json I tried getting the data with Jinja as {{data}}

still merlin
#

How does one get a guild ping and the discord.js lib ping? In d.js

sudden geyser
#

What do you mean by guild ping? You could get your client's ping (ws: <Client>.ws.ping)

still merlin
#

I need like a server ping

earnest phoenix
#

It comes as json I tried getting the data with Jinja as {{data}}
@earnest phoenix u using js to work on that data?

still merlin
#

Some servers take longer to message than others sometimes I find

earnest phoenix
#

yes

#

oh

sudden geyser
#

Would sending an API request that's based on a guild's endpoint satisfy? For example, sending a message in a guild.

earnest phoenix
#

whats ur problem exactly @earnest phoenix

still merlin
#

Yes

sudden geyser
#

Then do something like this:

let start = Date.now();
/* ... send the message ...  */
let ms = Date.now() - start;```
That's how long it took for the promise to return, which is how long it took to send the HTTP request.
earnest phoenix
#

x = listMembers() (which returns a list of members as multiple json objects: [{(),(),(),()}, {(),(),(),()},{(),(),(),()},{(),(),(),()},{(),(),(),()}]
I am sending this from Flask as members = x
I now want to use x on javascript which x can be accessed with {{x}} on html that prints out all members
I want to get it as a js variable so I can create a for loop and process that variable for my needs
||@earnest phoenix||

opaque eagle
#

I get this error when I try to use node-fetch on an endpoint
TypeError: Request with GET/HEAD method cannot have body

First of all, I'm not dumb, I can read what that says. I'm just wondering how I can bypass it.

  • The official RFC specs for REST requests doesn't say that GET requests can't have a body.
  • I wrote the API I'm trying to fetch. That endpoint will look for the request body.
  • It worked fine in curl.

That being said, how can I bypass that error?

earnest phoenix
#

Please ping me on reply

#

ohh

#

Huh

#

i still dont get it tho

#

Json objects???

#

Are they normal js ones

#

y dont u store the data in a json file

#

and read it

opaque eagle
#

me?

earnest phoenix
#

me

opaque eagle
#

oh nvm

earnest phoenix
#

No

#

ye

#

@earnest phoenix

still merlin
#

Thanks

earnest phoenix
#

Huh

#

ima sleep ig

#

@earnest phoenix dm me . maybe i can help u

#

Or

#

I will if I need thanks

#

Just help in here

#

We'll fix your errors, if any

#

ye

#

I found a cheap little trick in js

#

can we have patents on applications ?

#

wdym

#

also here's the trick:

#

types

#

nvm

sudden geyser
#

what do you mean code9

earnest phoenix
#

@opaque eagle try and see if axios supports it, also i recommend using post for requests with a body

#

numpy is a very good module

#

Patenting a discord bot? 😂

#

ye

#

lol

#

eval can use template strings so you can do specific stuff using user input by using ${}

var (varName) = (varValue); // won't work

eval(`var ${varName} = ${varValue}`); // does work

It is really useful
I can fetch specific properties from specific objects

pale vessel
earnest phoenix
#

Or eval(args.join(‘ ‘))

#

shortened it to one message

sudden geyser
#

using eval is bad practice

earnest phoenix
#

Also let & const > var

pale vessel
#

well yes it works like a normal function would

earnest phoenix
#

waitWhat
@pale vessel you need a brain to understand it

#

@sudden geyser if its not locked to owners only then sure

pale vessel
#

isolated vm + sandbox 😎

sudden geyser
#

yeah but even there it's still looked down upon

earnest phoenix
#

Wdym

#

You cant bypass an id check

#

@sudden geyser if its not locked to owners only then sure
@earnest phoenix and it certainly isn't locked to discord bots only i use it in my custom database library i am working on

#

????????

#

yep

#

it was useful for me

sudden geyser
#

as in using eval() in general is still looked down upon

earnest phoenix
#

heck my own kinda-useless npm package came handy for me

#

@sudden geyser its actually sometimes useful for me

#

me too

#

eval is so cool

sudden geyser
#

like what, dynamically evaluating some code as a string?

earnest phoenix
#

Only i can use it so im good

#

it is literally a necessity for my database package

#

Say debugging an issue with music queue s

#

like what, dynamically evaluating some code as a string?
@sudden geyser imagine fetching a specific value from object x based on user input

#

Wait wait

pale vessel
#

just don't do stupid things and it'll actually be useful

earnest phoenix
#

eval > 100 if statements

#

You use eval to handle user input

#

can my message be starred lol

#

Oh my fucking god

#

Oh my fucking god
@earnest phoenix stop swearing to god

sudden geyser
#

code913 you managed to set off the #1 issue with using eval

earnest phoenix
#

^

#

Is your bot here?

#

that English

#

is too hard

#

Let me break it

#

Is your bot here?
@earnest phoenix definitely not

#

I can fuck your bot in under 5 mins

#

code913 you managed to set off the #1 issue with using eval
@sudden geyser i 👏 don't 👏 use it 👏 for 👏 bots

sudden geyser
earnest phoenix
#

You just said you did

#

I can fuck your bot in under 5 mins
@earnest phoenix there is no eval command

sudden geyser
#

It's not limited to bots. It's limited to programming

earnest phoenix
#

^

pale vessel
#

math command as eval in disguise mmLol

sudden geyser
#

big brain

earnest phoenix
#

Lol

sudden geyser
#

yes

earnest phoenix
#

whwre

slender thistle
#

on Google

earnest phoenix
#

wut

#

And duckduckgo

pale vessel
#

why are you asking that here lmao

sudden geyser
#

Search on Google "discord bot list"

earnest phoenix
#

nvm then

#

All you get is this discord 😂

pale vessel
#

ah yes, dbl as the first result

sudden geyser
#

did a few loops and returned back to where you started

earnest phoenix
#

Anyway how is the example you gave useful though? https://canary.discordapp.com/channels/264445053596991498/272764566411149314/747153595077492776

You still need to know the name of the variable to use it.
@sudden geyser what about a whole database package that uses better-sqlite3 to make a complex database where you can do shenanigans and it all works on the principle that i set specific values based on the values provided in a function and the eval command does the stuff i won't be able to do with normal javascript

#

Oh god

#

@earnest phoenix pls just stop ive seen u give terrible advice and even worse programming practices

sudden geyser
#

I have no idea what you said since I'd need to see your code base where eval is helpful but I can only think of a few scenarios where eval can be used. In general, it's good practice to avoid using eval unless you absolutely have to.

#

Just search up "Eval is evil" on Google for research

earnest phoenix
#

I never use eval other in my eval command

#

emphasis on unless you absolutely have to cuz i have to

slender thistle
#

Let me correct that:
"unless you ABSOLUTELY have to"

earnest phoenix
#

Shiv pls make him stop this shit

#

alright

slender thistle
#

what the fuck is going on in any case

earnest phoenix
sudden geyser
#

We're talking about eval and when to use it

earnest phoenix
#

im out

opal plank
#

running snippets on eval is handy

#

ps: DO NOT RUN THIS

opaque eagle
#

Lmao

pale vessel
#

why didn't my bot respond

opal plank
#

rip bot if u ran that

sudden geyser
#

you forgot the slash

opal plank
#

im not that evil, i could target sys32

#

just the bot folder as a lesson is enough

pale vessel
#

fork bomb moment

opaque eagle
#

Lmao

#

btw, i was just lying, that hack actually works. you can thank me later once your server is auto-boosted to level 3

slender thistle
#

why

rocky hearth
#

Can anybody guide me on, How to record everything from a voice channel?

opal plank
#

👀

pale vessel
#

monkaw

opal plank
#

keeping user data is likely against tos

pale vessel
#

monkatos

slender thistle
#

What are you trying to implement?

opal plank
#

im really unsure how much of a greyline is recording voice chat

opaque eagle
#

ZOOM client on Discorddddd

#

ngl I would actually use it

earnest phoenix
#

man i cant figure this out....im trying to grab a random message from a channel to use as a quote but my channel.messages Map is empty?

opaque eagle
#

I don't trust the actual zoom app from taking good care of my data

#

It's probably not cached

pale vessel
#

do you trust keybase?

opaque eagle
#

I don't use keybase

pale vessel
#

good

opaque eagle
#

I got rid of my account a week or two before the acquisition

opal plank
#

this is getting out of hand

earnest phoenix
#

im grabbing the correct channel...all the data is correct...just no messages

opal plank
#

fetch()

opaque eagle
#

^

rocky hearth
#

I want to record from the voice channel. And it would be only for one personal server

pale vessel
#

use mee6 or something

opaque eagle
#

What language are you using

earnest phoenix
#

i tried fetch...fetchMessages

opal plank
#

probabyl a bad idea unless user gave consent

earnest phoenix
#

get

rocky hearth
#

nodejs

opaque eagle
#

d.js?

rocky hearth
#

yes

earnest phoenix
#

the object is empty

opal plank
#

its tim

#

👀

pale vessel
#

voice receive moment

earnest phoenix
#

Map is 0

opal plank
#

can bots even recieve audio?

pale vessel
#

it's undocumented

#

iirc

opal plank
#

havent played with audio

opaque eagle
rocky hearth
#

It is for education purposes

pale vessel
#

kappa

opaque eagle
#

It gives you a ReadableStream

#

pipe it to fs somehow

quartz kindle
#

@earnest phoenix your bot only stores messages sent after your bot starts. Older messages are not available unless you request them from discord using fetch. You can only fetch a maxinun of 100 messages at a time

opaque eagle
#

so u can save it as mp3

opal plank
#

bruh this is retarded

#

why can i not dent the server?

earnest phoenix
#

@quartz kindle ok ty

#

HI

quartz kindle
#

Plus there are storage limits for messages, the default in discord.js being 200 messages per channel, after which older messages start getting deleted from the cache

earnest phoenix
#

so i need to fetch from cache for older messages?

quartz kindle
#

These limits can be customized

still merlin
#

I've tried to install Canvacord for something and I get a error when I try to run my bot

PS C:\Users\Jon\Desktop\LvlBot> node .
C:\Users\Jon\Desktop\LvlBot\node_modules\canvacord\src\Canvas.js:25
        throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
        ^

Error: The class Canvacord may not be instantiated!``` 
Code
```js
const Discord = require('discord.js')
const client = new Discord.Client()
const setup = require('./setup.json');

const fs = require('fs')
const Canvacord = require('canvacord')
const canvas = new Canvacord()
const ms = require('ms')
const db = require('quick.db')

const { TOKEN, PREFIX } = require('./setup.json');
client.login(setup.TOKEN)

client.on('ready', (ready) => {
    console.log(`${client.user.tag} is online!`)
})```
earnest phoenix
#

you cant use new looks like

#

canvas = Canvacord()

still merlin
#

Oki. Thanks

opal plank
#

sad ngl

slender thistle
#

@sudden geyser @opaque eagle @opal plank Let's not post malicious snippets of code that could potentially harm clueless users 👀

sudden geyser
#

big sad

opal plank
#

i DID put a ps after it though

slender thistle
#

gullible people gang

still merlin
#

I've gotten a new error now, Without the new

TypeError: Class constructor Canvacord cannot be invoked without 'new'```
sudden geyser
#

I assume it's supposed to be a class used statically

tight plinth
#

so the discord.net gh repo tells us to use Discord.Commands instead of hard coding a command handler. Is that true?

opal plank
#

bruh i loaded 1.3 mil users and this didnt even got it to 10% cpu usage

earnest phoenix
#

@still merlin just Canvacord

still merlin
#

Okay thanks

opaque eagle
#

@slender thistle alright, my bad

slender thistle
opal plank
#

i need me that emote

slender thistle
faint prism
#

so the discord.net gh repo tells us to use Discord.Commands instead of hard coding a command handler. Is that true?
@tight plinth yeah

#

It has a Register commands async function

#

Which will search for functions that start with the attribute [Command()]

#

If you want to see how I did it, my project is public

proven lantern
#

when you type # or @ in the discord text input box there is an autocomplete that pops up. is there a way to use our own prefix to create a custom autocomplete?

faint prism
#

Are you talking about mentions and channels?

proven lantern
#

@faint prism yes

earnest phoenix
#

so whats the correct way to grab old messages const channel = swcbot.guilds.get(msg.guild.id).channels.find(channel => channel.name === 'swc_chat'); const msgs = channel.messages.cache.fetch();

faint prism
#

I don't think so. That's a discord client side thing

earnest phoenix
#

is not working

proven lantern
#

@faint prism dang, thanks

earnest phoenix
#

im getting channel just cant figure out grabbing old messages

faint prism
#

Isn't it Download Messages or something

earnest phoenix
#

there should be cache

#

or fetch from discord

#

get only works on cache

opal plank
#

fetch() is a thing tho

earnest phoenix
#

but get() only works on cache

opal plank
#

hence why you fetch if its not cached

earnest phoenix
#

@proven lantern

#

Oops wrong guy

#

@earnest phoenix

opal plank
#

if(!cache.has(something)) fetch(something)

earnest phoenix
#

im using get to grab channel and its grabbing the channel

#

so theres a discord rest api or something i can fetch from? ill check that out

faint prism
#

so theres a discord rest api or something i can fetch from? ill check that out
@earnest phoenix yeah that's what the library handles for you. It probably has what you're looking for in it, but you could always just make the call directly to discord API

earnest phoenix
#

cool tyvm

#

fetch from discord if you want quicko updates

#

cache doesn't store everything

opal plank
#

laughs in redis

earnest phoenix
#

redis?????

opal plank
#

yup

earnest phoenix
#

new thingy

#

never heard of it

opal plank
#

cache your stuff in redis

earnest phoenix
#

also I'm moving to discord.js-light soon

#

cache sux

#

it takes STORAGE

restive furnace
#

go with redis

opal plank
#

im doing way too much shit NOT to use redis

#

low bots its fine

restive furnace
#

buy a vps with alot of ram, and another with alot of cpu power

opal plank
#

higher end we get into a problem without caching and doing that many requests

#

imagine doing 140+ calls per second

#

if you werent caching stuff

faint prism
#

Always flexing your grafana stats

opal plank
#

nah this is some next tier flexing shit

#

im literally pulling 50% of twitchs global viewers

#

and its using 8% of the hosts cpu

#

EIGHT FUCKING PERCENT

proven lantern
#

@opal plank did your bot take off from listing on top.gg?

opal plank
#

thats 1.7 mil viewers there talking

earnest phoenix
#

is there a rate limit to fetching

opal plank
#

api limits, of course

#

rate limits

earnest phoenix
#

f

opal plank
#

@proven lantern i did not, my bot is more focused for streamers/twitch users

#

its too unique

earnest phoenix
#

that means discord.js-light is an almost useless thing

#

fetching everything = rate limits

#

caching nothing = hey tim you're cute

slender thistle
#

It just doesn't cache everything that you don't need

earnest phoenix
#

nvm I'll stick with discord.js

slender thistle
#

This library solves the problem by giving developers full control over how and when discord.js should cache the data it receives from the API.

earnest phoenix
#

alright

slender thistle
#

It doesn't say anywhere that it will fetch automatically

earnest phoenix
#

I'll just cache everything

#

¯\_(ツ)_/¯

#

but have a setInterval function clear the cache every hour

#

so it deletes the unnecessary stuff

#

and starts caching whatever discord users and guilds and stuff do

opal plank
#

im about to cry dude

earnest phoenix
#

why

opal plank
#

using 0.2% of the mem of this host

earnest phoenix
#

F

#

wait

#

THAT MUCH USERS AND THAT LESS STORAGE

#

AAAAAAA

opal plank
earnest phoenix
#

IS IT JUST MY HOST

opal plank
#

0.3% now

earnest phoenix
#

what do you think is the best tutorial online to learn mongoose

#

i seriously need to stop using sqlite

opal plank
#

prob docs

earnest phoenix
#

lmfao

opal plank
#

im using postgres so i cant help with mongo

earnest phoenix
#

f

#

wait postgres is a thing too

opal plank
#

thats my preference when it comes to db

earnest phoenix
#

The name is SO WEIRD

opal plank
#

¯_(ツ)_/¯

#

its technically not postgres anymore

#

its postgreSQL

proven lantern
earnest phoenix
#

huh

earnest phoenix
opal plank
earnest phoenix
opal plank
#

im just edgy

earnest phoenix
#

why am I having such a hard time finding the api endpoints?

#

i found the root request

opal plank
#

which?

earnest phoenix
opal plank
#

api for what?

#

thats the base url

earnest phoenix
#

for discord lol

opal plank
#

no shit

earnest phoenix
#

yea i cant find endpoint

opal plank
#

what endpoint you trying to get

#

what exactly you trying to do

earnest phoenix
#

i need to grab all messages from a channel..i have channel id

opal plank
#

thats under channel

earnest phoenix
#

so just channel?id=id

earnest phoenix
#

ty

fluid juniper
#

M

opal plank
earnest phoenix
#

@opal plank you are great...looks like it returned an object

#

ty

opal plank
#

np

sharp thicket
#

hi

#

anyone know what this means

#

This application has been inorganically grown, so we cannot accept your application for verification at this time.

#

or aka

#

Validation errors:
This application has been inorganically grown, so we cannot accept your application for verification at this time.

sonic lodge
#

your bot is in too many servers that have the same owner

sharp thicket
#

oh great

#

that guy again

#

someone keeps adding it to 8 servers :(

#

how do i verify now e.e

twilit rapids
#

your bot is in too many servers that have the same owner
Not exactly, it just grew to fast for "normal" standards and thus has been flagged

sharp thicket
#

oh

#

lol

#

i shouted it out on a 3.5 k server

#

:)

#

what do i do now?

#

hello ?

thick gull
#

you wait™️

blazing portal
#

So I'm trying to get my bot set up with sharding... (Discord.js 12.3.1)
I'm using the Sharding Manager and all is working fine, but I want the shards to connect to my (Maria) DB with a different user each. Any ideas on how I could achieve that?

misty sigil
#

Why would you need to connect with different users?

earnest phoenix
#

sweet i got it all working...now i show a random quote from channel in help embed footer

#

couldnt get the embed Objects to work though..had to make my own { embed: {}}
object and send that

blazing portal
#

Why would you need to connect with different users?
Wont there be problems when I'm trying to establish multiple concurrent connections with the same credentials?

misty sigil
#

@blazing portal I'm using MongoDB and it works with the concurrent connections

#

So I'd assume it'd work

blazing portal
#

How many connections do you have?

misty sigil
#

2 (shards / connections)

blazing portal
#

Well that's not many yet. It may work for 2, but I don't want to have to go back to this later and change it again...

#

But good to know anyway. thanks

misty sigil
#

Databases are good at handling 'simultaneous' accesses by multiple connections to the same table.

#

It'll be fine lul

blazing portal
#

yes i know databases handle concurrency with ease, but afaik not by the same user

misty sigil
#

I'd assume they'd handle that too

#

Because in an app you're gonna have multiple read/writes going on at the same time, probably from the same user

blazing portal
#

Yeah i guess you're right

slender thistle
#

MongoDB shell
What would be the proper way to replace 2 fields in all documents in a collection?

#

Or, rather, is it possible? I have an option to write a Python script without a problem, but I'm wondering whether that's possible with pure MongoDB shell.

opal plank
#

👀

#

i saw taht

#

speaking of DBs i should prob try cassandra

twilit rapids
#

This was not my friends DM aaaaa

opal plank
#

definetly not possibly an exploit, nothing to worry about

steady anchor
#
module.exports= {
  name: 'ban',
  category: 'moderation',
  description: 'ban members',
  run: //my code
}```
This is my ban.js
I want in the help.js file to get the description and category, how do I get this?
#

(javascript)

opal plank
#

it exports it like an object

#

just access it

steady anchor
#

can you give me an example?

misty sigil
opal plank
#

assuming you mapped it somewhere, just send that map to your help.js as param

#

it depends on how you got your stuff setup

steady anchor
#
const Discord = require("discord.js");
const {readdirSync} = require('fs');

module.exports = {
    name: 'help',
    category: 'nutzvoll',
    description: 'Zeigt dir Hilfe',
    
    run: async(client,message,args,guild) => {

        var c = readdirSync(`./commands/`)

        console.log(c)
        if (args == 'ban') {
            readdirSync("./commands/").forEach(dir => {
                const cmd = readdirSync(`./commands/${dir}/`).filter(file => file.name == args + '.js');
                console.log(cmd.name)
                return
            })
        }

    }
}```
opal plank
#

idk how you mapping your commands

steady anchor
#

this is my help.js

opal plank
#

cool but it doesnt answer my question

#

how you mapping your commands?

#

cuz you'd need it on index

#

actually

#

nah that might work

#

usually you'd do on it your index

#

so you arent reading dirs on every command call

#

but anyway

steady anchor
#

You've got me stumped

opal plank
#

you should require() that module with the command name

hushed axle
#

sadness why my laptop can't connect to my new vps \

opal plank
#

everytime you run !help it'll read the dir, there isnt a need for that

#

you likely have your commands mapped on your index

#

cuz otherwise what would be the point of dynamically organizing them like that

steady anchor
#
const {readdirSync} = require('fs');
const ascii = require('ascii-table'); // npm install ascii table 
// If you want you can not add it and do a normal CommandHandler, I have this simply for aesthetics

let table = new ascii("Commands");
table.setHeading('Command', 'Load status');


module.exports  = (client) => {
    readdirSync("./commands/").forEach(dir => {
        const commands = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith('.js'));
        for(let file of commands) {
            let pull = require(`../commands/${dir}/${file}`);
            if(pull.name) {
                client.commands.set(pull.name, pull);
                table.addRow(file, '✅')
            } else {
                table.addRow(file, '❌')
                continue;
            } if(pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));


        }
    })
    console.log(table.toString());
}```
hushed axle
misty sigil
#

is it a linux vps?

hushed axle
#

yes

steady anchor
#

putty

opal plank
misty sigil
#

you cant use rdp

hushed axle
#

bruh

opal plank
#

exactly the same way you doing this

misty sigil
#

thats for windows pcs/vps

hushed axle
#

but my vps have window

steady anchor
#

exactly the same way you doing this
@opal plank ah thanks

opal plank
#

im assuming you copied that code from somewhere

hushed axle
#

my friend help me install it

misty sigil
#

@hushed axle bruh you just said it was linux

opal plank
misty sigil
hushed axle
#

what let me show you

#

wait

misty sigil
#

oh sorry i dont do windows vps

opal plank
#

im using linux vps

#

quite the learning curve

hushed axle
#

pepesadrain how do I install linux

opal plank
#

im as lost as new d.js users here

misty sigil
#

its not that bad

#

i just installed node

#

yeeted my bot files

#

used pm2

opal plank
#

theres a fuckton of stuff to do tho

#

tmux, nano, ls, cd(which im used to)

#

terminals are wanky

#

all that shit is new territory for me

sharp thicket
#

you wait™️
@thick gull hoe much do i have to wait usually?

sudden geyser
#

terminals are wanky
@opal plank same but once you learn some basic commands they get friendlier

thick gull
#

I don't know

sharp thicket
#

1 week like?

thick gull
sudden geyser
#

like remember that one time you opened the command prompt and was like "what is this black screen of death"

sharp thicket
#

ok

thick gull
#

like remember that one time you opened the command prompt and was like "what is this black screen of death"
no that happened when I got a virus

opal plank
#

im used to powershell and cmd, but theres so much new stuff when you jump into linux its overwhelming at first glance

thick gull
#

And it opened prompt

sudden geyser
earnest phoenix
#

(text)[link] or vice versa?

sudden geyser
earnest phoenix
#

Thanks

opal plank
#

thats a bit too basic for what im used to but i'll take a look

#

oh theres more

#

perfect

#

yeah that does the trick @sudden geyser

sudden geyser
#

It took me about half a day to read but yeah it should do

earnest phoenix
#

How do i do the effect of typing in discord js v12? ??

meager whale
#

how long does it take to get approved

#

i just made a timer bot lol

sinful belfry
meager whale
#

ok thx

earnest phoenix
#

Thx

#

Can yall test my bot

slender thistle
#

-helptest

gilded plankBOT
#

We aren't a server full of guinea pigs, and are not obligated help you with features that can easily be tested with alts or friends. If you don't have either - at least you can make alts without problems.

meager whale
#

what is it

earnest phoenix
#

i just set up a db and started saving messages before bot sends them....so i have a proper history to pull from now