Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当 set_auto_reply() 列表含有置顶聊天时,check_new_msg() 会重复发送回复消息 #34

Closed
T-K-233 opened this issue Nov 28, 2023 · 3 comments

Comments

@T-K-233
Copy link
Contributor

T-K-233 commented Nov 28, 2023

之前的 thread 请见 #33

问题复现:

使用 commit 588f9fc,运行这条示例代码,假设聊天界面有 [A, B, C] 三个聊天,设 auto_reply_names = [A],如果 A 位于当前聊天窗口的第一条,代码会重复发送回复消息

(更简单的复现方法是只设定 A 为置顶聊天)

这似乎是逻辑上的 bug,如果 auto_reply_names = [A],check_new_msg() 里面的 first_name 和 last_name 都会等于 A,这时双击聊天按键,第一条显示的还是 A,不论 A 是否有新消息,if item.Name in self.auto_reply_contacts 这条就都会被判中,发送回复消息。

一个临时的 workaround 是置顶一个不在 auto_reply_names 列表里的聊天窗口,这样双击聊天返回最上方时就能确保不会读到列表里面的项

@LTEnjoy
Copy link
Owner

LTEnjoy commented Nov 28, 2023

你好,我这边似乎并没有出现这个问题?当A处在自动回复的列表中时,如果程序检测到A发送了新消息,就会进入到A的聊天窗口发送消息。此时A的新消息已经被点击消失,当再次双击聊天按钮时,应该已经跳转到了下一个有新消息的用户了?

@T-K-233
Copy link
Contributor Author

T-K-233 commented Nov 28, 2023

我这边的初始条件是列表里面都没有收到新消息,双击聊天按钮时微信会执行默认动作,移动到消息列表最顶端(在这个情况下就是没有变化),Python 这边就会重复读到 A 的值,并判定为又有新消息

@LTEnjoy
Copy link
Owner

LTEnjoy commented Nov 28, 2023

我重新修改了检查新消息的判断逻辑,你可以重新clone一下或者复制check_new_msg的函数再试一下。这次应该是没问题了。

@LTEnjoy LTEnjoy closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants