diff options
author | Wim <wim@42.be> | 2022-03-12 23:02:04 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2022-03-20 14:57:48 +0100 |
commit | aefa70891cfd489fccb8a9567b5bdafb0f863ede (patch) | |
tree | 90fe7c91d7b33b2a1ed08ea3a94840860adc6fc1 /vendor/go.mau.fi/whatsmeow/send.go | |
parent | 1b9877fda45be021ea6a5677c78648cecc19dcd5 (diff) | |
download | matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.tar.gz matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.tar.bz2 matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.zip |
Update vendor (whatsapp)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/send.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/send.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/send.go b/vendor/go.mau.fi/whatsmeow/send.go index fb4653e2..a3eae666 100644 --- a/vendor/go.mau.fi/whatsmeow/send.go +++ b/vendor/go.mau.fi/whatsmeow/send.go @@ -30,6 +30,9 @@ import ( ) // GenerateMessageID generates a random string that can be used as a message ID on WhatsApp. +// +// msgID := whatsmeow.GenerateMessageID() +// cli.SendMessage(targetJID, msgID, &waProto.Message{...}) func GenerateMessageID() types.MessageID { id := make([]byte, 16) _, err := rand.Read(id) @@ -46,6 +49,20 @@ func GenerateMessageID() types.MessageID { // // This method will wait for the server to acknowledge the message before returning. // The return value is the timestamp of the message from the server. +// +// The message itself can contain anything you want (within the protobuf schema). +// e.g. for a simple text message, use the Conversation field: +// cli.SendMessage(targetJID, "", &waProto.Message{ +// Conversation: proto.String("Hello, World!"), +// }) +// +// Things like replies, mentioning users and the "forwarded" flag are stored in ContextInfo, +// which can be put in ExtendedTextMessage and any of the media message types. +// +// For uploading and sending media/attachments, see the Upload method. +// +// For other message types, you'll have to figure it out yourself. Looking at the protobuf schema +// in binary/proto/def.proto may be useful to find out all the allowed fields. func (cli *Client) SendMessage(to types.JID, id types.MessageID, message *waProto.Message) (time.Time, error) { if to.AD { return time.Time{}, ErrRecipientADJID @@ -210,7 +227,7 @@ func (cli *Client) prepareMessageNode(to types.JID, id types.MessageID, message Content: participantNodes, }}, } - if message.ProtocolMessage != nil && message.GetProtocolMessage().GetType() == waProto.ProtocolMessage_REVOKE { + if message.ProtocolMessage != nil && message.GetProtocolMessage().GetType() == waProto.ProtocolMessage_REVOKE && message.GetProtocolMessage().GetKey() != nil { node.Attrs["edit"] = "7" } if includeIdentity { |