Esempio n. 1
0
        public bool IsCommandValid(string commandText)
        {
            var slackCommand = CommandParseService.ParseCommand(commandText);
            var command      = VirtualMachineCommandFactory.GetCommand(slackCommand);

            return(command != null);
        }
Esempio n. 2
0
        public void Execute(SlashCommandPayload slashCommandPayload)
        {
            // Parse the command
            var slackCommand = CommandParseService.ParseCommand(slashCommandPayload.Text);
            // Find the right command to execute
            var command = VirtualMachineCommandFactory.GetCommand(slackCommand);

            // Execute command
            command.Execute();

            // Send response to slack
            var responseModel = new SlashCommandResponse()
            {
                ResponseType = "in_channel",
                Text         = command.GetResultMessage()
            };

            SlackDelayedResponseService.SendDelayedResponse(slashCommandPayload.ResponseUrl, responseModel);
        }