forked from MirrorHub/mautrix-whatsapp
Handle WhatsApp chat create events
This commit is contained in:
parent
8cfb04a5ed
commit
2132bc653b
2 changed files with 3 additions and 2 deletions
2
user.go
2
user.go
|
@ -861,7 +861,7 @@ func (user *User) HandleChatUpdate(cmd whatsappExt.ChatUpdate) {
|
|||
|
||||
portal := user.GetPortalByJID(cmd.JID)
|
||||
if len(portal.MXID) == 0 {
|
||||
if cmd.Data.Action == whatsappExt.ChatActionIntroduce && cmd.Data.SenderJID != "unknown" {
|
||||
if cmd.Data.Action == whatsappExt.ChatActionIntroduce || cmd.Data.Action == whatsappExt.ChatActionCreate {
|
||||
go func() {
|
||||
err := portal.CreateMatrixRoom(user)
|
||||
if err != nil {
|
||||
|
|
|
@ -46,6 +46,7 @@ const (
|
|||
ChatActionPromote ChatActionType = "promote"
|
||||
ChatActionDemote ChatActionType = "demote"
|
||||
ChatActionIntroduce ChatActionType = "introduce"
|
||||
ChatActionCreate ChatActionType = "create"
|
||||
ChatActionRemove ChatActionType = "remove"
|
||||
ChatActionAdd ChatActionType = "add"
|
||||
)
|
||||
|
@ -109,7 +110,7 @@ func (cud *ChatUpdateData) UnmarshalJSON(data []byte) error {
|
|||
|
||||
var unmarshalTo interface{}
|
||||
switch cud.Action {
|
||||
case ChatActionIntroduce:
|
||||
case ChatActionIntroduce, ChatActionCreate:
|
||||
err = json.Unmarshal(arr[2], &cud.NameChange)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue