diff --git a/telegram_bot/bot_updates.py b/telegram_bot/bot_updates.py index 6868feb..704a976 100644 --- a/telegram_bot/bot_updates.py +++ b/telegram_bot/bot_updates.py @@ -74,19 +74,16 @@ def update_crontab(p_my_handler): user_ids = [] user_crontab = [] - if all_users != None: - for element in all_users: - if element["cron"] != '' and element["telegram_user_id"] != '': # check if both values are existing so I have consistent data + for element in all_users: + if element["cron"] != '' and element["telegram_user_id"] != '': # check if both values are existing so I have consistent data + try: + user_ids.append(int(element["telegram_user_id"])) try: - user_ids.append(int(element["telegram_user_id"])) - try: - user_crontab.append(str(element["cron"])) - except: - user_ids.pop() # if something goes wrong with cron I have to delete matching user id - except: continue - else: - print("Error with all users from db. Retrying in update_crontab()") - update_crontab(p_my_handler) + user_crontab.append(str(element["cron"])) + except: + user_ids.pop() # if something goes wrong with cron I have to delete matching user id + except: continue + print(user_ids)