Esempio n. 1
0
            public async Task StatsAsync()
            {
                var embed = new LocalEmbedBuilder
                {
                    Color  = RiasUtilities.ConfirmColor,
                    Author = new LocalEmbedAuthorBuilder
                    {
                        Name    = GetText(Localization.UtilityStats, RiasBot.CurrentUser.Name, Rias.Version),
                        IconUrl = RiasBot.CurrentUser.GetAvatarUrl()
                    },
                    ThumbnailUrl = RiasBot.CurrentUser.GetAvatarUrl(),
                    Footer       = new LocalEmbedFooterBuilder().WithText("© 2018-2020 Copyright: Koneko#0001")
                }.AddField(GetText(Localization.UtilityAuthor), Rias.Author, true)
                .AddField(GetText(Localization.UtilityBotId), RiasBot.CurrentUser.Id, true)
                .AddField(GetText(Localization.UtilityMasterId), Credentials.MasterId, true)
                .AddField(GetText(Localization.UtilityShard), $"{RiasBot.GetShardId(Context.Guild?.Id ?? 0) + 1}/{RiasBot.Shards.Count}", true)
                .AddField(GetText(Localization.UtilityInServer), Context.Guild?.Name ?? "-", true)
                .AddField(GetText(Localization.UtilityCommandsAttempted), CommandHandlerService.CommandsAttempted, true)
                .AddField(GetText(Localization.UtilityCommandsExecuted), CommandHandlerService.CommandsExecuted, true)
                .AddField(GetText(Localization.UtilityUptime), Rias.UpTime.Elapsed.Humanize(5, new CultureInfo(Localization.GetGuildLocale(Context.Guild?.Id)),
                                                                                            TimeUnit.Month, TimeUnit.Second), true)
                .AddField(GetText(Localization.UtilityPresence), $"{RiasBot.Guilds.Count} {GetText(Localization.UtilityServers)}\n" +
                          $"{RiasBot.Guilds.Sum(x => x.Value.TextChannels.Count)} {GetText(Localization.UtilityTextChannels)}\n" +
                          $"{RiasBot.Guilds.Sum(x => x.Value.TextChannels.Count)} {GetText(Localization.UtilityVoiceChannels)}\n" +
                          $"{RiasBot.Users.Count} {GetText(Localization.CommonUsers)}\n", true);

                var          links     = new StringBuilder();
                const string delimiter = " • ";

                if (!string.IsNullOrEmpty(Credentials.OwnerServerInvite))
                {
                    var ownerServer = RiasBot.GetGuild(Credentials.OwnerServerId);
                    links.Append(delimiter)
                    .Append(GetText(Localization.HelpSupportServer, ownerServer.Name, Credentials.OwnerServerInvite))
                    .Append("\n");
                }

                if (links.Length > 0)
                {
                    links.Append(delimiter);
                }
                if (!string.IsNullOrEmpty(Credentials.Invite))
                {
                    links.Append(GetText(Localization.HelpInviteMe, Credentials.Invite)).Append("\n");
                }

                if (links.Length > 0)
                {
                    links.Append(delimiter);
                }
                if (!string.IsNullOrEmpty(Credentials.Website))
                {
                    links.Append(GetText(Localization.HelpWebsite, Credentials.Website)).Append("\n");
                }

                if (links.Length > 0)
                {
                    links.Append(delimiter);
                }
                if (!string.IsNullOrEmpty(Credentials.Patreon))
                {
                    links.Append(GetText(Localization.HelpDonate, Credentials.Patreon)).Append("\n");
                }

                embed.AddField(GetText(Localization.HelpLinks), links.ToString());

                await ReplyAsync(embed);
            }