def rem_chat(chat_id): with INSERTION_LOCK: autochat = SESSION.query(ChatbotChats).get(str(chat_id)) if autochat: SESSION.delete(autochat) SESSION.commit()
def rm_afk(user_id): with INSERTION_LOCK: curr = SESSION.query(AFK).get(user_id) if curr: if user_id in AFK_USERS: # sanity check del AFK_USERS[user_id] del AFK_USERSS[user_id] SESSION.delete(curr) SESSION.commit() return True SESSION.close() return False
def rm_url_from_blacklist(chat_id, domain): with URL_BLACKLIST_FILTER_INSERTION_LOCK: domain_filt = SESSION.query(URLBlackListFilters).get( (str(chat_id), domain)) if domain_filt: if domain in CHAT_URL_BLACKLISTS.get(str(chat_id), set()): CHAT_URL_BLACKLISTS.get(str(chat_id), set()).remove(domain) SESSION.delete(domain_filt) SESSION.commit() return True SESSION.close() return False
def rmnsfwatch(chat_id: str): nsfwm = SESSION.query(Nsfwatch).get(str(chat_id)) if nsfwm: SESSION.delete(nsfwm) SESSION.commit()
def rmnightmode(chat_id: str): rmnightmoddy = SESSION.query(Nightmode).get(str(chat_id)) if rmnightmoddy: SESSION.delete(rmnightmoddy) SESSION.commit()
def remove_filter(chat_id, keyword): saved_filter = SESSION.query(Filters).get((str(chat_id), keyword)) if saved_filter: SESSION.delete(saved_filter) SESSION.commit()
def disapprove(chat_id): rem = SESSION.query(forceSubscribe).get(chat_id) if rem: SESSION.delete(rem) SESSION.commit()