def unban(cls, user_id): sqlquery = 'UPDATE USERS SET IS_BOT = ?, TIMESTAMP = 0 WHERE TELEGRAM_ID = ?' logger(sqlquery) data = (HUMAN, hashea(user_id)) logger(data) execute(sqlquery, data) return cls.get_user(user_id)
def insert_user(cls, member, chat_id, is_bot=False): sqlquery = 'INSERT INTO USERS (TELEGRAM_ID, TIMESTAMP, IS_BOT) VALUES(?, ?, ?)' logger(sqlquery) if is_bot or member['is_bot']: is_bot = BOT else: is_bot = HUMAN data = (hashea(member['id']), int(time.time()), is_bot) execute(sqlquery, data) return cls.get_user(member['id'])
def save(self): sqlquery = 'UPDATE USERS SET TIMESTAMP=?, IS_BOT=? WHERE TELEGRAM_ID=?' logger(sqlquery) data = (self._timestamp, self._is_bot, self._telegram_id) execute(sqlquery, data)