Skip to main content

betterBtnRole

A Button Role builder that lets admins create button roles. | Requires: manageBtn()

Program​

const simplydjs = require("simply-djs");
simplydjs.betterBtnRole(client, interaction, {
type: 'add' // type (required) [add (or) remove]
// options (optional)
})

Output​

image image

Arguments:​

simplydjs.betterBtnRole(
client: Discord.Client,
interaction: Discord.CommandInteraction,
options: betterBtnOptions
)

Options betterBtnOptions​

ParameterTypeRequiredDefaultDescription
customboolean❌falseThrows an error for custom error messages to the user
typeadd / remove✅noneThe type which adds new buttons or removes existing buttons.
channelTextChannel❌noneThe channel of the message
labelstring❌noneThe label of the button you're trying to create
emojistring❌noneThe emoji of the button you're trying to create
messageIdstring❌noneThe message you're trying to add a button to.
roleRole❌noneThe role to be given when a button is clicked
styleMessageButtonStyle❌PRIMARYThe style of the button that is getting created.
NOTE

custom option​

When the custom option is true, The package will reject. You can do .catch() to send any custom error message

simplydjs.betterBtnRole(client, interaction, {
type: 'add'
}).catch(err => {
// Error handling.
});

It will return a string as an error code.

NO_MSG - No Message found in the message Id
OVERLOAD - Message reached the maximum amount of buttons
NOT_FOUND - Message not found
OTHER_MSG - The message is sent by another user. Cannot add button.