= Benchmark subsystem formatting update
This commit is contained in:
@@ -15,7 +15,7 @@ public class CommandBeansShow extends Command
|
|||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
res.Call(String.format(LocStrings.stub("BeansShowDisplay"), user.GetBeans()));
|
res.call(String.format(LocStrings.stub("BeansShowDisplay"), user.GetBeans()));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String mentionedBeans = "";
|
String mentionedBeans = "";
|
||||||
@@ -23,7 +23,7 @@ public class CommandBeansShow extends Command
|
|||||||
{
|
{
|
||||||
mentionedBeans += mentioned.name + " has " + mentioned.GetBeans() + " ";
|
mentionedBeans += mentioned.name + " has " + mentioned.GetBeans() + " ";
|
||||||
}
|
}
|
||||||
res.Call(String.format(LocStrings.stub("BeansShowMentioned"), mentionedBeans));
|
res.call(String.format(LocStrings.stub("BeansShowMentioned"), mentionedBeans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,27 +30,27 @@ public class CommandBenchmark extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
framework.Update();
|
framework.update();
|
||||||
|
|
||||||
if(input.args == null || input.args.length() == 0)
|
if(input.args == null || input.args.length() == 0)
|
||||||
{
|
{
|
||||||
String output = getHelpText();
|
String output = getHelpText();
|
||||||
res.Call(output);
|
res.call(output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BenchmarkFormattable commandOutput = null;
|
BenchmarkFormattable commandOutput = null;
|
||||||
synchronized(framework)
|
synchronized(framework)
|
||||||
{
|
{
|
||||||
commandOutput = framework.Run(input.args.trim());
|
commandOutput = framework.run(input.args.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(commandOutput == null)
|
if(commandOutput == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("BenchmarkInvalid"));
|
res.call(LocStrings.stub("BenchmarkInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandOutput.Call(res);
|
commandOutput.call(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,19 +24,19 @@ public class CommandBetBeans extends Command
|
|||||||
bet = Integer.parseInt(input.args);
|
bet = Integer.parseInt(input.args);
|
||||||
if(bet < 50)
|
if(bet < 50)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("BetBeansLowBet"));
|
res.call(LocStrings.stub("BetBeansLowBet"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("BetBeansNotValid"));
|
res.call(LocStrings.stub("BetBeansNotValid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.GetBeans() < bet)
|
if(user.GetBeans() < bet)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("BetBeansNotEnough"));
|
res.call(LocStrings.stub("BetBeansNotEnough"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,18 +47,18 @@ public class CommandBetBeans extends Command
|
|||||||
|
|
||||||
win = getWinning(slots);
|
win = getWinning(slots);
|
||||||
|
|
||||||
res.Call(call);
|
res.call(call);
|
||||||
|
|
||||||
if(win == 0)
|
if(win == 0)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("BetBeansLose"));
|
res.call(LocStrings.stub("BetBeansLose"));
|
||||||
guild.beans.Add(bet);
|
guild.beans.Add(bet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.ChangeBeans(bet*win);
|
user.ChangeBeans(bet*win);
|
||||||
guild.beans.Subtract(bet*win);
|
guild.beans.Subtract(bet*win);
|
||||||
res.Call(String.format(LocStrings.stub("BetBeansWin"), "" + (bet*win)));
|
res.call(String.format(LocStrings.stub("BetBeansWin"), "" + (bet*win)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getWinning(int [] slots)
|
private int getWinning(int [] slots)
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ public class CommandBetHistory extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.Get()));
|
res.call(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.Get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,14 +69,14 @@ public class CommandBoop extends Command
|
|||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
boopTracker.ApplyBoop();
|
boopTracker.ApplyBoop();
|
||||||
res.Call(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.HowMany()));
|
res.call(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.HowMany()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(input.mentions.length == 1)
|
if(input.mentions.length == 1)
|
||||||
{
|
{
|
||||||
boopTracker.ApplyBoop();
|
boopTracker.ApplyBoop();
|
||||||
res.Call(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name));
|
res.call(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public class CommandBoop extends Command
|
|||||||
booped += "and " + input.mentions[i].name;
|
booped += "and " + input.mentions[i].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(LocStrings.stub("BoopMultiple"), user.name, booped));
|
res.call(String.format(LocStrings.stub("BoopMultiple"), user.name, booped));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,18 +17,18 @@ public class CommandChangeIndicator extends Command
|
|||||||
String arg = input.args.trim();
|
String arg = input.args.trim();
|
||||||
if(arg.length() == 0)
|
if(arg.length() == 0)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("ChangeIndicatorError"));
|
res.call(LocStrings.stub("ChangeIndicatorError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String indicator = arg.substring(0, 1);
|
String indicator = arg.substring(0, 1);
|
||||||
if(indicator.charAt(0) == '\n' || indicator.charAt(0) == '\t' || indicator.charAt(0) == '\r')
|
if(indicator.charAt(0) == '\n' || indicator.charAt(0) == '\t' || indicator.charAt(0) == '\r')
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.Lookup("ChangeIndicatorError"));
|
res.call(LocStrings.Lookup("ChangeIndicatorError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
guild.SetCommandIndicator(indicator);
|
guild.SetCommandIndicator(indicator);
|
||||||
res.Call(String.format(LocStrings.stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
|
res.call(String.format(LocStrings.stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ public class CommandCharacterCreate extends Command
|
|||||||
String [] info = input.args.split(",");
|
String [] info = input.args.split(",");
|
||||||
if(info.length < 3)
|
if(info.length < 3)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterCreateNullInfo"));
|
res.call(LocStrings.stub("CharacterCreateNullInfo"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
|
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterCreateSuccess"));
|
res.call(LocStrings.stub("CharacterCreateSuccess"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
res.Call(LocStrings.stub("CharacterCreateDuplicate"));
|
res.call(LocStrings.stub("CharacterCreateDuplicate"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,18 +21,18 @@ public class CommandCharacterEditBio extends Command
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditBioNotValid"));
|
res.call(LocStrings.stub("CharacterEditBioNotValid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editBio(character, input.args.substring(input.args.indexOf(' ')));
|
CharacterManager.instance.editBio(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
res.Call(LocStrings.stub("CharacterEditBioSuccess"));
|
res.call(LocStrings.stub("CharacterEditBioSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditBioNotAuth"));
|
res.call(LocStrings.stub("CharacterEditBioNotAuth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,18 +21,18 @@ public class CommandCharacterEditName extends Command
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditNameNotValid"));
|
res.call(LocStrings.stub("CharacterEditNameNotValid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editName(character, input.args.substring(input.args.indexOf(' ')));
|
CharacterManager.instance.editName(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
res.Call(LocStrings.stub("CharacterEditNameSuccess"));
|
res.call(LocStrings.stub("CharacterEditNameSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditNameNotAuth"));
|
res.call(LocStrings.stub("CharacterEditNameNotAuth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,18 +21,18 @@ public class CommandCharacterEditURL extends Command
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditURLNotValid"));
|
res.call(LocStrings.stub("CharacterEditURLNotValid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editRefImage(character, input.args.substring(input.args.indexOf(' ')));
|
CharacterManager.instance.editRefImage(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
res.Call(LocStrings.stub("CharacterEditURLSuccess"));
|
res.call(LocStrings.stub("CharacterEditURLSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterEditURLNotAuth"));
|
res.call(LocStrings.stub("CharacterEditURLNotAuth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,21 +20,21 @@ public class CommandCharacterSearch extends Command
|
|||||||
ArrayList <KittyCharacter> characters = CharacterManager.instance.searchCharacter(input.args);
|
ArrayList <KittyCharacter> characters = CharacterManager.instance.searchCharacter(input.args);
|
||||||
if(characters.size() < 1)
|
if(characters.size() < 1)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterSearchNoCharacterFound"));
|
res.call(LocStrings.stub("CharacterSearchNoCharacterFound"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(characters.size() > 1)
|
if(characters.size() > 1)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("CharacterSearchMultipleCharacterHeader"));
|
res.call(LocStrings.stub("CharacterSearchMultipleCharacterHeader"));
|
||||||
for(KittyCharacter character:characters)
|
for(KittyCharacter character:characters)
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("CharacterSearchMultipleCharacter"), character.getName(), character.getOwner().name, character.getUID()));
|
res.call(String.format(LocStrings.stub("CharacterSearchMultipleCharacter"), character.getName(), character.getOwner().name, character.getUID()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("CharacterSearchOneCharacter"), characters.get(0).getOwner().name, characters.get(0).getName(), characters.get(0).getBio(), characters.get(0).getRefImage(), characters.get(0).getUID()));
|
res.call(String.format(LocStrings.stub("CharacterSearchOneCharacter"), characters.get(0).getOwner().name, characters.get(0).getName(), characters.get(0).getBio(), characters.get(0).getRefImage(), characters.get(0).getUID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ public class CommandChoose extends Command
|
|||||||
{
|
{
|
||||||
if(input.args.trim().length() == 0)
|
if(input.args.trim().length() == 0)
|
||||||
{
|
{
|
||||||
res.Call(Stats.instance.GetHelpText(input.key));
|
res.call(Stats.instance.GetHelpText(input.key));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@ public class CommandChoose extends Command
|
|||||||
|
|
||||||
if(choices.length == 1)
|
if(choices.length == 1)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("ChooseOne"));
|
res.call(LocStrings.stub("ChooseOne"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(LocStrings.stub("ChooseChoice"), (choices[(int) (Math.random()*choices.length)]).toString()));
|
res.call(String.format(LocStrings.stub("ChooseChoice"), (choices[(int) (Math.random()*choices.length)]).toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ public class CommandColiru extends Command
|
|||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("ColiruError"));
|
res.call(LocStrings.stub("ColiruError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(compiler.compileCPlus(input.args));
|
res.call(compiler.compileCPlus(input.args));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class CommandColor extends Command
|
|||||||
// Verify the color was even found
|
// Verify the color was even found
|
||||||
if(colorData == null)
|
if(colorData == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("ColorNotSearchable"));
|
res.call(LocStrings.stub("ColorNotSearchable"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class CommandColor extends Command
|
|||||||
response.footerText = "All percentages and values are rounded to the nearest whole number!" + (colorData.name.exact_match_name ? "" : " '" + colorData.name.value + "' is actually " + colorData.name.closest_named_hex + ".");
|
response.footerText = "All percentages and values are rounded to the nearest whole number!" + (colorData.name.exact_match_name ? "" : " '" + colorData.name.value + "' is actually " + colorData.name.closest_named_hex + ".");
|
||||||
|
|
||||||
// Send then delete the temp local files
|
// Send then delete the temp local files
|
||||||
res.CallEmbed(response);
|
res.callEmbed(response);
|
||||||
ImageUtils.BlockingFileDelete(file);
|
ImageUtils.BlockingFileDelete(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class CommandCrouton extends Command
|
|||||||
|
|
||||||
embed.imageURL = "https://crouton.net/crouton.png";
|
embed.imageURL = "https://crouton.net/crouton.png";
|
||||||
|
|
||||||
res.CallEmbed(embed);
|
res.callEmbed(embed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ public class CommandDBFlush extends Command
|
|||||||
embed.descriptionText = "**Dirty:** " + numUpdated;
|
embed.descriptionText = "**Dirty:** " + numUpdated;
|
||||||
embed.color = Config.ColorDefault;
|
embed.color = Config.ColorDefault;
|
||||||
|
|
||||||
res.CallEmbed(embed);
|
res.callEmbed(embed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ public class CommandDBStats extends Command
|
|||||||
embed.descriptionText += "**Last Upkeep:** " + dateFormat.format(DatabaseManager.instance.getLastUpkeep()) + " UTC-7";
|
embed.descriptionText += "**Last Upkeep:** " + dateFormat.format(DatabaseManager.instance.getLastUpkeep()) + " UTC-7";
|
||||||
embed.color = Config.ColorDefault;
|
embed.color = Config.ColorDefault;
|
||||||
|
|
||||||
res.CallEmbed(embed);
|
res.callEmbed(embed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ public class CommandDoWork extends Command
|
|||||||
thispieceofshit += Math.log((double)i);
|
thispieceofshit += Math.log((double)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(LocStrings.stub("DoWorkFinished"));
|
res.call(LocStrings.stub("DoWorkFinished"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@ public class CommandEightBall extends Command
|
|||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
res.Call(LocStrings.stub("EightBallError"));
|
res.call(LocStrings.stub("EightBallError"));
|
||||||
|
|
||||||
res.Call(answers[(int) (Math.random()*answers.length)]);
|
res.call(answers[(int) (Math.random()*answers.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,30 +27,30 @@ public class CommandFetch extends Command
|
|||||||
switch(num)
|
switch(num)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
res.Call(String.format(LocStrings.stub("FetchBringBack"), emote));
|
res.call(String.format(LocStrings.stub("FetchBringBack"), emote));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
res.Call(String.format(LocStrings.stub("FetchRunAway")));
|
res.call(String.format(LocStrings.stub("FetchRunAway")));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
res.Call(String.format(LocStrings.stub("FetchBringBackWrong"), guild.emoji.get((int)(Math.random() * guild.emoji.size()) + 1)));
|
res.call(String.format(LocStrings.stub("FetchBringBackWrong"), guild.emoji.get((int)(Math.random() * guild.emoji.size()) + 1)));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
res.Call(String.format(LocStrings.stub("FetchEat"), emote));
|
res.call(String.format(LocStrings.stub("FetchEat"), emote));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
res.Call(String.format(LocStrings.stub("FetchCatchRun"), emote));
|
res.call(String.format(LocStrings.stub("FetchCatchRun"), emote));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
res.Call(String.format(LocStrings.stub("FetchStare"), user.name));
|
res.call(String.format(LocStrings.stub("FetchStare"), user.name));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res.Call("" + num);
|
res.call("" + num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("FetchError")));
|
res.call(String.format(LocStrings.stub("FetchError")));
|
||||||
System.out.println(emote);
|
System.out.println(emote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommandGiveBeans extends Command
|
|||||||
// First, make sure someone is mentioned
|
// First, make sure someone is mentioned
|
||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("GiveBeansNoneMentioned"));
|
res.call(LocStrings.stub("GiveBeansNoneMentioned"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public class CommandGiveBeans extends Command
|
|||||||
// If there wasn't a number we could find, well, nothing we can do.
|
// If there wasn't a number we could find, well, nothing we can do.
|
||||||
if(beans == null)
|
if(beans == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("GiveBeansInvalid"));
|
res.call(LocStrings.stub("GiveBeansInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public class CommandGiveBeans extends Command
|
|||||||
for(int i = 0; i < input.mentions.length; i++)
|
for(int i = 0; i < input.mentions.length; i++)
|
||||||
{
|
{
|
||||||
input.mentions[i].ChangeBeans(beans);
|
input.mentions[i].ChangeBeans(beans);
|
||||||
res.Call(String.format(LocStrings.stub("GiveBeansSuccess"), input.mentions[i].name, "" + beans));
|
res.call(String.format(LocStrings.stub("GiveBeansSuccess"), input.mentions[i].name, "" + beans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ public class CommandGuildRoleAdd extends Command
|
|||||||
{
|
{
|
||||||
if(guild.control.addRole(user.discordID, role))
|
if(guild.control.addRole(user.discordID, role))
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleAddSuccess"), role, user.name));
|
res.call(String.format(LocStrings.stub("GuildRoleAddSuccess"), role, user.name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleAddFailure"), role, user.name));
|
res.call(String.format(LocStrings.stub("GuildRoleAddFailure"), role, user.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleAddNotAllowed"), role));
|
res.call(String.format(LocStrings.stub("GuildRoleAddNotAllowed"), role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,12 +27,12 @@ public class CommandGuildRoleAllowed extends Command
|
|||||||
role = roles[i].trim();
|
role = roles[i].trim();
|
||||||
if(guild.roleList.contains(role))
|
if(guild.roleList.contains(role))
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("GuildRoleAllowedDuplicate"));
|
res.call(LocStrings.stub("GuildRoleAllowedDuplicate"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
guild.roleList.add(role);
|
guild.roleList.add(role);
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleAllowedSuccess"), role));
|
res.call(String.format(LocStrings.stub("GuildRoleAllowedSuccess"), role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommandGuildRoleList extends Command
|
|||||||
String roles = "";
|
String roles = "";
|
||||||
if(guild.roleList.isEmpty())
|
if(guild.roleList.isEmpty())
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleListEmpty")));
|
res.call(String.format(LocStrings.stub("GuildRoleListEmpty")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < guild.roleList.size(); i++)
|
for(int i = 0; i < guild.roleList.size(); i++)
|
||||||
@@ -26,6 +26,6 @@ public class CommandGuildRoleList extends Command
|
|||||||
roles += " and ";
|
roles += " and ";
|
||||||
roles += guild.roleList.get(i);
|
roles += guild.roleList.get(i);
|
||||||
}
|
}
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleListOutput"), roles));
|
res.call(String.format(LocStrings.stub("GuildRoleListOutput"), roles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,11 +28,11 @@ public class CommandGuildRoleNotAllowed extends Command
|
|||||||
if(guild.roleList.contains(role))
|
if(guild.roleList.contains(role))
|
||||||
{
|
{
|
||||||
guild.roleList.remove(role);
|
guild.roleList.remove(role);
|
||||||
res.Call(LocStrings.stub("GuildRoleNotAllowedSuccess"));
|
res.call(LocStrings.stub("GuildRoleNotAllowedSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleNotAllowedFailure"), role));
|
res.call(String.format(LocStrings.stub("GuildRoleNotAllowedFailure"), role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ public class CommandGuildRoleRemove extends Command
|
|||||||
{
|
{
|
||||||
if(guild.control.removeRole(user.discordID, role))
|
if(guild.control.removeRole(user.discordID, role))
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleRemoveSuccess"), role, user.name));
|
res.call(String.format(LocStrings.stub("GuildRoleRemoveSuccess"), role, user.name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleRemoveFailure"), role, user.name));
|
res.call(String.format(LocStrings.stub("GuildRoleRemoveFailure"), role, user.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("GuildRoleRemoveNotAllowed"), role));
|
res.call(String.format(LocStrings.stub("GuildRoleRemoveNotAllowed"), role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ public class CommandHelp extends Command
|
|||||||
help = LocStrings.stub("HelpDisplay");
|
help = LocStrings.stub("HelpDisplay");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(help);
|
res.call(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,6 @@ public class CommandInfo extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("InfoResponse"));
|
res.call(LocStrings.stub("InfoResponse"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ public class CommandInvite extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call("https://discordapp.com/oauth2/authorize?&client_id="+ Ref.CliID
|
res.call("https://discordapp.com/oauth2/authorize?&client_id="+ Ref.CliID
|
||||||
+"&scope=bot&permissions=8");
|
+"&scope=bot&permissions=8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,10 +19,10 @@ public class CommandJDoodle extends Command
|
|||||||
{
|
{
|
||||||
if(input.args.trim().length() < 1)
|
if(input.args.trim().length() < 1)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("JDoodleError"));
|
res.call(LocStrings.stub("JDoodleError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(compiler.compileJava(input.args));
|
res.call(compiler.compileJava(input.args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,6 @@ public class CommandLeaderboard extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write out embed result
|
// Write out embed result
|
||||||
res.CallEmbed(embed);
|
res.callEmbed(embed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class CommandMap extends Command
|
|||||||
}
|
}
|
||||||
catch(NumberFormatException e)
|
catch(NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("MapInvalid"));
|
res.call(LocStrings.stub("MapInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class CommandMap extends Command
|
|||||||
body += "\n```";
|
body += "\n```";
|
||||||
|
|
||||||
// Send back the map
|
// Send back the map
|
||||||
res.Call(header + body);
|
res.call(header + body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies and appropriately caps input as necessary
|
// Verifies and appropriately caps input as necessary
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ public class CommandPing extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("PingResponse"));
|
res.call(LocStrings.stub("PingResponse"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ public class CommandPollManage extends Command
|
|||||||
switch(input.args.split(" ")[0].toLowerCase())
|
switch(input.args.split(" ")[0].toLowerCase())
|
||||||
{
|
{
|
||||||
case "start":
|
case "start":
|
||||||
res.Call(guild.startPoll(input.args.substring(input.args.indexOf(' ')).trim()));
|
res.call(guild.startPoll(input.args.substring(input.args.indexOf(' ')).trim()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "choice":
|
case "choice":
|
||||||
res.Call(guild.addChoiceToPoll(input.args.substring(input.args.indexOf(' ')).trim()));
|
res.call(guild.addChoiceToPoll(input.args.substring(input.args.indexOf(' ')).trim()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "stop":
|
case "stop":
|
||||||
res.Call(guild.endPoll());
|
res.call(guild.endPoll());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ public class CommandPollResults extends Command
|
|||||||
results += String.format(LocStrings.stub("PollResultsResponse"), votes.get(i).votes, votes.get(i).choice, (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100));
|
results += String.format(LocStrings.stub("PollResultsResponse"), votes.get(i).votes, votes.get(i).choice, (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(results);
|
res.call(results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class CommandPollShow extends Command
|
|||||||
{
|
{
|
||||||
if(!guild.polling)
|
if(!guild.polling)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("PollShowNoPoll"));
|
res.call(LocStrings.stub("PollShowNoPoll"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String poll = String.format(LocStrings.stub("PollShowPoll"), guild.poll);
|
String poll = String.format(LocStrings.stub("PollShowPoll"), guild.poll);
|
||||||
@@ -25,6 +25,6 @@ public class CommandPollShow extends Command
|
|||||||
poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n";
|
poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(poll);
|
res.call(poll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommandPollVote extends Command
|
|||||||
{
|
{
|
||||||
if(guild.hasVoted.contains(user.uniqueID))
|
if(guild.hasVoted.contains(user.uniqueID))
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("PollVoteAlreadyVoted"));
|
res.call(LocStrings.stub("PollVoteAlreadyVoted"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -25,23 +25,23 @@ public class CommandPollVote extends Command
|
|||||||
int voteNum = Integer.parseInt(input.args)-1;
|
int voteNum = Integer.parseInt(input.args)-1;
|
||||||
if(voteNum >= guild.choices.size() || voteNum < 0)
|
if(voteNum >= guild.choices.size() || voteNum < 0)
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("PollVoteNotValidVote"), voteNum));
|
res.call(String.format(LocStrings.stub("PollVoteNotValidVote"), voteNum));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KittyPoll polled = guild.choices.get(voteNum);
|
KittyPoll polled = guild.choices.get(voteNum);
|
||||||
polled.votes++;
|
polled.votes++;
|
||||||
guild.hasVoted.add(user.uniqueID);
|
guild.hasVoted.add(user.uniqueID);
|
||||||
res.Call(LocStrings.stub("PollVoteSuccess") + " `" + polled.choice + "`!");
|
res.call(LocStrings.stub("PollVoteSuccess") + " `" + polled.choice + "`!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("PollVoteNotValidNumber"));
|
res.call(LocStrings.stub("PollVoteNotValidNumber"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(LocStrings.stub("PollVoteNoPoll"));
|
res.call(LocStrings.stub("PollVoteNoPoll"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class CommandRPEnd extends Command
|
|||||||
if(sending != null)
|
if(sending != null)
|
||||||
{
|
{
|
||||||
res.CallFile(sending, "txt");
|
res.CallFile(sending, "txt");
|
||||||
res.Call(LocStrings.stub("RPEndFileOut"));
|
res.call(LocStrings.stub("RPEndFileOut"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RPEndError"));
|
res.call(LocStrings.stub("RPEndError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class CommandRPG extends Command
|
|||||||
if(input.args == null || input.args.length() == 0)
|
if(input.args == null || input.args.length() == 0)
|
||||||
{
|
{
|
||||||
String output = getHelpText();
|
String output = getHelpText();
|
||||||
res.Call(output);
|
res.call(output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,10 +44,10 @@ public class CommandRPG extends Command
|
|||||||
|
|
||||||
if(result == null)
|
if(result == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RPGInvalid"));
|
res.call(LocStrings.stub("RPGInvalid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(result);
|
res.call(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ public class CommandRPStart extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(RPManager.instance.newRP(channel, users));
|
res.call(RPManager.instance.newRP(channel, users));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ public class CommandRaffleEnd extends Command
|
|||||||
{
|
{
|
||||||
if(guild.endRaffle())
|
if(guild.endRaffle())
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleEndSuccess"));
|
res.call(LocStrings.stub("RaffleEndSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleEndFailure"));
|
res.call(LocStrings.stub("RaffleEndFailure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,11 +22,11 @@ public class CommandRaffleJoin extends Command
|
|||||||
{
|
{
|
||||||
if(guild.joinRaffle(user))
|
if(guild.joinRaffle(user))
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleJoinSuccess"));
|
res.call(LocStrings.stub("RaffleJoinSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleJoinFailure"));
|
res.call(LocStrings.stub("RaffleJoinFailure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ public class CommandRaffleSpin extends Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("RaffleSpinSuccess"), guild.chooseRaffleWinner().name));
|
res.call(String.format(LocStrings.stub("RaffleSpinSuccess"), guild.chooseRaffleWinner().name));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleSpinFailure"));
|
res.call(LocStrings.stub("RaffleSpinFailure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,11 +33,11 @@ public class CommandRaffleStart extends Command
|
|||||||
|
|
||||||
if(guild.startRaffle(beanCost))
|
if(guild.startRaffle(beanCost))
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("RaffleStartSuccess"), beanCost));
|
res.call(String.format(LocStrings.stub("RaffleStartSuccess"), beanCost));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RaffleStartFailure"));
|
res.call(LocStrings.stub("RaffleStartFailure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ public class CommandRating extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(newRating != null)
|
if(newRating != null)
|
||||||
res.Call(LocStrings.stub("RatingChanged") + " " + newRating);
|
res.call(LocStrings.stub("RatingChanged") + " " + newRating);
|
||||||
else
|
else
|
||||||
res.Call(LocStrings.stub("RatingInvalid") + " `" + input.args + "`");
|
res.call(LocStrings.stub("RatingInvalid") + " `" + input.args + "`");
|
||||||
|
|
||||||
if(newRating.equals("Filtered"))
|
if(newRating.equals("Filtered"))
|
||||||
res.Call(LocStrings.stub("RatingWarning"));
|
res.call(LocStrings.stub("RatingWarning"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,13 @@ public class CommandRole extends Command
|
|||||||
{
|
{
|
||||||
if(input.args.isEmpty())
|
if(input.args.isEmpty())
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RoleStandardResponse") + " " + user.GetRole().name() + "!");
|
res.call(LocStrings.stub("RoleStandardResponse") + " " + user.GetRole().name() + "!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.GetRole().getValue() < KittyRole.Admin.getValue())
|
if(user.GetRole().getValue() < KittyRole.Admin.getValue())
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("RoleError"), KittyRole.Admin.toString()));
|
res.call(String.format(LocStrings.stub("RoleError"), KittyRole.Admin.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class CommandRole extends Command
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
res.Call(LocStrings.stub("RoleNeededRole"));
|
res.call(LocStrings.stub("RoleNeededRole"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String users = "";
|
String users = "";
|
||||||
@@ -56,6 +56,6 @@ public class CommandRole extends Command
|
|||||||
users += input.mentions[i].name + " ";
|
users += input.mentions[i].name + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Call(String.format(LocStrings.stub("RoleChanged"), users, newRole.name()));
|
res.call(String.format(LocStrings.stub("RoleChanged"), users, newRole.name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ public class CommandRoll extends Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
res.Call(rollDice(input.args));
|
res.call(rollDice(input.args));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("RollError"));
|
res.call(LocStrings.stub("RollError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,6 @@ public class CommandStats extends Command
|
|||||||
+ " Cached Users: " + userCount;
|
+ " Cached Users: " + userCount;
|
||||||
out += "\n```";
|
out += "\n```";
|
||||||
|
|
||||||
res.Call(out);
|
res.call(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class CommandTradeBeans extends Command
|
|||||||
{
|
{
|
||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("TradeBeansNoTargetError"));
|
res.call(LocStrings.stub("TradeBeansNoTargetError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,25 +32,25 @@ public class CommandTradeBeans extends Command
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("TradeBeansIntParseError"));
|
res.call(LocStrings.stub("TradeBeansIntParseError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.GetBeans() < beans)
|
if(user.GetBeans() < beans)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("TradeBeansNotEnoughError"));
|
res.call(LocStrings.stub("TradeBeansNotEnoughError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(beans < 0)
|
if(beans < 0)
|
||||||
{
|
{
|
||||||
res.Call(String.format(LocStrings.stub("TradeBeansStealingBeans"), user.name));
|
res.call(String.format(LocStrings.stub("TradeBeansStealingBeans"), user.name));
|
||||||
user.ChangeBeans(-10);
|
user.ChangeBeans(-10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.mentions[0].ChangeBeans(beans);
|
input.mentions[0].ChangeBeans(beans);
|
||||||
user.ChangeBeans(-beans);
|
user.ChangeBeans(-beans);
|
||||||
res.Call(String.format(LocStrings.stub("TradeBeansSuccess"), user.name, input.mentions[0].name, beans));
|
res.call(String.format(LocStrings.stub("TradeBeansSuccess"), user.name, input.mentions[0].name, beans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ public class CommandTweet extends Command
|
|||||||
{
|
{
|
||||||
//TODO: Figure out how to pass pictures correctly
|
//TODO: Figure out how to pass pictures correctly
|
||||||
try {
|
try {
|
||||||
res.Call(tweet.tweet(input.args));
|
res.call(tweet.tweet(input.args));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res.Call(LocStrings.stub("TweetError"));
|
res.call(LocStrings.stub("TweetError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class CommandWolfram extends Command
|
|||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
if(input.args == null || input.args.trim().length() == 0)
|
if(input.args == null || input.args.trim().length() == 0)
|
||||||
res.Call(LocStrings.stub("WolframNoArgs"));
|
res.call(LocStrings.stub("WolframNoArgs"));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ public class CommandWolfram extends Command
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
res.Call(LocStrings.stub("WolframError"));
|
res.call(LocStrings.stub("WolframError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ import core.benchmark.BenchmarkManager;
|
|||||||
|
|
||||||
public class BenchmarkCommandCompare extends BenchmarkCommand
|
public class BenchmarkCommandCompare extends BenchmarkCommand
|
||||||
{
|
{
|
||||||
public BenchmarkFormattable OnRun(BenchmarkManager manager, BenchmarkInput input)
|
public BenchmarkFormattable onRun(BenchmarkManager manager, BenchmarkInput input)
|
||||||
{
|
{
|
||||||
final String lineDelimiter = "\n";
|
final String lineDelimiter = "\n";
|
||||||
String output = "";
|
String output = "";
|
||||||
@@ -24,7 +24,7 @@ public class BenchmarkCommandCompare extends BenchmarkCommand
|
|||||||
if(i != 0)
|
if(i != 0)
|
||||||
output += lineDelimiter;
|
output += lineDelimiter;
|
||||||
|
|
||||||
List<BenchmarkEntry> entries = manager.FindModel(inputSplit[i]);
|
List<BenchmarkEntry> entries = manager.findModel(inputSplit[i]);
|
||||||
|
|
||||||
if(entries.size() < 1)
|
if(entries.size() < 1)
|
||||||
output += "Couldn't find any models containing `" + inputSplit[i] + "`!";
|
output += "Couldn't find any models containing `" + inputSplit[i] + "`!";
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ public class BenchmarkCommandFind extends BenchmarkCommand
|
|||||||
private final String lineDelimiter = "\n";
|
private final String lineDelimiter = "\n";
|
||||||
private final int listMax = 30;
|
private final int listMax = 30;
|
||||||
|
|
||||||
public BenchmarkFormattable OnRun(BenchmarkManager manager, BenchmarkInput input)
|
public BenchmarkFormattable onRun(BenchmarkManager manager, BenchmarkInput input)
|
||||||
{
|
{
|
||||||
String output = "";
|
String output = "";
|
||||||
String searchString = input.value.trim();
|
String searchString = input.value.trim();
|
||||||
|
|
||||||
List<BenchmarkEntry> entries = manager.FindModel(searchString);
|
List<BenchmarkEntry> entries = manager.findModel(searchString);
|
||||||
|
|
||||||
if(entries.size() > 0)
|
if(entries.size() > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,16 +74,16 @@ public class BenchmarkCommandInfo extends BenchmarkCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BenchmarkFormattable OnRun(BenchmarkManager manager, BenchmarkInput input)
|
public BenchmarkFormattable onRun(BenchmarkManager manager, BenchmarkInput input)
|
||||||
{
|
{
|
||||||
String searchString = input.value.trim();
|
String searchString = input.value.trim();
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
List<BenchmarkEntry> entries = manager.FindModel(searchString);
|
List<BenchmarkEntry> entries = manager.findModel(searchString);
|
||||||
|
|
||||||
if(entries.size() < 1)
|
if(entries.size() < 1)
|
||||||
return new BenchmarkFormattable("Couldn't find any models containing `" + searchString + "`!");
|
return new BenchmarkFormattable("Couldn't find any models containing `" + searchString + "`!");
|
||||||
|
|
||||||
List<BenchmarkEntry> sortedEntries = manager.EvaluateLevenshteinDistance(entries, searchString);
|
List<BenchmarkEntry> sortedEntries = manager.evaluateLevenshteinDistance(entries, searchString);
|
||||||
BenchmarkEntry entry = sortedEntries.get(0);
|
BenchmarkEntry entry = sortedEntries.get(0);
|
||||||
KittyEmbed embed = FormatInfoEmbed(entry);
|
KittyEmbed embed = FormatInfoEmbed(entry);
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ public abstract class BenchmarkCommand
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
// OVERRIDE ME
|
// OVERRIDE ME
|
||||||
public abstract BenchmarkFormattable OnRun(BenchmarkManager manager, BenchmarkInput input);
|
public abstract BenchmarkFormattable onRun(BenchmarkManager manager, BenchmarkInput input);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ public class BenchmarkFormattable
|
|||||||
this.resString = null;
|
this.resString = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(Response res)
|
public void call(Response res)
|
||||||
{
|
{
|
||||||
if(resEmbed == null)
|
if(resEmbed == null)
|
||||||
res.Call(resString);
|
res.call(resString);
|
||||||
else
|
else
|
||||||
res.CallEmbed(resEmbed);
|
res.callEmbed(resEmbed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,43 +16,43 @@ public class BenchmarkFramework
|
|||||||
this.benchmarkManager = new BenchmarkManager();
|
this.benchmarkManager = new BenchmarkManager();
|
||||||
this.benchmarkCommand = new HashMap<String, BenchmarkCommand>();
|
this.benchmarkCommand = new HashMap<String, BenchmarkCommand>();
|
||||||
|
|
||||||
RegisterCommand("find", new BenchmarkCommandFind());
|
registerCommand("find", new BenchmarkCommandFind());
|
||||||
RegisterCommand("compare", new BenchmarkCommandCompare());
|
registerCommand("compare", new BenchmarkCommandCompare());
|
||||||
RegisterCommand("info", new BenchmarkCommandInfo());
|
registerCommand("info", new BenchmarkCommandInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs a command if possible.
|
// Runs a command if possible.
|
||||||
public BenchmarkFormattable Run(String args)
|
public BenchmarkFormattable run(String args)
|
||||||
{
|
{
|
||||||
BenchmarkInput input = new BenchmarkInput(args);
|
BenchmarkInput input = new BenchmarkInput(args);
|
||||||
return ExecuteCommand(input.key, input);
|
return executeCommand(input.key, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void update()
|
||||||
{
|
{
|
||||||
synchronized(benchmarkManager)
|
synchronized(benchmarkManager)
|
||||||
{
|
{
|
||||||
benchmarkManager.Update();
|
benchmarkManager.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registers a command
|
// Registers a command
|
||||||
private void RegisterCommand(String commandName, BenchmarkCommand command)
|
private void registerCommand(String commandName, BenchmarkCommand command)
|
||||||
{
|
{
|
||||||
commandName = commandName.toLowerCase();
|
commandName = commandName.toLowerCase();
|
||||||
if(benchmarkCommand.put(commandName, command) != null)
|
if(benchmarkCommand.put(commandName, command) != null)
|
||||||
BenchmarkLog.Log("Multiple registration of a command with name '" + commandName + "'!");
|
BenchmarkLog.log("Multiple registration of a command with name '" + commandName + "'!");
|
||||||
|
|
||||||
BenchmarkLog.Log("Registered " + commandName);
|
BenchmarkLog.log("Registered " + commandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Executes a command with the specified name, and provides it with some extra input data.
|
// Executes a command with the specified name, and provides it with some extra input data.
|
||||||
private BenchmarkFormattable ExecuteCommand(String name, BenchmarkInput input)
|
private BenchmarkFormattable executeCommand(String name, BenchmarkInput input)
|
||||||
{
|
{
|
||||||
BenchmarkCommand command = benchmarkCommand.get(name.toLowerCase());
|
BenchmarkCommand command = benchmarkCommand.get(name.toLowerCase());
|
||||||
|
|
||||||
if(command != null && benchmarkManager != null)
|
if(command != null && benchmarkManager != null)
|
||||||
return command.OnRun(benchmarkManager, input);
|
return command.onRun(benchmarkManager, input);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import utils.GlobalLog;
|
|||||||
//Logging shim
|
//Logging shim
|
||||||
public class BenchmarkLog
|
public class BenchmarkLog
|
||||||
{
|
{
|
||||||
public static void Log(String str) { GlobalLog.Log("[Benchmark] " + str); }
|
public static void log(String str) { GlobalLog.Log("[Benchmark] " + str); }
|
||||||
public static void Warn(String str) { GlobalLog.Warn("[Benchmark] " + str); }
|
public static void warn(String str) { GlobalLog.Warn("[Benchmark] " + str); }
|
||||||
public static void Error(String str) { GlobalLog.Error(" [Benchmark] " + str); }
|
public static void error(String str) { GlobalLog.Error(" [Benchmark] " + str); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ public class BenchmarkManager
|
|||||||
directoryMonitor = new DirectoryMonitor(directory);
|
directoryMonitor = new DirectoryMonitor(directory);
|
||||||
needsUpdate = false;
|
needsUpdate = false;
|
||||||
|
|
||||||
RebuildLookup();
|
rebuildLookup();
|
||||||
|
|
||||||
BenchmarkLog.Log("Took " + (Instant.now().toEpochMilli() - start) + " ms to load " + raw.size() + " entries from " + directoryMonitor.GetCurrentFiles().size() + " file" + (raw.size() > 1 ? "s" : ""));
|
BenchmarkLog.log("Took " + (Instant.now().toEpochMilli() - start) + " ms to load " + raw.size() + " entries from " + directoryMonitor.GetCurrentFiles().size() + " file" + (raw.size() > 1 ? "s" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rebuilds the files being monitored
|
// Rebuilds the files being monitored
|
||||||
public void RebuildLookup()
|
public void rebuildLookup()
|
||||||
{
|
{
|
||||||
long start = Instant.now().toEpochMilli();
|
long start = Instant.now().toEpochMilli();
|
||||||
|
|
||||||
@@ -66,17 +66,17 @@ public class BenchmarkManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BenchmarkLog.Warn("No " + extension + " files where found in " + directory);
|
BenchmarkLog.warn("No " + extension + " files where found in " + directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long end = Instant.now().toEpochMilli();
|
long end = Instant.now().toEpochMilli();
|
||||||
BenchmarkLog.Log("Rebuilt data in " + (end - start) + "ms");
|
BenchmarkLog.log("Rebuilt data in " + (end - start) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-evaluates and re-orders the input list based on the Levenshtein distance of the
|
// Re-evaluates and re-orders the input list based on the Levenshtein distance of the
|
||||||
// original search and the contents of the provided list of benchmark entries.
|
// original search and the contents of the provided list of benchmark entries.
|
||||||
public List<BenchmarkEntry> EvaluateLevenshteinDistance(List<BenchmarkEntry> entries, String search)
|
public List<BenchmarkEntry> evaluateLevenshteinDistance(List<BenchmarkEntry> entries, String search)
|
||||||
{
|
{
|
||||||
// Populate cost list with heuristic results
|
// Populate cost list with heuristic results
|
||||||
List<Pair<BenchmarkEntry, Integer>> cost = new ArrayList<Pair<BenchmarkEntry, Integer>>();
|
List<Pair<BenchmarkEntry, Integer>> cost = new ArrayList<Pair<BenchmarkEntry, Integer>>();
|
||||||
@@ -86,7 +86,7 @@ public class BenchmarkManager
|
|||||||
BenchmarkEntry entry = entries.get(i);
|
BenchmarkEntry entry = entries.get(i);
|
||||||
String entryString = entry.brand + " " + entry.model;
|
String entryString = entry.brand + " " + entry.model;
|
||||||
|
|
||||||
int heuristic = LevenshteinHeuristic(entryString, search, bestSoFar);
|
int heuristic = levenshteinHeuristic(entryString, search, bestSoFar);
|
||||||
if(heuristic < bestSoFar)
|
if(heuristic < bestSoFar)
|
||||||
bestSoFar = heuristic;
|
bestSoFar = heuristic;
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public class BenchmarkManager
|
|||||||
// Returns cost based on distance of characters from string. This is a kinda sloppy way
|
// Returns cost based on distance of characters from string. This is a kinda sloppy way
|
||||||
// to do it, but because I keep tabs on the best result so far, it could be much worse.
|
// to do it, but because I keep tabs on the best result so far, it could be much worse.
|
||||||
// Still chucks a lot - a non-recursive result w/ memoization would be best but this will do.
|
// Still chucks a lot - a non-recursive result w/ memoization would be best but this will do.
|
||||||
private int LevenshteinHeuristic(String str1, String str2, int bestSoFar)
|
private int levenshteinHeuristic(String str1, String str2, int bestSoFar)
|
||||||
{
|
{
|
||||||
int cost;
|
int cost;
|
||||||
|
|
||||||
@@ -139,15 +139,15 @@ public class BenchmarkManager
|
|||||||
if(distance > bestSoFar)
|
if(distance > bestSoFar)
|
||||||
return distance;
|
return distance;
|
||||||
|
|
||||||
int s1 = LevenshteinHeuristic(str1.substring(1), str2, bestSoFar) + 1;
|
int s1 = levenshteinHeuristic(str1.substring(1), str2, bestSoFar) + 1;
|
||||||
int s2 = LevenshteinHeuristic(str1, str2.substring(1), bestSoFar) + 1;
|
int s2 = levenshteinHeuristic(str1, str2.substring(1), bestSoFar) + 1;
|
||||||
int s3 = LevenshteinHeuristic(str1.substring(1), str2.substring(1), bestSoFar) + cost;
|
int s3 = levenshteinHeuristic(str1.substring(1), str2.substring(1), bestSoFar) + cost;
|
||||||
|
|
||||||
return min(new int[] {s1, s2, s3 });
|
return min(new int[] {s1, s2, s3 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for a substring in the model name
|
// Search for a substring in the model name
|
||||||
public List<BenchmarkEntry> FindModel(String modelSubstr)
|
public List<BenchmarkEntry> findModel(String modelSubstr)
|
||||||
{
|
{
|
||||||
long start = Instant.now().toEpochMilli();
|
long start = Instant.now().toEpochMilli();
|
||||||
List<BenchmarkEntry> matching = new ArrayList<BenchmarkEntry>();
|
List<BenchmarkEntry> matching = new ArrayList<BenchmarkEntry>();
|
||||||
@@ -161,27 +161,27 @@ public class BenchmarkManager
|
|||||||
matching.add(e);
|
matching.add(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
BenchmarkLog.Log("Searched for '" + searchSubstr + "' for "+ (Instant.now().toEpochMilli() - start) + "ms and found " + matching.size() + " entries.");
|
BenchmarkLog.log("Searched for '" + searchSubstr + "' for "+ (Instant.now().toEpochMilli() - start) + "ms and found " + matching.size() + " entries.");
|
||||||
return matching;
|
return matching;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeps tabs on any changes of the files.
|
// Keeps tabs on any changes of the files.
|
||||||
public void Update()
|
public void update()
|
||||||
{
|
{
|
||||||
needsUpdate = false;
|
needsUpdate = false;
|
||||||
directoryMonitor.Update(this::OnRescan, this::OnRescan, this::OnRescan);
|
directoryMonitor.Update(this::onRescan, this::onRescan, this::onRescan);
|
||||||
|
|
||||||
if(needsUpdate)
|
if(needsUpdate)
|
||||||
RebuildLookup();
|
rebuildLookup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// When a file is changed, handle it.
|
// When a file is changed, handle it.
|
||||||
private void OnRescan(MonitoredFile file)
|
private void onRescan(MonitoredFile file)
|
||||||
{
|
{
|
||||||
// For now, all we need is to note that something was adjusted.
|
// For now, all we need is to note that something was adjusted.
|
||||||
if(file.path.toString().contains(extension))
|
if(file.path.toString().contains(extension))
|
||||||
{
|
{
|
||||||
BenchmarkLog.Log("File status changed: " + file.path);
|
BenchmarkLog.log("File status changed: " + file.path);
|
||||||
needsUpdate = true;
|
needsUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class Response
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Builds a nicely formatted embedded message based on information provided
|
// Builds a nicely formatted embedded message based on information provided
|
||||||
public void CallEmbed(KittyEmbed embedInfo)
|
public void callEmbed(KittyEmbed embedInfo)
|
||||||
{
|
{
|
||||||
EmbedBuilder embed = new EmbedBuilder();
|
EmbedBuilder embed = new EmbedBuilder();
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class Response
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Queues a standard text-based message response to the channel that issued the command.
|
// Queues a standard text-based message response to the channel that issued the command.
|
||||||
public void Call(String toRespondWith)
|
public void call(String toRespondWith)
|
||||||
{
|
{
|
||||||
GlobalLog.Log(LogFilter.Response, "Sending response: " + toRespondWith);
|
GlobalLog.Log(LogFilter.Response, "Sending response: " + toRespondWith);
|
||||||
if(toRespondWith.length() > discordMessageMax)
|
if(toRespondWith.length() > discordMessageMax)
|
||||||
|
|||||||
+1
-1
@@ -106,7 +106,7 @@ public class Main extends ListenerAdapter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response.Call(pluginOutput.get(i));
|
response.call(pluginOutput.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user