= Cleaning up edge cases

This commit is contained in:
Matthew Cech
2019-04-13 12:34:35 -07:00
parent 330e0c2e08
commit 0912034c2f
9 changed files with 30 additions and 10 deletions
+6
View File
@@ -17,6 +17,12 @@ public class CommandColiru extends Command
@Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
if(input.args.trim().length() < 1)
{
res.Call(Localizer.Stub("Please provide some c++ code to attempt to compile!"));
return;
}
res.Call(compiler.compileCPlus(input.args));
}
+3
View File
@@ -40,6 +40,9 @@ public class CommandEightBall extends Command
@Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
if(input.args.trim().length() < 1)
res.Call(Localizer.Stub("Hmm? You'll need to ask a question!"));
res.Call(answers[(int) (Math.random()*answers.length)]);
}
}
+2 -3
View File
@@ -15,12 +15,11 @@ public class CommandInfo extends Command
public CommandInfo(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return Localizer.Stub("Provides author info and a link to Kitty's website"); }
public String HelpText() { return Localizer.Stub("Provides some extra info about KittyBot"); }
@Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String info = Localizer.Stub("I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/");
res.Call(info);
res.Call(Localizer.Stub("I'm a Java application written with JDA! Check out my repo at <https://github.com/AlexStewartCode/KittyBot>"));
}
}
+6
View File
@@ -17,6 +17,12 @@ public class CommandJDoodle extends Command
@Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
if(input.args.trim().length() < 1)
{
res.Call(Localizer.Stub("Please provide some java code to get it compiled!"));
return;
}
res.Call(compiler.compileJava(input.args));
}
}
+2 -1
View File
@@ -17,7 +17,7 @@ public class CommandPollVote extends Command
{
if(guild.hasVoted.contains(user.uniqueID))
{
res.Call(Localizer.Stub("You already voted"));
res.Call(Localizer.Stub("You already voted!"));
return;
}
try
@@ -41,6 +41,7 @@ public class CommandPollVote extends Command
return;
}
}
res.Call(Localizer.Stub("There is no poll running!"));
}
}
+3 -1
View File
@@ -31,7 +31,9 @@ public class CommandRPG extends Command
{
if(input.args == null || input.args.length() == 0)
{
res.Call(HelpText());
String output = HelpText();
System.out.println("Out: |" + output + "|");
res.Call(output);
return;
}
+1 -1
View File
@@ -92,7 +92,7 @@ public class Localizer
return input;
String value = stringStore.GetKey(input);
if(value == null || value.length() < 1)
if(value == null || value.trim().length() < 1)
return input;
return value;
+1 -1
View File
@@ -312,7 +312,7 @@ public class ObjectBuilderFactory
manager.Register("results", new CommandPollResults(KittyRole.General, KittyRating.Safe));
manager.Register("showpoll", new CommandPollShow(KittyRole.General, KittyRating.Safe));
manager.Register("wolfram", new CommandWolfram(KittyRole.General, KittyRating.Safe));
manager.Register(new String[] {"c++", "g++", "cplus",}, new CommandColiru(KittyRole.General, KittyRating.Safe));
manager.Register(new String[] {"c++", "g++", "cplus","cpp"}, new CommandColiru(KittyRole.General, KittyRating.Safe));
manager.Register(new String[] {"java", "jdoodle" }, new CommandJDoodle(KittyRole.General, KittyRating.Safe));
manager.Register("beans", new CommandBeansShow(KittyRole.General, KittyRating.Safe));
manager.Register("role", new CommandRole(KittyRole.General, KittyRating.Safe));