Exemple #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
Exemple #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 BLACKLIST_SQL_.CHAT_BLACKLISTS.get(
                    str(chat_id), set()):  # sanity check
                BLACKLIST_SQL_.CHAT_BLACKLISTS.get(str(chat_id),
                                                   set()).remove(trigger)

            SESSION.delete(blacklist_filt)
            SESSION.commit()
            return True

        SESSION.close()
        return False
Exemple #3
0
def remove_s(user_id, chat_id):
    note = SESSION.query(LydiaAI).get((user_id, chat_id))
    if note:
        SESSION.delete(note)
        SESSION.commit()
Exemple #4
0
def disapprove(chat_id):
    rem = SESSION.query(PMPermit).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Exemple #5
0
def catungban(chat_id):
    rem = SESSION.query(GBan).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Exemple #6
0
def disapprove(chat_id):
    rem = SESSION.query(NOLogPMs).get(chat_id)
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Exemple #7
0
def ungmute(sender):
    rem = SESSION.query(GMute).get((str(sender)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()
Exemple #8
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()
Exemple #9
0
def unmute(sender, chat_id):
    rem = SESSION.query(Mute).get((str(sender), str(chat_id)))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()