def decorator(_cls, bot: telegram.Bot, update: telegram.Update):
     message = update.edited_message if update.edited_message else update.message
     uid = message.from_user.id
     if not DateChecker.is_day_active():
         return
     if not ChatUser.get(uid, CONFIG['anon_chat_id']):
         return
     return f(_cls, bot, update)
Esempio n. 2
0
 def decorator(_cls, bot: telegram.Bot, update: telegram.Update):
     message = update.edited_message if update.edited_message else update.message
     uid = message.from_user.id
     if not FSBDayModel.is_day_active():
         return
     if not ChatUser.get(uid, CONFIG['anon_chat_id']):
         return
     if cls.is_dinner_time():
         cls.__send_dinner(bot, uid)
         return
     return f(_cls, bot, update)
 def find_user(username: Optional[str], chat_id: int) -> Optional[User]:
     if not username:
         return None
     uid = User.get_id_by_name(username)
     if not uid:
         return None
     chat_user = ChatUser.get(uid, chat_id)
     if not chat_user:
         return None
     if chat_user.left:
         return None
     return User.get(uid)
Esempio n. 4
0
 def decorator(bot: telegram.Bot, update: telegram.Update):
     message = update.edited_message if update.edited_message else update.message
     uid = message.from_user.id
     if not ChatUser.get(uid, CONFIG['anon_chat_id']):
         return
     return func(bot, update)