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