EdJoPaTo / grammy-inline-menu

Inline Menus for Telegram made simple. Successor of telegraf-inline-menu.
MIT License
357 stars 44 forks source link

How do I call navigate in the code? #247

Closed romanticsoul closed 3 weeks ago

romanticsoul commented 1 month ago

how can I make a transition to another page using return in do()

// ✅ It works
mainMenu.navigate("/item:1", {
  text: "item 1",
});

// ❌ it doesn't work (how to fix it?)
mainMenu.interact(nanoid(), {
  text: "item 2",
  do: () => "/item:2",
});

mainMenu.manualAction(/item:(\d+)/, async (ctx) => {
  await editMenuOnContext(itemMenu, ctx, "/");
  return false;
});

tried different options: /item:2, /item:2/, item:2/, ../item:2, ../item:2/

EdJoPaTo commented 1 month ago

Have you checked out How does it work on the README? Adding the suggested bot.use with a console.log can be quite helpful in order to figure out where the menu is you want to trigger manually.

As you try to trigger them starting with / it might not be on the root level so not starting with the /?

EdJoPaTo commented 3 weeks ago

I'll just close this due to inactivity. If you have any questions feel free to ask ahead!