telebot
telebot copied to clipboard
TeleBot event catch any command does't works
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:

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:

Is correct this fix?
Thanks.