betterBtnRole
A Button Role builder that lets admins create button roles. | Requires: manageBtn()
Program
- Javascript
- Typescript
const simplydjs = require("simply-djs");
import simplydjs from "simply-djs";
simplydjs.betterBtnRole(client, interaction, {
type: 'add' // type (required) [add (or) remove]
// options (optional)
})
Output
Arguments:
simplydjs.betterBtnRole(
client: Discord.Client,
interaction: Discord.CommandInteraction,
options: betterBtnOptions
)
- client:
Discord.Client
- interaction
Discord.CommandInteraction
- options:
betterBtnOptions
Options betterBtnOptions
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
custom | boolean | ❌ | false | Throws an error for custom error messages to the user |
type | add / remove | ✅ | none | The type which adds new buttons or removes existing buttons. |
channel | TextChannel | ❌ | none | The channel of the message |
label | string | ❌ | none | The label of the button you're trying to create |
emoji | string | ❌ | none | The emoji of the button you're trying to create |
messageId | string | ❌ | none | The message you're trying to add a button to. |
role | Role | ❌ | none | The role to be given when a button is clicked |
style | MessageButtonStyle | ❌ | PRIMARY | The 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.
- Add Type
- Remove Type
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.
NO_MSG - No Message found in the message Id
NO_BTN - There is no button found in the search.
NOT_FOUND - Message not found
OTHER_MSG - The message is sent by another user. Cannot add button.