예제 #1
0
def lookup_user_by_telegram_handle(telegram_handle):
    telegram_handle = telegram_handle.lower().replace("@", "")
    session = create_session()
    bot_user = (session.query(User).filter(
        User.telegram_handle == telegram_handle).first())
    session.close()
    return bot_user
예제 #2
0
def lookup_user_by_account_id(account_id):
    account_id = int(account_id)

    session = create_session()
    bot_user = session.query(User).filter(
        User.account_id == account_id).first()
    session.close()
    return bot_user
예제 #3
0
def get_item_by_id(item_id):
    session = create_session()
    output = session.query(Item).filter(Item.id == item_id).first()
    session.close()
    return output
예제 #4
0
def get_item_by_name(item_name):
    session = create_session()
    output = session.query(Item).filter(
        Item.item_name == item_name.lower()).first()
    session.close()
    return output
예제 #5
0
def save_user(user):
    session = create_session()
    session.add(user)
    session.commit()
예제 #6
0
def lookup_user_by_telegram_handle(telegram_handle):
    session = create_session()
    bot_user = (session.query(User).filter(
        User.telegram_handle == telegram_handle).first())
    return bot_user
예제 #7
0
def save_user(user):
    user.telegram_handle = user.telegram_handle.lower()
    session = create_session()
    session.merge(user)
    session.commit()
예제 #8
0
def get_hero_by_name(hero_name):
    session = create_session()
    output = session.query(Hero).filter(
        Hero.localized_name.ilike(hero_name)).first()
    session.close()
    return output
예제 #9
0
def get_hero_aliases_by_hero_id(hero_id):
    session = create_session()
    output = session.query(HeroAlias).filter(
        HeroAlias.hero_id == hero_id).all()
    session.close()
    return output
예제 #10
0
def get_hero_alias_by_name(hero_alias):
    session = create_session()
    output = session.query(HeroAlias).filter(
        HeroAlias.alias.ilike(hero_alias)).first()
    session.close()
    return output
예제 #11
0
def get_hero_by_id(hero_id):
    session = create_session()
    output = session.query(Hero).filter(Hero.id == hero_id).first()
    session.close()
    return output