#development

1 messages ยท Page 923 of 1

royal laurel
#

k

maiden mauve
#

find in all files

#

replace == with ===

royal laurel
#

k

lyric mountain
#

replace in files would be better

royal laurel
#

how lol

lyric mountain
#

what IDE are u using?

royal laurel
#

visual studio code

lyric mountain
#

it doesn't have rif afaik

copper cradle
#

on each file do Ctrl + h

#

write in ==

#

in the replace field

#

put ===

#

and then click replace all

maiden mauve
#

also what is the significance of message.mentions.members.first()

#

why does it have to be chained out so much

#

if your waiting on an input

royal laurel
#

yes

lyric mountain
#

message.mentions.members.first() gets the first mention

royal laurel
#

yes

lyric mountain
#

you should've called it only once

royal laurel
#

i know

copper cradle
#

then?

royal laurel
#

but i have differint roles i want to give

earnest phoenix
#

what is the name of the perm to mention @everyone?

royal laurel
#

like

#

!role @me lol member

lyric mountain
#

what is the name of the perm to mention @everyone?
@earnest phoenix MENTION_EVERYONE

earnest phoenix
#

thanks

lyric mountain
#

but don't, please

royal laurel
#

@lyric mountain what do you mean i should of only called it once?

lyric mountain
#

let member = message.mentions.members.first()

#

then use member afterwards

maiden mauve
#

lol I had a much different solution when I was grinding away

#

I just got an idea to change my input filter

royal laurel
#

my member var is message.guild.member(user)

#

:|

lyric mountain
#

yes, but you're getting a member from the guild

royal laurel
#

so wait

#

if i change that var

#

will it fuck up all my code

lyric mountain
#

if you're gonna use a value in 2+ places, just store it somewhere and call that var

maiden mauve
#

if you call a function and store it in a variable

#

it doesn't make any difference

copper cradle
#

it does lmao

royal laurel
#

coders fighting with coders

copper cradle
#

whatever the function returns gets stored in a var

royal laurel
#

uhc watermark in the bottom left bois

copper cradle
#

lol

royal laurel
#

yes

copper cradle
#

DBL UHC CHAMPIONS

maiden mauve
#

in this case the function return will be the same every time =p

royal laurel
#

so

#

umm

copper cradle
#

I know

#

ah shit

royal laurel
#

wot does half of this mean?

copper cradle
#

I got wrong that loaf said

royal laurel
#

can somebody just help lol

copper cradle
#

I thought you meant 'sTorIng iT iN a VaRiaBlE doEsn'T dO aNytHing'

#

just fetch the member once and store it in a variable

royal laurel
#

WDYM LOL

maiden mauve
#
function returnsOne() {
  return 1;
}

if(returnsOne() === 1 || returnsOne() === 2 || returnsOne() === 3)
  console.log("lol");
royal laurel
#

no shit that returns 1

maiden mauve
#

you see why those function calls are redundant

royal laurel
#

HAH

#

idiot

#

you need curly braces

copper cradle
royal laurel
#

how

maiden mauve
#
function returnsOne() {
  return 1;
}

const ret = returnsOne();

if(ret === 1 || ret === 2 || ret === 3)
  console.log("lol");
royal laurel
#

lol

copper cradle
royal laurel
#

still no curly braces

copper cradle
#

they're optional

royal laurel
#

your almost there

maiden mauve
#

lol

#

I was typing that

copper cradle
#

as long as what you want to do is on one line

royal laurel
#

well how the fuck was i supposed to knoww that

maiden mauve
#

read a book

#

=p

copper cradle
#

every dev should know

lyric mountain
#

because curly braces are for multi-line code

royal laurel
#

how?

lyric mountain
#

while (i < 10) i++

#

this is valid

copper cradle
#

and don't call people idiots

#

bc sometimes the idiot won't be the other guy

maiden mauve
#
if()
  console.log();
else if()
  console.log();
else
  console.log();
earnest phoenix
#

how i can do that?

maiden mauve
#

just be careful with your spacing

digital ibex
#

hi

copper cradle
#

hi

royal laurel
#

hey so like

#

can i get help?

#

wdym by fixing them

digital ibex
#

is there a way to check if a certain member has a verified email?

#

with eris

royal laurel
#

@copper cradle

#

what do i do to them

copper cradle
#

instead of writing the code many times, and wasting memory

#

cache a member

#

and then add the role on that member

#

so

#

let mem = message.mentions.members.first();

maiden mauve
#

I think part of his solution is reversing the logic

#

instead of or or or or or

copper cradle
#

and then call the addRole method on the mem object

maiden mauve
#

not and not

#

might be simpler

copper cradle
#

that's not the fix lol

#

but I say this so they stop doing that shit where they don't follow the DRY convention

maiden mauve
#

I can't wait for his first refactor party

copper cradle
#

lol

lyric mountain
#

@digital ibex no

digital ibex
#

F

#

ok, ty

lyric mountain
#

@earnest phoenix check for guild events

royal laurel
#

ive replaced everything with mem var now wtf do i do

lyric mountain
#

first of all calm down

royal laurel
#

lol

#

its just

copper cradle
#

it isn't that hard

royal laurel
#

i have been trying to get this for over a week

lyric mountain
#

next make a bool table of your code flow

royal laurel
#

and this is my last resort

#

lol

copper cradle
#

holy fuc

#

that's a long time for such an easy task

#

brb

royal laurel
#

ik

maiden mauve
#

Your swimming against the tide hardcore here

royal laurel
#

my point

#

i cant figure it out

maiden mauve
#

Your focused on solving a problem without solving the logic of your code

lyric mountain
#

make a bool table

royal laurel
#

what

#

is

#

a

#

bool

#

table

lyric mountain
#

this:

maiden mauve
#

boolean values

royal laurel
#

like an array

maiden mauve
#

no

copper cradle
#

nO

maiden mauve
#

he'll show you I guess

royal laurel
#

except just bools instead

#

ok

copper cradle
#

KuuHaKu will show you

lyric mountain
#
a = 2
b = 3

a > b FALSE
a < b TRUE
#

but use your ifs

#

so:

copper cradle
#

wait

#

do you know what a bool is?

royal laurel
#

yes

#

yes

#

true or false

copper cradle
#

ok

royal laurel
#

only those 2

#

