Browse Source

Add Mono Runtime in version

Stuart Johnson 1 year ago
parent
commit
f3a33a2bfb
1 changed files with 14 additions and 0 deletions
  1. 14 0
      TFA-Bot/DiscordBot/Commands/clsVersion.cs

+ 14 - 0
TFA-Bot/DiscordBot/Commands/clsVersion.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
 using DSharpPlus.EventArgs;
@@ -23,6 +24,19 @@ namespace TFABot.DiscordBot.Commands
             var sb = new StringBuilder();
             sb.Append("```");
             sb.AppendLine(clsGitHead.GetHeadToString());
+
+            try
+            {
+                Type type = Type.GetType("Mono.Runtime");
+                if (type != null)
+                {
+                    MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
+                    if (displayName != null) sb.AppendLine($"Mono Runtime: {displayName.Invoke(null, null)}");
+                }
+            }
+            catch { } ;
+            
+            
             sb.Append("```");
             e.Channel.SendMessageAsync(sb.ToString());
         }