diff --git a/BetterSecondbot/DiscordSupervisor/Inbound.cs b/BetterSecondbot/DiscordSupervisor/Inbound.cs index 62f9740..d2e7067 100644 --- a/BetterSecondbot/DiscordSupervisor/Inbound.cs +++ b/BetterSecondbot/DiscordSupervisor/Inbound.cs @@ -127,6 +127,7 @@ namespace BetterSecondBot.DiscordSupervisor { reply = controler.getBot().CallAPI(bits[0], args.Split("~#~"), target); } + await MarkMessage(message, "✅").ConfigureAwait(false); await message.Channel.SendMessageAsync(reply, false, null,null,null, new MessageReference(message.Id)).ConfigureAwait(false); } else diff --git a/Core/bottypes/CommandsBot.cs b/Core/bottypes/CommandsBot.cs index 9e41c8f..6696d7a 100644 --- a/Core/bottypes/CommandsBot.cs +++ b/Core/bottypes/CommandsBot.cs @@ -406,8 +406,9 @@ namespace BetterSecondBot.bottypes if (customcommand == true) { SmartCommandReply(false, replyvia, "Custom command lockout", command); - return "{ status: \"false\", message: \"Custom command lockout\" }"; + return "Custom command lockout"; } + int commands_issued = 0; foreach (string A in custom_commands[command]) { List command_args_split = A.Split(new[] { "|||" }, StringSplitOptions.RemoveEmptyEntries).ToList(); @@ -423,12 +424,13 @@ namespace BetterSecondBot.bottypes } } CallAPI(command_args_split[0], args_passed.Split("~#~"), "None", true); + commands_issued++; } - return "{ status: \"true\", message: \"mixed reply custom command\" }"; + return "Issued "+ commands_issued.ToString()+" commands"; } public string CallAPI(string command, string[] args, string replyvia, bool customcommand) { - if(command == null) + if (command == null) { return "No command"; } @@ -436,6 +438,7 @@ namespace BetterSecondBot.bottypes { replyvia = "none"; } + KeyValuePair statusreply = new KeyValuePair(false, "Not processed"); if (commandnameLowerToReal.ContainsKey(command.ToLowerInvariant()) == false) { if (custom_commands.ContainsKey(command) == false) @@ -443,9 +446,12 @@ namespace BetterSecondBot.bottypes SmartCommandReply(false, replyvia, "Unknown command", command); return "{ status: \"false\", message: \"Unknown\" }"; } - customCommand(command, args, replyvia, customcommand); + statusreply = new KeyValuePair(true, customCommand(command, args, replyvia, customcommand)); + } + else + { + statusreply = callAPIcommand(command, args); } - KeyValuePair statusreply = callAPIcommand(command, args); SmartCommandReply(statusreply.Key, replyvia, statusreply.Value, command); return "{ status: \"" + statusreply.Key.ToString() + "\", message: \""+ statusreply.Value+"\" command: \""+command+"\", args: \""+string.Join("~#~",args)+"\" }"; }