public Message ToSlackMessage(WorkItemChangedNotification notification, BotElement bot, string channel) { string header = notification.ToMessage(bot, s => s).First(); var fields = new[] { new AttachmentField(bot.Text.State, notification.State, true), new AttachmentField(bot.Text.AssignedTo, notification.AssignedTo, true) }; return SlackHelper.CreateSlackMessage(header, fields, bot, channel, bot.GetSetting("standardColor")); }
public Message ToSlackMessage(WorkItemCommentNotification notification, BotElement bot, string channel) { string header = notification.ToMessage(bot, s => s).First(); var fields = new[] { new AttachmentField(bot.Text.Comment, notification.Comment, false) }; return SlackHelper.CreateSlackMessage(header, fields, bot, channel, bot.GetSetting("standardColor")); }
public Message ToSlackMessage(ReleaseEnvironmentCompletedNotification notification, BotElement bot, string channel, bool asUser) { string header = notification.ToMessage(bot, s => s).First(); string color = null; if (notification.EnvironmentStatus == EnvironmentStatus.Succeeded) color = bot.GetSetting("successColor"); else if (notification.EnvironmentStatus == EnvironmentStatus.Rejected || notification.EnvironmentStatus == EnvironmentStatus.Canceled) color = bot.GetSetting("errorColor"); else color = bot.GetSetting("standardColor"); var fields = new[] { new AttachmentField(notification.EnvironmentName, notification.EnvironmentStatus.ToString(), false) }; return SlackHelper.CreateSlackMessage(header, fields, bot, channel, color, asUser); }