Skip to content

Commit

Permalink
[Discord] Improve rpsls command coherence and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed May 8, 2019
1 parent 2b8ea4a commit 517a074
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Discord/cogs/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,15 +1045,25 @@ async def rpsls(self, ctx, object : str):
if object.lower() not in ('r', 'p', 's', 'l', "rock", "paper", "scissors", "lizard", "spock"):
return await ctx.embed_reply(":no_entry: That's not a valid object")
value = random.choice(("rock", "paper", "scissors", "lizard", "Spock"))
short_shape = 'S' if object[0] == 'S' and object.lower() != "scissors" or object.lower() == "spock" else object[0].lower()
resolution = {'r': {'s': "crushes", 'l': "crushes"}, 'p': {'r': "covers", 'S': "disproves"}, 's': {'p': "cuts", 'l': "decapitates"}, 'l': {'p': "eats", 'S': "poisons"}, 'S': {'r': "vaporizes", 's': "smashes"}}
emotes = {'r': ":fist::skin-tone-2:", 'p': ":raised_hand::skin-tone-2:", 's': ":v::skin-tone-2:", 'l': ":lizard:", 'S': ":vulcan::skin-tone-2:"}
if object[0] == 'S' and object.lower() != "scissors" or object.lower() == "spock":
short_shape = 'S'
else:
short_shape = object[0].lower()
resolution = {'r': {'s': "crushes", 'l': "crushes"}, 'p': {'r': "covers", 'S': "disproves"},
's': {'p': "cuts", 'l': "decapitates"}, 'l': {'p': "eats", 'S': "poisons"},
'S': {'r': "vaporizes", 's': "smashes"}}
emotes = {'r': ":fist::skin-tone-2:", 'p': ":raised_hand::skin-tone-2:",
's': ":v::skin-tone-2:", 'l': ":lizard:", 'S': ":vulcan::skin-tone-2:"}
if value[0] == short_shape:
await ctx.embed_reply(f"I chose `{value}`\nIt's a draw :confused:")
elif short_shape in resolution[value[0]]:
await ctx.embed_reply(f"I chose `{value}`\n{emotes[value[0]]} {resolution[value[0]][short_shape]} {emotes[short_shape]}\nYou lose :slight_frown:")
await ctx.embed_reply(f"I chose `{value}`\n"
f"{emotes[value[0]]} {resolution[value[0]][short_shape]} {emotes[short_shape]}\n"
"You lose :slight_frown:")
else:
await ctx.embed_reply(f"I chose `{value}`\n{emotes[short_shape]} {resolution[short_shape][value[0]]} {emotes[value[0]]}\nYou win! :tada:")
await ctx.embed_reply(f"I chose `{value}`\n"
f"{emotes[short_shape]} {resolution[short_shape][value[0]]} {emotes[value[0]]}\n"
"You win! :tada:")

@commands.command(aliases = ["rockpaperscissorslizardspockspidermanbatmanwizardglock", "rock-paper-scissors-lizard-spock-spiderman-batman-wizard-glock"])
@checks.not_forbidden()
Expand Down

0 comments on commit 517a074

Please sign in to comment.