24
24
# (4) chatroomList 群聊列表,每一项为一个Chatroom字典类,包括UserName, NickName, RemarkName, MemberCount, MemberList, Self等
25
25
# (5) mpList 订阅号列表,每一项为一个MassivePlatform字典类,包括UserName, NickName等
26
26
27
- my .global_keys = ["创业" , "算法" , " 人工智能" , "机器学习 " ]
27
+ my .global_keys = ["创业" , "人工智能" , "企业服务 " ]
28
28
my .to_user_name = "filehelper" # 消息接受者
29
29
my .update_time = time .time () # 信息更新时间
30
30
my .msg_store = {} # 消息存储队列
@@ -105,11 +105,6 @@ def process_message_group(msg):
105
105
"""
106
106
处理群消息
107
107
"""
108
- # 消息过滤, 只监测文字、图片、语音、名片、注解、分享等
109
- if msg .we_type not in ["Text" , "Picture" , "Recording" , "Card" , "Note" , "Sharing" ]:
110
- logging .warning ("process_message_group: message type isn't included, ignored" )
111
- return
112
-
113
108
# ==== 处理红包消息 ====
114
109
if msg .we_type == "Note" and msg .we_text .find ("收到红包,请在手机上查看" ) >= 0 :
115
110
my .send ("【%s】中有人发红包啦,快抢!" % msg .wind_name , toUserName = my .to_user_name )
@@ -132,11 +127,6 @@ def process_message_revoke(msg):
132
127
"""
133
128
处理撤回消息
134
129
"""
135
- # 消息过滤, 只监测文字、图片、语音、名片、注解、分享等
136
- if msg .we_type not in ["Text" , "Picture" , "Recording" , "Card" , "Note" , "Sharing" ]:
137
- logging .warning ("process_message_revoke: message type isn't included, ignored" )
138
- return
139
-
140
130
# 消息存储,删除过期消息
141
131
my .msg_store [msg .msg_id ] = msg
142
132
for _id in [_id for _id in my .msg_store if time .time () - my .msg_store [_id ].msg_time > 120 ]:
@@ -187,6 +177,11 @@ def text_reply(msg):
187
177
# 消息提取
188
178
msg = Message (msg )
189
179
180
+ # 消息过滤, 只监测文字、图片、语音、名片、注解、分享等
181
+ if msg .we_type not in ["Text" , "Picture" , "Recording" , "Card" , "Note" , "Sharing" ]:
182
+ logging .warning ("process_message_group: message type isn't included, ignored" )
183
+ return
184
+
190
185
# 处理群消息
191
186
if msg .from_user_name .startswith ("@@" ):
192
187
process_message_group (msg )
0 commit comments