BasicHfBot / bot /__init__.py
understanding's picture
Update bot/__init__.py
2ce10c9 verified
raw
history blame
585 Bytes
from logging import getLogger
from hydrogram import Client
from .config import Telegram
logger = getLogger("bot")
_kwargs = dict(
name="bot",
api_id=Telegram.API_ID,
api_hash=Telegram.API_HASH,
plugins={"root": "bot/plugins"},
sleep_threshold=-1,
max_concurrent_transmissions=10,
)
if Telegram.SESSION_STRING:
_kwargs["session_string"] = Telegram.SESSION_STRING
elif Telegram.BOT_TOKEN:
_kwargs["bot_token"] = Telegram.BOT_TOKEN
else:
raise RuntimeError("Set SESSION_STRING or TELEGRAM_BOT_TOKEN in environment.")
TelegramBot = Client(**_kwargs)