def rm_wafu_setting(chat_id): try: rem = SESSION.query(Joinwafu).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit() return True except BaseException: return False
def init_locks(chat_id, reset=False): curr_restr = SESSION.query(Locks).get(str(chat_id)) if reset: SESSION.delete(curr_restr) SESSION.flush() restr = Locks(str(chat_id)) SESSION.add(restr) SESSION.commit() return restr
def addwafu_setting(chat_id, previous_wafu, reply, f_mesg_id): to_check = getwafu(chat_id) if not to_check: adder = Joinwafu(chat_id, previous_wafu, reply, f_mesg_id) SESSION.add(adder) SESSION.commit() return True rem = SESSION.query(Joinwafu).get(str(chat_id)) SESSION.delete(rem) SESSION.commit() adder = Joinwafu(chat_id, previous_wafu, reply, f_mesg_id) SESSION.commit() return False
def rm_from_blacklist(chat_id, trigger): with BLACKLIST_FILTER_INSERTION_LOCK: blacklist_filt = SESSION.query(BlackListFilters).get( (str(chat_id), trigger)) if blacklist_filt: if trigger in CHAT_BLACKLISTS.get(str(chat_id), set()): # sanity check CHAT_BLACKLISTS.get(str(chat_id), set()).remove(trigger) SESSION.delete(blacklist_filt) SESSION.commit() return True SESSION.close() return False
def remove_echo(user_id, chat_id): note = SESSION.query(ECHOSQL).get((str(user_id), str(chat_id))) if note: SESSION.delete(note) 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(NOLogPMs).get(chat_id) if rem: SESSION.delete(rem) SESSION.commit()
def catungban(chat_id): rem = SESSION.query(GBan).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def unmute(sender, chat_id): rem = SESSION.query(Mute).get((str(sender), str(chat_id))) if rem: SESSION.delete(rem) SESSION.commit()
def disapprove(chat_id): rem = SESSION.query(forceSubscribe).get(chat_id) if rem: SESSION.delete(rem) SESSION.commit()
def ungmute(sender): rem = SESSION.query(GMute).get((str(sender))) if rem: SESSION.delete(rem) SESSION.commit()
def disapprove(chat_id): rem = SESSION.query(PMPermit).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def del_flist(chat_id): rem = SESSION.query(Fban).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def rm_welcome_setting(chat_id): rem = SESSION.query(Welcome).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()