public Task <SlackMessage> SendActionMessage(string channel, string message, SlackInteractiveMessage messageData) { var ts = new TaskCompletionSource <SlackMessage>(); var actions = new List <AttachmentAction>(); foreach (var button in messageData.Buttons) { actions.Add(new AttachmentAction(button.Name, button.Text)); } Slack.PostMessage( _ => { ProcessCompletion(ts, channel, _); }, channel, message, as_user: true, attachments: new Attachment[] { new Attachment() { title = messageData.Text, text = messageData.Description, callback_id = messageData.CallbackId, actions = actions.ToArray() } }); return(ts.Task); }
protected void SendActionMessage(SlackChannel channel, string message, SlackInteractiveMessage messageData) { SendActionMessageAsync(channel, message, messageData); }
protected Task <SlackMessage> SendActionMessageAsync(SlackChannel channel, string message, SlackInteractiveMessage messageData) { return(Slack.SendActionMessage(channel.Name, message, messageData)); }
protected Task <string> SendActionMessageAndWait(SlackChannel channel, string message, SlackInteractiveMessage messageData) { return(Slack.SendActionMessageAndWait(channel.Name, message, messageData)); }
public Task <string> SendActionMessageAndWait(string channel, string message, SlackInteractiveMessage messageData) { var requestId = (new Guid()).ToString(); var tcs = new TaskCompletionSource <string>(); SQSSubscriber.WaitFor(requestId, (selected) => { tcs.SetResult(selected); }); messageData.CallbackId = requestId; SendActionMessage(channel, message, messageData); return(tcs.Task); }