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

没法获取群里有人@我的精确问题 #38

Closed
pkptzx opened this issue Oct 16, 2023 · 5 comments · Fixed by #40
Closed

没法获取群里有人@我的精确问题 #38

pkptzx opened this issue Oct 16, 2023 · 5 comments · Fixed by #40

Comments

@pkptzx
Copy link

pkptzx commented Oct 16, 2023

在微信中@人和内容之间的空白,我之前看的是个空白符(非空格),我以为所有端都一样.
今天发现在macOS PC端居然是空格,其他端都是空白符
这样的话,导致我无法区分是有人@我,还是聊天信息里出现了"@我 "的字符.

我看了wechaty他是有mention信息的(非web接口)
docker-wechatbot-webhook 没有提供这个字段

或有什么好办法?

@danni-cool
Copy link
Owner

我这几天研究下wechaty能否区分的,再给方案

@danni-cool
Copy link
Owner

danni-cool commented Oct 22, 2023

wechaty 原贴讨论:wechaty/wechaty#2247
增加了isMentioned字段,辅助判断消息是否@到我,结论是无法区分。其实从实际场景来说,无论是否真的要@你,系统提不提示,作用都是一样的,所以不需要严格区分

@pkptzx
Copy link
Author

pkptzx commented Oct 22, 2023

wechaty 原贴讨论:wechaty/wechaty#2247 增加了isMentioned字段,辅助判断消息是否@到我,结论是无法区分。其实从实际场景来说,无论是否真的要@你,系统提不提示,作用都是一样的,所以不需要严格区分

有人引用我的时候也会, 有人复制了包含@我 也会. 我自动回复结果这些情况都回复了

@danni-cool
Copy link
Owner

danni-cool commented Oct 23, 2023

@pkptzx 出现了@你的确实没法区分,正如我贴的wechaty的源码,是不区分的

我理解的是引用回复也是 @提到你的一部分,我建议对于引用回复,手动用正则去匹配内容做区分,以下是一个引用体的消息内容, 其正则表达式如下

const regexp = /「[^」]+」 - - - - - - - - - - - - - -/
const isQuoteMsg =  regexp.test("「lccc:@C qqww」 - - - - - - - - - - - - - - - 你好")

这次加了isMentioned 字段其实大部分和 @yourname 的功能一样,也能通过自己编程去做到。但是我实际测试下来可以标记四个场景

  • @你的昵称
  • @群里自己改的备注名
  • @你给对方的备注名(最终其实会变成昵称@)
  • 手动复制的@你

@hungryTechBoy
Copy link

@pkptzx 出现了@你的确实没法区分,正如我贴的wechaty的源码,是不区分的

我理解的是引用回复也是 @提到你的一部分,我建议对于引用回复,手动用正则去匹配内容做区分,以下是一个引用体的消息内容, 其正则表达式如下

const regexp = /「[^」]+」 - - - - - - - - - - - - - -/
const isQuoteMsg =  regexp.test("「lccc:@C qqww」 - - - - - - - - - - - - - - - 你好")

这次加了isMentioned 字段其实大部分和 @yourname 的功能一样,也能通过自己编程去做到。但是我实际测试下来可以标记四个场景

  • @你的昵称
  • @群里自己改的备注名
  • @你给对方的备注名(最终其实会变成昵称@)
  • 手动复制的@你

@danni-cool 想请教下为什么我调用时候isMentioned这个字段始终返回0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants