Fix buttons list (#1656)

* fix: change the individual buttons limti to 3, still 5 on total

* docs: Change buttons example to include clipboard
This commit is contained in:
Sergio Carvalho
2022-08-15 15:04:12 -03:00
committed by GitHub
parent aba0f3c3c9
commit 617ea37b71
2 changed files with 7 additions and 5 deletions

View File

@@ -70,10 +70,10 @@ class Buttons {
* @returns {FormattedButtonSpec[]}
*/
_format(buttons){
// Limit the buttons (max 3 of regular and 2 of special buttons)
const templateButtons = buttons.filter(button => button.url || button.number).slice(0,2);
// Limit the buttons (max 3 of regular and 3 of special buttons) 5 buttons total at the same time
const templateButtons = buttons.filter(button => button.url || button.number).slice(0,3);
const regularButtons = buttons.filter(button => !button.url && !button.number).slice(0,3);
buttons = templateButtons.concat(regularButtons);
buttons = templateButtons.concat(regularButtons).slice(0,5);
return buttons.map((button, index) => {
if (button.url && button.number && button.id) throw 'Only pick one of the following (url/number/id)';