public async Task Say(BotMessage message) { if (string.IsNullOrEmpty(message.ChatHub?.Id)) { throw new MissingChannelException("When calling the Say() method, the message parameter must have its ChatHub property set."); } var client = _connectionFactory.CreateChatClient(); //This uses manual fillout. Lets simplify things shall we? //await client.PostMessage(SlackKey, message.ChatHub.Id, message.Text, message.Attachments); //By passing the message directly we can more easily control fields. await client.PostMessage(SlackKey, message); }
public async Task Say(BotMessage message) { if (string.IsNullOrEmpty(message.ChatHub?.Id)) { throw new MissingChannelException("When calling the Say() method, the message parameter must have its ChatHub property set."); } var client = _connectionFactory.CreateChatClient(); await client.PostMessage(SlackKey, message.ChatHub.Id, message.Text, message.Attachments); }
public async Task <SlackMessagePosted> Say(BotMessage message) { if (string.IsNullOrEmpty(message.ChatHub?.Id)) { throw new MissingChannelException("When calling the Say() method, the message parameter must have its ChatHub property set."); } var client = _connectionFactory.CreateChatClient(); var response = await client.PostMessage(SlackKey, message.ChatHub.Id, message.Text, message.Attachments); if (response == null) { return(null); } return(new SlackMessagePosted() { TimeStamp = response.TimeStamp, Channel = response.Channel, Message = response.Message }); }