diff options
author | 2023-03-03 18:25:52 +0000 | |
---|---|---|
committer | 2023-03-03 18:25:52 +0000 | |
commit | 3ec3479121253f726964cdc4e861c313e3af8909 (patch) | |
tree | 11625d4094a8ac861d163e1cebc9d35ba0c8de60 | |
parent | Bump sentry-sdk from 1.11.1 to 1.16.0 (diff) | |
parent | Merge pull request #2422 from Ibrahim2750mi/snekbox/handling-input-error-message (diff) |
Merge branch 'main' into dependabot/pip/sentry-sdk-1.16.0
-rw-r--r-- | bot/exts/utils/snekbox.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bot/exts/utils/snekbox.py b/bot/exts/utils/snekbox.py index 8a2e68b28..ddcbe01fa 100644 --- a/bot/exts/utils/snekbox.py +++ b/bot/exts/utils/snekbox.py @@ -344,8 +344,15 @@ class Snekbox(Cog): log.trace("Formatting output...") output, paste_link = await self.format_output(results["stdout"]) + warning_message = "" + + # This is done to make sure the last line of output contains the error + # and the error is not manually printed by the author with a syntax error. + if results["stdout"].rstrip().endswith("EOFError: EOF when reading a line") and results["returncode"] == 1: + warning_message += ":warning: Note: `input` is not supported by the bot :warning:\n\n" + icon = self.get_status_emoji(results) - msg = f"{ctx.author.mention} {icon} {msg}.\n\n```\n{output}\n```" + msg = f"{ctx.author.mention} {icon} {msg}.\n\n{warning_message}```\n{output}\n```" if paste_link: msg = f"{msg}\nFull output: {paste_link}" |