From 132f2c671b9cec78d72e2653587d2c7411837f97 Mon Sep 17 00:00:00 2001 From: chanomkaimuk <22185824+chanomkaimuk@users.noreply.github.com> Date: Fri, 2 Aug 2024 03:26:37 +0200 Subject: [PATCH] put hoabun in front since it's shorter --- commands/taiwanese/quiz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/taiwanese/quiz.py b/commands/taiwanese/quiz.py index 5f86d06..54648b4 100644 --- a/commands/taiwanese/quiz.py +++ b/commands/taiwanese/quiz.py @@ -11,7 +11,8 @@ class TaigiQuizChoice(QuizChoice): def __init__(self, poj_unicode: str, is_correct: bool, engbun:str="", hoabun:str=""): engbun = re.sub(r"<.*?>", "", engbun) # remove explanation in engbun, which is denoted by <>, since it might contain the answer - label = f"{engbun}" + f" ({hoabun})" if hoabun else "" + labels = (bun for bun in [hoabun, engbun] if bun) # only include non-empty labels + label = " | ".join(labels) if len(label) > DISCORD_MAX_LABEL_LENGTH: # discord only allows 80 characters for the label, so truncate if necessary label = label[:DISCORD_MAX_LABEL_LENGTH]