scraton / node-red-contrib-telegrambot-home

Useful Node RED nodes for connecting your home to Telegram.
MIT License
28 stars 11 forks source link

Switch #15

Closed albafer closed 3 years ago

albafer commented 5 years ago

I have search about it but I have not found a answer...

I have been using the switch node for a long time, but now I need to include more text in each option.

In my telegram chat, only apears [Option1...][Option2...] but I would like to see...

[Option 1 etc, etc ] [Option 2 etc, etc]

is it possible to do??

Best regards,

erkenes commented 3 years ago

Thats a Telegram issue.

You can add for every option an own switch-node.

image

danielnguyen commented 3 years ago

Not sure how active support for this repo is anymore, but wanted to suggest a potential quick fix to support this.

Telegram inline keyboard layout works using nested arrays. We can simply expose a vertical answers flag in the node configuration, which would map the answers to an array of arrays, instead of a single array, at this location: https://github.com/scraton/node-red-contrib-telegrambot-home/blob/master/nodes/switch/switch.js#L141

Telegram reference: https://core.telegram.org/bots/api#inlinekeyboardmarkup

This would automatically yield vertical list of buttons.

@scraton What do you think?

scraton commented 3 years ago

This is wonderful. Thank you all.