Files
houston-be/internal/processor/set_description_command_processor.go

37 lines
1.0 KiB
Go
Raw Normal View History

package processor
import (
"fmt"
"github.com/slack-go/slack/socketmode"
"houston/internal/processor/action"
"houston/logger"
"houston/pkg/slackbot"
)
type SetDescriptionCommandProcessor struct {
socketModeClient *socketmode.Client
setDescriptionCommandAction *action.SetDescriptionCommandAction
}
const setDescriptionCommandProcessorLogTag = "[set_description_command_processor]"
func NewSetDescriptionCommandProcessor(
socketModeClient *socketmode.Client,
slackBot *slackbot.Client,
) *SetDescriptionCommandProcessor {
return &SetDescriptionCommandProcessor{
socketModeClient: socketModeClient,
setDescriptionCommandAction: action.NewSetDescriptionCommandAction(socketModeClient, slackBot),
}
}
func (processor *SetDescriptionCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
defer func() {
if r := recover(); r != nil {
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", setDescriptionCommandProcessorLogTag, r.(error)))
}
}()
processor.setDescriptionCommandAction.PerformAction(event)
}