Skip to content

Commit

Permalink
wamsgtype: add more known types
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 9, 2024
1 parent eda6be5 commit 55577f1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/rs/zerolog v1.33.0
go.mau.fi/util v0.8.1-0.20241003092848-3b49d3e0b9ee
go.mau.fi/webp v0.1.0
go.mau.fi/whatsmeow v0.0.0-20241001150013-71e7937b706a
go.mau.fi/whatsmeow v0.0.0-20241009112614-70d73b690a8d
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/image v0.20.0
golang.org/x/net v0.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ go.mau.fi/util v0.8.1-0.20241003092848-3b49d3e0b9ee h1:/BGpUK7fzVyFgy5KBiyP7ktED
go.mau.fi/util v0.8.1-0.20241003092848-3b49d3e0b9ee/go.mod h1:L9qnqEkhe4KpuYmILrdttKTXL79MwGLyJ4EOskWxO3I=
go.mau.fi/webp v0.1.0 h1:BHObH/DcFntT9KYun5pDr0Ot4eUZO8k2C7eP7vF4ueA=
go.mau.fi/webp v0.1.0/go.mod h1:e42Z+VMFrUMS9cpEwGRIor+lQWO8oUAyPyMtcL+NMt8=
go.mau.fi/whatsmeow v0.0.0-20241001150013-71e7937b706a h1:6f0HGXBZiGrQMrI8MF5u0zjrdsBXLzWAneikUOhbN3E=
go.mau.fi/whatsmeow v0.0.0-20241001150013-71e7937b706a/go.mod h1:UvaXcdb8y5Mryj2LSXAMw7u4/exnWJIXn8Gvpmf6ndI=
go.mau.fi/whatsmeow v0.0.0-20241009112614-70d73b690a8d h1:0OV2Ula2IGaoHVfvv7ns+Gn3xGT0SHn5yDecJBB8FQY=
go.mau.fi/whatsmeow v0.0.0-20241009112614-70d73b690a8d/go.mod h1:UvaXcdb8y5Mryj2LSXAMw7u4/exnWJIXn8Gvpmf6ndI=
go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM=
go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
Expand Down
35 changes: 35 additions & 0 deletions pkg/connector/wamsgtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func getMessageType(waMsg *waE2E.Message) string {
return "live location start"
case waMsg.GroupInviteMessage != nil:
return "group invite"
case waMsg.GroupMentionedMessage != nil:
return "group mention"
case waMsg.ScheduledCallCreationMessage != nil:
return "scheduled call create"
case waMsg.ScheduledCallEditMessage != nil:
return "scheduled call edit"
case waMsg.ReactionMessage != nil:
if waMsg.ReactionMessage.GetText() == "" {
return "reaction remove"
Expand Down Expand Up @@ -101,8 +107,35 @@ func getMessageType(waMsg *waE2E.Message) string {
return "order"
case waMsg.InvoiceMessage != nil:
return "invoice"
case waMsg.BotInvokeMessage != nil:
return "bot invoke"
case waMsg.EventMessage != nil:
return "event"
case waMsg.EventCoverImage != nil:
return "event cover image"
case waMsg.EncEventResponseMessage != nil:
return "ignore" // these are ignored for now as they're not meant to be shown as new messages
//return "encrypted event response"
case waMsg.CommentMessage != nil:
return "comment"
case waMsg.EncCommentMessage != nil:
return "encrypted comment"
case waMsg.NewsletterAdminInviteMessage != nil:
return "newsletter admin invite"
case waMsg.SecretEncryptedMessage != nil:
return "secret encrypted"
case waMsg.PollResultSnapshotMessage != nil:
return "poll result snapshot"
case waMsg.MessageHistoryBundle != nil:
return "message history bundle"
case waMsg.RequestPhoneNumberMessage != nil:
return "request phone number"
case waMsg.KeepInChatMessage != nil:
return "keep in chat"
case waMsg.StatusMentionMessage != nil:
return "status mention"
case waMsg.StickerPackMessage != nil:
return "sticker pack"
case waMsg.AlbumMessage != nil:
return "album" // or maybe these should be ignored?
case waMsg.SendPaymentMessage != nil, waMsg.RequestPaymentMessage != nil,
Expand All @@ -113,6 +146,8 @@ func getMessageType(waMsg *waE2E.Message) string {
return "call"
case waMsg.Chat != nil:
return "chat"
case waMsg.PlaceholderMessage != nil:
return "placeholder"
case waMsg.SenderKeyDistributionMessage != nil, waMsg.StickerSyncRmrMessage != nil:
return "ignore"
default:
Expand Down

0 comments on commit 55577f1

Please sign in to comment.