CharlieHess / slack-poker-bot

A bot that deals Texas Hold'em games in Slack
MIT License
1.66k stars 207 forks source link

Cannot read property 'send' of undefined #22

Closed kordless closed 8 years ago

kordless commented 9 years ago

Got the bot working. Started a game. Getting this now:

[Tue Sep 01 2015 21:38:13 GMT+0000 (UTC)] INFO Connecting...
Welcome to Slack. You are johnny of Giant Swarm
You are in: general
Your open DM's: xxxx
/poker/node_modules/rx/dist/rx.js:579
    throw e;
          ^
TypeError: Cannot read property 'send' of undefined
    at TexasHoldem.dealPlayerCards (/poker/src/texas-holdem.js:503:11)
    at TexasHoldem.playHand (/poker/src/texas-holdem.js:116:10)
    at /poker/src/texas-holdem.js:70:27
    at /poker/node_modules/rx/dist/rx.js:4924:20
    at tryCatcher (/poker/node_modules/rx/dist/rx.js:567:29)
    at InnerObserver.onNext (/poker/node_modules/rx/dist/rx.js:4806:43)
    at InnerObserver.tryCatcher (/poker/node_modules/rx/dist/rx.js:567:29)
    at AutoDetachObserverPrototype.next (/poker/node_modules/rx/dist/rx.js:5274:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/poker/node_modules/rx/dist/rx.js:1710:35)
    at scheduleItem (/poker/node_modules/rx/dist/rx.js:2961:16)
davixyz commented 9 years ago

I'm getting the same issue

kordless commented 9 years ago

I ran it again and made everyone stop talking in the channel. It appears to be due to 'last action', perhaps.

CharlieHess commented 9 years ago

This is a timing bug with opening DM channels. I'll fix it properly soon; in the meantime the workaround is for each player to open a DM with the poker bot before they ask it to deal a game (no need to send a message to the bot).

kordless commented 9 years ago

Cool, thanks.

jabbink commented 9 years ago

Tested a few hours ago with the most recent version of this repo: this error still occurs

poker@hostname:~/slack-poker-bot$ node src/main
[Tue Sep 08 2015 10:36:21 GMT-0400 (EDT)] INFO Connecting...
Welcome to Slack. You are botname of slackname
You are in: casino
Your open DM's: slackbot, user1, user2, user3, user4, user5, user6, user7, user8, user9, user10

user11 types @botname deal in channel. user2, user11 and user12 type yes. Log continues:

Opening DM channel for user2
Opening DM channel for user11
Opening DM channel for user12
/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:579
    throw e;
          ^
TypeError: Cannot read property 'send' of undefined
    at TexasHoldem.dealPlayerCards (/home/poker/slack-poker-bot/src/texas-holdem.js:489:11)
    at TexasHoldem.playHand (/home/poker/slack-poker-bot/src/texas-holdem.js:102:10)
    at /home/poker/slack-poker-bot/src/texas-holdem.js:55:27
    at /home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:4924:20
    at tryCatcher (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:567:29)
    at InnerObserver.onNext (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:4806:43)
    at InnerObserver.tryCatcher (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:567:29)
    at AutoDetachObserverPrototype.next (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:5274:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:1710:35)
    at scheduleItem (/home/poker/slack-poker-bot/node_modules/rx/dist/rx.js:2961:16)

Restarted the bot, made sure all participating users had the DM open -> played a game of poker.

wision commented 8 years ago

+1 on still happening

CharlieHess commented 8 years ago

Curses you're right.