1
0
Fork 0

Add support for incoming sticker messages

These are simply parsed as image attachments for their given MIME type
and a random filename.
This commit is contained in:
Alex Palaistras 2023-06-16 20:57:57 +01:00
parent f7e06e9828
commit 1f50157537
1 changed files with 3 additions and 1 deletions

View File

@ -17,7 +17,6 @@ import (
// Go session adapter.
type EventKind int
// The event types handled by the overarching session adapter handler.
const (
EventUnknown EventKind = iota
@ -258,6 +257,7 @@ func getMessageAttachments(client *whatsmeow.Client, message *proto.Message) ([]
message.GetAudioMessage(),
message.GetVideoMessage(),
message.GetDocumentMessage(),
message.GetStickerMessage(),
}
for _, msg := range kinds {
@ -272,6 +272,8 @@ func getMessageAttachments(client *whatsmeow.Client, message *proto.Message) ([]
a.MIME, a.Caption = msg.GetMimetype(), msg.GetCaption()
case *proto.DocumentMessage:
a.MIME, a.Caption, a.Filename = msg.GetMimetype(), msg.GetCaption(), msg.GetFileName()
case *proto.StickerMessage:
a.MIME = msg.GetMimetype()
}
// Ignore attachments with empty or unknown MIME types.