func (t *TeamJoinActions) Handle(name string, fn TeamJoinActionFn) {
	t.actions = append(t.actions, teamJoinAction{name, fn})
}
Handle registers a TeamJoinActionFn to be taken on new join events.
package handler
import (
	"fmt"
	"github.com/gobridge/gopherbot/mparser"
	"github.com/gobridge/gopherbot/workqueue"
	"github.com/rs/zerolog"
	"github.com/slack-go/slack"
)
type TeamJoiner interface {
	User() slack.User
}
type teamJoiner slack.User
func (j teamJoiner) User() slack.User { return slack.User(j) }
type TeamJoinActionFn func(ctx workqueue.Context, tj TeamJoiner, r Responder) error
type teamJoinAction struct {
	name string
	fn   TeamJoinActionFn
}
type TeamJoinActions struct {
	shadow  bool
	actions []teamJoinAction
	l       zerolog.Logger
}
func NewTeamJoinActions(shadowMode bool, l zerolog.Logger) *TeamJoinActions {
	return &TeamJoinActions{shadow: shadowMode, l: l}
}
func (t *TeamJoinActions) Handler(ctx workqueue.Context, tj *slack.TeamJoinEvent) (bool, bool, error) {
	j := teamJoiner(tj.User)
	mention := mparser.Mention{
		Type: mparser.TypeUser,
		ID:   j.ID,
	}
	msg := NewMessage(j.ID, "im", j.ID, "", "", "", "", nil)
	msg.allMentions = []mparser.Mention{mention}
	msg.userMentions = []mparser.Mention{mention}
	resp := response{
		sc: ctx.Slack(),
		m:  msg,
	}
	var someWorked bool
	for _, a := range t.actions {
		if t.shadow {
			t.l.Info().
				Str("user_id", tj.User.ID).
				Bool("shadow_mode", true).
				Msg("would welcome user")
			continue
		}
		err := a.fn(ctx, j, resp)
		if err != nil {
			if someWorked {
				t.l.Error().
					Err(err).
					Str("join_action", a.name).
					Msg("failed to take action")
				return false, false, nil
			}
			return true, false, fmt.Errorf("failed to take join action: %w", err)
		}
		someWorked = true
	}
	return false, false, nil
}