telebot icon indicating copy to clipboard operation
telebot copied to clipboard

TeleBot event catch any command does't works

Open rgonzlz opened this issue 5 years ago • 0 comments

Hi!

I have this code:

export const id = 'Test';
export const defaultConfig = { };
export const plugin = (bot: TeleBot, pluginConfig: any) => {

    bot.on('/*', (msg, props) => {

        msg.reply.text(`Hi! Command: ${msg.text}`);
        
    });

}

Output: image

I checked the code and the problem is in the updates.js file, line 88:

                const eventList = ['/' + match[1]];
                if (!anyEventFlags[1]) {
                    eventList.push(['/*']); // <--- this
                    anyEventFlags[1] = true;
                }

Is an array, I edit to remove it and replace for a string:

                const eventList = ['/' + match[1]];
                if (!anyEventFlags[1]) {
                    eventList.push('/*'); 
                    anyEventFlags[1] = true;
                }

Output: image

Is correct this fix?

Thanks.

rgonzlz avatar May 28 '20 17:05 rgonzlz