feat: 手机上回复消息,不触发机器人master
@@ -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 | |||
@@ -58,6 +58,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 | |||
@@ -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: | |||