A bot that turns Slack into a legitimate Texas Hold'em client. Start a game in any channel or private group with 2-10 players. PokerBot will deal hands, direct message players with their hole cards, query players for their action, determine the winning hand, and handle the pot.
See it in action.
Click this button:
heroku config:set SLACK_POKER_BOT_TOKEN=[Your API token]
git push heroku master
token.txtfile and paste your API token there
@<your-bot-name>: quit game. The game will end once the current hand finishes. Note that any player can end a game at any time with this command, so Be Honorable™.
@<your-bot-name>: config <name-of-option>=<value>. The supported options are:
timeout: Sets the duration (in seconds) before a player times out. Set to 0 to specify no timeout.
So, to start a game without any player timeout, say:
@<your-bot-name>: config timeout=0 @<your-bot-name>: deal
Check the open issues for some planned enhancements.
Although this client was built for managing human players in a Slack channel, it has some support for AI players. To add a bot player:
getAction, which is called whenever it is the bot's turn
src/bot.jsto add your bot to every game
To run tests, simply do:
NodeJS Slack Client
node-slack-client abstracts the basics of a Slack bot, including authentication, getting messages from players, and posting messages or attachments to the channel.
The majority of this client is written using
RxJS. It simplifies many of the complex player polling interactions, that would otherwise be Death By Timers, into very legible code.
Imgur / Lightweight Image Processor
Each card is a separate image, and board images are created on the fly by pasting several cards onto a single canvas (with the help of
lwip). The resulting image is than uploaded to
imgur, which gives us a single URL that can be passed as an attachment to the Slack API. This route was chosen to avoid uploading 318,505,200 images to the cloud, and allows us to modify the card assets easily.
poker-evaluator is used for evaluating the winning hand when it comes time to show down. Here it has been extended to calculate the best 5-card hand from any 7-card hand.
Most of the tricky client logic is backed up by tests, which were written using