Added ability to reply with an optional image for bet history

This commit is contained in:
Matthew Cech
2021-01-03 21:46:13 -08:00
parent 127bdb74fb
commit d481fec0af
2 changed files with 22 additions and 1 deletions
+2 -1
View File
@@ -73,7 +73,8 @@
"Localized Strings","BetBeansNotValid","That's not a valid bet!" "Localized Strings","BetBeansNotValid","That's not a valid bet!"
"Localized Strings","BetBeansWin","You won %s beans!" "Localized Strings","BetBeansWin","You won %s beans!"
"Localized Strings","BetHistoryInfo","Gives how many beans I've ~~stolen~~ won from your bets!" "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","BlurryInfo","Blurs your icon or the icon of a friend you mentioned"
"Localized Strings","BoopInfo","Kitty will react with a counter" "Localized Strings","BoopInfo","Kitty will react with a counter"
"Localized Strings","BoopMultiple","%s booped several others - %s!" "Localized Strings","BoopMultiple","%s booped several others - %s!"
1 Type Key Value
73 Localized Strings BetBeansNotValid That's not a valid bet!
74 Localized Strings BetBeansWin You won %s beans!
75 Localized Strings BetHistoryInfo Gives how many beans I've ~~stolen~~ won from your bets!
76 Localized Strings BetHistoryOutput BetHistoryOptionalPNGPath I have %s treats from betting!
77 Localized Strings BetHistoryOutput I have %s beans from betting!
78 Localized Strings BlurryInfo Blurs your icon or the icon of a friend you mentioned
79 Localized Strings BoopInfo Kitty will react with a counter
80 Localized Strings BoopMultiple %s booped several others - %s!
+20
View File
@@ -1,5 +1,7 @@
package commands.beans; package commands.beans;
import java.io.File;
import core.Command; import core.Command;
import core.LocStrings; import core.LocStrings;
import dataStructures.KittyChannel; import dataStructures.KittyChannel;
@@ -9,6 +11,8 @@ import dataStructures.KittyRole;
import dataStructures.KittyUser; import dataStructures.KittyUser;
import dataStructures.Response; import dataStructures.Response;
import dataStructures.UserInput; import dataStructures.UserInput;
import utils.GlobalLog;
import utils.LogFilter;
public class CommandBetHistory extends Command public class CommandBetHistory extends Command
{ {
@@ -20,6 +24,22 @@ 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)
{ {
// Send primary response
res.send(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.get())); 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.");
}
}
} }
} }