L
L
Lynatik0012020-07-06 20:39:50
JavaScript
Lynatik001, 2020-07-06 20:39:50

How to make buttons full width (Telegraf)?

Actually the question is in the title
Here is the implementation of the menu output.
Button width ctx.reply('hi', Botmenu); by default - refers to the text in front of the buttons - i.e. - hi
In this case, my buttons are 30% of the width of the full width of the screen (chat?) - by the way, sorry for the taftology.
My menu will not be the same in the bot. and the difference in full width in different menus look

dumb

controlPanel(Botmenu) {
    const controlPanelScene = new Scene('controlPanel');
    controlPanelScene.enter(async (ctx) => {
      await ctx.reply('hi', Botmenu);
    });
    return controlPanelScene;
  }


const Botmenu = frontMenu(...);


const frontMenu = (...arrayOfLabel) => Telegraf.Extra.markdown().markup((m) => m.inlineKeyboard(
  arrayOfLabel.map((a) => a.map((b) => m.callbackButton(b.name, b.callback))),
));

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2020-07-06
@Kozack

Something is screwed up in your code. But in my opinion you don't need to use spread operator when creating Botmenu.
There should be a two-dimensional array: an array of strings, and inside each string, an array of buttons.
https://github.com/telegraf/telegraf/blob/develop/...

L
Lynatik001, 2020-07-07
@Lynatik001

never found a solution. button width. after it adapts to its context (the text in the button) - it makes a ratio with the size of the text from the top.
How to either launch the keyboard without text on top, or make it full width and the button and the text - exits (to score with spaces, as for me, this is not a solution if it just works)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question