Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/zhayujie/chatgpt-on-wechat
Browse files Browse the repository at this point in the history
…into master-dev
  • Loading branch information
lanvent committed Apr 7, 2023
2 parents 4278d2b + 3a3affd commit 8c48a27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions channel/wechatmp/receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def __init__(self, xmlData):
self.from_user_id = xmlData.find('FromUserName').text
self.create_time = xmlData.find('CreateTime').text
self.msg_type = xmlData.find('MsgType').text
if self.msg_type != 'event':
try:
self.msg_id = xmlData.find('MsgId').text
else:
self.msg_id = self.create_time
except:
self.msg_id = self.from_user_id+self.create_time
self.is_group = False

# reply to other_user_id
Expand All @@ -39,7 +39,7 @@ def __init__(self, xmlData):
self.pic_url = xmlData.find('PicUrl').text
self.media_id = xmlData.find('MediaId').text
elif self.msg_type == 'event':
self.event = xmlData.find('Event').text
self.content = xmlData.find('Event').text
else: # video, shortvideo, location, link
# not implemented
pass
4 changes: 2 additions & 2 deletions channel/wechatmp/wechatmp_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def POST(self):
channel.query2[cache_key] = False
channel.query3[cache_key] = False
# Request again
elif cache_key in channel.running:
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:
channel.query1[cache_key] = False #To improve waiting experience, this can be set to True.
channel.query2[cache_key] = False #To improve waiting experience, this can be set to True.
channel.query3[cache_key] = False
Expand Down Expand Up @@ -231,7 +231,7 @@ def POST(self):
return replyPost

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

0 comments on commit 8c48a27

Please sign in to comment.