Esempio n. 1
0
def antiubot_list(chat_id):
    try:
        return SESSION.query(AntiUbot).filter(
            AntiUbot.chat_id == str(chat_id)).order_by(
                AntiUbot.command.asc()).all()
    finally:
        SESSION.close()
Esempio n. 2
0
def filter_list(chat_id):
    try:
        return SESSION.query(Filters).filter(
            Filters.chat_id == str(chat_id)).order_by(
                Filters.name.asc()).all()
    finally:
        SESSION.close()
Esempio n. 3
0
def get_disabled(chat_id):
    try:
        return SESSION.query(DisableAble).filter(
            DisableAble.chat_id == str(chat_id)).order_by(
                DisableAble.command.asc()).all()
    finally:
        SESSION.close()
Esempio n. 4
0
def add_to_gmute(user_id,reason):
	with CHAT_INSERTION_LOCK:
		prev = SESSION.query(Gmute).get(user_id)
		if prev:
			SESSION.delete(prev)
			SESSION.commit()

		gban_filt = Gmute(user_id,reason)
		SESSION.merge(gban_filt)
		SESSION.commit()
Esempio n. 5
0
def add_to_sudo(user_id):
	with SUDO_INSERTION_LOCK:
		prev = SESSION.query(Sudo).get(user_id)
		if prev:
			SESSION.delete(prev)
			SESSION.commit()

		gban_filt = Sudo(user_id)
		SESSION.merge(gban_filt)
		SESSION.commit()
Esempio n. 6
0
def add_to_antiubot(chat_id, command, mode, time):
    with ANTIUBOT_INSERTION_LOCK:
        prev = SESSION.query(AntiUbot).get((str(chat_id), command))
        if prev:
            SESSION.delete(prev)
            SESSION.commit()

        antiubot_filt = AntiUbot(chat_id, command, mode, time)

        SESSION.merge(antiubot_filt)
        SESSION.commit()
Esempio n. 7
0
def add_to_blacklist(chat_id,trigger,mode,time):
	with BLACKLIST_INSERTION_LOCK:
		prev = SESSION.query(Blacklist).get((str(chat_id), trigger))
		if prev:
			SESSION.delete(prev)
			SESSION.commit()

		blacklist_filt = Blacklist(chat_id,trigger,mode,time)

		SESSION.merge(blacklist_filt)
		SESSION.commit()
Esempio n. 8
0
def rm_from_gban(user_id):
	with CHAT_INSERTION_LOCK:
		curr = SESSION.query(Gmute).get(user_id)
		if curr:
			SESSION.delete(curr)
			SESSION.commit()
			return True

		else:
			SESSION.close()
			return False
Esempio n. 9
0
def rm_from_antiubot(chat_id, command):
    with ANTIUBOT_INSERTION_LOCK:
        curr = SESSION.query(AntiUbot).get((str(chat_id), command))
        if curr:
            SESSION.delete(curr)
            SESSION.commit()
            return True

        else:
            SESSION.close()
            return False
Esempio n. 10
0
def rm_from_blacklist(chat_id,trigger):
	with BLACKLIST_INSERTION_LOCK:
		curr = SESSION.query(Blacklist).get((str(chat_id), trigger))
		if curr:
			SESSION.delete(curr)
			SESSION.commit()
			return True

		else:
			SESSION.close()
			return False
Esempio n. 11
0
def rm_from_sudo(user_id):
	with SUDO_INSERTION_LOCK:
		curr = SESSION.query(Sudo).get(user_id)
		if curr:
			SESSION.delete(curr)
			SESSION.commit()
			return True

		else:
			SESSION.close()
			return False
Esempio n. 12
0
def rm_from_disableable(chat_id, command):
    with DISABLEABLE_INSERTION_LOCK:
        curr = SESSION.query(DisableAble).get((str(chat_id), command))
        if curr:
            SESSION.delete(curr)
            SESSION.commit()
            return True

        else:
            SESSION.close()
            return False
Esempio n. 13
0
def rm_from_filter(chat_id, name):
    with FILTERS_INSERTION_LOCK:
        curr = SESSION.query(Filters).get((str(chat_id), name))
        if curr:
            SESSION.delete(curr)
            SESSION.commit()
            return True

        else:
            SESSION.close()
            return False
Esempio n. 14
0
def add_to_filter(chat_id, name, value, document, filter_type, document_type):
    with FILTERS_INSERTION_LOCK:
        prev = SESSION.query(Filters).get((str(chat_id), name))
        if prev:
            SESSION.delete(prev)
            SESSION.commit()

        filter_filt = Filters(chat_id, name, value, document, filter_type,
                              document_type)

        SESSION.merge(filter_filt)
        SESSION.commit()
Esempio n. 15
0
def check_gban(user_id):
	try:
		return SESSION.query(Gban).get(user_id)
	finally:
		SESSION.close()
Esempio n. 16
0
def get_chatlist():
	try:
		return SESSION.query(Chat).all()
	finally:
		SESSION.close()
Esempio n. 17
0
def check_chatlist(chat_id):
	try:
		return SESSION.query(Chat).get(str(chat_id))
	finally:
		SESSION.close()
Esempio n. 18
0
def check_gmute(user_id):
	try:
		return SESSION.query(Gmute).get(user_id)
	finally:
		SESSION.close()
Esempio n. 19
0
def sudo_list():
	try:
		return SESSION.query(Sudo).all()
	finally:
		SESSION.close()
Esempio n. 20
0
def check_antiubot(chat_id, command):
    try:
        return SESSION.query(AntiUbot).get((str(chat_id), command))
    finally:
        SESSION.close()
Esempio n. 21
0
def check_disableable(chat_id, command):
    try:
        return SESSION.query(DisableAble).get((str(chat_id), command))
    finally:
        SESSION.close()
Esempio n. 22
0
def blacklist_list(chat_id):
	try:
		return SESSION.query(Blacklist).filter(Blacklist.chat_id == str(chat_id)).order_by(Blacklist.trigger.asc()).all()
	finally:
		SESSION.close()