python_study-project/main.py

40 lines
1.2 KiB
Python

import logging
from logging import Logger
from src.utils import logging_configuration
from src.integrations.gigachat_api_client import GigaChatClient
from src.integrations.google_translate_client import GoogleTranslateClient
from src.bot.telegram_userbot import TelegramUserBot
from src.core.configuration import config
def main() -> None:
"""
Entry point for starting the Telegram user bot.
"""
# Configure logging
logging_configuration.setup_logging()
logger: Logger = logging.getLogger(__name__)
# Load API credentials and configuration
api_id: str = config.API_ID
api_hash: str = config.API_HASH
api_token: str = config.API_GIGACHAT_TOKEN
# Initialize services
gigachat_client: GigaChatClient = GigaChatClient(api_token=api_token)
translate_client: GoogleTranslateClient = GoogleTranslateClient(logger)
# Initialize and run the Telegram user bot
bot: TelegramUserBot = TelegramUserBot(
session_name="userbot",
api_id=api_id,
api_hash=api_hash,
gigachat_client=gigachat_client,
translate_client=translate_client
)
bot.run()
if __name__ == "__main__":
main()