UNPKG

@shgysk8zer0/slack

Version:

An npm package for sending messages in Slack

37 lines (28 loc) 616 B
'use strict'; var element = require('./element.cjs'); class SlackInteractiveElement extends element.SlackElement { #action; constructor({ id, action } = {}) { super({ id }); if (typeof action !== 'undefined') { this.action = action; } } get action() { return this.#action; } set action(val) { if (typeof val === 'string' && val.length !== 0) { this.#action = val; } else { throw new TypeError('action must be a non-empty string.'); } } toJSON() { return { ...super.toJSON(), action_id: this.#action, }; } } exports.SlackInteractiveElement = SlackInteractiveElement;