UNPKG

discord-vatron

Version:

Módulo para facilitar la interacción con la API de Discord

73 lines (57 loc) 1.55 kB
const estilos = { AZUL: 1, GRIS: 2, VERDE: 3, ROJO: 4, URL: 5 }; module.exports = class Boton { constructor(datos) { /*if(!bot) { console.error('[DISCORD-VATRON] Debes pasar al bot en el primer parámetro al crear un botón'); return this; }*/ //this._bot = bot; this.type = 2; this.style = 2; this.label = ''; this.emoji = null; this.custom_id = null; this.disabled = false; this.url = null; if(datos) Object.assign(this, datos); } estEstilo(e) { if(!estilos[e]) return console.error('[DISCORD-VATRON] El estilo ' + e + ' no existe, puedes poner: ' + Object.keys(estilos).join(', ')); this.style = estilos[e]; return this; } estTexto(t) { this.label = t ? t.toString() : ''; return this; } estEmoji(e) { this.emoji = { name: e.nombre || null, id: e.id || null, animated: e.animado || false }; if(!e.id) this.emoji = { name: e, animated: false }; return this; } estID(id) { this.custom_id = id || Math.random().toString(36); return this; } estDesactivado(b = false) { this.disabled = b || false; return this; } estURL(url) { this.url = url ? url.toString() : null; return this; } }