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 add dynamic voices?

See original GitHub issue

I have this sub-menu:

const projects = new TelegrafInlineMenu(ctx => ctx.i18n.t('projectsHandler'));
projects.setCommand('myprojects');
main.submenu(ctx => ctx.i18n.t('projectsHandler'), 'p', projects);

essentially when I type the command myprojects the menu is displayed, and this works well. Now, I need to show in this menu all the projects store inside my MongoDB database, so essentially when I write /myprojects the menu must be built dynamically.

Could you tell me how can I add dynamic voices?

Kind regards.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
EdJoPaTocommented, Apr 23, 2019

Oh, I meant that differently. Sorry for not being clear there. Thats what I meant with textFunc:

menu.selectSubmenu(…, getOptions, p, {
  textFunc: (ctx, key) => {…}
}

If you like your way and want to continue it, you can return a dictionary like the following example. Its nice to have but tended to messy code in my experience.

{
  a: 'AAA',
  b: 'BBB'
  c: 'I like trains'
}

which would require this code:

    let objects = {};
    projects.forEach(p => {
        objects[p._id] = p.name;
    });
1reaction
EdJoPaTocommented, Apr 23, 2019

If I understand your code correctly you want to have this menu structure:

  • main
    • projects
      • p (for each option)

In this case main.submenu(…, projects) is still what you wanted? Your last example has two selectSubmenu calls which you probably don’t want?

To your question 1: you can set the columns on a menu.select(). 1 column → 1 entry per row.

To your question 2: The menu p which handles the specific project can read it from ctx.match. Most likely ctx.match[1] but it can be different depending on the menu structure.

Maybe its helpful to explain the purpose of each method:

  • submenu takes a submenu and one button leading to it
  • select takes multiple options which can be used to select something out of multiple entries.
  • selectSubmenu combines both: you can pick which option you want to handle in the submenu
const projects = new …
projects.setCommand('myprojects')

const p = new TelegrafInlineMenu(ctx => ctx.match[1])
projects.selectSubmenu('pro', ctx => loadProjectsForContext(ctx), p)

main.select(…, projects)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Dynamic Voice and Add Personality to Your ...
Authority is rather dull · But don't become a blabbermouth · Pay attention to rhythm · Go beyond word choice to set the...
Read more >
How To Create 100 Distinctly Different Voices - YouTube
Very few can make careers using multiple voices...but the ones that do ... this skill properly so that you can stand out and...
Read more >
How to Give Your Voice Dynamism
Use Andrew Bennett's tips to give your voice dynamism when speaking in meetings or presenting · Set the Scene · Breathe · Practice...
Read more >
Different Dynamics for different voices - MuseScore
I also tried selecting all of the voice 2 notes, then adding the dynamic. It added a separate one for each note, and...
Read more >
Vocal Dynamics in Singing | How Do I Improve My ... - TeenStar
Messa di Voce is a common method that dynamic singers use to improve their vocals. Messa di Voce is an Italian saying that...
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