diff --git a/chat.go b/chat.go index d27f3d0..b0a0317 100644 --- a/chat.go +++ b/chat.go @@ -178,6 +178,27 @@ func (c Chat) Send(message ...string) (ChatAPI, error) { return r, nil } +// Reply sends a reply to a chat message +func (c Chat) Reply(replyTo int, message ...string) (ChatAPI, error) { + m := ChatAPI{ + Params: ¶ms{}, + } + m.Params.Options = options{ + Message: &mesg{}, + } + + m.Method = "send" + m.Params.Options.Channel = &c.Channel + m.Params.Options.ReplyTo = replyTo + m.Params.Options.Message.Body = strings.Join(message, " ") + + r, err := chatAPIOut(c.keybase, m) + if err != nil { + return ChatAPI{}, err + } + return r, nil +} + // Edit edits a previously sent chat message func (c Chat) Edit(messageID int, message ...string) (ChatAPI, error) { m := ChatAPI{ diff --git a/types.go b/types.go index ad279a1..89f7690 100644 --- a/types.go +++ b/types.go @@ -239,6 +239,7 @@ type options struct { ConversationID string `json:"conversation_id,omitempty"` FlipConversationID string `json:"flip_conversation_id,omitempty"` MsgID int `json:"msg_id,omitempty"` + ReplyTo int `json:"reply_to,omitempty"` GameID string `json:"game_id,omitempty"` Name string `json:"name,omitempty"` @@ -538,6 +539,7 @@ type chat interface { Edit(messageID int, message ...string) (ChatAPI, error) React(messageID int, reaction string) (ChatAPI, error) Send(message ...string) (ChatAPI, error) + Reply(replyTo int, message ...string) (ChatAPI, error) Upload(title string, filepath string) (ChatAPI, error) Download(messageID int, filepath string) (ChatAPI, error) LoadFlip(messageID int, conversationID string, flipConversationID string, gameID string) (ChatAPI, error)