Бот + прокси
This commit is contained in:
12
bot/factory.py
Normal file
12
bot/factory.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from aiogram import Bot, Dispatcher
|
||||
from aiogram.client.session.aiohttp import AiohttpSession
|
||||
|
||||
|
||||
bot: Bot = None # type: ignore
|
||||
dp: Dispatcher = None
|
||||
|
||||
def init_bot_and_dp(proxy_url: str, token: str):
|
||||
global bot, dp
|
||||
bot = Bot(token=token, session=AiohttpSession(proxy=proxy_url) if proxy_url else None)
|
||||
dp = Dispatcher()
|
||||
return bot, dp
|
||||
Reference in New Issue
Block a user