Skip to main content

manageBtnRole

A Button Role Handler for simply-djs button role system.

caution

You should use betterBtnRole() or btnRole() before this function. Because handlers are like back-end (core), They just handle things. But betterBtnRole/btnRole is like front-end. without this, handlers are useless.

Implementation

simplydjs.manageBtnRole(interaction, { 
// options (optional)
})

Output

button role panel assigning role

Types

simplydjs.manageBtnRole(
button: ButtonInteraction,
options: manageBtnRoleOptions
): Promise<boolean>

Options

manageBtnOptions

ParameterTypeRequiredDefaultDescription
strictbooleanfalseEnables strict mode in manageBtnRole
replyBtnRoleRepliesdefault repliesPass a BtnRoleReplies Object to customize replies
export type manageBtnRoleOptions = {
reply?: BtnRoleReplies;
strict?: boolean;
};

BtnRoleReplies

ParameterTypeDefaultDescription
addstring✅ Added the {role} role to youThe message sent when the role is added.
removestring❌ Removed the {role} role from youThe message sent when the role is removed.
export interface BtnRoleReplies {
add: string;
remove: string;
}

Example

  • Default settings

interactionCreate.js
const simplydjs = require('simply-djs')

simplydjs.manageBtnRole(interaction)
  • Customized with options

interactionCreate.js
const simplydjs = require('simply-djs')

simplydjs.manageBtnRole(interaction, {
strict: true,
reply: {
add: "✅ Added the {role} role to you",
remove: "❌ Removed the {role} role from you"
}
})