From fa0b2211dc4a2393ed83bada7a9749a1eea655fb Mon Sep 17 00:00:00 2001 From: Madpeter Date: Mon, 27 Apr 2020 00:48:30 +0100 Subject: [PATCH] improvements to the args system when no args are given. --- Core/Commands/commandlib.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Core/Commands/commandlib.cs b/Core/Commands/commandlib.cs index 9576f0f..a2ea41e 100644 --- a/Core/Commands/commandlib.cs +++ b/Core/Commands/commandlib.cs @@ -212,9 +212,14 @@ namespace BSB.Commands if (cmd != null) { cmd.Setup(bot, caller); + string[] args = new string[] { }; + if (helpers.notempty(arg) == true) + { + args = arg.Split(new string[] { "~#~" }, StringSplitOptions.None); + } if ((cmd.ArgTypes.Contains("Avatar") == true) || (cmd.ArgTypes.Contains("Smart") == true)) { - string[] args = arg.Split(new string[] { "~#~" }, StringSplitOptions.None); + if (cmd.MinArgs <= args.Length) { pending_avatar_lookup pending = new pending_avatar_lookup(this, cmd, args); @@ -241,7 +246,7 @@ namespace BSB.Commands } else { - return cmd.CallFunction(arg.Split(new string[] { "~#~" }, StringSplitOptions.None)); + return cmd.CallFunction(args); } } else @@ -253,7 +258,6 @@ namespace BSB.Commands } return false; } - } public bool Call(string command, string arg,UUID caller) {