Skip to content

Commit

Permalink
Merge pull request #74 from juzibot/feat/merge-forward
Browse files Browse the repository at this point in the history
feat: ✨ add static method mergeForward
  • Loading branch information
su-chang authored Nov 7, 2023
2 parents a79ec2a + f5a1d65 commit ad9cb0a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/user-modules/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,23 @@ class MessageMixin extends MixinBase implements SayableSayer {
return broadcastStatus
}

static async mergeForward (to: ContactInterface | RoomInterface, messageList: MessageInterface[]): Promise<void | MessageInterface> {
log.verbose('Message', `mergeForward(${messageList})`)
try {
const msgId = await this.wechaty.puppet.messageForward(
to.id,
messageList.map(msg => msg.id),
)
if (msgId) {
const msg = await this.wechaty.Message.find({ id: msgId })
return msg
}
} catch (e) {
log.error('Message', 'forward(%s) exception: %s', to, e)
throw e
}
}

/**
*
* Instance Properties
Expand Down

0 comments on commit ad9cb0a

Please sign in to comment.