aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Ionite <[email protected]>2023-02-12 03:39:44 -0500
committerGravatar GitHub <[email protected]>2023-02-12 03:39:44 -0500
commit48b0f7d90243a1248cb5d12a0e3d0f42611f3896 (patch)
tree2a11268dd31810d6c6d88ea6dbb5ddc51bf48b14
parentAdd `failed_file` emoji to config (diff)
Simplify file name truncation
Co-authored-by: Boris Muratov <[email protected]>
-rw-r--r--bot/exts/utils/snekbox/_eval.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/bot/exts/utils/snekbox/_eval.py b/bot/exts/utils/snekbox/_eval.py
index 5c2fc8757..6de88baed 100644
--- a/bot/exts/utils/snekbox/_eval.py
+++ b/bot/exts/utils/snekbox/_eval.py
@@ -120,14 +120,9 @@ class EvalResult:
names.append("...")
break
- to_display = min(char_max, len(file))
- name_short = file[:to_display]
- # Add ellipsis if name was truncated
- if to_display < len(file):
- name_short += "..."
- names.append(name_short)
+ if len(file) > char_max:
+ names.append(file[:char_max] + "...")
break
-
char_max -= len(file)
names.append(file)