Skip to content

Commit

Permalink
switchに
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Mar 31, 2024
1 parent af1977b commit e7cf850
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ func (c *Client) HandleSlackEvents(ctx context.Context) {
if eventsAPIEvent.Type == slackevents.CallbackEvent {
innerEvent := eventsAPIEvent.InnerEvent
slog.Debug("InnerEvent", "innerEvent", innerEvent)
if ev, ok := innerEvent.Data.(*slackevents.MemberJoinedChannelEvent); ok {

switch ev := innerEvent.Data.(type) {
case *slackevents.MemberJoinedChannelEvent:
slog.Info("MemberJoinedChannelEvent", "event", ev, "channel", ev.Channel)

observTarget, err := c.DetermineObservTarget(ctx)
Expand Down Expand Up @@ -233,7 +235,7 @@ func (c *Client) HandleSlackEvents(ctx context.Context) {
continue
}

} else if ev, ok := innerEvent.Data.(*slackevents.ChannelCreatedEvent); ok {
case *slackevents.ChannelCreatedEvent:
slog.Info("ChannelCreatedEvent", "event", ev)

observTarget, err := c.DetermineObservTarget(ctx)
Expand Down Expand Up @@ -265,8 +267,8 @@ func (c *Client) HandleSlackEvents(ctx context.Context) {
slog.Error("Error inviting MCG members to channel", "error", err)
continue
}
} else {
slog.Debug("Ignored inner event", "innerEvent", innerEvent)
default:
slog.Debug("Ignored event", "event", innerEvent)
}
}
}
Expand Down

0 comments on commit e7cf850

Please sign in to comment.