Closed FuzzyDark closed 5 years ago
Unless I am misunderstanding your code, you need to put the declaration of option outside of conditional block:
let option;
if(args > 0){
option = args.splice(1, 1);
}else{
....
}
...
if(message.content.startsWith(prefx)
....
I figured it out 3 hours ago lol Thanks anyway, I'll take that
Hey guys, I'm working on a basic bot Discord.js project and I'm having some trouble... I'm making some commands, that could rank people and at the same time give them info (without some arguments that I'm going to show...), and I have trouble with a variable.. Codeblocks following:
that "option" one is the one which I'm having trouble with... It constantly says " 'option' is declared but its value is never read.ts(6133)".
now the thing is, 'option' is what follows the main command, an example would be:
where "!" is the prefix, "rankme" the args, and "god" the option. So in that case 'option' exists, because in my program, "god" is a role with it's correspondant ID, but if had this:
then it throws all this error code:
Here's the rest of the code that "terms" the option thing, it's below the initialization: