Beispiel #1
0
def add_snip(keyword, reply, f_mesg_id):
    to_check = get_snips(keyword)
    if not to_check:
        adder = Note(keyword, reply, f_mesg_id)
        SESSION.add(adder)
        SESSION.commit()
        return True
    rem = SESSION.query(Note).get(keyword)
    SESSION.delete(rem)
    SESSION.commit()
    adder = Note(keyword, reply, f_mesg_id)
    SESSION.add(adder)
    SESSION.commit()
    return False
Beispiel #2
0
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
Beispiel #3
0
def unmute(sender, chat_id):
    rem = SESSION.query(Mute).get((str(sender), str(chat_id)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Beispiel #4
0
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()
Beispiel #5
0
def disapprove(chat_id):
    rem = SESSION.query(PMPermit).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Beispiel #6
0
def rm_welcome_setting(chat_id):
    rem = SESSION.query(Welcome).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Beispiel #7
0
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()
Beispiel #8
0
def ungmute(sender):
    rem = SESSION.query(GMute).get((str(sender)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()