From 54efcd2403fe27ef3fb6ce92b45403caf3d05f31 Mon Sep 17 00:00:00 2001 From: "scoopala7.tngl.sh" Date: Sat, 13 Jun 2026 12:01:23 -0700 Subject: [PATCH] Add rock paper scissors --- cogs/fun.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/cogs/fun.py b/cogs/fun.py index ec9b9d5..742a13b 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -25,4 +25,41 @@ async def decide_command(interaction): choice = "Yes" elif choice == 2: choice = "No" - interaction.response.send(f"{choice}\n-# note: this is completely randomized. use some common sense!!") \ No newline at end of file + interaction.response.send(f"{choice}\n-# note: this is completely randomized. use some common sense!!") + +@discohook.command.slash('rps', description = 'Play RPS against the bot!',options=[discohook.option.string("choice", "Your choice", required=True, choices=[ + discohook.Choice("Rock","rock"), + discohook.Choice("Paper", "paper"), + discohook.Choice("Scissors","scissors") +])]) +async def rps_command(interaction, choice): + bot_choice = random.randint(1,3) + if bot_choice == 1: + bot_choice = "rock" + elif bot_choice == 2: + bot_choice = "paper" + elif bot_choice == 3: + bot_choice = "scissors" + + if bot_choice == choice: + win = "That's a tie!" + elif choice == "rock" and bot_choice == "paper": + win = "Bot wins!" + elif choice == "rock" and bot_choice == "scissors": + win = "You wins!" + elif choice == "paper" and bot_choice == "scissors": + win = "Bot wins!" + elif choice == "scissors" and bot_choice == "paper": + win = "You win!" + elif choice == "paper" and bot_choice == "rock": + win = "You win!" + elif choice == "scissors" and bot_choice == "rock": + win = "Bot wins!" + + text = '\n'.join([ + f"You chose {choice}", + f"Bot chose {bot_choice}", + win + ]) + interaction.response.send(text) + \ No newline at end of file -- 2.51.2