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