|
|
|
@ -235,10 +235,9 @@ func (k *Keybase) SendEphemeralToChannel(channel chat1.ChatChannel, duration tim
@@ -235,10 +235,9 @@ func (k *Keybase) SendEphemeralToChannel(channel chat1.ChatChannel, duration tim
|
|
|
|
|
Message: SendMessageBody{ |
|
|
|
|
Body: fmt.Sprintf(message, a...), |
|
|
|
|
}, |
|
|
|
|
ExplodingLifetime: explodingLifetime{duration}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
opts.ExplodingLifetime.Duration = duration |
|
|
|
|
|
|
|
|
|
r, err := k.SendMessage(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return r, err |
|
|
|
@ -256,10 +255,9 @@ func (k *Keybase) SendEphemeralToConvID(convID chat1.ConvIDStr, duration time.Du
@@ -256,10 +255,9 @@ func (k *Keybase) SendEphemeralToConvID(convID chat1.ConvIDStr, duration time.Du
|
|
|
|
|
Message: SendMessageBody{ |
|
|
|
|
Body: fmt.Sprintf(message, a...), |
|
|
|
|
}, |
|
|
|
|
ExplodingLifetime: explodingLifetime{duration}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
opts.ExplodingLifetime.Duration = duration |
|
|
|
|
|
|
|
|
|
r, err := k.SendMessage(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return r, err |
|
|
|
@ -268,43 +266,43 @@ func (k *Keybase) SendEphemeralToConvID(convID chat1.ConvIDStr, duration time.Du
@@ -268,43 +266,43 @@ func (k *Keybase) SendEphemeralToConvID(convID chat1.ConvIDStr, duration time.Du
|
|
|
|
|
return r, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Send sends a chat message
|
|
|
|
|
func (c Chat) Send(message ...string) (ChatAPI, error) { |
|
|
|
|
m := ChatAPI{ |
|
|
|
|
Params: ¶ms{}, |
|
|
|
|
} |
|
|
|
|
m.Params.Options = options{ |
|
|
|
|
Message: &mesg{}, |
|
|
|
|
} |
|
|
|
|
// ReplyToChannel sends a chat message to a channel
|
|
|
|
|
func (k *Keybase) ReplyToChannel(channel chat1.ChatChannel, replyTo *chat1.MessageID, message string, a ...interface{}) (SendResponse, error) { |
|
|
|
|
var r SendResponse |
|
|
|
|
|
|
|
|
|
m.Method = "send" |
|
|
|
|
m.Params.Options.Channel = &c.Channel |
|
|
|
|
m.Params.Options.Message.Body = strings.Join(message, " ") |
|
|
|
|
opts := SendMessageOptions{ |
|
|
|
|
Channel: channel, |
|
|
|
|
Message: SendMessageBody{ |
|
|
|
|
Body: fmt.Sprintf(message, a...), |
|
|
|
|
}, |
|
|
|
|
ReplyTo: replyTo, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
r, err := chatAPIOut(c.keybase, m) |
|
|
|
|
r, err := k.SendMessage(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return r, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return r, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SendEphemeral sends an exploding chat message, with specified duration
|
|
|
|
|
func (c Chat) SendEphemeral(duration time.Duration, message ...string) (ChatAPI, error) { |
|
|
|
|
m := ChatAPI{ |
|
|
|
|
Params: ¶ms{}, |
|
|
|
|
} |
|
|
|
|
m.Params.Options = options{ |
|
|
|
|
Message: &mesg{}, |
|
|
|
|
// ReplyToConvID sends a chat message to a conversation id
|
|
|
|
|
func (k *Keybase) ReplyToConvID(convID chat1.ConvIDStr, replyTo *chat1.MessageID, message string, a ...interface{}) (SendResponse, error) { |
|
|
|
|
var r SendResponse |
|
|
|
|
|
|
|
|
|
opts := SendMessageOptions{ |
|
|
|
|
ConversationID: convID, |
|
|
|
|
Message: SendMessageBody{ |
|
|
|
|
Body: fmt.Sprintf(message, a...), |
|
|
|
|
}, |
|
|
|
|
ReplyTo: replyTo, |
|
|
|
|
} |
|
|
|
|
m.Params.Options.ExplodingLifetime.Duration = duration |
|
|
|
|
m.Method = "send" |
|
|
|
|
m.Params.Options.Channel = &c.Channel |
|
|
|
|
m.Params.Options.Message.Body = strings.Join(message, " ") |
|
|
|
|
|
|
|
|
|
r, err := chatAPIOut(c.keybase, m) |
|
|
|
|
r, err := k.SendMessage(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return r, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return r, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|