umbot
Version:
Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber
61 lines (60 loc) • 1.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartAppButton = void 0;
const TemplateButtonTypes_1 = require("./TemplateButtonTypes");
const Text_1 = require("../../../utils/standard/Text");
class SmartAppButton extends TemplateButtonTypes_1.TemplateButtonTypes {
isCard;
constructor() {
super();
this.isCard = false;
}
getButtons() {
const objects = [];
if (this.isCard) {
const button = this.buttons[0];
if (button) {
if (button.url) {
return {
deep_link: button.url,
type: 'deep_link',
};
}
else {
const text = Text_1.Text.resize(button.title || '', 64);
if (text) {
return {
text,
type: 'text',
};
}
}
}
}
else {
this.buttons.forEach((button) => {
const title = Text_1.Text.resize(button.title || '', 64);
if (title) {
const object = {
title,
};
if (button.payload) {
object.action = {
server_action: button.payload,
type: 'server_action',
};
}
else {
object.action = {
text: title,
type: 'text',
};
}
objects.push(object);
}
});
}
return objects;
}
}
exports.SmartAppButton = SmartAppButton;