question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to show back button?

See original GitHub issue

Hi again,

I can’t see the back button in the sub-menu:

    const config = new TelegrafInlineMenu("Configuration")
    config.setCommand('config');

    //Available languages
    const locales = new TelegrafInlineMenu("Locales");
    locales.simpleButton("italian", 'SET_LOCALE_IT', {
        doFunc: async ctx => settingsController.SetLocale(ctx, bot)
    });
    locales.simpleButton("english", 'SET_LOCALE_EN', {
        doFunc: async ctx => settingsController.SetLocale(ctx, bot)
    });

    config.submenu("Set locale", 's', locales);
    bot.use(config.init({
        backButtonText: "back...",
        mainMenuButtonText: "Go to main menu",
    }));

When I press on Set Locale I get:

  • Italian
  • English
  • Go to main menu

but the back button missing… what I did wrong?

Thanks in advnance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sfarzosocommented, Apr 21, 2019

@EdJoPaTo Thanks for your support and congrats for this helpful library 😃

1reaction
EdJoPaTocommented, Apr 21, 2019

The init is only required once per menu “tree”: Having two separate menus you need to init both. If one is a submenu of the other one, you only need to init it once.

- main
- config
→ Init both


- main
  - config
→ Init only main

And to your other question: Commands can be on every menu wherever they are in a menu tree. So this is possible:

const mainmenu = new TelegrafInlineMenu(…)
mainmenu.setCommand('start')

const submenu = new TelegrafInlineMenu(…)
submenu.setCommand('foo')
mainmenu.submenu(…, submenu)

bot.init(mainmenu.init(…))

This way you can either use /start and go to the submenu with a button or use /config (as a shortcut). This is especially handy for things like /help or /settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Get The BACK Button On Your Android Phone
1) Tap the Settings icon on your phone. It can be found in your app list. · 2) Once in the Settings area,...
Read more >
Display back button on action bar - android - Stack Overflow
Step 1 showing back button: Add this line in onCreate() method to show back button. assert getSupportActionBar() != null; //null check getSupportActionBar() ...
Read more >
How to Add and Customize Back Button of Action Bar in ...
Create action bar variable and call function getSupportActionBar() in the java/kotlin file. · Show back button using actionBar.
Read more >
How To Get The Back Button BACK in Android 12
Go To Settings > System; Inside System, Locate The 3 Button Navigation Switch To Turn on Android's Standard Navigation Buttons; Once Selected, ...
Read more >
How to bring back Android's 3-button navigation
Swipe right quickly and briefly on the Home button to switch between your two most recent apps (the same as double-tapping the Overview...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found