Skip to content

Commit be0a4a9

Browse files
authored
fix: compatible old puppet service (#130)
1 parent 71a222c commit be0a4a9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

wechaty-puppet-service/puppet_service.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ func (p *PuppetService) MessageRawMiniProgramPayload(messageID string) (*schemas
531531
return nil, err
532532
}
533533

534+
// Deprecated: will be removed after Dec 31, 2022
535+
//nolint:staticcheck
536+
if response.MiniProgram == nil {
537+
payload := &schemas.MiniProgramPayload{}
538+
p.unMarshal(response.MiniProgramDeprecated, payload)
539+
return payload, nil
540+
}
541+
534542
payload := &schemas.MiniProgramPayload{
535543
Appid: response.MiniProgram.Appid,
536544
Description: response.MiniProgram.Description,
@@ -573,6 +581,8 @@ func (p *PuppetService) MessageSendMiniProgram(conversationID string, miniProgra
573581
Username: miniProgramPayload.Username,
574582
ThumbKey: miniProgramPayload.ThumbKey,
575583
},
584+
// Deprecated: will be removed after Dec 31, 2022
585+
MiniProgramDeprecated: miniProgramPayload.ToJson(),
576586
})
577587
if err != nil {
578588
return "", err

0 commit comments

Comments
 (0)