37 lines
863 B
Python
Executable File
37 lines
863 B
Python
Executable File
import os
|
|
import asyncio
|
|
import logging
|
|
import sys
|
|
|
|
|
|
from aiogram import Bot, Dispatcher
|
|
from aiogram.enums import ParseMode
|
|
from aiogram.client.default import DefaultBotProperties
|
|
from aiogram.client.session.aiohttp import AiohttpSession
|
|
|
|
from handlers import register_all_handlers
|
|
from config import config
|
|
|
|
# BOT_TOKEN = config["BOT_TOKEN"]
|
|
BOT_TOKEN=os.environ.get('BOT_TOKEN')
|
|
|
|
dp = Dispatcher()
|
|
register_all_handlers(dp)
|
|
|
|
PROXY_URL = os.environ.get('PROXY_URL')
|
|
|
|
session = AiohttpSession(proxy=PROXY_URL)
|
|
|
|
async def main() -> None:
|
|
bot = Bot(
|
|
token=BOT_TOKEN
|
|
, session=session
|
|
, default=DefaultBotProperties(parse_mode=ParseMode.HTML)
|
|
)
|
|
await dp.start_polling(bot)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
|
asyncio.run(main())
|