From 5fccf24b03feb9e1f43e8dc4fc2d576f88a89208 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei Date: Tue, 8 Feb 2022 21:58:36 +0200 Subject: [PATCH] Fixed subscription update message incorrectly being sent on resubscribe --- src/main.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.py b/src/main.py index 8d93b14..f3ca284 100755 --- a/src/main.py +++ b/src/main.py @@ -170,16 +170,17 @@ def subscribe_command_handler(update: telegram.Update, context: telegram.ext.Cal if db_user is None: return - db_user.subscription = database.User.Subscription.accepted.value - db_user.save() + if db_user.subscription != database.User.Subscription.accepted.value: + db_user.subscription = database.User.Subscription.accepted.value + db_user.save() - subscription_update_message = db_user.get_subscription_update_message() + subscription_update_message = db_user.get_subscription_update_message() - telegram_utils.send_subscription_update_message( - bot=telegram_queue_bot, - chat_id=ADMIN_USER_ID, - text=subscription_update_message - ) + telegram_utils.send_subscription_update_message( + bot=telegram_queue_bot, + chat_id=ADMIN_USER_ID, + text=subscription_update_message + ) utils.send_subscription_accepted_message_if_needed( bot=bot,