Finish revising messaging API

This commit is contained in:
Zontreck 2020-06-28 19:45:04 -07:00
parent 59c62e62e2
commit 4b07283a3d
8 changed files with 137 additions and 143 deletions

View file

@ -94,8 +94,8 @@ namespace Bot.CommandSystem
[CommandGroup("show_level", 0, 0, "This command shows your current auth level if any.", Destinations.DEST_AGENT | Destinations.DEST_LOCAL | Destinations.DEST_GROUP)]
public void show_level(UUID client, int level, GridClient grid, string[] additionalArgs,
[CommandGroup("show_level", 0, 0, "This command shows your current auth level if any.", Destinations.DEST_AGENT | Destinations.DEST_DISCORD | Destinations.DEST_LOCAL | Destinations.DEST_GROUP)]
public void show_level(UUID client, int level, string[] additionalArgs,
Destinations source,
UUID agentKey, string agentName)
{
@ -128,7 +128,7 @@ namespace Bot.CommandSystem
public void PerformExit(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName)
{
MHE(source, client, "Bot exit initiated.");
BotSession.Instance.LaunchTime = new DateTime(); // zero out date time to force a relog
BotSession.Instance.EnqueueExit = true;
}
// !!help
[CommandGroup("!help", 1, 0, "Prints the entire help registry", Destinations.DEST_AGENT |Destinations.DEST_LOCAL | Destinations.DEST_GROUP)]

View file

@ -239,8 +239,23 @@ namespace Bot.CommandSystem
//(UUID client, int level, string[] additionalArgs,
//Destinations source,
//UUID agentKey, string agentName)
Thread CommandThread = new Thread(() => cgX.AssignedMethod.Invoke(ovj, new object[] { user, level, additionalArgs, source, agentKey, agentName }));
CommandThread.Start();
try
{
Thread CMDThread = new Thread(() =>
{
try
{
cgX.AssignedMethod.Invoke(ovj, new object[] { user,level,additionalArgs, source,agentKey, agentName });
}catch(Exception e)
{
MessageFactory.Post(Destinations.DEST_LOCAL, "Exception caught when executing a command\n" + e.Message + "\nStacktrace: " + e.StackTrace, UUID.Zero);
}
});
CMDThread.Start();
}catch(Exception e)
{
MessageFactory.Post(Destinations.DEST_LOCAL, "EXCEPTION CAUGHT WHEN EXECUTING COMMAND\n\n" + e.Message + "\nSTACK\n" + e.StackTrace, UUID.Zero);
}
}
}
}