Bläddra i källkod

feat: 手机上回复消息,不触发机器人

develop
SSMario 1 år sedan
förälder
incheckning
44cb54a9ea
3 ändrade filer med 6 tillägg och 0 borttagningar
  1. +1
    -0
      channel/chat_message.py
  2. +3
    -0
      channel/wechat/wechat_channel.py
  3. +2
    -0
      channel/wechat/wechat_message.py

+ 1
- 0
channel/chat_message.py Visa fil

@@ -48,6 +48,7 @@ class ChatMessage(object):
to_user_nickname = None
other_user_id = None
other_user_nickname = None
my_msg = False

is_group = False
is_at = False


+ 3
- 0
channel/wechat/wechat_channel.py Visa fil

@@ -59,6 +59,9 @@ def _check(func):
if conf().get("hot_reload") == True and int(create_time) < int(time.time()) - 60: # 跳过1分钟前的历史消息
logger.debug("[WX]history message {} skipped".format(msgId))
return
if cmsg.my_msg:
logger.debug("[WX]my message {} skipped".format(msgId))
return
return func(self, cmsg)

return wrapper


+ 2
- 0
channel/wechat/wechat_message.py Visa fil

@@ -58,6 +58,8 @@ class WechatMessage(ChatMessage):
if self.to_user_id == user_id:
self.to_user_nickname = nickname
try: # 陌生人时候, 'User'字段可能不存在
self.my_msg = itchat_msg["ToUserName"] == itchat_msg["User"]["UserName"] and \
itchat_msg["ToUserName"] != itchat_msg["FromUserName"]
self.other_user_id = itchat_msg["User"]["UserName"]
self.other_user_nickname = itchat_msg["User"]["NickName"]
if self.other_user_id == self.from_user_id:


Laddar…
Avbryt
Spara