+Added command injection from plugins
This commit is contained in:
@@ -61,6 +61,15 @@ public class UserInput
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Used for injecting direct commands from plugins
|
||||||
|
public UserInput(String input, KittyGuild contextGuild)
|
||||||
|
{
|
||||||
|
int loc = FindFirstWhitespace(input);
|
||||||
|
key = input.substring(0, loc);
|
||||||
|
args = input.substring(loc);
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean IsValid()
|
public boolean IsValid()
|
||||||
{
|
{
|
||||||
return isValid;
|
return isValid;
|
||||||
|
|||||||
@@ -92,10 +92,20 @@ public class Main extends ListenerAdapter
|
|||||||
if(pluginOutput != null && pluginOutput.size() > 0)
|
if(pluginOutput != null && pluginOutput.size() > 0)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < pluginOutput.size(); ++i)
|
for(int i = 0; i < pluginOutput.size(); ++i)
|
||||||
|
{
|
||||||
|
if(pluginOutput.get(i).startsWith("!"))
|
||||||
|
{
|
||||||
|
commandManager.InvokeOnNewThread(guild, channel, user, new UserInput(pluginOutput.get(i).substring(1), guild), response);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
response.Call(pluginOutput.get(i));
|
response.Call(pluginOutput.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Run any upkeep in post we need to
|
// Run any upkeep in post we need to
|
||||||
Superintendent.PerCommandUpkeepPost(kitty, databaseManager);
|
Superintendent.PerCommandUpkeepPost(kitty, databaseManager);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user