forked from AmiyaBot/Amiya-Bot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathamiya.py
51 lines (38 loc) · 1.54 KB
/
amiya.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
from core import AmiyaBot, Message
from core.util import log
from core.util.common import TimeRecorder
#from console.server.app import Console
from handlers.functions.mole.bili.biliTask import biliTask
from handlers.handleEvents import EventHandlers
from handlers.handleMessage import Handlers
from handlers.automaticEvents import AutomaticEvents
from handlers.functions.user.activereply import ActiveReply
class Main(AmiyaBot):
def __init__(self):
tr = TimeRecorder()
log.info(f'starting AmiyaBot...')
super().__init__()
self.automaticEvents = AutomaticEvents(self)
self.eventsHandlers = EventHandlers(self)
self.handlers = Handlers(self)
#self.console = Console(self)
self.activereply = ActiveReply(self)
self.bili = biliTask(self) # live room task
log.info(f'AmiyaBot ready to connect, starting used {tr.rec()} sec.')
def message_filter(self, data: Message):
return self.handlers.message_filter(data)
def on_private_message(self, data: Message):
if data.is_admin:
return self.handlers.reply_private_message(data)
def on_group_message(self, data: Message):
return self.handlers.reply_group_message(data)
def on_event(self, data: Message):
self.eventsHandlers.event_handler(data)
def loop_events(self, times):
self.automaticEvents.exec_all_tasks(times)
if __name__ == '__main__':
amiya = Main()
amiya.client_start()
amiya.bili.start()
amiya.activereply.start()
#amiya.console.start()