swiftui-shapes icon indicating copy to clipboard operation
swiftui-shapes copied to clipboard

Feature Request: Wechaty Could Support Quote Message

Open hcfw007 opened this issue 2 years ago • 25 comments

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!

hcfw007 avatar Mar 18 '22 03:03 hcfw007