mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-23 10:27:49 +00:00
fix: RegexExp in process messges updates
This commit is contained in:
parent
5385d41f1f
commit
4fa9a735bb
@ -686,6 +686,11 @@ class TelegramBot extends EventEmitter {
|
|||||||
debug('Text message');
|
debug('Text message');
|
||||||
this._textRegexpCallbacks.some(reg => {
|
this._textRegexpCallbacks.some(reg => {
|
||||||
debug('Matching %s with %s', message.text, reg.regexp);
|
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);
|
const result = reg.regexp.exec(message.text);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user