#error

1 messages ยท Page 1 of 1 (latest)

buoyant wren
snow bridge
#

i c

#

nice

#

ty

buoyant wren
#

@snow bridge can you please give me an image of your error?

buoyant wren
#

Oh

#

Hm

#

Wait

snow bridge
#

k

buoyant wren
#

Oh

#

I think I found

#

if(!args[2] == 'red' || !args[2] == 'white' ){
message.reply({embed: [rouletteErrorEmbed]});
}

#

If its ! == red

#

Wait

#

I think

#

No

#

Hm

#

Hm

#

You are parsing string

#

Your args 1 is 50 or red?

#

@snow bridge

snow bridge
#

sry net bad

buoyant wren
#

np

snow bridge
#

oh

#

i c

#

wait

buoyant wren
#

Why are you returning true if not its nan?

#

Wait

#

Its ok

#

Try to log

#

in else put your args[1] and [2] to console

snow bridge
#

ok

buoyant wren
#

In this else

#

End send output

snow bridge
#

k

#

@buoyant wren

#

its showing red

#

then undefined

#

i think

#

i have to use 0

#

1 min

buoyant wren
#

Hm

#

are you using console.log(args[1], args[2]);?

snow bridge
buoyant wren
#

console.log(args[1]);
console.log(args[2]);

#

?

snow bridge
#

yes

#

wait

#

i changed

#

args[1] to args[0] and args[2] to args[1]

#

now its logging undefined

#

in console

#

in both

#

;-;

buoyant wren
#

Can you send screenshot?

snow bridge
#

k

buoyant wren
#

And please send peace of code when you are defining args

snow bridge
#

k

#

const args = message.content.slice(prefix.length).split(/ +/);

buoyant wren
snow bridge
#

Smth is wrong

buoyant wren
#

Hm, its really weird

#

Log args

snow bridge
#

Hm

#

K

buoyant wren
#

console.log(args);

snow bridge
#

Ik

#

args is empty ;-;

buoyant wren
#

Where are you logging it?

#

As ik functions are needed to define variables that it use

buoyant wren
#

i mean function fn(args)

snow bridge
#

hm

#

wait

#

i added args

buoyant wren
#

Where are you logging your args? In function or in if?

buoyant wren
#

Here, right?

#

Not in if, I mean before

snow bridge
#

Hm

#

Wait

#

I am

#

Logging args

#

In else

#

The first if statement

buoyant wren
#

Try to log it 3 times, in start of your execute in else and in function

snow bridge
#

The else of the first if statement

snow bridge
#

Also

#

I did

#

function fn(args)

#

Addes args in function brackets

#

It

#

It showing

#

Erroe

#

In console

#

@buoyant wren

buoyant wren
#

that its defined twice?

snow bridge
#

Huh

#

Wait

#

