From bf60ed822e9dac5d9e3bc109953c3f6a1aef6f15 Mon Sep 17 00:00:00 2001 From: Jackes David Date: Thu, 3 Oct 2019 16:31:52 -0400 Subject: [PATCH 1/2] Add StickerMessage Download function like we have in ImageMessage --- go.mod | 2 ++ message.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/go.mod b/go.mod index ead71f94..53ba08f5 100644 --- a/go.mod +++ b/go.mod @@ -10,3 +10,5 @@ require ( github.com/pkg/errors v0.8.1 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 ) + +go 1.13 diff --git a/message.go b/message.go index 5f69f83e..4cf1de4b 100644 --- a/message.go +++ b/message.go @@ -306,6 +306,13 @@ func (m *ImageMessage) Download() ([]byte, error) { return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) } +/* +Download is the function to retrieve Sticker media data. The media gets downloaded, validated and returned. +*/ +func (m *StickerMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) +} + /* VideoMessage represents a video message. Unexported fields are needed for media up/downloading and media validation. Provide a io.Reader as Content for message sending. From 03852bba8f5d297da9d771d8984e1577b6d00cef Mon Sep 17 00:00:00 2001 From: Jackes David Date: Thu, 3 Oct 2019 21:13:34 -0400 Subject: [PATCH 2/2] change Sticker Download position to folow current rules --- message.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/message.go b/message.go index 4cf1de4b..f2a03b6f 100644 --- a/message.go +++ b/message.go @@ -306,13 +306,6 @@ func (m *ImageMessage) Download() ([]byte, error) { return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) } -/* -Download is the function to retrieve Sticker media data. The media gets downloaded, validated and returned. -*/ -func (m *StickerMessage) Download() ([]byte, error) { - return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) -} - /* VideoMessage represents a video message. Unexported fields are needed for media up/downloading and media validation. Provide a io.Reader as Content for message sending. @@ -663,6 +656,13 @@ func getStickerMessage(msg *proto.WebMessageInfo) StickerMessage { return StickerMessage } +/* +Download is the function to retrieve Sticker media data. The media gets downloaded, validated and returned. +*/ +func (m *StickerMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) +} + func ParseProtoMessage(msg *proto.WebMessageInfo) interface{} { switch {