diff --git a/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java b/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java index ef50a5862ffa807f9e0b63a4f8e95d2cd6279d04..b6eb9077fb62a23456a522d667d1ec16384fe58c 100644 --- a/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java +++ b/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java @@ -3,7 +3,10 @@ package com.comandante.creeper.bot; import com.comandante.creeper.bot.commands.*; import com.google.common.collect.Maps; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; public class BotCommandFactory { @@ -17,6 +20,7 @@ public class BotCommandFactory { addCommand(new ImdbBotCommand(botCommandManager)); addCommand(new ForecastCommand(botCommandManager)); addCommand(new RandomRoomDescriptionCommand(botCommandManager)); + addCommand(new CardsCommand(botCommandManager)); } public BotCommand getCommand(String originalFullCmd) { diff --git a/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java b/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..1d216476af17c055fd74e70fe38d129f06ced184 --- /dev/null +++ b/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java @@ -0,0 +1,33 @@ +package com.comandante.creeper.bot.commands; + +import com.comandante.creeper.blackjack.BlackJack; +import com.comandante.creeper.blackjack.Deck; +import com.comandante.creeper.bot.BotCommandManager; +import com.google.api.client.util.Lists; +import com.google.common.collect.Sets; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +public class CardsCommand extends BotCommand { + + static Set<String> triggers = Sets.newHashSet("cards"); + static String helpUsage = "cards"; + static String helpDescription = "Some random cards."; + + public CardsCommand(BotCommandManager botCommandManager) { + super(botCommandManager, triggers, helpUsage, helpDescription); + } + + @Override + public List<String> process() { + Deck deck = new Deck(); + deck.shuffle(); + List<BlackJack.Card> cards = com.google.common.collect.Lists.newArrayList(deck.next(), deck.next(), deck.next(), deck.next(), deck.deal()); + String asciiPlayingCardHand = BlackJack.getAsciiPlayingCardHand(cards); + ArrayList<String> resp = Lists.newArrayList(); + resp.add(asciiPlayingCardHand); + return resp; + } +}