def rem_chat(chat_id): with INSERTION_LOCK: chat = SESSION.query(Chats).get(str(chat_id)) if chat: SESSION.delete(chat) SESSION.commit() else: SESSION.close()
def del_user(user_id): with INSERTION_LOCK: curr = SESSION.query(Users).get(user_id) if curr: SESSION.delete(curr) SESSION.commit() return True ChatMembers.query.filter(ChatMembers.user == user_id).delete() SESSION.commit() SESSION.close() return False
def rem_nsfw(chat_id): with INSERTION_LOCK: nsfwchat = SESSION.query(NSFWChats).get(str(chat_id)) if nsfwchat: SESSION.delete(nsfwchat) SESSION.commit()