Skip to content

Commit

Permalink
If at first you don't succeed, try, try again?
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieHess committed Oct 1, 2015
1 parent d641f3a commit c678e7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/texas-holdem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const _ = require('underscore-plus');

const Deck = require('./deck');
const PotManager = require('./pot-manager');
const SlackApiRx = require('./slack-api-rx');
const PlayerOrder = require('./player-order');
const PlayerStatus = require('./player-status');
const ImageHelpers = require('./image-helpers');
Expand Down Expand Up @@ -486,7 +487,14 @@ class TexasHoldem {

if (!player.isBot) {
let dm = this.playerDms[player.id];
dm.send(`Your hand is: ${this.playerHands[player.id]}`);
if (!dm) {
SlackApiRx.getOrOpenDm.subscribe(({dm}) => {
this.playerDms[player.id] = dm;
dm.send(`Your hand is: ${this.playerHands[player.id]}`);
});
} else {
dm.send(`Your hand is: ${this.playerHands[player.id]}`);
}
} else {
player.holeCards = this.playerHands[player.id];
}
Expand Down

0 comments on commit c678e7f

Please sign in to comment.