def num_blacklist_filters(): try: return SESSION.query(BlackListFilters).count() finally: SESSION.close()
def disapprove(chat_id): rem = SESSION.query(PMPermit).get(str(chat_id)) if rem: SESSION.delete(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 get_locks(chat_id): try: return SESSION.query(Locks).get(str(chat_id)) finally: SESSION.close()
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 rm_channel(chat_id): rem = SESSION.query(ghdb).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()
def ungmute(sender): rem = SESSION.query(GMute).get((str(sender))) if rem: SESSION.delete(rem) SESSION.commit()
def remove_snip(keyword): note = SESSION.query(Snips).filter(Snips.snip == keyword) if note: note.delete() 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 is_muted(sender, chat_id): user = SESSION.query(Mute).get((str(sender), str(chat_id))) if user: return True else: return False