Пример #1
0
def get_name_by_userid(user_id):
    try:
        return SESSION.query(Users).get(Users.user_id == int(user_id)).first()
    finally:
        SESSION.close()
Пример #2
0
def get_connected_chat(user_id):
    try:
        return SESSION.query(Connection).get((int(user_id)))
    finally:
        SESSION.close()
Пример #3
0
def get_userid_by_name(username):
    try:
        return SESSION.query(Users).filter(
            func.lower(Users.username) == username.lower()).all()
    finally:
        SESSION.close()
Пример #4
0
def get_locks(chat_id):
    try:
        return SESSION.query(Permissions).get(str(chat_id))
    finally:
        SESSION.close()
Пример #5
0
def curr_connection(chat_id):
    try:
        return SESSION.query(Connection).get((str(chat_id)))
    finally:
        SESSION.close()
Пример #6
0
def get_all_users():
    try:
        return SESSION.query(Users).all()
    finally:
        SESSION.close()
Пример #7
0
def num_chats():
    try:
        return SESSION.query(Chats).count()
    finally:
        SESSION.close()
Пример #8
0
def num_filters():
    try:
        return SESSION.query(CustomFilters).count()
    finally:
        SESSION.close()
Пример #9
0
def get_warn_filter(chat_id, keyword):
    try:
        return SESSION.query(WarnFilters).get((str(chat_id), keyword))
    finally:
        SESSION.close()
Пример #10
0
def num_chats():
    try:
        return SESSION.query(func.count(distinct(
            CustomFilters.chat_id))).scalar()
    finally:
        SESSION.close()
Пример #11
0
def get_all_filters():
    try:
        return SESSION.query(CustomFilters).all()
    finally:
        SESSION.close()
Пример #12
0
def num_logchannels():
    try:
        return SESSION.query(func.count(distinct(GroupLogs.chat_id))).scalar()
    finally:
        SESSION.close()
Пример #13
0
def num_notes():
    try:
        return SESSION.query(Notes).count()
    finally:
        SESSION.close()
Пример #14
0
def get_restr(chat_id):
    try:
        return SESSION.query(Restrictions).get(str(chat_id))
    finally:
        SESSION.close()
Пример #15
0
def get_chat_members(chat_id):
    try:
        return SESSION.query(ChatMembers).filter(
            ChatMembers.chat == str(chat_id)).all()
    finally:
        SESSION.close()
Пример #16
0
def num_warns():
    try:
        return SESSION.query(func.sum(Warns.num_warns)).scalar() or 0
    finally:
        SESSION.close()
Пример #17
0
def get_all_chats():
    try:
        return SESSION.query(Chats).all()
    finally:
        SESSION.close()
Пример #18
0
def num_warn_chats():
    try:
        return SESSION.query(func.count(distinct(Warns.chat_id))).scalar()
    finally:
        SESSION.close()
Пример #19
0
def get_user_num_chats(user_id):
    try:
        return SESSION.query(ChatMembers).filter(
            ChatMembers.user == int(user_id)).count()
    finally:
        SESSION.close()
Пример #20
0
def num_warn_filters():
    try:
        return SESSION.query(WarnFilters).count()
    finally:
        SESSION.close()
Пример #21
0
def num_users():
    try:
        return SESSION.query(Users).count()
    finally:
        SESSION.close()
Пример #22
0
def num_disabled():
    try:
        return SESSION.query(Disable).count()
    finally:
        SESSION.close()