Skip to content

Commit

Permalink
enable mentionIdList (#151)
Browse files Browse the repository at this point in the history
* enable mentionIdList (#141)

* 0.29.6
  • Loading branch information
huan authored Sep 11, 2021
1 parent 9d27b1b commit 517ce87
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-puppet-wechat",
"version": "0.29.5",
"version": "0.29.6",
"description": "Puppet WeChat for Wechaty",
"type": "module",
"exports": {
Expand Down
10 changes: 10 additions & 0 deletions src/puppet-wechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
ImageType,
EventScanPayload,
log,
MessagePayloadRoom,
} from 'wechaty-puppet'

import {
Expand Down Expand Up @@ -101,6 +102,7 @@ import {
WebRoomRawMember,
WebRoomRawPayload,
} from './web-schemas.js'
import { parseMentionIdList } from './pure-function-helpers/parse-mention-id-list.js'

export type ScanFoodType = 'scan' | 'login' | 'logout'

Expand Down Expand Up @@ -383,6 +385,14 @@ export class PuppetWeChat extends Puppet {

const payload = messageRawPayloadParser(rawPayload)

/**
* Huan(202109): generate mention id list
* https://github.com/wechaty/wechaty-puppet-wechat/issues/141
*/
if (payload.roomId && payload.text) {
(payload as MessagePayloadRoom).mentionIdList = await parseMentionIdList(this, payload.roomId, payload.text)
}

return payload
}

Expand Down
1 change: 1 addition & 0 deletions src/pure-function-helpers/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './message-raw-payload-parser.js'
export * from './web-message-type.js'
export * from './xml.js'
export * from './retry-policy.js'
export { parseMentionIdList } from './parse-mention-id-list.js'
Loading

0 comments on commit 517ce87

Please sign in to comment.