init commit
This commit is contained in:
36
.history/app/bot_main_20251210215926.py
Normal file
36
.history/app/bot_main_20251210215926.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Telegram Bot Entry Point
|
||||
Runs the bot polling service
|
||||
"""
|
||||
import asyncio
|
||||
import logging
|
||||
from app.bot.client import TelegramBotClient
|
||||
from app.core.config import settings
|
||||
import redis
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def main():
|
||||
"""Start Telegram bot"""
|
||||
try:
|
||||
redis_client = redis.from_url(settings.redis_url)
|
||||
|
||||
bot = TelegramBotClient(
|
||||
bot_token=settings.bot_token,
|
||||
api_base_url="http://web:8000",
|
||||
redis_client=redis_client
|
||||
)
|
||||
|
||||
logger.info("Starting Telegram bot...")
|
||||
await bot.start()
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Bot error: {e}", exc_info=True)
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user