Beispiel #1
0
        private Task UpdateMessageForUser(string answerText, string questionText, InvocationPayloadRequest request)
        {
            var message = $"{SpeechBalloon}\n" +
                          $"*Your answer:* _{answerText}_\n" +
                          $"*On question:* _{questionText}_\n" +
                          "*Your answer will be recorded in a moment. Thank you!*";

            return(_slackClient.UpdateMessageAsync(
                       request.State,
                       request.Channel.Id,
                       message));
        }
Beispiel #2
0
        private Task DefinePayloadTypeAndInvokeMethod(InvocationPayloadRequest invocation, string payload)
        {
            switch (invocation.Type)
            {
            case MessageType.InteractiveMessage:
                var interactiveMessage = JsonConvert.DeserializeObject <InteractiveMessage>(payload, _defaultSlackSerializerSettings);
                return(_interactiveMessageService.ProcessRequest(interactiveMessage));

            case MessageType.DialogSubmission:
                var submissionType = _submissionSelectService.Choose(invocation.CallbackId);
                var dialog         = JsonConvert.DeserializeObject(payload, submissionType, _defaultSlackSerializerSettings);
                return(_slackExecutorService.ExecuteSubmission(dialog.GetType(), dialog));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }