From 0cac78221dd21dd854fd4fb26b9080d9f66c0c6f Mon Sep 17 00:00:00 2001 From: wass3r <1301201+wass3r@users.noreply.github.com> Date: Tue, 20 Dec 2022 21:58:59 -0600 Subject: [PATCH] fix for api changes --- remote/slack/helper.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/remote/slack/helper.go b/remote/slack/helper.go index df133976..77c7d66b 100644 --- a/remote/slack/helper.go +++ b/remote/slack/helper.go @@ -133,8 +133,15 @@ func handleCallBack(api *slack.Client, event slackevents.EventsAPIInnerEvent, bo case *slackevents.MemberJoinedChannelEvent: // limit to our bot if ev.User == bot.ID { + // options for getting channel info + opts := &slack.GetConversationInfoInput{ + ChannelID: ev.Channel, + IncludeLocale: false, + IncludeNumMembers: true, + } + // look up channel info, since 'ev' only gives us ID - channel, err := api.GetConversationInfo(ev.Channel, false) + channel, err := api.GetConversationInfo(opts) if err != nil { log.Error().Msgf("unable to fetch channel info for channel joined event: %v", err) } @@ -212,7 +219,6 @@ func getEventsAPIEventHandler(api *slack.Client, signingSecret string, inputMsgs // process regular Callback events if eventsAPIEvent.Type == slackevents.CallbackEvent { - //nolint:contextcheck // TODO: fix to pass context handleCallBack(api, eventsAPIEvent.InnerEvent, bot, inputMsgs, w) } } @@ -579,8 +585,15 @@ func readFromSocketMode(sm *slack.Client, inputMsgs chan<- models.Message, bot * case *slackevents.MemberJoinedChannelEvent: // limit to our bot if ev.User == bot.ID { + // options for getting channel info + opts := &slack.GetConversationInfoInput{ + ChannelID: ev.Channel, + IncludeLocale: false, + IncludeNumMembers: true, + } + // look up channel info, since 'ev' only gives us ID - channel, err := sm.GetConversationInfo(ev.Channel, false) + channel, err := sm.GetConversationInfo(opts) if err != nil { log.Error().Msgf("unable to fetch channel info for channel joined event: %v", err) }