Add Reply()
This commit is contained in:
21
chat.go
21
chat.go
@ -178,6 +178,27 @@ func (c Chat) Send(message ...string) (ChatAPI, error) {
|
|||||||
return r, nil
|
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
|
// Edit edits a previously sent chat message
|
||||||
func (c Chat) Edit(messageID int, message ...string) (ChatAPI, error) {
|
func (c Chat) Edit(messageID int, message ...string) (ChatAPI, error) {
|
||||||
m := ChatAPI{
|
m := ChatAPI{
|
||||||
|
|||||||
2
types.go
2
types.go
@ -239,6 +239,7 @@ type options struct {
|
|||||||
ConversationID string `json:"conversation_id,omitempty"`
|
ConversationID string `json:"conversation_id,omitempty"`
|
||||||
FlipConversationID string `json:"flip_conversation_id,omitempty"`
|
FlipConversationID string `json:"flip_conversation_id,omitempty"`
|
||||||
MsgID int `json:"msg_id,omitempty"`
|
MsgID int `json:"msg_id,omitempty"`
|
||||||
|
ReplyTo int `json:"reply_to,omitempty"`
|
||||||
GameID string `json:"game_id,omitempty"`
|
GameID string `json:"game_id,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
@ -538,6 +539,7 @@ type chat interface {
|
|||||||
Edit(messageID int, message ...string) (ChatAPI, error)
|
Edit(messageID int, message ...string) (ChatAPI, error)
|
||||||
React(messageID int, reaction string) (ChatAPI, error)
|
React(messageID int, reaction string) (ChatAPI, error)
|
||||||
Send(message ...string) (ChatAPI, error)
|
Send(message ...string) (ChatAPI, error)
|
||||||
|
Reply(replyTo int, message ...string) (ChatAPI, error)
|
||||||
Upload(title string, filepath string) (ChatAPI, error)
|
Upload(title string, filepath string) (ChatAPI, error)
|
||||||
Download(messageID int, filepath string) (ChatAPI, error)
|
Download(messageID int, filepath string) (ChatAPI, error)
|
||||||
LoadFlip(messageID int, conversationID string, flipConversationID string, gameID string) (ChatAPI, error)
|
LoadFlip(messageID int, conversationID string, flipConversationID string, gameID string) (ChatAPI, error)
|
||||||
|
|||||||
Reference in New Issue
Block a user