aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Ionite <[email protected]>2023-02-12 03:40:05 -0500
committerGravatar Ionite <[email protected]>2023-02-12 03:40:05 -0500
commit51b719e49bd4b71cea539cd37888c86ce73e42a1 (patch)
treebd8e867f40c931cf883f1124350404ca8e104d35
parentMade EvalJob and FileAttachment dataclasses frozen (diff)
parentSimplify file name truncation (diff)
Merge branch 'snekbox-files' of https://github.com/python-discord/bot into snekbox-files
-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 51455fb58..f82b6aa89 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)