This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandler.py
82 lines (73 loc) · 1.8 KB
/
handler.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
get some handler
"""
import logging
from command import (start, run, add_admin, clearwarns, get_id, admins, get_groups, link, stop, info,
globalban, unglobalban, globalban_list, maxwarns, settimeflood, setflood, settings,
banword, unbanword, banwords, save, lang, save_data, kick, lock, unlock, autolock,
cancel, lockstart, lockstop, setmaxmessage, timer, deletetimer,
listtimer, unautolock, ping)
from telegram.ext import ConversationHandler, RegexHandler, MessageHandler
from message import common_message_handler, telegram_link_handler, limit_set, new_member
from constant import SETTING_RE, RunState
set_handler = RegexHandler(callback=limit_set, pattern=SETTING_RE, pass_chat_data=True, pass_groups=True)
command_handler = [
start,
add_admin,
get_id,
admins,
get_groups,
info,
globalban_list,
globalban,
unglobalban,
stop,
run,
save,
link,
maxwarns,
banword,
unbanword,
setflood,
settings,
settimeflood,
setmaxmessage,
banwords,
lang,
clearwarns,
kick,
lock,
unlock,
timer,
unautolock,
deletetimer,
listtimer,
ping
]
message_handler = [
set_handler,
telegram_link_handler,
new_member,
common_message_handler,
]
auto_lock_handler = ConversationHandler(
entry_points=[autolock],
states={
RunState.START_TIME: [
lockstart
],
RunState.STOP_TIME: [
lockstop
]
},
fallbacks=[cancel]
)
def stop_handler(_, __):
pass
# save_data()
def error_handler(bot, update, error):
if update:
bot.send_message(chat_id=update.message.chat_id, text="a error")
logging.error(error)