Files
houston-be/internal/processor/slash_command_processor.go
Shubham Kirve b135eade9c Revert "Revert "TP-0000 | restricting incident creation from private channels"" (#63)
* Revert "Revert "TP-0000 | restricting incident creation from private channels (#60)" (#62)"

This reverts commit b3eed5dd63.

* TP-0000 | allow incident creation from channels where houston is invited

* TP-0000 | renaming functions

* TP-0000 | making desc mandatory
2023-05-11 17:56:34 +05:30

36 lines
994 B
Go

package processor
import (
"fmt"
"houston/internal/processor/action"
"houston/model/incident"
"houston/pkg/slackbot"
"github.com/slack-go/slack/socketmode"
"go.uber.org/zap"
)
type SlashCommandProcessor struct {
logger *zap.Logger
socketModeClient *socketmode.Client
slashCommandAction *action.SlashCommandAction
}
func NewSlashCommandProcessor(logger *zap.Logger, socketModeClient *socketmode.Client, incidentService *incident.Repository, slackBot *slackbot.Client) *SlashCommandProcessor {
return &SlashCommandProcessor{
logger: logger,
socketModeClient: socketModeClient,
slashCommandAction: action.NewSlashCommandAction(incidentService, logger, socketModeClient, slackBot),
}
}
func (scp *SlashCommandProcessor) ProcessSlashCommand(event socketmode.Event) {
defer func() {
if r := recover(); r != nil {
scp.logger.Error(fmt.Sprintf("[SCP] Exception occurred: %v", r.(error)))
}
}()
scp.slashCommandAction.PerformAction(&event)
}