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
custombooleanfalseThrows an error for custom error messages to the user
typeadd / removenoneThe type which adds new buttons or removes existing buttons.
channelTextChannelnoneThe channel of the message
labelstringnoneThe label of the button you're trying to create
emojistringnoneThe emoji of the button you're trying to create
messageIdstringnoneThe message you're trying to add a button to.
roleRolenoneThe role to be given when a button is clicked
styleMessageButtonStylePRIMARYThe 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.