Node-telegram-bot-api: Unhandled rejection TypeError: reg.regexp.exec is not a function (when receiving a message)

Created on 26 Apr 2016  路  4Comments  路  Source: yagop/node-telegram-bot-api

Unhandled rejection TypeError: reg.regexp.exec is not a function
    at /home/nick/Desktop/telegram-bot/node_modules/node-telegram-bot-api/src/telegram.js:90:33
    at Array.forEach (native)
    at TelegramBot._processUpdate (/home/nick/Desktop/telegram-bot/node_modules/node-telegram-bot-api/src/telegram.js:88:32)
    at null.<anonymous> (/home/nick/Desktop/telegram-bot/node_modules/node-telegram-bot-api/src/telegramPolling.js:36:14)
    at Array.forEach (native)
    at null.<anonymous> (/home/nick/Desktop/telegram-bot/node_modules/node-telegram-bot-api/src/telegramPolling.js:33:15)
    at tryCatcher (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/nick/Desktop/telegram-bot/node_modules/bluebird/js/main/async.js:15:14)
    at tryOnImmediate (timers.js:534:15)
    at processImmediate [as _immediateCallback] (timers.js:514:5)

Most helpful comment

reg.regexp is a regular expression provided by telegramBot.onText(regexp, callback). So it looks like you used onText somewhere without a regexp object.

There's also a debug statement right before reg.regexp.exec gets called, so starting node with the DEBUG=node-telegram-bot-api environment variable will give you some more information about whats going on.

All 4 comments

reg.regexp is a regular expression provided by telegramBot.onText(regexp, callback). So it looks like you used onText somewhere without a regexp object.

There's also a debug statement right before reg.regexp.exec gets called, so starting node with the DEBUG=node-telegram-bot-api environment variable will give you some more information about whats going on.

Yep, this was my fault, my editor was at fault here.

what was the problem?

@Besatnias : The problem was, @ZudoMC didn't use _Regular Expression_ on onText..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenny76 picture lenny76  路  3Comments

Rezania815 picture Rezania815  路  3Comments

hems picture hems  路  3Comments

saeedhei picture saeedhei  路  4Comments

abbddo picture abbddo  路  3Comments