Spaces:
Runtime error
Runtime error
File size: 585 Bytes
f780c8b 2ce10c9 f780c8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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) |