Example #1
0
        public async Task DoGetRecruitmentStats()
        {
            if (await _permManager.IsAllowedAsync(PermissionType.ManageRecruitment, Context.User))
            {
                _recruitmentService.RStatDbUpdate();
                var builder = new EmbedBuilder();
                builder.WithTitle($"Recruitment statistics:");
                builder.WithDescription($"-- DataSource DB : Last updated just now --{Environment.NewLine}" +
                                        $"Sent (API): {_recruitmentService.ApiSent}{Environment.NewLine}" +
                                        $"Pending (API): {_recruitmentService.ApiPending}{Environment.NewLine}" +
                                        $"Failed (API): {_recruitmentService.ApiFailed}{Environment.NewLine}" +
                                        $"Skipped (API) : {_recruitmentService.ApiSkipped}{Environment.NewLine}{Environment.NewLine}" +
                                        $"-- DataSource Dump : Last updated {DateTime.UtcNow.Subtract(DumpDataService.LastDumpUpdateTimeUtc).ToString("h'h 'm'm 's's'")} ago --{Environment.NewLine}" +
                                        $"Recruited (API): {_recruitmentService.ApiRecruited} ({_recruitmentService.ApiRatio.ToString(_locale)}%){Environment.NewLine}" +
                                        $"Reserved (Manual): {_recruitmentService.ManualReserved}{Environment.NewLine}" +
                                        $"Recruited (Manual): {_recruitmentService.ManualRecruited} ({_recruitmentService.ManualRatio.ToString(_locale)}%){Environment.NewLine}" +
                                        $"{Environment.NewLine}" +
                                        $"Recruited Today: A: {_recruitmentService.RecruitedTodayA}, M: {_recruitmentService.RecruitedTodayM}{Environment.NewLine}" +
                                        $"Recruited Yesterday: A: {_recruitmentService.RecruitedYesterdayA}, M: {_recruitmentService.RecruitedYesterdayM}{Environment.NewLine}" +
                                        $"Recruited Last Week: A: {_recruitmentService.RecruitedLastWeekA}, M: {_recruitmentService.RecruitedLastWeekM}{Environment.NewLine}" +
                                        $"Recruited Last Week (Avg/D): A: {_recruitmentService.RecruitedLastWeekAvgDA.ToString("0.00", _locale)}, M: {_recruitmentService.RecruitedLastWeekAvgDM.ToString("0.00", _locale)}{Environment.NewLine}" +
                                        $"Recruited Last Month: A: {_recruitmentService.RecruitedLastMonthA}, M: {_recruitmentService.RecruitedLastMonthM}{Environment.NewLine}" +
                                        $"Recruited Last Month (Avg/D): A: {_recruitmentService.RecruitedLastMonthAvgDA.ToString("0.00", _locale)}, M: {_recruitmentService.RecruitedLastMonthAvgDM.ToString("0.00", _locale)}{Environment.NewLine}{Environment.NewLine}" +
                                        $"Recruits which CTE'd or left the region are excluded.");
                builder.WithFooter($"NationStatesApiBot {AppSettings.VERSION} by drehtisch");

                await ReplyAsync(embed : builder.Build());
            }
            else
            {
                await ReplyAsync(AppSettings.PERMISSION_DENIED_RESPONSE);
            }
        }