Merge branch 'master' of http://gitlab.sprinthub.ru/self/ruz-bot
This commit is contained in:
commit
bc8361731c
@ -50,7 +50,8 @@ def process():
|
|||||||
try:
|
try:
|
||||||
bot.send_message(
|
bot.send_message(
|
||||||
user["chat_id"],
|
user["chat_id"],
|
||||||
f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user_model.daily_notify_today else 'завтра'}:\n" + text
|
f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user_model.daily_notify_today else 'завтра'}:\n" + text,
|
||||||
|
parse_mode='Markdown'
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@ -59,7 +60,7 @@ def process():
|
|||||||
{"$set": {"next_daily_notify_time": user_model.next_daily_notify_time + datetime.timedelta(days=1)}}
|
{"$set": {"next_daily_notify_time": user_model.next_daily_notify_time + datetime.timedelta(days=1)}}
|
||||||
)
|
)
|
||||||
|
|
||||||
for user in mongo.users_collection.find({"first_lesson_notify": {"$ne": None}, "hse_id": {"$ne": None}}):
|
for user in mongo.users_collection.find({"first_lesson_notify": {"$exists": True}, "first_lesson_notify": {"$ne": None}, "hse_id": {"$ne": None}}):
|
||||||
time_now = now(UserSchema().load(user))
|
time_now = now(UserSchema().load(user))
|
||||||
for lesson in mongo.lessons_collection.find({
|
for lesson in mongo.lessons_collection.find({
|
||||||
"hse_user_id": user["hse_id"],
|
"hse_user_id": user["hse_id"],
|
||||||
@ -91,7 +92,7 @@ def process():
|
|||||||
except ApiTelegramException:
|
except ApiTelegramException:
|
||||||
pass
|
pass
|
||||||
start_of_day = datetime.datetime(year=time_now.year, month=time_now.month, day=time_now.day)
|
start_of_day = datetime.datetime(year=time_now.year, month=time_now.month, day=time_now.day)
|
||||||
mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}}, {"$set": {"notified_today": True}})
|
mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}, "hse_user_id": user["hse_id"]}, {"$set": {"notified_today": True}})
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user