diff options
| author | 2022-05-28 16:46:09 +0100 | |
|---|---|---|
| committer | 2022-05-28 16:46:09 +0100 | |
| commit | d9b48c5f4103afba015726a36900d7fc7233bc4d (patch) | |
| tree | e844a572acbd7c5b22e297cb5da8da57847901e7 | |
| parent | Add special handling for eval command followed by backticks. (diff) | |
Copy message instead of modifying original
| -rw-r--r-- | bot/exts/backend/error_handler.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py index dd7867407..5126c0267 100644 --- a/bot/exts/backend/error_handler.py +++ b/bot/exts/backend/error_handler.py @@ -1,3 +1,4 @@ +import copy import difflib from botcore.site_api import ResponseCodeError @@ -189,15 +190,14 @@ class ErrorHandler(Cog): Return True if command was invoked, else False """ - old_message_content = ctx.message.content + msg = copy.copy(ctx.message) - command, sep, end = ctx.message.content.partition("```") - ctx.message.content = command + " " + sep + end - new_ctx = await self.bot.get_context(ctx.message) + command, sep, end = msg.content.partition("```") + msg.content = command + " " + sep + end + new_ctx = await self.bot.get_context(msg) eval_command = self.bot.get_command("eval") if eval_command is None or new_ctx.command != eval_command: - ctx.message.content = old_message_content return False log.debug("Running fixed eval command.") |