-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
24 lines (22 loc) · 986 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from telegram.ext import Application
from telegram.ext import CommandHandler
from telegram.ext import filters
from telegram.ext import MessageHandler
from telegram.ext import PicklePersistence
from commands.maintenance import maintenance
from configurations import settings
from configurations.settings import IS_MAINTENANCE
from utils import logger
if __name__ == "__main__":
logger.init_logger(f"logs/{settings.NAME}.log")
persistence = PicklePersistence(filepath="conversation states")
application = (Application.builder().token(
settings.TOKEN).read_timeout(50).write_timeout(
50).get_updates_read_timeout(50).persistence(persistence).build())
if IS_MAINTENANCE:
application.add_handler(CommandHandler("start", maintenance))
application.add_handler(
MessageHandler(filters.TEXT & ~filters.COMMAND, maintenance))
else:
"""YOUR COMMANDS IS HERE WHEN BOT IS NOT MAINTENANCE"""
application.run_polling()