37 lines
957 B
Go
37 lines
957 B
Go
|
|
package processor
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"github.com/slack-go/slack/socketmode"
|
||
|
|
"houston/internal/processor/action"
|
||
|
|
"houston/logger"
|
||
|
|
"houston/pkg/slackbot"
|
||
|
|
)
|
||
|
|
|
||
|
|
type SetTeamCommandProcessor struct {
|
||
|
|
socketModeClient *socketmode.Client
|
||
|
|
setTeamCommandAction *action.SetTeamCommandAction
|
||
|
|
}
|
||
|
|
|
||
|
|
const setTeamCommandProcessorLogTag = "[set_team_command_processor]"
|
||
|
|
|
||
|
|
func NewSetTeamCommandProcessor(
|
||
|
|
socketModeClient *socketmode.Client,
|
||
|
|
slackBot *slackbot.Client,
|
||
|
|
) *SetTeamCommandProcessor {
|
||
|
|
return &SetTeamCommandProcessor{
|
||
|
|
socketModeClient: socketModeClient,
|
||
|
|
setTeamCommandAction: action.NewSetTeamCommandAction(socketModeClient, slackBot),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (processor *SetTeamCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
|
||
|
|
defer func() {
|
||
|
|
if r := recover(); r != nil {
|
||
|
|
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", setTeamCommandProcessorLogTag, r.(error)))
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
|
||
|
|
processor.setTeamCommandAction.PerformAction(event)
|
||
|
|
}
|