コード例 #1
0
        public IActionResult CallStats()
        {
            var configs  = ConfigRepository.GetAllConfigurations();
            var commands = new List <CommandStatSummaryItem>();

            foreach (var config in configs)
            {
                var guild = DiscordClient.GetGuild(config.GuildIDSnowflake);

                commands.Add(new CommandStatSummaryItem()
                {
                    CallsCount       = config.UsedCount,
                    Command          = config.Command,
                    Group            = config.Group,
                    Guild            = guild == null ? $"UnknownGuild ({config.GuildIDSnowflake})" : $"{guild.Name}",
                    PermissionsCount = config.Permissions.Count
                });
            }

            return(View(new CallStatsViewModel(commands)));
        }