예제 #1
0
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
예제 #2
0
def remove_warn_filter(chat_id, keyword):
    with WARN_FILTER_INSERTION_LOCK:
        warn_filt = SESSION.query(WarnFilters).get((str(chat_id), keyword))
        if warn_filt:
            if keyword in WARN_FILTERS.get(str(chat_id), []):  # sanity check
                WARN_FILTERS.get(str(chat_id), []).remove(keyword)

            SESSION.delete(warn_filt)
            SESSION.commit()
            return True
        SESSION.close()
        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 rm_tracker(amazon_url: str):
    warner = SESSION.query(Anp).get(str(amazon_url))
    if warner:
        SESSION.delete(warner)
        SESSION.commit()
def unglobelmute(sender):
    rem = SESSION.query(GLOBELMute).get((str(sender)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
예제 #6
0
def rm_welcome_setting(chat_id):
    rem = SESSION.query(Welcome).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
예제 #7
0
def rmfed(feds):
    rmfeddy = SESSION.query(Fed).get(feds)
    if rmfeddy:
        SESSION.delete(rmfeddy)
        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(PMPermit).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
예제 #10
0
def unmute(sender, chat_id):
    rem = SESSION.query(Mute).get((str(sender), str(chat_id)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
예제 #11
0
def remove_dataz(chat_id):
    lul = SESSION.query(Pa).get(str(chat_id))
    if lul:
        SESSION.delete(lul)
        SESSION.commit()
def remove_datas(chat_id):
    sed = SESSION.query(Cst).get(str(chat_id))
    if sed:
        SESSION.delete(sed)
        SESSION.commit()
예제 #13
0
def rmping(url):
    rmpinger = SESSION.query(Serverpinger).get(url)
    if rmpinger:
        SESSION.delete(rmpinger)
        SESSION.commit()
예제 #14
0
def rmnightmode(chat_id: str):
    rmnightmoddy = SESSION.query(Nightmode).get(str(chat_id))
    if rmnightmoddy:
        SESSION.delete(rmnightmoddy)
        SESSION.commit()
예제 #15
0
def ungban_user(user_id):
    ungbanner = SESSION.query(Gban).get(str(user_id))
    if ungbanner:
        SESSION.delete(ungbanner)
        SESSION.commit()
예제 #16
0
def rmnsfwatch(chat_id: str):
    nsfwm = SESSION.query(Nsfwatch).get(str(chat_id))
    if nsfwm:
        SESSION.delete(nsfwm)
        SESSION.commit()