* TP-49403 | parameterized slash command * TP-49403 | handeling resolve and rca params also implemented Help-Commands button * TP-49403 | using command pattern for command resolutiuon and execution * TP-49403 | made find team by name and find severity by name queries case insensitive * TP-49403 | updating help message keys
39 lines
1020 B
Go
39 lines
1020 B
Go
package processor
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/slack-go/slack/socketmode"
|
|
"houston/internal/processor/action"
|
|
"houston/logger"
|
|
"houston/pkg/slackbot"
|
|
"houston/service/rca"
|
|
)
|
|
|
|
type HoustonCommandProcessor struct {
|
|
socketModeClient *socketmode.Client
|
|
houstonCommandAction *action.HoustonCommandAction
|
|
}
|
|
|
|
const houstonCommandProcessorLogTag = "[houston_command_processor]"
|
|
|
|
func NewHoustonCommandProcessor(
|
|
socketModeClient *socketmode.Client,
|
|
slackBot *slackbot.Client,
|
|
rcaService *rca.RcaService,
|
|
) *HoustonCommandProcessor {
|
|
return &HoustonCommandProcessor{
|
|
socketModeClient: socketModeClient,
|
|
houstonCommandAction: action.NewHoustonCommandAction(socketModeClient, slackBot, rcaService),
|
|
}
|
|
}
|
|
|
|
func (processor *HoustonCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", houstonCommandProcessorLogTag, r.(error)))
|
|
}
|
|
}()
|
|
|
|
processor.houstonCommandAction.PerformAction(event)
|
|
}
|