mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-26 02:55:39 +00:00
Update PostMessage to also return and error. Add EditMessage function
This commit is contained in:
parent
5a8d7b5f6d
commit
e84417430d
@ -451,9 +451,22 @@ func (m *MMClient) GetChannelHeader(channelId string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MMClient) PostMessage(channelId string, text string) {
|
||||
func (m *MMClient) PostMessage(channelId string, text string) (string, error) {
|
||||
post := &model.Post{ChannelId: channelId, Message: text}
|
||||
m.Client.CreatePost(post)
|
||||
res, resp := m.Client.CreatePost(post)
|
||||
if resp.Error != nil {
|
||||
return "", resp.Error
|
||||
}
|
||||
return res.Id, nil
|
||||
}
|
||||
|
||||
func (m *MMClient) EditMessage(postId string, text string) (string, error) {
|
||||
post := &model.Post{Message: text}
|
||||
res, resp := m.Client.UpdatePost(postId, post)
|
||||
if resp.Error != nil {
|
||||
return "", resp.Error
|
||||
}
|
||||
return res.Id, nil
|
||||
}
|
||||
|
||||
func (m *MMClient) JoinChannel(channelId string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user