示例#1
0
def already_added(chat_id):
    try:
        return SESSION.query(Moidata).filter(Moidata.chat_id == str(chat_id)).one()
    except:
        return None
    finally:
        SESSION.close()
def in_channels(chat_id):
    try:
        return SESSION.query(fban).filter(fban.chat_id == str(chat_id)).one()
    except BaseException:
        return None
    finally:
        SESSION.close()
示例#3
0
def its_userid(message_id: int):
    """ get the user_id from the message_id """
    try:
        s__ = SESSION.query(Users).get(str(message_id))
        return int(s__.chat_id), s__.um_id
    finally:
        SESSION.close()
示例#4
0
def get_all_snips():
    try:
        return SESSION.query(Snips).all()
    except:
        return None
    finally:
        SESSION.close()
示例#5
0
def get_snips(keyword):
    try:
        return SESSION.query(Snips).get(keyword)
    except:
        return None
    finally:
        SESSION.close()
示例#6
0
def is_id_added(chat_id):
    try:
        return SESSION.query(Blockedid).filter(
            Blockedid.chat_id == str(chat_id)).one()
    except:
        return None
    finally:
        SESSION.close()
示例#7
0
def add_snip(
    keyword, reply, snip_type, media_id, media_access_hash, media_file_reference
):
    adder = SESSION.query(Snips).get(keyword)
    if adder:
        adder.reply = reply
        adder.snip_type = snip_type
        adder.media_id = media_id
        adder.media_access_hash = media_access_hash
        adder.media_file_reference = media_file_reference
    else:
        adder = Snips(
            keyword, reply, snip_type, media_id, media_access_hash, media_file_reference
        )
    SESSION.add(adder)
    SESSION.commit()
示例#8
0
def add_in_db(chat_id: int):
    lodu = Blockedid(str(chat_id))
    SESSION.add(lodu)
    SESSION.commit()
示例#9
0
def get_all_users():
    stark = SESSION.query(Moidata).all()
    SESSION.close()
    return stark
示例#10
0
def add_usersid_in_db(chat_id: int):
    id_user = Moidata(str(chat_id))
    SESSION.add(id_user)
    SESSION.commit()
示例#11
0
def add_id_in_db(message_id: int, chat_id: int, um_id: int):
    """ add the message to the table """
    __user = Users(message_id, str(chat_id), um_id)
    SESSION.add(__user)
    SESSION.commit()
示例#12
0
def removeid(chat_id):
    safai = SESSION.query(Blockedid).get(str(chat_id))
    if safai:
        SESSION.delete(safai)
        SESSION.commit()
示例#13
0
def get_all_nibba():
    eberyone = SESSION.query(Blockedid).all()
    SESSION.close()
    return eberyone
示例#14
0
def add_channel(chat_id):
    adder = fban(str(chat_id))
    SESSION.add(adder)
    SESSION.commit()
示例#15
0
def remove_snip(keyword):
    note = SESSION.query(Snips).filter(Snips.snip == keyword)
    if note:
        note.delete()
        SESSION.commit()
示例#16
0
def get_all_channels():
    rem = SESSION.query(fban).all()
    SESSION.close()
    return rem
示例#17
0
def rm_channel(chat_id):
    rem = SESSION.query(fban).get(str(chat_id))
    if rem:
        SESSION.delete(rem)
        SESSION.commit()