コード例 #1
0
ファイル: InfoModule.cs プロジェクト: Nequss/Kipo
        public async Task Stats()
        {
            MetricsModule systemInfo = new MetricsModule();

            int users = 0;

            foreach (SocketGuild guild in Context.Client.Guilds)
            {
                users += guild.Users.Count;
            }

            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder.Color = Color.Purple;

            embedBuilder.WithAuthor(author =>
            {
                author.WithName("Kipo - Cutest bot in the universe!");
                author.WithIconUrl(Context.Client.CurrentUser.GetAvatarUrl());
            });

            embedBuilder.AddField("Guilds", Context.Client.Guilds.Count, true);
            embedBuilder.AddField("Users", users, true);
            embedBuilder.AddField("Version", "1.0", true);
            embedBuilder.AddField("Prefix", _config.prefix, true);
            embedBuilder.AddField("Created", Context.Client.CurrentUser.CreatedAt.UtcDateTime, true);
            embedBuilder.AddField("ID", Context.Client.CurrentUser.Id, true);
            embedBuilder.AddField("RAM", systemInfo.getMemoryUsedGB() + "GB / " + systemInfo.getMemoryMaxGB() + "GB", true);
            embedBuilder.AddField("CPU", systemInfo.getCpuNow() + "%", true);
            embedBuilder.AddField("Host OS", systemInfo.getOsPlatform(), true);
            embedBuilder.AddField("Library", "Discord.Net 2.2.0", true);
            embedBuilder.AddField("Creator", "Nequs#6848", true);
            embedBuilder.AddField("Support server", "https://discord.com/XR5HG7Yayz", true);

            await Context.Channel.SendMessageAsync(embed : embedBuilder.Build());
        }