i still dont get what a bool table is

copper cradle
#
maiden mauve
#

think diagnostics

copper cradle
#

there

maiden mauve
#

"why doesn't this work"

copper cradle
#

fixed

royal laurel
#

hell yeah dude

maiden mauve
#

"what part of my program isn't giving me the correct result"

royal laurel
#

the best website

copper cradle
#

lemme google google in google

royal laurel
#

everything

nocturne grove
#

Hey.
Ok so I have two files:

// file 1
module.exports = {
  async execute() {
    return await new Promise((resolve) => {
      // do things
      resolve(result);
    });
  },
};```

```js
// file 2
const file1 = require('pathToFileOne');
const result = await file1.execute();
// continue code```
Is there a way to stop execution in `file 2` if `file 1` had a certain result, like an error happened there? I could insert this to `file 2`:```js
if (result == 'err') console.log('error occured');```
But is there a nicer way, for example stop the second file from execution in `file 1`?
maiden mauve
#

"what is the first variable to fail in my code"

#

then you ask "why isn't this variable producing what I want"

royal laurel
#

ummmmm

#

none

#

all vars work

lyric mountain
#
member.has(ownerRole) -> TRUE || member.has(adminBotRole) -> TRUE ====> TRUE
member.has(ownerRole) -> FALSE || member.has(adminBotRole) -> TRUE ====> TRUE
member.has(ownerRole) -> TRUE || member.has(adminBotRole) -> FALSE ====> TRUE
member.has(ownerRole) -> FALSE || member.has(adminBotRole) -> FALSE ====> FALSE
#

something like that

royal laurel
#

i mean

lyric mountain
#

it'll help u brainstorm why it's not working

maiden mauve
#

work means it gives the result you want

royal laurel
#

is this supposed to be valid code or just plain text to keep track

maiden mauve
#

not doesn't cause an error

#

that's just plain text

#

the arrows are results

royal laurel
#

k

lyric mountain
#

is this supposed to be valid code or just plain text to keep track
@royal laurel plain text

royal laurel
#

k

earnest phoenix
#

@lyric mountain

#

i used your regex like that

royal laurel
#

as in

earnest phoenix
#
let regex = "//[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]//g"
    if(String.match(regex)) return message.delete().then(message.author.send(nolinkswarn))```
royal laurel
#

i should just put it in a file

#

txt

lyric mountain
#

it's actually a lot more helpful than u think to put it like that

earnest phoenix
#

this is the only way i saw i could use

#

@earnest phoenix check for guild events
@lyric mountain is the event roleUpdate

nocturne grove
#

lol it's too busy now I will wait with my question

lyric mountain
#

because it helps you check if your logic is right

maiden mauve
#

we're trying to tell you that you have to be a little creative in diagnosing your problem

lyric mountain
#

this is the only way i saw i could use
@earnest phoenix correct

earnest phoenix
#

but it wont delete

maiden mauve
#

this is programming 101

lyric mountain
#

@lyric mountain is the event roleUpdate
@earnest phoenix probably

royal laurel
#

k

earnest phoenix
#

String.match is not a function

maiden mauve
#

if your code doesn't throw an error but doesn't do what you want

#

that means the logic is wrong

earnest phoenix
#

String.match is not a function
...

royal laurel
#

k

lyric mountain
#

but it wont delete
@earnest phoenix if (message.content.match(regex))

maiden mauve
#

so start retyping it and console log everything

earnest phoenix
#

forgot to add this

royal laurel
#

lemme look at it close

maiden mauve
#

make sure everything has the values you intend it to

earnest phoenix
#

oh

maiden mauve
#

if your logic (your if conditions) aren't producing what you think

#

your whole program falls apart

lyric mountain
#

also, use .match(regex).lenght > 0

earnest phoenix
#
(node:2916) UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression: ///[.*?(?:^|[\W])((ht|f)tp(s?)://|www\.)(([\w\-]+\.)+?([\w\-.~]+/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)]//g/: Unmatched ')'
    at String.match (<anonymous>)
lyric mountain
#

because match will return an empty array if it doesn't match

royal laurel
#

mem.roles.add(adminRole) do i still reference this?

earnest phoenix
#
(node:2916) UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression: ///[.*?(?:^|[\W])((ht|f)tp(s?)://|www\.)(([\w\-]+\.)+?([\w\-.~]+/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)]//g/: Unmatched ')'
    at String.match (<anonymous>)

what do you think the error is KuuHaKu

#

i dont get why its wrong

lyric mountain
#

ah

#

forgot escape chars

earnest phoenix
#

[]?

#

wdym by "escape chars"

copper cradle
#

no

lyric mountain
#

no, I mean

#

discord removed them

copper cradle
#

remove the "" from the string

earnest phoenix
#

oh

copper cradle
#

and then remove the first / and the last /

earnest phoenix
#

but then its like invis

copper cradle
#

so it looks like this

#

/[.?(?:^|[\W])((ht|f)tp(s?)://|www.)(([\w-]+.)+?([\w-.~]+/?)[\p{Alnum}.,%_=?&#-+()[]$~@!:/{};']?)]/g

earnest phoenix
#

i did it

#

but it says Unmatched

copper cradle
#

show your code

earnest phoenix
#

invalid regular expression

copper cradle
#

the regex shouldn't be a string

earnest phoenix
#
let regex = /[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]/g```
#

it isnt

copper cradle
#

okok

earnest phoenix
#

its still wrong tho

#

invalid regular expression

copper cradle
#

where did you get this regex from

#

this regex has so many errors I just can't

lyric mountain
#

me

earnest phoenix
#

from him

#

LMAOOO

lyric mountain
#

discord broke the regex

earnest phoenix
#

oh

royal laurel
#

i ran my bot to see if anything has changed

#

nothing changed

#

i can still not give anyone roles

lyric mountain
#

