Skip to content

Commit

Permalink
Merge pull request #75 from juzibot/pref/imporve-find-with-id
Browse files Browse the repository at this point in the history
Pref/imporve find with
  • Loading branch information
hcfw007 authored Nov 7, 2023
2 parents 6e9df75 + 9722148 commit a79ec2a
Show file tree
Hide file tree
Showing 2 changed files with 13 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": "@juzi/wechaty",
"version": "1.0.75",
"version": "1.0.76",
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
"type": "module",
"exports": {
Expand Down
12 changes: 12 additions & 0 deletions src/user-modules/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ class MessageMixin extends MixinBase implements SayableSayer {
): Promise<undefined | MessageInterface> {
log.verbose('Message', 'find(%s)', JSON.stringify(query))

if (typeof query === 'object' && query.id) {
const message = this.load(query.id)
try {
await message.ready()
} catch (e) {
this.wechaty.emitError(e)
return undefined
}

return message
}

if (typeof query === 'string') {
query = { text: query }
}
Expand Down

0 comments on commit a79ec2a

Please sign in to comment.