def get_all_nibba(): nibbaid = SESSION.query(Blockedid).all() SESSION.close() return nibbaid
def removenibba(chat_id): nibbanoob = SESSION.query(Blockedid).get(str(chat_id)) if nibbanoob: SESSION.delete(nibbanoob) SESSION.commit()
def delgvar(variable): rem = (SESSION.query(Globals).filter( Globals.variable == str(variable)).delete(synchronize_session="fetch")) if rem: SESSION.commit()
def get_all_approved(): rem = SESSION.query(PMPermit).all() SESSION.close() return rem
def get_all_channels(): rem = SESSION.query(ghdb).all() SESSION.close() return rem
def del_flist(chat_id): rem = SESSION.query(Fban).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def disapprove(chat_id): rem = SESSION.query(NOLogPMs).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 rm_note(chat_id, keyword): note = SESSION.query(Notes).filter(Notes.chat_id == str(chat_id), Notes.keyword == keyword) if note: note.delete() SESSION.commit()
def rm_all_notes(chat_id): notes = SESSION.query(Notes).filter(Notes.chat_id == str(chat_id)) if notes: notes.delete() SESSION.commit()
def get_notes(chat_id): try: return SESSION.query(Notes).filter(Notes.chat_id == str(chat_id)).all() finally: SESSION.close()
def get_locks(chat_id): try: return SESSION.query(Locks).get(str(chat_id)) finally: SESSION.close()
def remove_snip(keyword): note = SESSION.query(Snips).filter(Snips.snip == keyword) if note: note.delete() SESSION.commit()
def rm_welcome_setting(chat_id): rem = SESSION.query(Welcome).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def get_all_users(): stark = SESSION.query(Moidata).all() SESSION.close() return stark
def update_previous_welcome(chat_id, previous_welcome): row = SESSION.query(Welcome).get(chat_id) row.previous_welcome = previous_welcome # commit the changes to the DB SESSION.commit()
def updateprevious_wafu(chat_id, previous_wafu): row = SESSION.query(Joinwafu).get(str(chat_id)) row.previous_wafu = previous_wafu SESSION.commit()
def rm_channel(chat_id): rem = SESSION.query(ghdb).get(str(chat_id)) if rem: SESSION.delete(rem) SESSION.commit()
def getwafu(chat_id): try: return SESSION.query(Joinwafu).get(str(chat_id)) finally: SESSION.close()
def get_flist(): try: return SESSION.query(Fban).all() finally: SESSION.close()
def disapprove(chat_id): rem = SESSION.query(PMPermit).get(str(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 remove_echo(user_id, chat_id): note = SESSION.query(ECHOSQL).get((str(user_id), str(chat_id))) if note: SESSION.delete(note) SESSION.commit()