here /.*?(?:^|[\W])((ht|f)tp(s?):\/\/|www\.)(([\w\-]+\.)+?([\w\-.~]+\/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)/g

#

fixed regex

quartz kindle
#

alien language

royal laurel
#

yes

#

the secret language

#

is

#

regex

#

tbh

#

if i just smashed my keyboard a couple times

copper cradle
#

/(https|http):\/\/.*/

#

this should do it by now

royal laurel
#

i could prob get the same result

maiden mauve
#

lol I love that regex's work but to be literate

lyric mountain
#

that regex checks for any kind of url

maiden mauve
#

ooof

copper cradle
#

/(https|http):\/\/(.*)\//g

#

this one should be enough

maiden mauve
#

const flake = flakeID.match(/^\d+|\d+\b|\d+(?=\w)/g);

#

I made that like 8 months ago

copper cradle
#

wait

maiden mauve
#

and couldn't tell you why it works

copper cradle
#

/(https|http):\/\/(.*)\/?/g

#

this one

#

I could change the (https|http) to https?

#

but meh

lyric mountain
#

anyway

maiden mauve
#

tumbleweed

#

I'm pretty sure I could spend the rest of the year refactoring my gamebot

#

but it works

lyric mountain
#

discord.js v11?

gaunt blade
#

Anyone want me to make a discord bot for em or like help em to create one or help with something specific? Cause need some money :/

maiden mauve
#

I started it on v11 and swapped to v12

#

very few errors thrown

lyric mountain
#

wise boi

#

Anyone want me to make a discord bot for em or like help em to create one or help with something specific? Cause need some money :/
@gaunt blade not the right place

maiden mauve
#

most of my bot is just logic and math

#

the discord interaction is minimal

gaunt blade
#

@lyric mountain oh okay, u know a right place?

maiden mauve
#

embed remotes I think were the only thing I had to recode

#

with v12

#

partials etc Tim helped me a ton

lyric mountain
#

@gaunt blade maybe some freelancer site or reddit

gaunt blade
#

okay, I did post on fiverr tho xD

lyric mountain
#

then just...................||wait ||

sullen portal
#

Can someone help me?

#

I'm new to coding and there's an error is the package.json

gaunt blade
#

@sullen portal what is the error?

sullen portal
#

Wait let me copy and paste

gaunt blade
#

okay

sullen portal
#

Its incorrect type

#

Expected "array"

#

in " "bundleDependencies": false,"

#

It says that line has an error

#

@gaunt blade

gaunt blade
sullen portal
#

I don't use pastebin

gaunt blade
#

Also

#

bundleDependencies must be an array

#

= []

#

[ stuff inside here ]

sullen portal
#

I'm new to coding

#

oh ok

gaunt blade
#

I understand

#

I was at that level some years ago too

sullen portal
#

I just put [] around false @gaunt blade

#

its not working

maiden mauve
#

There is a great website for json errors

#

it checks your syntax

sullen portal
#

Now there's a different error

#

Expected string

maiden mauve
gaunt blade
#

it cant be boolean (so it cant be true or false)

maiden mauve
#

try that site NarutoFan

gaunt blade
#

^^

maiden mauve
#

just paste it in there and validate

gaunt blade
#

so it must be a string (a "text here" string, by replacing text here with the needed value)

sullen portal
#

ok

#

are you sure its safe?

gaunt blade
#

yes it is

#

I've used it myself before too

sullen portal
#

wait i put "" around the false

#

too

#

["false"]

#

and it worked

#

theres no error anymore

gaunt blade
#

ok

hardy vector
#

how would i make a dashboard for my bot that shows the ping of the bot?

maiden mauve
#

like an html dashboard on a web server?

#

discord <-> database <-> website

would be my first thought

#

oh wait you literally meant ping

#

I think most bots are reliant on the status of discords servers for ping

#

but they seem pretty fast

balmy knoll
#

TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters How can i resolve this problem with special characters? (JS)

sudden geyser
#

You encode the string.

#

encodeURI or encodeURIComponent

balmy knoll
#

Ok perfect, thanks

earnest phoenix
#

if the bot is not allowed to send messages to the server

#

and

#

You send a message to the channel I set

#

can you help me?

#

@earnest phoenix no

#

Eror:

    at item.request.gen.end (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
    at then (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7473) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 65)```
#

@earnest phoenix

#

@earnest phoenix no

#

You did not understand

#

or I couldn't explain

#

if the bot is not authorized to write on any server

#

Send a message to the channel I set on my own server

#

Can you help me?

#

if the bot is not authorized to write on any server

#

send a message to the console

honest perch
#

ew

earnest phoenix
#

hey look

#

@earnest phoenix

#

this is my boat

honest perch
#

if its a modified instance then yes you can

#

nice

earnest phoenix
#

and this is currently silenced

#

it fails the console because it can't message to this channel

sullen portal
#

can someone help me?

honest perch
#

@sullen portal dont ask to ask

earnest phoenix
#

@honest perch sure i know

sullen portal
#

ask to ask?

mossy vine
#

just post your question

honest perch
#

^

#

dont expect us to ask what you need help with

sullen portal
#

There keeps being an error with the message embed

#
                ^

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.```
#

can someone help me fix it

mossy vine
#

MessageEmbed field values may not be empty.

sullen portal
#

how do you fix it?

mossy vine
#

you.. give the field a value..

sullen portal
#

im new to coding

#

i dont know what that means

#

also it isnt in my code

mossy vine
#

bruh

sullen portal
#

its in node-modules

mossy vine
#

yes but its triggered because your code is trash

sullen portal
#

it said theres an error in that code

#

it doesnt say that my code crashed

#

it said that there was an error in the messageembed.js

mossy vine
#

yes, because your code failed there

quartz kindle
#

the error originated there because of an invalid input you gave it

amber fractal
#

the library threw the error

sullen portal
#

it doesnt say where

amber fractal
#

you made it throw the error.

sullen portal
#

but where did i make the error

quartz kindle
#

show the full error

sullen portal
#
                ^

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
    at C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
    at MessageEmbed.addFields (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
    at MessageEmbed.addField (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
    at Client.<anonymous> (C:\Users\kethy\Desktop\Discord Bots\index.js:453:18)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
quartz kindle
#

index.js line 453

sullen portal
#

ok

#

this is the line

honest perch
#

erm

sullen portal
#

.addField('You guessed...', msgargs2)

honest perch
#

@modern sable

quartz kindle
#

then msgargs2 is empty

#

causing it to have an empty value, like the error says

sullen portal
#

ok

honest perch
modern sable
#

ty

sullen portal
#

ok ima see it

#

let msgargs2 = args.slice(1).join(" ");

#

@quartz kindle this is msgargs2

amber fractal
#

it can still be empty

tight plinth
#

make sure args[1] exists

quartz kindle
#

console.log args and you will likely see the problem

sullen portal
#

ohhh

#

i know now

honest perch
#

also just as a tip making a command handler will ease your life if you havent made one already

sullen portal
#

im bad at making command handlers

#

its confusing for me

maiden mauve
#

the filename.js command handler example

#

is what I based my whole bot off

sullen portal
#

@quartz kindle thank you

regal bison
#

Do u need Help ? loaf

maiden mauve
#

Nah just saying the online examples work good

#

You don't have to fully understand it to get started

regal bison
#

if u Wanna Pay

#

hmhmh

#

u Know a Lot About Me

slender thistle
#

Considering I'm only just starting to get used to C#, should I play around with Winforms or WPF first?
Reading about differences and seeing that WPF is more complex compared to Winforms ๐Ÿ‘€

#

... unless I'm confusing their actual purposes?

earnest phoenix
#

how i can do e!play but with out url?

#

python

lyric mountain
#

that's vague

hallow bone
#

Can a bot share an Instagram post be made?

#

auto

earnest phoenix
#

do you mean like a instagram feed in a channel?

#

@hallow bone

hallow bone
#

Once post is posted on Instagram, post it on auto channel

earnest phoenix
#

again, so like a feed?

hallow bone
#

ex: i share instagram post my account

earnest phoenix
#

for example someone posts something on Instagram, that post would get posted in a specified channel?

hallow bone
#

and later

#

bot : announcment channel share post

amber fractal
#

so a feed...

earnest phoenix
hallow bone
#

for example someone posts something on Instagram, that post would get posted in a specified channel?
@earnest phoenix yep

earnest phoenix
#

the legacy api will be disabled on June 29, 2020.

#

so i'd suggest using the second one

#

best of luck GWgoaMonikaSmug

#

that's vague
@lyric mountain what?

hallow bone
#

I couldn't find the post related category and there is no api๐Ÿฅบ

earnest phoenix
#

using google might help you too

#

i know how to actually do it, but i wont tell you exactly, because that would be spoonfeed

hallow bone
#

๐Ÿ™‚

#

thx

earnest phoenix
#

discordjs and node version?

#

node -v

turbid bough
#

are you sure string is a string?

earnest phoenix
#

i'd suggest putting it into a seperate variable first

#

.toLowerCase()

turbid bough
#

idkwhatthatis

#

yes

earnest phoenix
#

try doing just a test string

turbid bough
astral yoke
#

howdy

#

i got this error

earnest phoenix
#

GWhurpySip show us

astral yoke
#

(node:8964) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `channel` of 'undefined' or 'null'.

#

for this

#

const { channel } = message.member.voice;

mossy vine
#

message.member.voice is undefined or null

earnest phoenix
#

is the user connected to the voice channel?

astral yoke
#

how could i define it

#

down in the code i solved it with if (!channel) return message.channel.send('I\'m sorry but you need to be in a voice channel to play music!');

#

I think ik why

twin wolf
#

hello i wanna ask can i set a bot in my server that only delete a specific user's message

lyric mountain
#

if (message.user.id === "someid") message.delete()

twin wolf
#

but where should i type it because i am new on making a bot

lyric mountain
#

well, first of all you gotta setup a basic bot code

#

google "discord.js bot tutorial"

glass crag
#

When sharding, if I want to send a direct message to a user, not knowing which shard the user's guild is on, what's the best way to do this?

iron scroll
restive furnace
#

well the function please ^

#

When sharding, if I want to send a direct message to a user, not knowing which shard the user's guild is on, what's the best way to do this?
@glass crag fetchClientValues.

glass crag
#

@restive furnace thanks ๐Ÿฅฐ

earnest phoenix
#

how i can do e!play but with out url?
python

#

just the name of the video

#

check if the command has any arguments containing a url

#

oh that

#

ok

livid falcon
#

how would i make a music bot i have been trying but i keep getting errors

restive furnace
#

code

livid falcon
#

i tried

earnest phoenix
#

whats the error

livid falcon
#

it gives me some stupid error

earnest phoenix
#

whats the error

livid falcon
#

something like Unhandled Expression

earnest phoenix
#

whats the exact error

#

copy paste

livid falcon
#

ok

#

i rage quit so idk where it is

#

nvm i found a yt tutorial

earnest phoenix
#
user.permissions.toArray().map(p => permisos[p]).join(", ")
```this work in 11v?
#

dont watch tutorials, they're always outdated @livid falcon

livid falcon
#

oh

earnest phoenix
#

@earnest phoenix it should

#

ok

#

:v

#

thats the motto

#

hey @everyone

#

toArray is undefined

astral yoke
#

[2020-05-12 18:02:07]: [Error]: TypeError: Cannot read property 'name' of undefined

#
const logger = require("../utils/logger"); 
const Discord = require('discord.js')
const client = new Discord.Client();
const fs = require("fs")
const ms = require('ms');


module.exports = (bot) => {
  const load = dirs => {
    const commands = readdirSync(`./src/commands/${dirs}/`).filter(d => d.endsWith('.js')); 

    for (let file of commands) { //for each of these files
      let pull = require(`../src/commands/${dirs}/${file}`);
      bot.commands.set(pull.config.name, pull);
      if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name));
    };

  };
  readdir(`./src/commands/`, (err, directories) => {
    if (err) logger.error(err); 
    var dirArray = [];
    directories.forEach((f, i) => { 
      if (lstatSync(`./src/commands/${f}`)) {  
        dirArray.push(f);
      }
    });

    dirArray.forEach(x => load(x));
  });
};

#

At

#

bot.commands.set(pull.config.name, pull);

#

why is this happening?

earnest phoenix
#

pull.config is undefined

astral yoke
#

the pulls defined at the top of it though

#

fixed

tall orchid
#

In Discord.js how do I get the shard id of a Client Spawned by a ShardManager? There's client.shard but that appears to be a ShardClientUtil instead of the actual Shard, and it doesn't appear to have the id as a property.

https://discord.js.org/#/docs/main/stable/class/ShardClientUtil

#

found it: ```typescript
client.shard?.ids[0]

balmy knoll
#

channel.updateOverwrite(guild.roles.cache.get(role_id), ...); How do I set more permissions on True? (Connect and move members)

hardy vector
#

how do you get total memory usage of your bot?

earnest phoenix
#

library?

wild plover
#

Idk I use PermissionOverwrites for js

channel.updateOverwrite(guild.roles.cache.get(role_id), ...); How do I set mor permissions on True? (Connect and move members)
@balmy knoll

balmy knoll
#

@wild plover But i have to use channel.updateOverwrite

wild plover
#

What lib?

earnest phoenix
#

@hardy vector what library are you using?

hardy vector
#

discord.js

earnest phoenix
white anvil
#

memory usage doesnt even depend on library

earnest phoenix
#

false

#

so?

white anvil
#

just use process.memoryUsage.rss / 1000 / 1000

earnest phoenix
#

if the lib u use caches a lot it does

white anvil
#

and this will give u approximate usage in mb

earnest phoenix
#

asking for the library still gives me the info of what language they're using

white anvil
#

well i mean fetching it is independant on library

earnest phoenix
#

asking for the library still gives me the info of what language they're using
@earnest phoenix

white anvil
#

ok but u could have just asked what language it was

astral yoke
#

i got a question

#

wait i forgot the question

earnest phoenix
#

dont ask to ask, just ask

wild plover
#

Hope this helps

earnest phoenix
#

ok but u could have just asked what language it was
welp doesn't matter GWossuKannaSip

astral yoke
#

i remembered it but took a bite of my sandwhich and then forgot it

wild plover
#

Also ask for this help in the official DJS server

astral yoke
#

we can ask where we can

#

we dont gotta ask over there

wild plover
#

Lel

valid frigate
#

you need to catch the error

#

uhhhh

#

using .catch() or smth

#

or try catch block

nocturne grove
#

Yes but I want that file2 to stop running

#

In the most easiest way

valid frigate
#

it will pretty much

#

once the error is caught the code stops in that file after you handle the error

#

and the easiest way is indeed a try catch block

nocturne grove
#

Yes but I want to stop in the other file. If there is an easy way to do so

valid frigate
#

you mean file 1 too

#

the thing is that you dont have to do anything extra apart from adding try catch like

try {
  await command.execute()
}
catch (e) {
  // handle
}
nocturne grove
#

Hmm but will it also catch an erorr caused by a MySQL query (in file 1)?

valid frigate
#

yeah

#

it's sort of a catch all

#

i havent really seen anyone return an entire promise before eiter

nocturne grove
#

Oh lol

#

Well thanks. Will try tomorrow

valid frigate
#

ok well there you go bro

#

np

lofty urchin
#

discord api down=

#

?

nimble escarp
#
client.shard.client.shard.client.shard.client.shard.client.shard.broadcastEval(`this.shard.id === -1 ? -1 : this.shard.id`)

why doesn't this return shard id? Discord.js ShardingManager

earnest phoenix
#

what the fuck are you trying to do with client.shard.client.shard.client etc

nimble escarp
#

Just trying to make it look interesting LaughPepe
client.shard doesn't work as well

quartz kindle
#

circular dependencies lmao

#

it has shard.ids

#

which is an array of shard ids managed by that shard

#

because internal sharding exists

nimble escarp
#

Oh, I'm trying to get the master shard id.

quartz kindle
#

what master shard id?

nimble escarp
#

Well, the id of the current shard (for the client).

quartz kindle
#

for the person using the bot?

nimble escarp
#

sure

quartz kindle
#

client.shard.ids[0]?

nimble escarp
#

Would that be guaranteed to get the current shard id? I'm still kinda new to sharding so it's harder for me.

quartz kindle
#

using the default sharding settings yes

#

the manager will create 1 shard per process by default, so each shard will only have 1 item in the .ids array

nimble escarp
#

however if there were more than 1 shards per process, would that still work?

quartz kindle
#

no

#

in that case you would use message.guild.shardID

#

assuming the sharding manager properly assigns those

nimble escarp
#

That's what I want, thanks MonjiroPray

quartz kindle
#

i though that emoji was somebody puking to the right

#

lmao

nimble escarp
#

Didn't know guild had a shardID property.

hollow prawn
#

uhh in what case/scenario

#

would for work only for one entry in a array?

quartz kindle
#

wat

hollow prawn
#

ok so I have this code

const gIDs = bot.guilds.map(g => g.id);
  for (const g of gIDs) {
    const gInDB = await bot.db.query(`SELECT * FROM serverInfo WHERE serverID = ${g}`).catch(console.error);
        // console.log(gInDB[0]);
        if (gInDB[0].serverID) {
        if (gInDB[0].serverID.length < 1) {
                await bot.db.query(`INSERT INTO serverInfo (serverID) VALUES ('${g}')`);
                console.log(`Added ${g} to database as it was not in it`);
        } else if (gInDB[0].serverID.length > 1) {
                return console.log(`${g} is already in the database`);
        }
        } else if (!gInDB[0].serverID) {
            // await bot.db.query(`DELETE FROM serverInfo WHERE serverID = '${g}'`).catch(console.error);
            console.log(`Error with \n ${gInDB[0]}`);
        }
  }```
and it does only 1 entry, then it stops
#

the idea of the code is for fault-proof to check for guild ID's and if they exist in the database

#

but it does only one check and that's it

quartz kindle
#

because you return it

hollow prawn
#

ah, i wasn't expecting return to cancel out the for

#

as I though it was for the if statement only

quartz kindle
#

if you want to skip a for iteration, use continue

astral yoke
#

so this is my config json file { "token": "my token ovbiously", "ownerid": "id", "specialid": "id" } but how do I make it so I can do like "ownerid": ["id", "id"]?

hollow prawn
#

nah, dont wanna skip anything

#

exactly like that

nimble escarp
astral yoke
#

oh

#

lol

#

okay

#

ty

hollow prawn
#

lmao ovxrflow

#

but ye like that then you have ownerid as an array

earnest phoenix
#

can bots use animated emojis

hollow prawn
#

yes

nimble escarp
#

@earnest phoenix they can
aight I'm slow

hollow prawn
#

then from that array u access whichever id u want

earnest phoenix
#

good to know

astral yoke
#

@earnest phoenix to access the emoji you gotta do \:emoji:

hollow prawn
#

ok so, apparently there is something in my bot.guilds.size

#

that provides undefined

#

i have completely no idea what is a guild, but also is not

nimble escarp
#

bot.guilds.size? What version of d.js are you using?

hollow prawn
#

11.6.4, bot.guilds.size is 37

#

basically the guilds has something

#

in it that isn't a guild

astral yoke
#

do you have bot as your client or client as your client

#

this

hollow prawn
#

bot, holdup i think i gotta do some adjustments

#

mby my fault proof code is not so fault proof

topaz fjord
#

fault proof code doesn't exist

hollow prawn
nimble escarp
#

If a code is fault proof then that's the fault. frickenbullies

topaz fjord
#

there's always gonna be some random error that'll kill it

nimble escarp
#

inb4 Error: true cannot be assigned to true

hollow prawn
#

now i fixed the issue pog

nimble escarp
#

TypeScript for the win frickenbullies

hollow prawn
#

the idea of that fault proof code is, if the bot spazzes out and doesn't add the guild ID upon joining to the database it will do that on restart to add it

nimble escarp
#

However I hate the "sharding" development process with TS...

    "scripts": {
        "start": "ts-node -r dotenv/config ./src",
        "dev": "nodemon -r dotenv/config -e ts --exec \"yarn build\"",
        "build": "tsc && node -r dotenv/config dist/src/index.js",
        "lint": "eslint --ext ts,tsx src/**"
    }
earnest phoenix
#

glad i will never get to the point of sharding, im too bad at making bots GWseremePeepoHappy GWvertiPeepoCheer GWvertiPeepoSadMan

limber flume
#

anyone

modest maple
#

hhmmmmmmmmm

limber flume
#

not u

#

ur smarter than me

earnest phoenix
#

just ask

nimble escarp
#

then ask @limber flume

limber flume
#

oh no what i got myself into

#

๐Ÿ˜

nimble escarp
#

Isn't the point of asking to get an opinion from someone who has more experience (therefore is "smarter")?

earnest phoenix
#

How were existing servers deleted? 1500 server down 790 server wtf this ???????????

limber flume
#

erm

modest maple
#

i mean you asked for help, we're here now sooooooooooooo

limber flume
#

ok

earnest phoenix
#

@earnest phoenix you made a sharding mistake or discord has a stroke

limber flume
#

how to change the color of this

earnest phoenix
#

color of what

#

also shows low in normal command

limber flume
#

hol up

#
@bot.command(pass_context=True)
async def servers(ctx):
    servers = list(bot.guilds)
    embed = discord.Embed(title=None,description="Connected on " + str(len(servers)) + " servers")
    await ctx.send(embed=embed)  
#

this

#

how to change color

#

me dum dum

earnest phoenix
#

color=""

limber flume
#

i tryed

earnest phoenix
#

i think

limber flume
#

embed.color= colOR

#

not woRK

slender thistle
#

What is colOR

limber flume
#

erm

earnest phoenix
#

@earnest phoenix will this problem be solved in the coming hours?

nimble escarp
#

It's colour (eww)

limber flume
#

i tryed this

earnest phoenix
#

@earnest phoenix i think so yes

limber flume
#
embed.colour = (0x00FF)
#

not works

modest maple
#

do do ()

#

its just a hex code

rough walrus
#

yo guys i tried to make a rock paper scissors command but my bot doesn't react with any emoji (so i can play)

const { MessageEmbed } = require("discord.js");
const { promptMessage } = require("./functions.js");

const chooseArr = ["๐Ÿ—ป", "๐Ÿ“ƒ", "โœ‚" ];

module.exports.run = async (bot, message, args) => {

    const embed = new MessageEmbed()
      .setColor("#C8A3FF")
      .setFooter(message.guild.me.displayName, bot.user.displayAvatarURL)
      .setDescription("Rock Paper Scissors game has started, React to one of the emojis to play the game!")
      .setTimestamp();
    const m = await message.channel.send(embed);
    const reacted = await promptMessage(m, message.author, 30, chooseArr);

    const botChoice = chooseArr[Math.floor(Math.random() * chooseArr.length)];

    const result = await getResult(reacted, botChoice);
    await m.reactions.removeAll();


    embed
       .setDescription("")
       .addField(result, `${reacted} vs ${botChoice}`);

    m.edit(embed);

    function getResult(me, clientChosen) {
        if ((me === "๐Ÿ—ป" && clientChosen === "โœ‚") ||
             (me === "๐Ÿ“ƒ" && clientChosen === "๐Ÿ—ป") ||
              (me === "โœ‚" && clientChosen === "๐Ÿ“ƒ")) {
                  return "You won!";
        } else if (me === clientChosen) {
                  return "It's a tie!";
        } else {
                  return "You lost!"; 
        }
    }
}

module.exports.help = {
    name: "rps"
}```

i don't get erros (discord.js)
limber flume
#

what

modest maple
#

it must be in lower case

earnest phoenix
#

-_-

modest maple
#

you can either do a int

#

e.g

limber flume
#

i dont understand u

earnest phoenix
#

@limber flume embed.color=0x<hexcolor>

modest maple
#

3124214 or 0xfffff

limber flume
#

yes

#

I DO THAT

#

NOT WORK

modest maple
#

you didnt

limber flume
#

I D K

modest maple
#

i just saw what u but

#

you put a tuple with a malformed hex code

slender thistle
#

(1) isn't a tuple

limber flume
#

waut

#

what

slender thistle
#

(1,) is a tuple

limber flume
#

let me try ;|

modest maple
#

shiv i thinks u might of confused them more

#

๐Ÿ˜ข

limber flume
#

embed.color=0x<fffff>

#

so this

nimble escarp
#

@rough walrus you aren't reacting with the bot as far as I can see.

modest maple
#

no

slender thistle
#

Without the <>

modest maple
#

remove the <>

limber flume
#

ok

#
@bot.command(pass_context=True)
async def servers(ctx):
    servers = list(bot.guilds)
    embed = discord.Embed(title=None,description="Connected on " + str(len(servers)) + " servers")
    embed.color=0xfffff
    await ctx.send(embed=embed)
modest maple
#

that will be white

nimble escarp
#

Depends on your promptMessage function.

rough walrus
#

@nimble escarp my bot doesn't react with any emoji, after that it edits the message with result, and i can't play because there are no emojis

limber flume
#

oh

#

i want

#

bluE

slender thistle
#

You heard of discord.Color?

limber flume
#

E R M

modest maple
#

^ Less customisability but good presets also a rgb converter

nimble escarp
#

The bot has to react with the emoji first @rough walrus so that they show up.

rough walrus
#

yes, but it doesn't react

slender thistle
#

It's mentioned in the docs

nimble escarp
#

Where are you reacting then?

limber flume
#

W R On G

nimble escarp
#

show me the promptMessage function @rough walrus

slender thistle
#

Putting tab instead of space or vice versa

nimble escarp
#

python
LaughPepe IndentationError

limber flume
#

loL

slender thistle
#

If you have a proper IDE that doesn't mix tabs with spaces, indents are not an issue

earnest phoenix
#

better discord? weirdsip or am i tripping?

nimble escarp
#

Tabs are superior, so no IDE should mix those two...

#

Doesn't everyone use BD?

earnest phoenix
#

Nope

#

Atleast the developers who know what bd could do

nimble escarp
#

They could steal ur acc pepeshrug
EDIT: getting a malware is not really something that should be counted

earnest phoenix
#

more

slender thistle
#

Sounds like a topic not for this server

bleak agate
#

yo, is anyone aware of a bug like this?

/root/server/node_modules/discord.js/src/util/Util.js:32
    );
    ^
SyntaxError: Unexpected token )
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/root/server/node_modules/discord.js/src/index.js:3:14)
    at Module._compile (module.js:571:32)

