fix plural + dedup
parent
a898f1f816
commit
7fc91eb6ef
|
@ -1034,18 +1034,15 @@ def ban_user(fullname, v):
|
||||||
reason = reason_regex_post.sub(r'<a href="\1">\1</a>', reason)
|
reason = reason_regex_post.sub(r'<a href="\1">\1</a>', reason)
|
||||||
reason = reason_regex_comment.sub(r'<a href="\1#context">\1</a>', reason)
|
reason = reason_regex_comment.sub(r'<a href="\1#context">\1</a>', reason)
|
||||||
|
|
||||||
duration = "permanently"
|
|
||||||
if days:
|
if days:
|
||||||
days_txt = str(days)
|
days_txt = str(days)
|
||||||
if days_txt.endswith('.0'): days_txt = days_txt[:-2]
|
if days_txt.endswith('.0'): days_txt = days_txt[:-2]
|
||||||
duration = f"for {days_txt} day"
|
duration = f"for {days_txt} day"
|
||||||
if days != 1: duration += "s"
|
if days != 1: duration += "s"
|
||||||
if reason: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}"
|
|
||||||
else: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days."
|
|
||||||
else:
|
else:
|
||||||
if reason: text = f"@{v.username} (a site admin) has banned you permanently for the following reason:\n\n> {reason}"
|
duration = "permanently"
|
||||||
else: text = f"@{v.username} (a site admin) has banned you permanently."
|
|
||||||
|
|
||||||
|
text = f"@{v.username} (a site admin) has banned you {duration} for the following reason:\n\n> {reason}"
|
||||||
|
|
||||||
user.ban(admin=v, reason=reason, days=days)
|
user.ban(admin=v, reason=reason, days=days)
|
||||||
send_repeatable_notification(user.id, text)
|
send_repeatable_notification(user.id, text)
|
||||||
|
|
Loading…
Reference in New Issue