This commit is contained in:
Kellermann 2022-05-13 12:28:22 +02:00
parent 6586ac2bfe
commit e06c43b762

View File

@ -74,19 +74,16 @@ def update_crontab(p_my_handler):
user_ids = [] user_ids = []
user_crontab = [] user_crontab = []
if all_users != None: for element in all_users:
for element in all_users: if element["cron"] != '' and element["telegram_user_id"] != '': # check if both values are existing so I have consistent data
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: try:
user_ids.append(int(element["telegram_user_id"])) user_crontab.append(str(element["cron"]))
try: except:
user_crontab.append(str(element["cron"])) user_ids.pop() # if something goes wrong with cron I have to delete matching user id
except: except: continue
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)
print(user_ids) print(user_ids)