diff options
author | 2023-03-01 16:45:24 +0530 | |
---|---|---|
committer | 2023-03-01 16:45:24 +0530 | |
commit | e5fbddbe56921d46bf7f8451aef6c859214b2709 (patch) | |
tree | d835901446edba78f981a2e82cf63e737e3d1667 | |
parent | Merge pull request #2421 from shtlrs/bump-pydis-core-to-9-5-0 (diff) |
Add warning message when using `input`
-rw-r--r-- | bot/exts/utils/snekbox.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/exts/utils/snekbox.py b/bot/exts/utils/snekbox.py index 8a2e68b28..7ee5c5d21 100644 --- a/bot/exts/utils/snekbox.py +++ b/bot/exts/utils/snekbox.py @@ -344,8 +344,14 @@ class Snekbox(Cog): log.trace("Formatting output...") output, paste_link = await self.format_output(results["stdout"]) + warning_message = "" + # 33 is the length of the error message. It 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 "EOFError: EOF when reading a line" in output[-33:] 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}" |