2020-02-19 22:46:50 +00:00
const misc = require ( "../utils/misc.js" ) ;
2019-09-13 20:02:41 +00:00
exports . run = async ( message , args ) => {
if ( args . length === 0 || ( args [ 0 ] !== "rock" && args [ 0 ] !== "paper" && args [ 0 ] !== "scissors" ) ) return ` ${ message . author . mention } , you need to choose whether you want to be rock, paper, or scissors! ` ;
let emoji ;
let winOrLose ;
2020-02-19 22:46:50 +00:00
const result = misc . random ( [ "rock" , "paper" , "scissors" ] ) ;
2019-09-13 20:02:41 +00:00
switch ( result ) {
case "rock" :
emoji = "✊" ;
if ( args [ 0 ] . toLowerCase ( ) === "paper" ) winOrLose = 1 ;
break ;
case "paper" :
emoji = "✋" ;
if ( args [ 0 ] . toLowerCase ( ) === "scissors" ) winOrLose = 1 ;
break ;
case "scissors" :
emoji = "✌" ;
if ( args [ 0 ] . toLowerCase ( ) === "rock" ) winOrLose = 1 ;
break ;
default :
break ;
}
return args [ 0 ] . toLowerCase ( ) === result ? ` ${ emoji } I chose ${ result } . It's a tie! ` : ` ${ emoji } I chose ${ result } . ${ winOrLose ? "You win!" : "You lose!" } ` ;
} ;
2019-12-02 20:47:22 +00:00
exports . aliases = [ "rockpaperscissors" ] ;
exports . category = 4 ;
2019-12-05 16:58:46 +00:00
exports . help = "Plays rock, paper, scissors with me" ;
exports . params = "[rock/paper/scissors]" ;