Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const commando = require('discord.js-commando');
- class RpsCommand extends commando.Command
- {
- constructor(client)
- {
- super(client,{
- name: 'rps',
- group: 'misc',
- memberName: 'rps',
- description: "Usage: .rps (Chose rock paper or scissors) Play Rock Paer Scissors With the Bot"
- });
- }
- async run(message, args)
- {
- //Checks for a input
- if(!args[0])
- {
- message.channel.send("You must chose rock, paper or scissors");
- return;
- }
- //Check if input if valid
- if(!message.content('rock', 'paper', 'scissors'))
- {
- message.channel.send("You must chose rock, paper or scissors");
- return;
- }
- //Randomly generated a number
- var chance = Math.floor(Math.random() * 3);
- //If number = 0 then bot choses rock
- if(chance == 0)
- {
- message.reply("Rock!");
- if(message.content('rock'))
- {
- message.reply("Tie");
- return;
- }
- if(message.content('paper'))
- {
- message.reply("You Won");
- return;
- }
- if(message.content('scissors'))
- {
- message.reply("I Won");
- message.reply("SUCK IT LOSER");
- return;
- }
- }
- //If number = 1 then bot choses paper
- if(chance == 1)
- {
- message.reply("Paper!");
- if(message.content('rock'))
- {
- message.reply("I Win");
- message.reply("SUCK IT LOSER");
- return;
- }
- if(message.content('paper'))
- {
- message.reply("Tie");
- return;
- }
- if(message.content('scissors'))
- {
- message.reply("You Won");
- return;
- }
- //If number = 2 then bot choses scissors
- if(chance == 2)
- {
- message.reply("Scissors!");
- if(message.content('rock'))
- {
- message.reply("You Win");
- return;
- }
- if(message.content('paper'))
- {
- message.reply("I Won");
- message.reply("SUCK IT LOSER");
- return;
- }
- if(message.content('scissors'))
- {
- message.reply("Tie");
- return;
- }
- }
- }
- }}
- module.exports = RpsCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement