@ayanaware/bentocord
Version:
Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.
44 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = void 0;
const eris_1 = require("eris");
const BaseComponent_1 = require("./BaseComponent");
const { ButtonStyles, ComponentTypes } = eris_1.Constants;
class Button extends BaseComponent_1.BaseComponent {
constructor(ctx, customId, handler) {
super(ctx, customId, handler);
// set button defaults
this.definition.type = ComponentTypes.BUTTON;
this.definition.style = ButtonStyles.PRIMARY;
}
label(label) {
this.definition.label = label;
return this;
}
async labelTranslated(key, repl, backup) {
return this.label(await this.ctx.formatTranslation(key, repl, backup));
}
emoji(emoji) {
this.definition.emoji = emoji;
return this;
}
// styles
style(style) {
this.definition.style = style;
return this;
}
primary() {
return this.style(ButtonStyles.PRIMARY);
}
secondary() {
return this.style(ButtonStyles.SECONDARY);
}
success() {
return this.style(ButtonStyles.SUCCESS);
}
danger() {
return this.style(ButtonStyles.DANGER);
}
}
exports.Button = Button;
//# sourceMappingURL=Button.js.map