forked from xubai2001/telegram-pm-chat-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (33 loc) · 929 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from telegram.ext import (
filters,
MessageHandler,
ApplicationBuilder,
CommandHandler,
)
from utils import *
from handlers import *
def main():
app = (
ApplicationBuilder()
.token(CONFIG["Token"])
.post_init(check_config)
.post_stop(save_all_config)
.build()
)
handlers = [
CommandHandler('start', start),
CommandHandler('ping', ping),
CommandHandler("ban", ban),
CommandHandler("unban", unban),
CommandHandler("info", info),
CommandHandler("setadmin", setadmin),
CommandHandler("add", add),
CommandHandler("delete", delete),
MessageHandler(filters.COMMAND, unknown_command),
MessageHandler(~filters.COMMAND, process_msg)
]
for handler in handlers:
app.add_handler(handler)
app.run_polling()
if "__main__" == __name__:
main()