UNPKG

umbot

Version:

Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber

40 lines (39 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ViberButton = void 0; const TemplateButtonTypes_1 = require("./TemplateButtonTypes"); class ViberButton extends TemplateButtonTypes_1.TemplateButtonTypes { static T_REPLY = 'reply'; static T_OPEN_URL = 'open-url'; static T_LOCATION_PICKER = 'location-picker'; static T_SHARE_PHONE = 'share-phone'; static T_NONE = 'none'; getButtons() { let object = null; const buttons = []; this.buttons.forEach((button) => { let btn = { Text: button.title, }; if (button.url) { btn.ActionType = ViberButton.T_OPEN_URL; btn.ActionBody = button.url; } else { btn.ActionType = ViberButton.T_REPLY; btn.ActionBody = button.title; } btn = { ...btn, ...button.options }; buttons.push(btn); }); if (buttons.length) { object = { DefaultHeight: true, BgColor: '#FFFFFF', Buttons: buttons, }; } return object; } } exports.ViberButton = ViberButton;