2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-22 18:07:16 +00:00

fix: RegexExp in process messges updates

This commit is contained in:
Daniel 2023-11-01 12:31:54 +01:00
parent 5385d41f1f
commit 4fa9a735bb

View File

@ -686,6 +686,11 @@ class TelegramBot extends EventEmitter {
debug('Text message');
this._textRegexpCallbacks.some(reg => {
debug('Matching %s with %s', message.text, reg.regexp);
if (!(reg.regexp instanceof RegExp)) {
reg.regexp = new RegExp(reg.regexp);
}
const result = reg.regexp.exec(message.text);
if (!result) {
return false;