Skip to content

Feature Request: Wechaty Could Support Quote Message #2387

@hcfw007

Description

@hcfw007

A lot IMs has quote messages or something like that, e.g. QQ, wechat, wecom, whatsapp and meta messenger, even github! So it would be great for Wechaty to support that.
My early thoughts about this is to add a quote field in message payload which contains the id of the quoted message. The quoted message could be an image or video so save id as reference is good.

  // get quote from a message

  quote (): MessageInterface | null {
    if (!this.payload) {
      throw new Error('no payload')
    }

    let quoteMessageId = this.payload.quoteId
    if (!quoteMessageId) {
      return null // no quote is acceptable
    }

    }

    const quoteMessage = (this.wechaty.Message as typeof MessageImpl).load(quoteMessageId)

    return quoteMessage
  }

For sending a quote message, I'm not sure how to implement it. I'm considering two options:

  1. add some options to say(), like contact.say(content: Sayable, options?: messageOptions)
  2. add a new method, like message.quote(contactOrRoom: Contact | Room, quotedMessage: Message)

Please tell me if you like this feature, and how you want to implement it. Cheers!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions