#error
1 messages ยท Page 1 of 1 (latest)
@snow bridge can you please give me an image of your error?
k sure
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
np
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
ok
k
@buoyant wren
its showing red
then undefined
i think
i have to use 0
1 min
nope 2 lines
yes
wait
i changed
args[1] to args[0] and args[2] to args[1]
now its logging undefined
in console
in both
;-;
Can you send screenshot?
And please send peace of code when you are defining args
You used same cmd?
console.log(args);
Where are you logging it?
As ik functions are needed to define variables that it use
i mean function fn(args)
Where are you logging your args? In function or in if?
else
Try to log it 3 times, in start of your execute in else and in function
The else of the first if statement
K
Also
I did
function fn(args)
Addes args in function brackets
It
It showing
Erroe
In console
@buoyant wren
that its defined twice?
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
You need it to define all where you are defining function( if (fn(args)) )
Log args in start of your execute
You are using command handler?
Yes
Or where is your messageCreate event
Try to log message.content.slice(prefix.length).split(/ +/); there
Where
In messageCreate event
๐
before or after defining args
lol
Can you give me your code messageCreate
I'm gonna too
before this
I got something like you getting
๐
const must be regardless of his variable
If its changes const mustn't
Ik
But its changing
Shall i try to log args after every period of code?
You can initialize your args inside execute
๐
No, we understood what we needed
I c
Just initialize arguments using message.content.slice(prefix.length).split(/ +/);
Ok
You are still have message in execute
Yes
But its must be not args(diff name)
K
This is the last thing i di
Do*
After this ill fk node and study for geo exam tomorrow

no, it will ruine all your cmds
just create variable arguments
ok, log it

@buoyant wren u a gril?
No
I c
Wait
Prefix not defined
Ill define prefix
Ok
@buoyant wren
Roulette 50 red
Ok, fine now change all args in your code to arguments
K
Your are using VS code, right?
Yes
Nvm
I changed
All args to arguements
ok, now try
logs?
undefined?
You changed args[1] to args[0] before, did you return it how they was?
Send your code now, please
change arguements[0] to arguements[1]
Sure
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
Its bad way
๐

after define arguments
try log (parseFloat(arguements[0]), parseInt(arguements[0]) and isNaN(arguements[0])
Yes
Parse your arguments to int in isNaN
parseInt(arguements[0])
isNaN(parseInt(arguements[1]))
Smth else
Yes
Parsed int log?
?
.
Its*
Oh
It is coming as true
too lazy to read through all the messages to see if you fixed what I am seeing
your fn function is kinda useless, but wayne
Hm
K
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
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

xD
where does that come from now
god knows
did you change anything else?
nope
use pastebin
that
will take ages
i have to write the name of each file
etc
ill just copy my whole bot folder
oh you mean everything
including .env
I just need your message event file and the command file
file
i c
can you log rouleteErrorEmbed inside the if you just edited?
hm
I can also just test it myself
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
Is he need to define embeds in function?
What
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]});
}
}```
It is defined for that function
Ok