提交 d5685695 编写于 作者: M Miao Luo 提交者: Huan (李卓桓)

add check isMentionMe method (#1532)

* add check isMentionedMe method

*     add check isMentionedMe method

* update method name isMentionMe

* debug isMentionMe Method

* update isMentionMe annotation

* rename isMentionMe to mentionSelf, fix example bug
上级 e648ce5c
......@@ -586,6 +586,21 @@ export class Message extends Accessory implements Sayable {
return this.mention()
}
/**
* Check if a message is mention self.
*
* @returns {Promise<boolean>} - Return `true` for mention me.
* @example
* if (await message.mentionSelf()) {
* console.log('this message were mentioned me! [You were mentioned] tip ([有人@我]的提示)')
* }
*/
public async mentionSelf (): Promise<boolean> {
const selfId = this.puppet.selfId()
const mentionList = await this.mention()
return mentionList.some(contact => contact.id === selfId)
}
/**
* @private
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册