From 8895d9679d5caa859082ed2a1aed4434b95c24a2 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Wed, 6 Mar 2019 15:18:12 +0500 Subject: [PATCH] more stats --- CompatBot/Commands/BotStats.cs | 6 +++++- CompatBot/Utils/SandboxDetector.cs | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CompatBot/Utils/SandboxDetector.cs diff --git a/CompatBot/Commands/BotStats.cs b/CompatBot/Commands/BotStats.cs index c6890088..f6c4cd84 100644 --- a/CompatBot/Commands/BotStats.cs +++ b/CompatBot/Commands/BotStats.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using System.Numerics; using System.Text; using System.Threading.Tasks; using CompatApiClient.Utils; @@ -30,7 +31,10 @@ namespace CompatBot.Commands .AddField("Discord latency", $"{ctx.Client.Ping} ms", true) .AddField("GitHub rate limit", $"{GithubClient.Client.RateLimitRemaining} out of {GithubClient.Client.RateLimit} calls available\nReset in {(GithubClient.Client.RateLimitResetTime - DateTime.UtcNow).AsShortTimespan()}", true) .AddField("Google Drive API", File.Exists(Config.GoogleApiConfigPath) ? "✅ Configured" : "❌ Not configured") - .AddField(".NET versions", $"Runtime {System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion()}\n{System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}", true); + .AddField(".NET versions", $"Runtime {System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion()}\n" + + $"{System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}\n" + + $"SIMD Acceleration:{(Vector.IsHardwareAccelerated ? "✅ Supported" : "❌ Not supported")}\n" + + $"Confinement: {SandboxDetector.Detect() ?? "None"}", true); AppendPiracyStats(embed); AppendCmdStats(ctx, embed); AppendExplainStats(embed); diff --git a/CompatBot/Utils/SandboxDetector.cs b/CompatBot/Utils/SandboxDetector.cs new file mode 100644 index 00000000..2d3e33a7 --- /dev/null +++ b/CompatBot/Utils/SandboxDetector.cs @@ -0,0 +1,18 @@ +using System; + +namespace CompatBot.Utils +{ + public static class SandboxDetector + { + public static string Detect() + { + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SNAP"))) + return "Snap"; + + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("FLATPAK_SYSTEM_DIR"))) + return "Flatpak"; + + return null; + } + } +}