public static Slack.Message CreateSlackMessage(string header, IList <AttachmentField> fields, BotElement bot, string channel, string color) { if (header == null) { return(null); } var message = new Slack.Message() { Channel = channel, Username = bot.GetSetting("username"), Attachments = new[] { new Attachment() { Fallback = header, Pretext = header, Color = color, Fields = fields } } }; if (!String.IsNullOrEmpty(bot.GetSetting("iconUrl"))) { message.IconUrl = bot.GetSetting("iconUrl"); } else if (!String.IsNullOrEmpty(bot.GetSetting("iconEmoji"))) { message.IconEmoji = bot.GetSetting("iconEmoji"); } return(message); }
public static Slack.Message CreateSlackMessage(string header, IEnumerable<AttachmentField> fields, BotElement bot, string channel, string color) { if (header == null) return null; var message = new Slack.Message() { Channel = channel, Username = bot.GetSetting("username"), Attachments = new[] { new Attachment() { Fallback = header, Pretext = header, Color = color, Fields = fields } } }; if (!String.IsNullOrEmpty(bot.GetSetting("iconUrl"))) message.IconUrl = bot.GetSetting("iconUrl"); else if (!String.IsNullOrEmpty(bot.GetSetting("iconEmoji"))) message.IconEmoji = bot.GetSetting("iconEmoji"); return message; }