Handle WhatsApp poll creation message v2

This commit is contained in:
Tulir Asokan 2022-12-21 23:20:23 +02:00
parent c1538ccfa0
commit 52876bb607
3 changed files with 7 additions and 5 deletions

2
go.mod
View file

@ -11,7 +11,7 @@ require (
github.com/prometheus/client_golang v1.14.0
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/tidwall/gjson v1.14.4
go.mau.fi/whatsmeow v0.0.0-20221213225758-70ef67df3c68
go.mau.fi/whatsmeow v0.0.0-20221221211611-6a0e825b4049
golang.org/x/image v0.2.0
golang.org/x/net v0.4.0
google.golang.org/protobuf v1.28.1

4
go.sum
View file

@ -66,8 +66,8 @@ github.com/yuin/goldmark v1.5.3 h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M=
github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf h1:mzPxXBgDPHKDHMVV1tIWh7lwCiRpzCsXC0gNRX+K07c=
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf/go.mod h1:XCjaU93vl71YNRPn059jMrK0xRDwVO5gKbxoPxow9mQ=
go.mau.fi/whatsmeow v0.0.0-20221213225758-70ef67df3c68 h1:uieThnMYyFDdUNDrHxauuZOW5ip+igWhHwyWFNjA2Sw=
go.mau.fi/whatsmeow v0.0.0-20221213225758-70ef67df3c68/go.mod h1:2yweL8nczvtlIxkrvCb0y8xiO13rveX9lJPambwYV/E=
go.mau.fi/whatsmeow v0.0.0-20221221211611-6a0e825b4049 h1:QM3QppkH6DQWWROgR084Xj5g5ZHwGBFJVBpAua6Rkpg=
go.mau.fi/whatsmeow v0.0.0-20221221211611-6a0e825b4049/go.mod h1:2yweL8nczvtlIxkrvCb0y8xiO13rveX9lJPambwYV/E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=

View file

@ -392,7 +392,7 @@ func containsSupportedMessage(waMsg *waProto.Message) bool {
waMsg.DocumentMessage != nil || waMsg.ContactMessage != nil || waMsg.LocationMessage != nil ||
waMsg.LiveLocationMessage != nil || waMsg.GroupInviteMessage != nil || waMsg.ContactsArrayMessage != nil ||
waMsg.HighlyStructuredMessage != nil || waMsg.TemplateMessage != nil || waMsg.TemplateButtonReplyMessage != nil ||
waMsg.ListMessage != nil || waMsg.ListResponseMessage != nil || waMsg.PollCreationMessage != nil
waMsg.ListMessage != nil || waMsg.ListResponseMessage != nil || waMsg.PollCreationMessage != nil || waMsg.PollCreationMessageV2 != nil
}
func getMessageType(waMsg *waProto.Message) string {
@ -425,7 +425,7 @@ func getMessageType(waMsg *waProto.Message) string {
return "reaction"
case waMsg.EncReactionMessage != nil:
return "encrypted reaction"
case waMsg.PollCreationMessage != nil:
case waMsg.PollCreationMessage != nil || waMsg.PollCreationMessageV2 != nil:
return "poll create"
case waMsg.PollUpdateMessage != nil:
return "poll update"
@ -544,6 +544,8 @@ func (portal *Portal) convertMessage(intent *appservice.IntentAPI, source *User,
return portal.convertListResponseMessage(intent, waMsg.GetListResponseMessage())
case waMsg.PollCreationMessage != nil:
return portal.convertPollCreationMessage(intent, waMsg.GetPollCreationMessage())
case waMsg.PollCreationMessageV2 != nil:
return portal.convertPollCreationMessage(intent, waMsg.GetPollCreationMessageV2())
case waMsg.PollUpdateMessage != nil:
return portal.convertPollUpdateMessage(intent, source, info, waMsg.GetPollUpdateMessage())
case waMsg.ImageMessage != nil: