Browse Source

Add ability to delete messages

main
Sam 6 years ago
parent
commit
12869de13b
  1. 2
      api/api.go
  2. 30
      api/chatOut.go

2
api/api.go

@ -15,6 +15,8 @@ type keybase interface {
ChatSendTextTeam(team, channel, message string) (chatOutResultResult, error) ChatSendTextTeam(team, channel, message string) (chatOutResultResult, error)
ChatSendReaction(user, reaction string, messageId int) (chatOutResultResult, error) ChatSendReaction(user, reaction string, messageId int) (chatOutResultResult, error)
ChatSendReactionTeam(team, channel, reaction string, messageId int) (chatOutResultResult, error) ChatSendReactionTeam(team, channel, reaction string, messageId int) (chatOutResultResult, error)
ChatDeleteMessage(user string, messageId int) (chatOutResultResult, error)
ChatDeleteMessageTeam(team, channel string, messageId int) (chatOutResultResult, error)
ChatList() ([]chatOutResultConversations, error) ChatList() ([]chatOutResultConversations, error)
LoggedIn() bool LoggedIn() bool
Username() string Username() string

30
api/chatOut.go

@ -143,6 +143,36 @@ func (k Keybase) ChatSendReactionTeam(team, channel, reaction string, messageId
return r.Result, nil return r.Result, nil
} }
// ChatDeleteMessage() deletes a message from a one-on-one conversation.
func (k Keybase) ChatDeleteMessage(user string, messageId int) (chatOutResultResult, error) {
m := chatOut{}
m.Method = "delete"
m.Params.Options.Channel.Name = user
m.Params.Options.MessageID = messageId
r, err := chatAPIOut(k.path, m)
if err != nil {
return chatOutResultResult{}, err
}
return r.Result, nil
}
// ChatDeleteMessageTeam() deletes a message from a team conversation.
func (k Keybase) ChatDeleteMessageTeam(team, channel string, messageId int) (chatOutResultResult, error) {
m := chatOut{}
m.Method = "delete"
m.Params.Options.Channel.Name = team
m.Params.Options.Channel.MembersType = "team"
m.Params.Options.Channel.TopicName = channel
m.Params.Options.MessageID = messageId
r, err := chatAPIOut(k.path, m)
if err != nil {
return chatOutResultResult{}, err
}
return r.Result, nil
}
// ChatList() returns a list of all conversations. // ChatList() returns a list of all conversations.
func (k Keybase) ChatList() ([]chatOutResultConversations, error) { func (k Keybase) ChatList() ([]chatOutResultConversations, error) {
m := chatOut{} m := chatOut{}

Loading…
Cancel
Save