Skip to content

Commit

Permalink
fix for api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r committed Dec 21, 2022
1 parent 79101c7 commit 0cac782
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions remote/slack/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 0cac782

Please sign in to comment.