@@ -27,10 +27,11 @@ type PostMessageResponse struct {
27
27
28
28
// IMMessageRequest .
29
29
type IMMessageRequest struct {
30
- ReceiveID string `json:"receive_id"`
31
- Content string `json:"content"`
32
- MsgType string `json:"msg_type"`
33
- UUID string `json:"uuid,omitempty"`
30
+ Content string `json:"content"`
31
+ MsgType string `json:"msg_type,omitempty"`
32
+ ReceiveID string `json:"receive_id,omitempty"`
33
+ UUID string `json:"uuid,omitempty"`
34
+ ReplyInThread bool `json:"reply_in_thread,omitempty"`
34
35
}
35
36
36
37
// IMSender .
@@ -56,19 +57,20 @@ type IMBody struct {
56
57
57
58
// IMMessage .
58
59
type IMMessage struct {
59
- MessageID string `json:"message_id"`
60
- UpperMessageID string `json:"upper_message_id"`
61
- RootID string `json:"root_id"`
62
- ParentID string `json:"parent_id"`
63
- ChatID string `json:"chat_id"`
64
- MsgType string `json:"msg_type"`
65
- CreateTime string `json:"create_time"`
66
- UpdateTime string `json:"update_time"`
67
- Deleted bool `json:"deleted"`
68
- Updated bool `json:"updated"`
69
- Sender IMSender
70
- Mentions []IMMention
71
- Body IMBody
60
+ MessageID string `json:"message_id"`
61
+ UpperMessageID string `json:"upper_message_id"`
62
+ RootID string `json:"root_id"`
63
+ ParentID string `json:"parent_id"`
64
+ ThreadID string `json:"thread_id"`
65
+ ChatID string `json:"chat_id"`
66
+ MsgType string `json:"msg_type"`
67
+ CreateTime string `json:"create_time"`
68
+ UpdateTime string `json:"update_time"`
69
+ Deleted bool `json:"deleted"`
70
+ Updated bool `json:"updated"`
71
+ Sender IMSender `json:"sender"`
72
+ Mentions []IMMention `json:"mentions"`
73
+ Body IMBody `json:"body"`
72
74
}
73
75
74
76
// ReactionResponse .
@@ -266,7 +268,7 @@ func (bot Bot) PostMessage(om OutcomingMessage) (*PostMessageResponse, error) {
266
268
267
269
// ReplyMessage replies a message
268
270
func (bot Bot ) ReplyMessage (om OutcomingMessage ) (* PostMessageResponse , error ) {
269
- req , err := BuildMessage (om )
271
+ req , err := buildReplyMessage (om )
270
272
if err != nil {
271
273
return nil , err
272
274
}
@@ -299,16 +301,22 @@ func (bot Bot) DeleteReaction(messageID string, reactionID string) (*ReactionRes
299
301
300
302
// UpdateMessage updates a message
301
303
func (bot Bot ) UpdateMessage (messageID string , om OutcomingMessage ) (* UpdateMessageResponse , error ) {
302
- if om .MsgType != MsgInteractive {
304
+ if om .MsgType != MsgInteractive &&
305
+ om .MsgType != MsgText &&
306
+ om .MsgType != MsgPost {
303
307
return nil , ErrMessageType
304
308
}
305
- req , err := BuildMessage (om )
309
+ req , err := buildUpdateMessage (om )
306
310
if err != nil {
307
311
return nil , err
308
312
}
309
313
url := fmt .Sprintf (updateMessageURL , messageID )
310
314
var respData UpdateMessageResponse
311
- err = bot .PatchAPIRequest ("UpdateMessage" , url , true , req , & respData )
315
+ if om .MsgType == MsgInteractive {
316
+ err = bot .PatchAPIRequest ("UpdateMessage" , url , true , req , & respData )
317
+ } else {
318
+ err = bot .PutAPIRequest ("UpdateMessage" , url , true , req , & respData )
319
+ }
312
320
return & respData , err
313
321
}
314
322
0 commit comments