diff --git a/django_code/apps/telegram_communication/utils.py b/django_code/apps/telegram_communication/utils.py index 787a875..a9c9843 100644 --- a/django_code/apps/telegram_communication/utils.py +++ b/django_code/apps/telegram_communication/utils.py @@ -72,6 +72,10 @@ class telegramUtils(): expired_messages_list = [] expired_messages = TelegramData.objects.filter(expiration_date__lte=yesterday) + #leave if the list is empty + if expired_messages.len == 0: + return 1 + #create a list with only the message_id for expired_message in expired_messages: expired_messages_list.append(expired_message.message_id)