Added ability to reply with an optional image for bet history
This commit is contained in:
+2
-1
@@ -73,7 +73,8 @@
|
||||
"Localized Strings","BetBeansNotValid","That's not a valid bet!"
|
||||
"Localized Strings","BetBeansWin","You won %s beans!"
|
||||
"Localized Strings","BetHistoryInfo","Gives how many beans I've ~~stolen~~ won from your bets!"
|
||||
"Localized Strings","BetHistoryOutput","I have %s treats from betting!"
|
||||
"Localized Strings","BetHistoryOptionalPNGPath",""
|
||||
"Localized Strings","BetHistoryOutput","I have %s beans from betting!"
|
||||
"Localized Strings","BlurryInfo","Blurs your icon or the icon of a friend you mentioned"
|
||||
"Localized Strings","BoopInfo","Kitty will react with a counter"
|
||||
"Localized Strings","BoopMultiple","%s booped several others - %s!"
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package commands.beans;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import core.Command;
|
||||
import core.LocStrings;
|
||||
import dataStructures.KittyChannel;
|
||||
@@ -9,6 +11,8 @@ import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
|
||||
public class CommandBetHistory extends Command
|
||||
{
|
||||
@@ -20,6 +24,22 @@ public class CommandBetHistory extends Command
|
||||
@Override
|
||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
// Send primary response
|
||||
res.send(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.get()));
|
||||
|
||||
// Look up extra information to see if we ahve a flair image
|
||||
String optional = LocStrings.stub("BetHistoryOptionalPNGPath");
|
||||
if(optional != null && optional.length() > 0)
|
||||
{
|
||||
File responseImage = new File(optional);
|
||||
if(responseImage.exists())
|
||||
{
|
||||
res.sendFile(responseImage, ".png");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalLog.warn(LogFilter.Command, "Optional PNG image for bet history was specified, but the file could not be found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user