depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

TypeError: Cannot read property 'text' of undefined #78

Open vbauer opened 8 years ago

vbauer commented 8 years ago
TypeError: Cannot read property 'text' of undefined
    at /var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/lib/Bot.js:221:32
    at Array.forEach (native)
    at Request._callback (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/lib/Bot.js:216:23)
    at Request.self.callback (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:198:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:1035:10)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:962:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:944:16
theshaun commented 8 years ago

I have seen this error and the one noted in #79 as well. Have not had a chance to look into it yet. Can confirm that both do occur on occasions

vbauer commented 8 years ago

Unfortunately, I do not see the connection between them.. Errors occur spontaneously.

cryarchy commented 7 years ago

Having the same problem as well. Sending the following messages to a bot /cmd param or text /cmd results in:

if (msg.message.text && msg.message.text.charAt(0) === '/') {
                               ^

TypeError: Cannot read property 'text' of undefined
    at /home/user/path/to/node_modules/node-telegram-bot/lib/Bot.js:221:32
    at Array.forEach (native)
    at Request._callback (/home/user/path/to/node_modules/node-telegram-bot/lib/Bot.js:216:23)
    at Request.self.callback (/home/user/path/to/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/home/user/path/to/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/home/user/path/to/node_modules/request/request.js:1091:12)
hamidb80 commented 6 years ago

i change my bot and problem automatically fixed! why?