# -*- coding: utf-8 -*-

import logging

from libbot import json_read
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import Message

from modules.utils import string, userSet

logger = logging.getLogger(__name__)


@Client.on_message(
    ~filters.scheduled
    & filters.command(["start", "help", "допомога"], prefixes=["/", ""])  # type: ignore
)
async def command_help(app: Client, msg: Message):
    await msg.reply_text((await string("welcome")).format(await string("get_number")))
    if msg.from_user.language_code in await json_read("strings.json"):
        userSet(msg.from_user.id, "locale", msg.from_user.language_code)
    else:
        userSet(msg.from_user.id, "locale", "en")
