From 7ec994d4b3a9ee69cb7a49e94113d225e23d5261 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 15 Jun 2022 15:36:33 +0200 Subject: [PATCH] show gift reason in public transfer log --- files/routes/users.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index d2daed086..cb24e9a0b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -419,12 +419,14 @@ def transfer_coins(v, username): receiver.coins += amount - tax log_message = f"@{v.username} has transferred {amount} coins to @{receiver.username}" - send_repeatable_notification(GIFT_NOTIF_ID, log_message) - notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!" + if reason: if len(reason) > 200: return {"error": "Reason is too long, max 200 characters"},400 notif_text += f"\n\n> {reason}" + log_message += f"\n\n> {reason}" + + send_repeatable_notification(GIFT_NOTIF_ID, log_message) send_repeatable_notification(receiver.id, notif_text) g.db.add(receiver) @@ -1274,4 +1276,4 @@ def fp(v, fp): print(v.username + ' + ' + u.username, flush=True) g.db.add(v) g.db.commit() - return '', 204 \ No newline at end of file + return '', 204