Skip to content

Commit 8c48a27

Browse files
committed
Merge branch 'master' of https://github.com/zhayujie/chatgpt-on-wechat into master-dev
2 parents 4278d2b + 3a3affd commit 8c48a27

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

channel/wechatmp/receive.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def __init__(self, xmlData):
1919
self.from_user_id = xmlData.find('FromUserName').text
2020
self.create_time = xmlData.find('CreateTime').text
2121
self.msg_type = xmlData.find('MsgType').text
22-
if self.msg_type != 'event':
22+
try:
2323
self.msg_id = xmlData.find('MsgId').text
24-
else:
25-
self.msg_id = self.create_time
24+
except:
25+
self.msg_id = self.from_user_id+self.create_time
2626
self.is_group = False
2727

2828
# reply to other_user_id
@@ -39,7 +39,7 @@ def __init__(self, xmlData):
3939
self.pic_url = xmlData.find('PicUrl').text
4040
self.media_id = xmlData.find('MediaId').text
4141
elif self.msg_type == 'event':
42-
self.event = xmlData.find('Event').text
42+
self.content = xmlData.find('Event').text
4343
else: # video, shortvideo, location, link
4444
# not implemented
4545
pass

channel/wechatmp/wechatmp_channel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def POST(self):
150150
channel.query2[cache_key] = False
151151
channel.query3[cache_key] = False
152152
# Request again
153-
elif cache_key in channel.running:
153+
elif cache_key in channel.running and channel.query1.get(cache_key) == True and channel.query2.get(cache_key) == True and channel.query3.get(cache_key) == True:
154154
channel.query1[cache_key] = False #To improve waiting experience, this can be set to True.
155155
channel.query2[cache_key] = False #To improve waiting experience, this can be set to True.
156156
channel.query3[cache_key] = False
@@ -231,7 +231,7 @@ def POST(self):
231231
return replyPost
232232

233233
elif wechat_msg.msg_type == 'event':
234-
logger.info("[wechatmp] Event {} from {}".format(wechat_msg.Event, wechat_msg.from_user_id))
234+
logger.info("[wechatmp] Event {} from {}".format(wechat_msg.content, wechat_msg.from_user_id))
235235
trigger_prefix = conf().get('single_chat_prefix',[''])[0]
236236
content = textwrap.dedent(f"""\
237237
感谢您的关注!

0 commit comments

Comments
 (0)