i believe it's caused by something else but i can't find what

#

it's happening i think because i'm trying to require it in an existing node process (?)

rough walrus
#

@nimble escarp lmao i just didn't set a function for promptMessage,i do stupid mistakes i'm just still learning js

astral yoke
#

hi

#

so how come

#

this dosent work

#
    "token": "my token ruihriweghekrjg",
    "ownerid": [ "279116778246766593", "528353078672490507"],
    "specialid": "528353078672490507" 
}```
#

the owner id

#

dosent let both of us use the commands

#

only me

nimble escarp
#

You need to change the checks since ownerid is now an array instead of a string.

astral yoke
#

how would I do so?

nimble escarp
#

What library are you using?

astral yoke
#

d.js 11.6.4

nimble escarp
#

Then you need to find your check (something like this)

if (message.author.id === config.ownerid)

and do something like this

if (config.ownerid.includes(message.author.id))
astral yoke
#

i have it as this

#

if (message.author.id !== ownerid) return;

#

would that work for both of us?

nimble escarp
#

then just use .includes and negate the expression pepeshrug

astral yoke
#

hm

#

okay

#

ty

copper cradle
#

@bleak agate the error literally says unexpected token

#

so requiring a an existing node process creates a syntax error

#

cute

bleak agate
#

huh?

#

how do you mean

#

apologies, i'm a bit new

nimble escarp
#

It says unexpected token, meaning it thinks that there's something that shouldn't be there.
Many stuff can cause that error, like a missing comma.

glacial thicket
#

@bot.command(pass_context=True) async def help(ctx): await bot.say("no") with discord.py i made a help command like this and when i run it i get an errror message sent to the console saying the command is already registered

modest maple
#

you need to remove the inbuilt command

glacial thicket
#

how do i do that? sorry if its easy im just stupid

modest maple
#

bot.remove_command('help')

nimble escarp
slender thistle
#

bot.remove_command(command_name) right after declaring bot

nimble escarp
#

One second of using google pepecry

bleak agate
#
ovxrfl0wToday at 4:51 PM
It says unexpected token, meaning it thinks that there's something that shouldn't be there.
Many stuff can cause that error, like a missing comma.

so, this is true but

#

it runs fine when i'm trying to run it from just the console

#

but if i try to run it from within this game server i'm using, it throws the error

#

i can replace all of the game server's code with var Discord = require("discord.js"); and return; and it still throws the error

#

which is weird

nimble escarp
#

A game server? That's a new one to me.
Well, anyway, are you sure it's the same version?
Are you really trying to run what you want to run?

bleak agate
#

how do you mean?

copper cradle
#

explain

nimble escarp
#

Since I don't know what your development environment is I can't really provide a better explanation.
Let's say you'd be running it on a vps.
What I'm asking is: is the code you're trying to run on the vps the same as the one you are running locally?

bleak agate
#

oh

#

i meant that it runs fine on the server's console

#

the only instance where it doesn't run correctly is when i bundle it into the game's code

copper cradle
#

are you trying to run the bot on a webserver?

bleak agate
#

yeah

copper cradle
#

yeah but

#

like

#

nvm

#

forget that

#

how are you running the code

#

what do you do

bleak agate
#

i'm open to any suggestions because i've been trying to figure this out for 8 hours or so now

nimble escarp
#

This one is new to me. ๐Ÿ‘€

bleak agate
#

so

copper cradle
#

show your code

#

how do you run the bot

#

what do you use

#

explain everything

bleak agate
#

i'm not even running the bot at this point, i only have a single line of code i'm testing

#

alright

#

one sec

nimble escarp
#

The thing is, we need to see how you're trying to run the code that fails (e.g. how you're bundling it into the game, etc)

bleak agate
#

yeah, for sure

nimble escarp
#

We need to know what there's to work with to diagnose the issue.

copper cradle
#

yeah

nimble escarp
#

Since it runs in the console it most likely is the way you're trying to run the bot when it's bundled.

copper cradle
#

just show your code

#

yeah

bleak agate
#

the platform: vylocity, a js-based engine that runs in your browser
the goal: a discord bot that scrapes messages from my discord server and serves them to the game server (so i can run commands from my chat, etc.)
the issue: var Discord = require("discord.js"); keeps tossing the above error when it's run inside the code, but not when it's run from my code

#

it's difficult to show the code because it's like

#

obfuscated i guess

copper cradle
#

just

bleak agate
#

the ide compiles it- one sec

copper cradle
#

it doesn't matter

bleak agate
#
var Discord = require("discord.js");
console.log('Vylocity v0.0.1  https://www.vylocity.com/');
#

this is the only code that is running

#

everything else is commented out

copper cradle
#

ok

bleak agate
#

and it provides the above error

nimble escarp
#

Also why would you run it in the browser, don't you want the bot to be available all the time?
Running it in a browser would mean that the code would run only when someone visits the location.

copper cradle
#

go to this file

#

/root/server/node_modules/discord.js/src/util/Util.js:32

#

that's where the error lives

earnest phoenix
#

how i disconnect (voice channel) the bot in python?

bleak agate
#

it's running on the server end of the browser game, so it's hosted on the server (and can communicate w/ the game server directly rather than having to send post reqs and etc.)

#

kk

#

sec

nimble escarp
bleak agate
#
  static flatten(obj, ...props) {
    if (!isObject(obj)) return obj;

    props = Object.assign(
      ...Object.keys(obj)
        .filter(k => !k.startsWith('_'))
        .map(k => ({ [k]: true })),
      ...props,
    );
#

this is the section in question

#

line 32 is );

#

my first assumption was it's my node version fighting with the ... spread operator

#

but i updated node to 14 and it still has this issue

copper cradle
#

what's your version

white anvil
#

dont use node 14 in prod

#

its still unstable

bleak agate
#

node is 12.16.3 rn

#

nodejs is 14.2.0

nimble escarp
#

12.16.3 is the best node version to run as of now pepeshrug

white anvil
#

best is subjective

amber fractal
#

well it's the LTS

#

it's the best for production

nimble escarp
#

Yes but best in a sense of support for existing libraries and other stuff.

white anvil
#

@bleak agate so ur literally running these 2 lines and its erroring?

bleak agate
#

yep

#

if i put var Discord = require("discord.js); in its own js file tho

nimble escarp
#

It might be the "obfuscation" bit.

bleak agate
#

and run that w/ node

#

no error

nimble escarp
#

If it touches node_modules it most likely is causing the issue.

bleak agate
#

this is past that, so i edited what the ide outputs

#

and commented out everything but those two lines

white anvil
#

remove all ur other stuff entirely

#

there could be conflicting commenting

bleak agate
#

kk

#

sec

#

same deal

copper cradle
#

dude you can't just do that

#

and show us 2 lines that are separates by god know what

#

show your entire thing

#

maybe there's conflicting code

bleak agate
#

that's what i mean though

amber fractal
#

did you close the function?

fallow quiver
#

I am using Discord.js and I want to poll the user with a reaction, for instance to confirm they react with โœ… to deny they react with โŒ, is there a way to wait for a reaction and then after a certain amount of time cancel the action?

bleak agate
#

this is all of the code i am executing

white anvil
#

do you get a line number where this erorr is being thrown

bleak agate
#

yeah, i posted the code snippet it's complaining about up above

white anvil
amber fractal
nimble escarp
#

Didn't anyone check the path the error is referencing? it's in node_modules/discord.js
You shouldn't under most circumstances touch anything in node_modules pepeshrug

bleak agate
#

hold it

#

wait

#

i think i might've made progress

amber fractal
#

@nimble escarp modules can throw errors

#

and you need to handle them

bleak agate
#

i was using the command nohup ./node server.js & before

#

using nohup node server.js & fixed it

nimble escarp
#

They may, however you shouldn't really go around poking inside the module itself.

white anvil
#

cant u just do node server

copper cradle
#

you can just install the module again

nimble escarp
#

Then that's solved, no?

copper cradle
#

messing with modules is the best way to learn new practices

bleak agate
#

yeah @white anvil, this is just how i've done it for a while and i didn't think to change it

#

yep

copper cradle
#

bruh

bleak agate
#

that is half a day of my life

#

down the drain

#

to

#

./

copper cradle
#

do you know what ./ is?

nimble escarp
#

wait, you'd need the node executable in the cwd to be able to run that

bleak agate
#

parent folder right

copper cradle
#

no

nimble escarp
#

no

bleak agate
#

oh

#

what is it

nimble escarp
#

parent is ../

copper cradle
#

parent is ../

bleak agate
#

(sorry again i'm a new man)

#

ah

nimble escarp
#

./ is current folder

copper cradle
#

but still node is a path variable

bleak agate
#

what's the diff between ./node and node then?

copper cradle
#

so you don't need ./

nimble escarp
#

./node would try running node executable inside the current folder

copper cradle
#

do you have a binary called node in that folder?

#

node will try to use the path variable node

bleak agate
#

ahh

#

okay

#

that explains it

copper cradle
#

show the files in that folder

nimble escarp
#

I wonder what it'd output in nohup ./node -v &

copper cradle
#

yeah

#

my guess it that they have an older version of node in the folder

nimble escarp
#

could be, might be non-existent as well but that wouldn't really output a js error pepeshrug

copper cradle
#

@bleak agate run the following ./node -v

nimble escarp
#

for science

bleak agate
#

7.2.1

#

ah.

copper cradle
#

that explains it

bleak agate
#

that explains- yeah

nimble escarp
#

Well, never would've guessed that... pepeshrug

bleak agate
#

thanks guys

copper cradle
#

lol

bleak agate
#

truly you are adept at jumping through the retarded hoops i've set for myself

nimble escarp
#

This gotta be pinned somewhere tho lmao, it's a hilarious situation.

copper cradle
#

yeah

bleak agate
#

man

#

i was like

#

man

#

of course it's that

#

so much time trying to figure out my syntax issues

wicked pivot
#
var tab= "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789_-"
function random(rdm){
    rdm[Math.floor(Math.random() * rdm.length)]
}
    console.log(random(tab))```
someone can help me ? it does not work
copper cradle
#

oml

#

you have an azerty keyboard

#

eww

wicked pivot
#

yes xD

nimble escarp
#

eww

wicked pivot
#

i'm french

abstract crow
copper cradle
#

they play with zasd

nimble escarp
#

@wicked pivot you are not returning the value

copper cradle
#

do you know what a return is?

#

that function is missing the return value

#

that's the most basic thing on a function

#

the function executed the code

#

and then what?

#

it's not returning anything

nimble escarp
#

I jumped on repl.it because I missed it and here I am facepalming now pepeshrug

copper cradle
#

lmaoo

#

I opened vscode and then was like

#

wait where's the return

wicked pivot
#

it returns me "undefined"

nimble escarp
#

Yeah, the realization of "wait, that's wrong"

#

Yes, you need to return a value in the function

wicked pivot
#
function random(rdm){
    return rdm[Math.floor(Math.random() * rdm.length)]
}```that's all?
copper cradle
#

yes

quartz kindle
#

yes

nimble escarp
#

yes

copper cradle
#

that's literally it