Skip to content

Commit

Permalink
[Discord] Use error emoji Bot attribute in calculate command
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Jul 18, 2023
1 parent 7e9f6fb commit eafee4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Discord/cogs/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@ async def calculate(self, ctx, *, equation: str):
await ctx.embed_reply(f"{equation} = {result}")
except discord.HTTPException:
# TODO: use textwrap/paginate
await ctx.embed_reply(":no_entry: Output too long")
await ctx.embed_reply(f"{ctx.bot.error_emoji} Output too long")
except SyntaxError:
await ctx.embed_reply(":no_entry: Syntax error")
await ctx.embed_reply(f"{ctx.bot.error_emoji} Syntax error")
except TypeError as e:
await ctx.embed_reply(f":no_entry: Error: {e}")
await ctx.embed_reply(f"{ctx.bot.error_emoji} Error: {e}")
except ZeroDivisionError:
await ctx.embed_reply(":no_entry: Error: Division by zero")
await ctx.embed_reply(
f"{ctx.bot.error_emoji} Error: Division by zero"
)
except (
asyncio.TimeoutError, concurrent.futures.TimeoutError,
multiprocessing.context.TimeoutError
):
await ctx.embed_reply(
":no_entry: Execution exceeded time limit"
f"{ctx.bot.error_emoji} Execution exceeded time limit"
)

@commands.command()
Expand Down

0 comments on commit eafee4a

Please sign in to comment.