Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Apr 16, 2024
1 parent 55d96ff commit 1e5faa0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ func (c *Client) HandleSlackEvents(ctx context.Context) error {
slog.Error("Error getting prefixed channels", "error", err)
continue
}

slog.Info("Inviting user to channels", "trigerUser", ev.User, "mcgMembers", mcgMembers, "channels", channels)

err = c.InviteUsersToChannels(ctx, maps.Keys(channels), maps.Keys(mcgMembers))
Expand All @@ -397,6 +398,16 @@ func (c *Client) HandleSlackEvents(ctx context.Context) error {
slog.Info("Ignored channel created event", "channelName", ev.Channel.Name)
}

_, warn, _, err := c.slackBotClient.JoinConversationContext(ctx, ev.Channel.ID)
if err != nil {
slog.Error("Error joining channel", "channelID", ev.Channel.ID, "error", err)
continue
}

if warn != "" && warn != "already_in_channel" {
slog.Warn("Warning joining channel", "channelID", ev.Channel.ID, "warning", warn)
}

mcgMembers, err := c.GetAllMCGMembers(ctx, "")
if err != nil {
slog.Error("Error getting MCG members", "error", err)
Expand Down

0 comments on commit 1e5faa0

Please sign in to comment.