public async Task <IActionResult> Post([FromServices] ISlackClient slackClient, [FromForm] SlackRequest slackRequest, CancellationToken cancellationToken)
        {
            await slackClient.PostOnChannelAsync(slackRequest.TeamDomain, slackRequest.ChannelId, "command [list]", cancellationToken);

            return(Ok(new SlackResponse
            {
                ResponseType = SlackResponseType.InChannel,
                Text = "teste"
            }));
        }
Beispiel #2
0
        public async Task <IActionResult> Post([FromServices] ISlackClient slackClient, [FromForm] SlackRequest slackRequest, CancellationToken cancellationToken)
        {
            await slackClient.PostOnChannelAsync(slackRequest.TeamDomain, slackRequest.ChannelId, "command [not_found]", cancellationToken);

            return(Ok(new SlackResponse
            {
                ResponseType = SlackResponseType.InChannel,
                Text = $"Sorry. [{slackRequest.Command} {slackRequest.Text}] is not a valid command. 😟" +
                       $"Try using [{slackRequest.Command} help] instead."
            }));
        }
        public async Task <IActionResult> Help([FromServices] ISlackClient slackClient, [FromForm] SlackRequest slackRequest, [FromQuery] string extraParameters, CancellationToken cancellationToken)
        {
            await slackClient.PostOnChannelAsync(slackRequest.TeamDomain, slackRequest.ChannelId, $"command [list help] parameters: [{extraParameters}]", cancellationToken);

            return(Ok(new SlackResponse
            {
                ResponseType = SlackResponseType.InChannel,
                Text = String.Join(Environment.NewLine, new List <string>
                {
                    $"Hey, there!",
                    $"This is the [{slackRequest.Command} list]. With it you can"
                }),
                Attachments = new List <SlackAttachment>
                {
                    new SlackAttachment
                    {
                        Text = $"List flags: Try [{slackRequest.Command} list flags] list all available flags."
                    }
                }
            }));
        }
        public async Task <IActionResult> Post([FromServices] ISlackClient slackClient, [FromForm] SlackRequest slackRequest, CancellationToken cancellationToken)
        {
            await slackClient.PostOnChannelAsync(slackRequest.TeamDomain, slackRequest.ChannelId, "command [help]", cancellationToken);

            return(Ok(new SlackResponse
            {
                ResponseType = SlackResponseType.InChannel,
                Text = string.Join(Environment.NewLine, new List <string>
                {
                    $"Welcome to [{slackRequest.Command} help]!",
                    $"The available commands are:"
                }),
                Attachments = new List <SlackAttachment>
                {
                    new SlackAttachment
                    {
                        Text = $"List: Try [{slackRequest.Command} list help] to know details."
                    }
                }
            }));
        }