Discord Additions - Components
Some helpful additions to make creating components easier.
Versions 1.0.7
and beyond have been changed to be compatible with Oceanic instead of Eris. If you're using this module with eris, do not update.
Get started by using our main class, the ComponentHelper
.
import {
ComponentHelper,
ButtonStyles,
ButtonColors,
TextInputStyles,
Button,
SelectMenu,
TextInput,
MessageActionRow,
ModalActionRow
} from "@discord-additions/components";
const helper = new ComponentHelper();
helper.addInteractionButton(ButtonStyles.PRIMARY, "some-custom-id", "My Button Label", { id: null, name: "🐾" }, false);
helper.addURLButton("https://google.com", "Click Here", { id: "681748079778463796", name: "paws8", animated: false }, false);
ComponentHelper.emojiToPartial("🐾", "default")
ComponentHelper.emojiToPartial("<:paws8:681748079778463796>", "custom")
ComponentHelper.emojiToPartial("<a:owoanim:768551122066472990>", "custom")
helper.addSelectMenu("some-custom-id", [], "Some Placeholder Here", 1, 3, false);
helper.addTextInput(TextInputStyles.SHORT, "Some Label Here", "some-custom-id", "Some Placeholder Here", "Initial Value", 20, 100, true);
helper.removeEmptyRows();
helper.toJSON();
helper.addRow();
helper.addComponent(new Button(ButtonColors.RED, "some-custom-id"));
helper.addComponents([
new Button(ButtonStyles.LINK, "https://google.com"),
new SelectMenu("some-custom-id"),
new TextInput(TextInputStyles.PARAGRAPH, "Some Label", "some-custom-id")
]);
const helper3 = new ComponentHelper(3);
helper3.setRowMax(2);
helper.toJSON<MessageActionRow>();
helper.toJSON<ModalActionRow>();
const helperMessage = new ComponentHelper<MessageActionRow>();
const helperMessage = new ComponentHelper<ModalActionRow>();
Install
npm i @discord-additions/components