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)
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..
Most helpful comment
reg.regexpis a regular expression provided bytelegramBot.onText(regexp, callback). So it looks like you usedonTextsomewhere without a regexp object.There's also a
debugstatement right beforereg.regexp.execgets called, so starting node with theDEBUG=node-telegram-bot-apienvironment variable will give you some more information about whats going on.