-
Notifications
You must be signed in to change notification settings - Fork 0
/
delay_bot.py
70 lines (57 loc) · 1.84 KB
/
delay_bot.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
from bot.bot import Bot
from bot.filter import Filter
from bot.handler import (BotButtonCommandHandler, DefaultHandler,
HelpCommandHandler, MessageHandler,
StartCommandHandler)
import config
from server import (but_deletepost, but_deletepublic, but_post, but_public,
but_queuepublic, delete_public, main_message, queue_posts,
setpublic_cm, settime_cm, add_post)
bot = Bot(token=config.MAIN_TOKEN)
bot.dispatcher.add_handler(StartCommandHandler(
callback=main_message
))
bot.dispatcher.add_handler(HelpCommandHandler(
callback=main_message
))
bot.dispatcher.add_handler(MessageHandler(
callback=setpublic_cm,
filters=Filter.regexp(r'^\/setpublic')
))
bot.dispatcher.add_handler(MessageHandler(
callback=settime_cm,
filters=Filter.regexp(r'^\/settime')
))
bot.dispatcher.add_handler(MessageHandler(
callback=delete_public,
filters=Filter.regexp(r'^\/delete')
))
bot.dispatcher.add_handler(MessageHandler(
callback=queue_posts,
filters=Filter.regexp(r'^\/queue')
))
bot.dispatcher.add_handler(DefaultHandler(
callback=add_post
))
bot.dispatcher.add_handler(BotButtonCommandHandler(
callback=but_public,
filters=Filter.callback_data_regexp(r'public')
))
bot.dispatcher.add_handler(BotButtonCommandHandler(
callback=but_post,
filters=Filter.callback_data_regexp(r'post')
))
bot.dispatcher.add_handler(BotButtonCommandHandler(
callback=but_deletepublic,
filters=Filter.callback_data_regexp(r'deletepublic')
))
bot.dispatcher.add_handler(BotButtonCommandHandler(
callback=but_deletepost,
filters=Filter.callback_data_regexp(r'deletepost')
))
bot.dispatcher.add_handler(BotButtonCommandHandler(
callback=but_queuepublic,
filters=Filter.callback_data_regexp(r'queuepublic')
))
bot.start_polling()
bot.idle()