UNPKG

@urban-bot/slack

Version:

Create Slack chatbot with urban-bot

35 lines 990 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withRightSpaceIfExist = exports.formatTitle = exports.formatButtons = void 0; function formatButtons(buttons) { if (Array.isArray(buttons[0])) { throw new Error('Please provide flat buttons structure to @urban-bot/slack'); } return buttons.map((button) => { return { type: 'button', text: { type: 'plain_text', text: button.text, emoji: true, }, value: button.id, }; }); } exports.formatButtons = formatButtons; function formatTitle(title) { return { type: 'section', text: { type: 'mrkdwn', text: title, }, }; } exports.formatTitle = formatTitle; function withRightSpaceIfExist(text) { return text ? `${text} ` : ''; } exports.withRightSpaceIfExist = withRightSpaceIfExist; //# sourceMappingURL=format.js.map