From df446136860c9cbc77f96d62c18af9afec41d8ea Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 10 Oct 2022 06:16:43 +0200 Subject: [PATCH] make it so when u ban someone for 3 days for example, it appears as "3 days" instead of "3.0 days" --- files/routes/admin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index f5b9f93ee..977ba1450 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -853,7 +853,9 @@ def agendaposter(user_id, v): user.agendaposter = expiry g.db.add(user) - if days: note = f"for {days} days" + if days: + days_txt = str(days).rstrip('.0') + note = f"for {days_txt} days" else: note = "permanently" ma = ModAction( @@ -1015,8 +1017,9 @@ def ban_user(user_id, v): x.ban(admin=v, reason=reason, days=days) if days: - if reason: text = f"@{v.username} has banned you for **{days}** days for the following reason:\n\n> {reason}" - else: text = f"@{v.username} has banned you for **{days}** days." + days_txt = str(days).rstrip('.0') + if reason: text = f"@{v.username} has banned you for **{days_txt}** days for the following reason:\n\n> {reason}" + else: text = f"@{v.username} has banned you for **{days_txt}** days." else: if reason: text = f"@{v.username} has banned you permanently for the following reason:\n\n> {reason}" else: text = f"@{v.username} has banned you permanently." @@ -1025,7 +1028,7 @@ def ban_user(user_id, v): if days == 0: duration = "permanently" elif days == 1: duration = "for 1 day" - else: duration = f"for {days} days" + else: duration = f"for {days_txt} days" note = f'reason: "{reason}", duration: {duration}' ma=ModAction(