diff --git a/Assembly/ASMInfo.cs b/Assembly/ASMInfo.cs index b4b6525..bfdd4ec 100644 --- a/Assembly/ASMInfo.cs +++ b/Assembly/ASMInfo.cs @@ -6,7 +6,7 @@ using System.Reflection; [assembly: AssemblyCompany("ZNI")] [assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)] [assembly: AssemblyCopyright("(C) 2020 Tara Piccari")] -[assembly: AssemblyFileVersion("5.3.929")] +[assembly: AssemblyFileVersion("5.4.014")] [assembly: AssemblyDescription("Second Life Bot - BotCore5")] @@ -15,7 +15,7 @@ namespace Bot.Assemble public class ASMInfo { public static string BotName = "ZBotCore"; - public static string BotVer = "5.3.929"; + public static string BotVer = "5.4.014"; public static string GitPassword { get diff --git a/CommandSystem/BaseHooks.cs b/CommandSystem/BaseHooks.cs index 40b0d39..0640afd 100644 --- a/CommandSystem/BaseHooks.cs +++ b/CommandSystem/BaseHooks.cs @@ -146,5 +146,38 @@ namespace Bot.CommandSystem { CommandRegistry.Instance.PrintHelp(source, additionalArgs[0], client); } + + + [CommandGroup("disable", 6, 1, "disable [string] - Disables a command", Destinations.DEST_AGENT | Destinations.DEST_GROUP | Destinations.DEST_LOCAL)] + public void DisableCmd(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) + { + if (!MainConfiguration.Instance.DisabledCommands.Contains(additionalArgs[0])) + { + MHE(source, client, "Disabling command..."); + MainConfiguration.Instance.DisabledCommands.Add(additionalArgs[0]); + MHE(source, client, "Command successfully disabled"); + MainConfiguration.Instance.Save(); + } else + { + MHE(source, client, "Error: Command is already disabled"); + } + } + + + [CommandGroup("enable", 6, 1, "enable [string] - Enables a command", Destinations.DEST_AGENT | Destinations.DEST_GROUP | Destinations.DEST_LOCAL)] + public void EnableCmd(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) + { + if (MainConfiguration.Instance.DisabledCommands.Contains(additionalArgs[0])) + { + MHE(source, client, "Enabling command..."); + MainConfiguration.Instance.DisabledCommands.Remove(additionalArgs[0]); + MainConfiguration.Instance.Save(); + MHE(source, client, "Command successfully enabled"); + } + else + { + MHE(source, client, "Error: That command is not disabled!"); + } + } } } diff --git a/CommandSystem/CommandRegistry.cs b/CommandSystem/CommandRegistry.cs index 1743e83..190a4e4 100644 --- a/CommandSystem/CommandRegistry.cs +++ b/CommandSystem/CommandRegistry.cs @@ -228,7 +228,11 @@ namespace Bot.CommandSystem } else { - + if (MainConfiguration.Instance.DisabledCommands.Contains(cgX.Command)) + { + BaseCommands.MH(source, user, "Error: That command is disabled"); + return; + } var ovj = Activator.CreateInstance(cgX.AssignedMethod.DeclaringType); string[] additionalArgs = new string[cgX.arguments]; IgnoreCount = cgX.arguments; diff --git a/ConfigSystem/MainConfiguration.cs b/ConfigSystem/MainConfiguration.cs index 2479df6..3c770b3 100644 --- a/ConfigSystem/MainConfiguration.cs +++ b/ConfigSystem/MainConfiguration.cs @@ -72,6 +72,8 @@ namespace Bot public List AuthedGithubUsers { get; set; } = new List(); + public List DisabledCommands { get; set; } = new List(); + public bool Authed(string GHLogin) { if (AuthedGithubUsers.Contains(GHLogin)) return true;