Hseapp
This commit is contained in:
19
migrate.py
Normal file
19
migrate.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import settings
|
||||
from daemons.bot import bot
|
||||
from helpers.keyboards import campus_keyboard
|
||||
from helpers.mongo import mongo
|
||||
from requests import get
|
||||
|
||||
|
||||
for user in mongo.users_collection.find({'$or': [{'hse_id': None}, {'hse_id': {'$exists': False}}], "state": {"$ne": "wait_for_campus"}}):
|
||||
try:
|
||||
bot.send_message(
|
||||
user['chat_id'],
|
||||
"Время закончить регистрацию! Выбери свой кампус обучения.",
|
||||
reply_markup=campus_keyboard()
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
continue
|
||||
print('sent to', user['chat_id'])
|
||||
mongo.users_collection.update_one({"_id": user['_id']}, {"$set": {"state": "wait_for_campus"}})
|
||||
Reference in New Issue
Block a user