Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. const commando = require('discord.js-commando');
  2.  
  3. class RpsCommand extends commando.Command
  4. {
  5. constructor(client)
  6. {
  7. super(client,{
  8. name: 'rps',
  9. group: 'misc',
  10. memberName: 'rps',
  11. description: "Usage: .rps (Chose rock paper or scissors) Play Rock Paer Scissors With the Bot"
  12. });
  13. }
  14.  
  15. async run(message, args)
  16. {
  17.  
  18. //Checks for a input
  19. if(!args[0])
  20. {
  21. message.channel.send("You must chose rock, paper or scissors");
  22. return;
  23. }
  24.  
  25. //Check if input if valid
  26. if(!message.content('rock', 'paper', 'scissors'))
  27. {
  28. message.channel.send("You must chose rock, paper or scissors");
  29. return;
  30. }
  31.  
  32. //Randomly generated a number
  33. var chance = Math.floor(Math.random() * 3);
  34.  
  35. //If number = 0 then bot choses rock
  36. if(chance == 0)
  37. {
  38. message.reply("Rock!");
  39. if(message.content('rock'))
  40. {
  41. message.reply("Tie");
  42. return;
  43. }
  44. if(message.content('paper'))
  45. {
  46. message.reply("You Won");
  47. return;
  48. }
  49. if(message.content('scissors'))
  50. {
  51. message.reply("I Won");
  52. message.reply("SUCK IT LOSER");
  53. return;
  54. }
  55. }
  56.  
  57. //If number = 1 then bot choses paper
  58. if(chance == 1)
  59. {
  60. message.reply("Paper!");
  61. if(message.content('rock'))
  62. {
  63. message.reply("I Win");
  64. message.reply("SUCK IT LOSER");
  65. return;
  66. }
  67. if(message.content('paper'))
  68. {
  69. message.reply("Tie");
  70. return;
  71. }
  72. if(message.content('scissors'))
  73. {
  74. message.reply("You Won");
  75. return;
  76. }
  77.  
  78. //If number = 2 then bot choses scissors
  79. if(chance == 2)
  80. {
  81. message.reply("Scissors!");
  82. if(message.content('rock'))
  83. {
  84. message.reply("You Win");
  85. return;
  86. }
  87. if(message.content('paper'))
  88. {
  89. message.reply("I Won");
  90. message.reply("SUCK IT LOSER");
  91. return;
  92. }
  93. if(message.content('scissors'))
  94. {
  95. message.reply("Tie");
  96. return;
  97. }
  98. }
  99. }
  100. }}
  101.  
  102. module.exports = RpsCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement