37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
|
|
package processor
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"github.com/slack-go/slack/socketmode"
|
||
|
|
"houston/internal/processor/action"
|
||
|
|
"houston/logger"
|
||
|
|
"houston/pkg/slackbot"
|
||
|
|
)
|
||
|
|
|
||
|
|
type StartIncidentCommandProcessor struct {
|
||
|
|
socketModeClient *socketmode.Client
|
||
|
|
startIncidentCommandAction *action.StartIncidentCommandAction
|
||
|
|
}
|
||
|
|
|
||
|
|
const StartIncidentCommandProcessorLogTag = "[start_incident_command_processor]"
|
||
|
|
|
||
|
|
func NewStartIncidentCommandProcessor(
|
||
|
|
socketModeClient *socketmode.Client,
|
||
|
|
slackBot *slackbot.Client,
|
||
|
|
) *StartIncidentCommandProcessor {
|
||
|
|
return &StartIncidentCommandProcessor{
|
||
|
|
socketModeClient: socketModeClient,
|
||
|
|
startIncidentCommandAction: action.NewStartIncidentCommandAction(socketModeClient, slackBot),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (processor *StartIncidentCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
|
||
|
|
defer func() {
|
||
|
|
if r := recover(); r != nil {
|
||
|
|
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", StartIncidentCommandProcessorLogTag, r.(error)))
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
|
||
|
|
processor.startIncidentCommandAction.PerformAction(event)
|
||
|
|
}
|