'How to use once in telegraf

Im writing telegram bot in node.js with menu tree, i done folder tree, but in one i must send id in callback_data, im using this code

 bot.on('callback_query', async ctx => {
    await ctx.answerCbQuery()
    await ctx.deleteMessage()

    require(ctx.callbackQuery.data)({ bot, ctx, User })
})

but i want to use bot.once, to get callback_query in sub folders, how can i do it?

I tried

Promises

removeListner

and others EventEmmiter methods



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source