only add reason if there's a reason

master
Aevann1 2022-11-05 04:48:02 +02:00
parent a84c6b6b24
commit 299dbceeeb
2 changed files with 5 additions and 3 deletions

View File

@ -163,7 +163,7 @@ def execute_snappy(post, v):
text = f"@Snappy has banned you for **{days}** days for the following reason:\n\n> {reason}" text = f"@Snappy has banned you for **{days}** days for the following reason:\n\n> {reason}"
send_repeatable_notification(v.id, text) send_repeatable_notification(v.id, text)
duration = f"for {days} days" duration = f"for {days} days"
note = f'reason: "{reason}", duration: {duration}' note = f'duration: {duration}, reason: "{reason}"'
ma=ModAction( ma=ModAction(
kind="ban_user", kind="ban_user",
user_id=snappy.id, user_id=snappy.id,

View File

@ -968,7 +968,7 @@ def ban_user(user_id, v):
send_repeatable_notification(user.id, text) send_repeatable_notification(user.id, text)
note = f'reason: "{reason}", duration: {duration}' note = f'duration: {duration}, reason: "{reason}"'
ma=ModAction( ma=ModAction(
kind="ban_user", kind="ban_user",
user_id=v.id, user_id=v.id,
@ -1029,7 +1029,9 @@ def agendaposter(user_id, v):
send_repeatable_notification(user.id, text) send_repeatable_notification(user.id, text)
note = f'reason: "{reason}", duration: {duration}' note = f'duration: {duration}'
if reason: note += f', reason: "{reason}"'
ma=ModAction( ma=ModAction(
kind="agendaposter", kind="agendaposter",
user_id=v.id, user_id=v.id,