public Message ToSlackMessage(ICommentNotification notification, BotElement bot, string channel, bool asUser) { 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"), asUser)); }
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(WorkItemChangedNotification notification, BotElement bot, string channel) { string header = notification.ToMessage(bot, s => s).First(); var fields = new List <AttachmentField>(); var searchType = notification.IsNew ? SearchFieldsType.Core : SearchFieldsType.Changed; var displayFieldsKey = notification.IsNew ? "wiCreatedDisplayFields" : "wiChangedDisplayFields"; foreach (var fieldId in bot.GetCsvSetting(displayFieldsKey, Defaults.WorkItemFields)) { var field = notification.GetUnifiedField(fieldId, searchType); if (field != null) { var fieldrep = notification.IsNew ? field.NewValue : bot.Text.WorkItemFieldTransitionFormat.FormatWith(field); fields.Add(new AttachmentField(field.Name, fieldrep, true)); } } 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)); }
public Message ToSlackMessage(INotification notification, BotElement bot, string channel) { var lines = notification.ToMessage(bot, s => s); return(SlackHelper.CreateSlackMessage(lines, bot, channel, bot.GetSetting("standardColor"))); }
public Message ToSlackMessage(INotification notification, BotElement bot, string channel, bool asUser) { var lines = notification.ToMessage(bot, s => s); return(SlackHelper.CreateSlackMessage(lines, bot, channel, asUser)); }