-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
60 lines (50 loc) · 1.24 KB
/
init.py
File metadata and controls
60 lines (50 loc) · 1.24 KB
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
"""
初始化聊天机器人模块
"""
from wxpy import *
import wrshell
import broadcast
import constant
import auto_reply
import time
import os
bot = Bot(cache_path=True, console_qr=True)
bot.enable_puid()
constant.bot = bot
@bot.register(bot.file_helper, TEXT, except_self=False)
def file_helper_shell(msg):
"""
接收发往文件助手的消息,判断是否为指令
:param msg: 发往文件助手的消息
:return: 无
"""
print(msg)
if msg.receiver != bot.file_helper:
return
wrshell.inner_func(msg.text)
@bot.register(Friend, TEXT)
def friend_reply(msg):
"""
接收活动列表好友消息,自动回复
:param msg: 好友的消息
:return: 无
"""
print(msg)
if msg.sender.puid not in constant.contact_friend_list.keys():
return
return auto_reply.auto_reply(msg)
@bot.register(Group, TEXT)
def group_reply(msg):
"""
接收活动列表群组的消息,自动回复
:param msg: 群组消息
:return: 无
"""
if msg.sender.puid not in constant.contact_group_list.keys():
return
if not msg.is_at:
return
return auto_reply.auto_reply(msg)
# TODO 添加对外接口,可以传入自己函数和相应指令
embed()
#bot.join()