Exemple #1
0
 def user_is_admin(self, chat_id):
     logging.debug('Called')
     try:
         return ChatIDs.select(ChatIDs.is_admin).where(
             ChatIDs.chat_id == chat_id).execute()[0].is_admin
     except Exception as e:
         logging.error(e)
Exemple #2
0
 def get_user_last_qa_set(self, user_id: int) -> ChatIDs.last_set:
     """
     Get user last question and answer set.
     """
     logging.debug('Entry')
     result = ChatIDs.select(ChatIDs.last_set).where(
         ChatIDs.chat_id == user_id).execute()[0].last_set
     logging.debug('Возвращаемый результат ' + result)
     return result
Exemple #3
0
 def get_chatid_name_by_id(self, chat_id):
     """
     TODO: Упрлс?
     :param chat_id:
     :return: number of affected rows
     """
     logging.debug('Called')
     with self.db.atomic():
         try:
             return ChatIDs.select(ChatIDs.user_name).where(
                 ChatIDs.chat_id == chat_id).execute()
         except OperationalError as e:
             logging.error(e)
Exemple #4
0
 def is_exists_user_acc(self, chat_id):
     """
     Check what the user is exist in DB
     :param chat_id: int (T_Chat_ID)
     :return: bool type
     """
     logging.debug('Called')
     try:
         with self.db.atomic():
             return ChatIDs.select().where(
                 ChatIDs.chat_id == chat_id).exists()
     except Exception as e:
         logging.error(e)