From 6969fc1973261bcba51b7346c8e168bcc011b833 Mon Sep 17 00:00:00 2001 From: Gustav Odinger Date: Sun, 4 Oct 2020 23:30:47 +0200 Subject: Revert and update roll command - Returns to previous version of code - Improves readability - Adds spaced between dice --- bot/exts/evergreen/fun.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bot/exts/evergreen/fun.py') diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py index 9d6ee29c..23715906 100644 --- a/bot/exts/evergreen/fun.py +++ b/bot/exts/evergreen/fun.py @@ -60,13 +60,15 @@ class Fun(Cog): @commands.command() async def roll(self, ctx: Context, num_rolls: int = 1) -> None: """Outputs a number of random dice emotes (up to 6).""" + output = "" if num_rolls > 6: num_rolls = 6 - - dice = (f"dice_{random.randint(1, 6)}" for _ in range(num_rolls)) - output = " ".join(getattr(Emojis, die, '') for die in dice) - - await ctx.send(output or ":no_entry: You must roll at least once.") + elif num_rolls < 1: + output = ":no_entry: You must roll at least once." + for _ in range(num_rolls): + dice = f"dice_{random.randint(1, 6)}" + output += getattr(Emojis, dice, '') + " " + await ctx.send(output.rstrip()) @commands.command(name="uwu", aliases=("uwuwize", "uwuify",)) async def uwu_command(self, ctx: Context, *, text: clean_content(fix_channel_mentions=True)) -> None: -- cgit v1.2.3