diff options
author | Duco van Amstel <duco.vanamstel@gmail.com> | 2018-10-16 19:34:09 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-10-16 20:34:09 +0200 |
commit | 6238effdc27e4f439cb49bfa5fb5cd09fd88375e (patch) | |
tree | b820678b1edbddc7b5cb5e88910f1b8c49768a9c /bridge/slack/handlers.go | |
parent | 498377a230b8712792a47a61ad63ab746f7379d1 (diff) | |
download | matterbridge-msglm-6238effdc27e4f439cb49bfa5fb5cd09fd88375e.tar.gz matterbridge-msglm-6238effdc27e4f439cb49bfa5fb5cd09fd88375e.tar.bz2 matterbridge-msglm-6238effdc27e4f439cb49bfa5fb5cd09fd88375e.zip |
Clean up user and channel information management (slack) (#521)
Diffstat (limited to 'bridge/slack/handlers.go')
-rw-r--r-- | bridge/slack/handlers.go | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index 56fd7026..b6400a80 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -61,25 +61,11 @@ func (b *Bslack) handleSlackClient(messages chan *config.Message) { case *slack.OutgoingErrorEvent: b.Log.Debugf("%#v", ev.Error()) case *slack.ChannelJoinedEvent: - var err error - b.users, err = b.sc.GetUsers() - if err != nil { - b.Log.Errorf("Could not reload users: %#v", err) - } + b.populateUsers() case *slack.ConnectedEvent: - var err error - b.channels, _, err = b.sc.GetConversations(&slack.GetConversationsParameters{ - Limit: 1000, - Types: []string{"public_channel,private_channel,mpim,im"}, - }) - if err != nil { - b.Log.Errorf("Channel list failed: %#v", err) - } b.si = ev.Info - b.users, err = b.sc.GetUsers() - if err != nil { - b.Log.Errorf("Could not reload users: %#v", err) - } + b.populateChannels() + b.populateUsers() case *slack.InvalidAuthEvent: b.Log.Fatalf("Invalid Token %#v", ev) case *slack.ConnectionErrorEvent: @@ -163,9 +149,7 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er // update the userlist on a channel_join if ev.SubType == sChannelJoin { - if b.users, err = b.sc.GetUsers(); err != nil { - return nil, err - } + b.populateUsers() } // Edit message |