create static method

ReceiptCommand create(
  1. String text,
  2. Envelope? head,
  3. Content? body
)

Creates a ReceiptCommand instance with receipt text and original message metadata.

Automatically purifies the original message's envelope/content using QuoteHelper to generate the "origin" field (removes sensitive data). Also handles group message receipt by setting the group ID if present in the original content.

@param text - Receipt comment/feedback text

@param head - Optional envelope of the original message being acknowledged

@param body - Optional content of the original message being acknowledged

@return A new ReceiptCommand instance

Implementation

static ReceiptCommand create(String text, Envelope? head, Content? body) {
  var helper = sharedMessageExtensions.quoteHelper;
  Map? origin = helper.purifyForReceipt(head, body);
  var command = BaseReceiptCommand.from(text, origin);
  if (body != null) {
    // check group
    ID? group = body.group;
    if (group != null) {
      command.group = group;
    }
  }
  return command;
}