adds custom commands back to discord interface
adds custom commands back to discord interface and fixs a bug with unpacking
This commit is contained in:
parent
8c6d2a9701
commit
7103428c32
2 changed files with 31 additions and 16 deletions
|
|
@ -106,24 +106,25 @@ namespace BetterSecondBot.DiscordSupervisor
|
|||
else
|
||||
{
|
||||
string[] bits = message.Content.Split("|||");
|
||||
if(bits.Length >= 2)
|
||||
string target = "None";
|
||||
if (bits.Length == 3)
|
||||
{
|
||||
string target = "None";
|
||||
if (bits.Length == 3)
|
||||
{
|
||||
target = bits[2];
|
||||
}
|
||||
if (controler.Bot.getFullListOfCommands().Contains(bits[0].ToLowerInvariant()) == true)
|
||||
{
|
||||
controler.Bot.CallAPI(bits[0], bits[1].Split("~#~"), target);
|
||||
await MarkMessage(message, "✅").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
await MarkMessage(message, "❌").ConfigureAwait(false);
|
||||
}
|
||||
target = bits[2];
|
||||
}
|
||||
string args = "";
|
||||
if (bits.Length == 3)
|
||||
{
|
||||
args = bits[1];
|
||||
}
|
||||
if (controler.Bot.GetFullListOfCommandsWithCustoms().Contains(bits[0].ToLowerInvariant()) == true)
|
||||
{
|
||||
controler.Bot.CallAPI(bits[0], args.Split("~#~"), target);
|
||||
await MarkMessage(message, "✅").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
await MarkMessage(message, "❌").ConfigureAwait(false);
|
||||
}
|
||||
await MarkMessage(message, "❌").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,20 @@ namespace BetterSecondBot.bottypes
|
|||
return output.ToArray();
|
||||
}
|
||||
|
||||
public string[] GetFullListOfCommandsWithCustoms()
|
||||
{
|
||||
List<string> output = new List<string>();
|
||||
foreach (string A in endpointcommandmap.Keys)
|
||||
{
|
||||
output.Add(A.ToLowerInvariant());
|
||||
}
|
||||
foreach(string A in custom_commands.Keys)
|
||||
{
|
||||
output.Add(A.ToLowerInvariant());
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
|
||||
public void NotecardAddContent(string target_notecard_storage_id, string content)
|
||||
{
|
||||
NotecardAddContent(target_notecard_storage_id, content, true, "\n\r");
|
||||
|
|
|
|||
Loading…
Reference in a new issue