Skip to content

Commit

Permalink
[Discord] Improve random dice command formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Apr 25, 2024
1 parent 0945c57 commit c8b9302
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Discord/cogs/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,21 @@ async def random_dice(self, ctx, *, input: str = '6'):
if isinstance(result, int):
await ctx.embed_reply(result)
else:
await ctx.embed_reply(", ".join(str(roll) for roll in result))
await ctx.embed_reply(
", ".join(str(roll) for roll in result)
)
except discord.HTTPException:
# TODO: use textwrap/paginate
await ctx.embed_reply(f"{ctx.bot.error_emoji} Output too long")
except pyparsing.ParseException:
await ctx.embed_reply(f"{ctx.bot.error_emoji} Invalid input")
except (concurrent.futures.TimeoutError, multiprocessing.context.TimeoutError):
await ctx.embed_reply(f"{ctx.bot.error_emoji} Execution exceeded time limit")
except (
concurrent.futures.TimeoutError,
multiprocessing.context.TimeoutError
):
await ctx.embed_reply(
f"{ctx.bot.error_emoji} Execution exceeded time limit"
)
except dice.DiceFatalException as e:
await ctx.embed_reply(f"{ctx.bot.error_emoji} Error: {e}")

Expand Down

0 comments on commit c8b9302

Please sign in to comment.