PS C:\Users\Admin\Desktop\DiscordBot> node .
bot is online
Connected to the database!
C:\Users\Admin\Desktop\DiscordBot\commands\roulette.js:35
if((parseFloat(args[0]) == parseInt(args[0])) && !isNaN(args[0])){
^

TypeError: Cannot read properties of undefined (reading '0')
at fn (C:\Users\Admin\Desktop\DiscordBot\commands\roulette.js:35:32)
at Object.execute (C:\Users\Admin\Desktop\DiscordBot\commands\roulette.js:41:13)
at module.exports (C:\Users\Admin\Desktop\DiscordBot\events\guild\messageCreate.js:116:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Node.js v17.3.0
PS C:\Users\Admin\Desktop\DiscordBot>

#

@buoyant wren

buoyant wren
#

Hm

#

Send your code now please

snow bridge
#

K

buoyant wren
#

You need it to define all where you are defining function( if (fn(args)) )

snow bridge
#

๐Ÿ’€

#

@buoyant wren

#

It is sending

#

Error embed

#

And 2 undefined

#

In console

buoyant wren
#

Log args in start of your execute

snow bridge
#

K

#

Empty

#

@buoyant wren

#

It is

#

Empty

buoyant wren
#

Hm

#

Its really weird

snow bridge
#

Jm

#

Ik

buoyant wren
#

You are using command handler?

snow bridge
#

Yes

buoyant wren
#

Or where is your messageCreate event

snow bridge
#

Hm

#

It is in

#

Guild forlder

#

Which is

#

In events folder

buoyant wren
#

Try to log message.content.slice(prefix.length).split(/ +/); there

snow bridge
#

Where

buoyant wren
#

In messageCreate event

snow bridge
#

๐Ÿ’€

buoyant wren
#

before or after defining args

snow bridge
#

K

#

@buoyant wren

#

Roulette

#

Then

#

50

#

Then red

buoyant wren
#

lol

snow bridge
#

I just

#

Wanna cry

buoyant wren
#

Can you give me your code messageCreate

snow bridge
#

K

buoyant wren
#

I'm gonna too

snow bridge
#

Tryl

#

Bye

buoyant wren
#

Wdym?

#

Try to log args before execute

snow bridge
#

Hm

#

K

#

@buoyant wren

#

Before Messagecreate execute

#

Or

#

Roulette.js execute

#

?

buoyant wren
#

before this

snow bridge
#

K

#

IT IS EMPTY

#

BRUH

#

DJS HIGH

#

NODE HIGH

#

JS HIGH

buoyant wren
#

lmao

#

Its very weird

snow bridge
#

๐Ÿ’€

#

๐Ÿ˜ญ

buoyant wren
#

I got something like you getting

snow bridge
#

๐Ÿ’€

buoyant wren
#

const must be regardless of his variable

snow bridge
#

๐Ÿ’€

#

Ike

buoyant wren
#

If its changes const mustn't

snow bridge
#

Ik

buoyant wren
#

But its changing

snow bridge
#

Thats why

#

Node high

buoyant wren
#

Ye

#

Your error is most abnormal what i saw

snow bridge
#

Yes

#

Ik

buoyant wren
#

If mine I can I understand

#

But yours..

#

I think

snow bridge
#

Shall i try to log args after every period of code?

buoyant wren
#

You can initialize your args inside execute

snow bridge
#

๐Ÿ’€

buoyant wren
snow bridge
#

I c

buoyant wren
#

Just initialize arguments using message.content.slice(prefix.length).split(/ +/);

snow bridge
#

Ok

buoyant wren
#

You are still have message in execute

snow bridge
#

Yes

buoyant wren
#

But its must be not args(diff name)

snow bridge
#

K

#

This is the last thing i di

#

Do*

#

After this ill fk node and study for geo exam tomorrow

buoyant wren
snow bridge
#

Also

#

Shall i remove args frm execute()

#

Then ill declare args

#

@buoyant wren

buoyant wren
#

no, it will ruine all your cmds

snow bridge
#

Hm

#

Then ill declare

#

Without

#

Removing

#

Right?

buoyant wren
#

just create variable arguments

snow bridge
#

I c

#

Nice

#

Ok

#

I declare d

#

A var

#

Called arguments

#

@buoyant wren

buoyant wren
#

ok, log it

snow bridge
#

๐Ÿ’€

#

K

buoyant wren
snow bridge
#

@buoyant wren u a gril?

buoyant wren
#

No

snow bridge
#

I c

#

Wait

#

Prefix not defined

#

Ill define prefix

#

Ok

#

@buoyant wren

#

Roulette 50 red

buoyant wren
#

Ok, fine now change all args in your code to arguments

snow bridge
#

K

#

Is there

#

Any shortcut

#

To do that

buoyant wren
#

Ye, in visual studio

#

But wait

snow bridge
#

K

buoyant wren
#

Your are using VS code, right?

snow bridge
#

Nvm

#

I changed

#

All args to arguements

buoyant wren
#

ok, now try

snow bridge
#

Nah

#

Same error

buoyant wren
#

logs?

snow bridge
#

Yes

#

Everything same

#

I logged arguements

buoyant wren
#

undefined?

snow bridge
#

But roulette 50 red

#

In log

buoyant wren
#

You changed args[1] to args[0] before, did you return it how they was?

#

Send your code now, please

snow bridge
#

ok

#

i

#

will now

#

calm down

buoyant wren
#

change arguements[0] to arguements[1]

snow bridge
#

And 1 to 2

#

Right?

buoyant wren
#

Sure

snow bridge
#

K

#

If this doesn't work i swear to god i wont do a single thing after this

#

Ill leave it the way it is and study

buoyant wren
#

Its bad way

snow bridge
#

๐Ÿ’€

buoyant wren
snow bridge
#

Nah

#

Still error embed

buoyant wren
#

Wait

#

log arguments 1 and 2

snow bridge
#

Ok

#

Where

#

Shoud i log

buoyant wren
#

after define arguments

snow bridge
#

K

#

Wait

#

I already logged while arguements

#

And its fine

#

1 is 50 and 2 is red

buoyant wren
#

try log (parseFloat(arguements[0]), parseInt(arguements[0]) and isNaN(arguements[0])

snow bridge
#

K

#

@buoyant wren

#

Showing trye

#

True

buoyant wren
#

isNan?

#

showing true?

snow bridge
#

Yes

buoyant wren
#

Parse your arguments to int in isNaN

snow bridge
#

1 min

#

How to

#

Do that

buoyant wren
#

parseInt(arguements[0])

snow bridge
#

K

#

0?

#

Or

buoyant wren
#

isNaN(parseInt(arguements[1]))

snow bridge
#

Smth else

snow bridge
#

@buoyant wren

#

True

buoyant wren
#

Hm

#

And args 1 is 50?

snow bridge
#

Yes

buoyant wren
#

Parsed int log?

snow bridge
#

?

snow bridge
#

Yes

#

Uts coning as true

buoyant wren
#

Wdym?

#

Uts?

snow bridge
#

Its*

buoyant wren
#

Oh

snow bridge
#

It is coming as true

drifting bear
#

whats your current code

#

copy paste here

snow bridge
#

K

drifting bear
#

too lazy to read through all the messages to see if you fixed what I am seeing

snow bridge
#

see i have to prepare for my exams

#

pls do it fast

drifting bear
#

your fn function is kinda useless, but wayne

snow bridge
#

Hm

drifting bear
#

in your if where you check for red or white

#

use && instead of ||

snow bridge
#

K

drifting bear
#

if you put in white, it will send the error, if you put in red, it will error. Cuz it will always return true on one of them

snow bridge
#

K

#

PS C:\Users\Admin\Desktop\DiscordBot> node .
bot is online
Connected to the database!
[ 'roulette', '50', 'red' ]
true
false
C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async TextChannel.send (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172:15) {
method: 'post',
path: '/channels/880114981897666590/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}

Node.js v17.3.0
PS C:\Users\Admin\Desktop\DiscordBot>

#

error

drifting bear
snow bridge
#

xD

drifting bear
#

where does that come from now

snow bridge
#

god knows

drifting bear
#

did you change anything else?

snow bridge
#

shall i just copy my entire file

#

upload to medifire and send

snow bridge
drifting bear
snow bridge
#

that

#

will take ages

#

i have to write the name of each file

#

etc

#

ill just copy my whole bot folder

drifting bear
#

oh you mean everything

snow bridge
#

upload

#

then send link

snow bridge
drifting bear
#

I just need your message event file and the command file

snow bridge
#

i c

#

command file or folder?

drifting bear
#

file

snow bridge
#

there aint a file called command ;-;

drifting bear
#

I mean the file with the code of the command in it

#

...

snow bridge
drifting bear
#

can you log rouleteErrorEmbed inside the if you just edited?

snow bridge
#

hm

drifting bear
#

I can also just test it myself

snow bridge
#

yes

#

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Admin\Desktop\DiscordBot> node .
bot is online
Connected to the database!
[ 'roulette' ]
true
true
MessageEmbed {
type: 'rich',
title: 'ERROR',
description: 'the valid input is %roulette <bet> <space>',
url: null,
color: 15548997,
timestamp: null,
fields: [],
thumbnail: null,
image: null,
video: null,
author: null,
provider: null,
footer: null
}

#

@drifting bear i gtg

#

can i ttyl ?

#

@drifting bear i will talk to you later

#

sorry for the inconvienience

#

bye

buoyant wren
#

Is he need to define embeds in function?

drifting bear
#

What

buoyant wren
#

outcome can't know what is loseEmbed and winEmbed

#
function outcome(loseEmbed, winEmbed){
            if(randomSmth == 1)
            {
                message.channel.send({embeds: [loseEmbed]});
            }
            else{
                message.channel.send({embeds: [winEmbed]});
            }
        }```
drifting bear
#

It is defined for that function

buoyant wren
#

Ok