wechaty / puppet-xp

Wechaty Puppet WeChat Windows Protocol
http://wechaty.js.org/docs/puppet-providers/xp
Apache License 2.0
471 stars 114 forks source link

[BUG] message.mention.Self() #97

Closed Ran-Xing closed 2 years ago

Ran-Xing commented 2 years ago

[有人@我]的提示 message.mention() ⇒ Promise <Contact []> 版本: wechaty@1.11 wechaty-puppet-xp wechaty/go-wechaty#108

Ran-Xing commented 2 years ago

亲爱的大佬,能看看这个问题吗?

ericcug commented 2 years ago

message.mention() ⇒ Promise <Contact []> The method gets you the message mentioned contactList and returns Promise <Contact []> - > message mentioned contactList.

message.mention.Self() would not work as expected. You could use message.mentionSelf() instead.

Ran-Xing commented 2 years ago

@ericcug There is only mentionSelf() in go-wechaty, which is the problem I mentioned.

ericcug commented 2 years ago

Could you give more details? I'm not get your point.

As I quoted above, message.mention() return a contact list not only a contact. message.mention.self() will not work like that you expected, there is no self() for a contactList.

Both message.mention() and message.mentionSelf() works in TypeScript. Or you should try latest version.

Ran-Xing commented 2 years ago

@ericcug I am using the go-wechaty library, but the author tested the padlocal protocol normally

This is the case, for example

Botname= helloword
UserA: `@helloword` (with spaces here)
or
UserA: `@helloword How are you!` (There is content after the nickname)

Both cases use `message.MentionSelf()`   ,,,,, Result :`message.MentionSelf()== false`
That is, it can't detect someone @ the robot
ericcug commented 2 years ago

I don't know much about golang. mentionSelf is async and don't forget await code in js: let atMe = await message.mentionSelf()

jyxinye commented 2 years ago

你好,系统运营中,添加到新群,报错,是不是因为XP协议,不知道入群,无法更新群列表信息。所以找不到报错。这个暂时不发解决吧

keac commented 2 years ago
if (await message.mentionSelf()) {
 console.log('this message were mentioned me! [You were mentioned] tip ([有人@我]的提示)')
}

有人@我,在有消息时无法正常显示

Ran-Xing commented 2 years ago

@keac 我现在都是login的时候把名字存起来名字切片,哈哈哈