gitscope
← marzneshin / v0.3.0-alpha8 / app/telegram/__init__.py
https://dev.kronoz.win/r/marzneshin.git
app/telegram/__init__.py · Python
Blame Raw
 1from telebot import asyncio_helper
 2from telebot.async_telebot import AsyncTeleBot
 3
 4from config import TELEGRAM_API_TOKEN, TELEGRAM_PROXY_URL
 5from app.telegram.report import (
 6    report,
 7    report_new_user,
 8    report_user_modification,
 9    report_user_deletion,
10    report_status_change,
11    report_user_usage_reset,
12    report_user_subscription_revoked,
13)
14
15bot = None
16if TELEGRAM_API_TOKEN:
17    asyncio_helper.proxy = TELEGRAM_PROXY_URL
18    bot = AsyncTeleBot(TELEGRAM_API_TOKEN)
19
20
21async def start_bot():
22    if bot:
23        await bot.polling()
24
25
26__all__ = [
27    "bot",
28    "report",
29    "report_new_user",
30    "report_user_modification",
31    "report_user_deletion",
32    "report_status_change",
33    "report_user_usage_reset",
34    "report_user_subscription_revoked",
35]