aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2023-03-03 16:43:02 +0000
committerGravatar GitHub <[email protected]>2023-03-03 16:43:02 +0000
commit6d3d1cc41e20d3d251ed272caf0dc3fc5bf3e92d (patch)
tree557a6cb33bde19f0c7c450483a60c249f1816653
parentMerge pull request #2430 from python-discord/dependabot/pip/pydis-core-9.5.1 (diff)
parentMerge branch 'main' into snekbox/handling-input-error-message (diff)
Merge pull request #2422 from Ibrahim2750mi/snekbox/handling-input-error-message
Add warning message when using `input` with `eval` command
-rw-r--r--bot/exts/utils/snekbox.py9
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}"