UNPKG

hennus-api

Version:

Esta es una libreria para el bot Hennus

49 lines (48 loc) 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ButtonsBuilder = void 0; class ButtonsBuilder { constructor(options) { this.type = 2; this.style = 1; this.emoji = { name: undefined, id: undefined, animated: undefined }; if (options) { this.SetStyle(options.style); if (options.label) this.SetLabel(options.label); this.SetEmoji(options.emoji); if (options.style != 5) this.SetCustomId(options.custom_id); if (options.style == 5) this.SetURL(options.url); } } SetStyle(style) { const stylesMap = { "Primary": 1, "Secondary": 2, "Success": 3, "Danger": 4, "Link": 5 }; this.style = typeof style === "string" ? stylesMap[style] || 1 : style; return this; } SetLabel(label) { this.label = typeof label === "string" ? label.slice(0, 80) : undefined; return this; } SetEmoji(name, id, animated) { this.emoji = typeof name === "object" ? name : { name, id, animated }; return this; } SetCustomId(id) { this.custom_id = typeof id === "string" ? id : undefined; return this; } SetURL(url) { this.url = this.style === 5 && typeof url === "string" ? url : undefined; return this; } } exports.ButtonsBuilder = ButtonsBuilder;