diff options
| -rw-r--r-- | bot/exts/utils/snekbox/_cog.py | 3 | ||||
| -rw-r--r-- | bot/exts/utils/snekbox/_eval.py | 13 | 
2 files changed, 13 insertions, 3 deletions
| diff --git a/bot/exts/utils/snekbox/_cog.py b/bot/exts/utils/snekbox/_cog.py index e2a155176..00150a837 100644 --- a/bot/exts/utils/snekbox/_cog.py +++ b/bot/exts/utils/snekbox/_cog.py @@ -328,7 +328,8 @@ class Snekbox(Cog):                  output, paste_link = await self.format_output(result.stdout)              msg = f"{ctx.author.mention} {result.status_emoji} {msg}.\n" -            if output not in ("[No output]", "") or not (result.files or result.failed_files): +            # Skip output if it's empty and there are file uploads +            if result.stdout or not result.has_files:                  msg += f"\n```\n{output}\n```"              if paste_link: diff --git a/bot/exts/utils/snekbox/_eval.py b/bot/exts/utils/snekbox/_eval.py index f82b6aa89..2f61b5924 100644 --- a/bot/exts/utils/snekbox/_eval.py +++ b/bot/exts/utils/snekbox/_eval.py @@ -63,10 +63,19 @@ class EvalResult:      failed_files: list[str] = field(default_factory=list)      @property +    def has_output(self) -> bool: +        """True if the result has any output (stdout, files, or failed files).""" +        return bool(self.stdout.strip() or self.files or self.failed_files) + +    @property +    def has_files(self) -> bool: +        """True if the result has any files or failed files.""" +        return bool(self.files or self.failed_files) + +    @property      def status_emoji(self) -> str:          """Return an emoji corresponding to the status code or lack of output in result.""" -        # If there are attachments, skip empty output warning -        if not self.stdout.strip() and not (self.files or self.failed_files): +        if not self.has_output:              return ":warning:"          elif self.returncode == 0:  # No error              return ":white_check_mark:" | 
