make it so when u ban someone for 3 days for example, it appears as "3 days" instead of "3.0 days"

master
Aevann1 2022-10-10 06:16:43 +02:00
parent fe1b22a131
commit df44613686
1 changed files with 7 additions and 4 deletions

View File

@ -853,7 +853,9 @@ def agendaposter(user_id, v):
user.agendaposter = expiry user.agendaposter = expiry
g.db.add(user) 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" else: note = "permanently"
ma = ModAction( ma = ModAction(
@ -1015,8 +1017,9 @@ def ban_user(user_id, v):
x.ban(admin=v, reason=reason, days=days) x.ban(admin=v, reason=reason, days=days)
if days: if days:
if reason: text = f"@{v.username} has banned you for **{days}** days for the following reason:\n\n> {reason}" days_txt = str(days).rstrip('.0')
else: text = f"@{v.username} has banned you for **{days}** days." 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: else:
if reason: text = f"@{v.username} has banned you permanently for the following reason:\n\n> {reason}" 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." else: text = f"@{v.username} has banned you permanently."
@ -1025,7 +1028,7 @@ def ban_user(user_id, v):
if days == 0: duration = "permanently" if days == 0: duration = "permanently"
elif days == 1: duration = "for 1 day" 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}' note = f'reason: "{reason}", duration: {duration}'
ma=ModAction( ma=ModAction(