Esempio n. 1
0
async def set_language_inline_query(bot: Amime, inline_query: InlineQuery):
    user = inline_query.from_user
    if not user:
        return
    lang = inline_query._lang
    code: str = ""
    user_code = user.language_code or "en"
    if "." in user_code:
        user_code = user_code.split(".")[0]
    if user_code not in lang.strings.keys():
        user_code = "en"

    code = (await Users.get_or_create(
        {
            "name": user.first_name,
            "username": user.username or "",
            "language_bot": user_code,
            "language_anime": user_code,
            "is_collaborator": False,
        },
        id=user.id,
    ))[0].language_bot
    inline_query._lang = lang.get_language(code)
Esempio n. 2
0
async def deflang(c: Client, iq: InlineQuery):
    iq._lang = langs.get_language(os.getenv("LANGUAGE"))