Example #1
0
        public async Task PrintTemplateInfo(string templateId)
        {
            var template = await GetTemplate(templateId);

            if (template == null)
            {
                await ReplyAsync("No template by that name could be found");

                return;
            }

            var kvps        = _templateConfigurationService.GetPropertyData(template);
            var pageBuilder = new PageFormatBuilder()
                              .AddColumn("Property Key")
                              .AddColumn("Property Name")
                              .AddColumn("Current Value")
                              .AlternateRowColors();

            pageBuilder.AddRow(new[] { "N/A", "Template Name", template.Id });
            foreach (var kvp in kvps)
            {
                pageBuilder.AddRow(new[] { kvp.Key.ToString(), kvp.Name, kvp.Value.ToString() });
            }

            await _pageService.SendPages(Context.Channel, pageBuilder.Build());
        }
Example #2
0
        public async Task PrintConfig()
        {
            var config = await AddOrGetRaidTemplate();

            var configPropertyData =
                _templateConfigurationService.GetPropertyData(config).ToList().OrderBy(pi => pi.Key);
            var pageBuilder = new PageFormatBuilder()
                              .AddColumn("Property Key")
                              .AddColumn("Property Name")
                              .AddColumn("Current Value")
                              .AlternateRowColors();

            foreach (var kvp in configPropertyData)
            {
                var valueString = kvp.Value.ToString();
                if (kvp.Key == typeof(RecurringRaidTemplate)
                    .GetProperty(nameof(RecurringRaidTemplate.ResetDayOfWeek))
                    .GetCustomAttribute <ConfigurationKeyAttribute>().Key)
                {
                    valueString = $"{kvp.Value} ({((DayOfWeek) kvp.Value)})";
                }

                pageBuilder.AddRow(new[] { kvp.Key.ToString(), kvp.Name, valueString });
            }

            await _pageService.SendPages(Context.Channel, pageBuilder.Build());
        }