RoleSelectCommand
Since
1.0.0
Extends
Properties
description?
optional
description:string
Inherited from
Source
execute()
execute: (
ctx
,tbd
) =>unknown
Parameters
• ctx: RoleSelectMenuInteraction
<CacheType
>
• tbd: SDT
Returns
unknown
Overrides
Source
locals
locals:
Dictionary
Custom data storage object for module-specific information. Plugins and module code can use this to store and retrieve metadata, configuration, or any other module-specific information.
Description
A key-value store that allows plugins and module code to persist data at the module level. This is especially useful for InitPlugins that need to attach metadata or configuration to modules.
Example
1// In a plugin2module.locals.registrationDate = Date.now();3module.locals.version = "1.0.0";4module.locals.permissions = ["ADMIN", "MODERATE"];
Example
1// In module execution2console.log(`Command registered on: ${new Date(module.locals.registrationDate)}`);
Example
1// Storing localization data2module.locals.translations = {3 en: "Hello",4 es: "Hola",5 fr: "Bonjour"6};
Example
1// Storing command metadata2module.locals.metadata = {3 category: "admin",4 cooldown: 5000,5 requiresPermissions: true6};
Remarks
- The locals object is initialized as an empty object ({}) by default
- Keys should be namespaced to avoid collisions between plugins
- Values can be of any type
- Data persists for the lifetime of the module
- Commonly used by InitPlugins during module initialization
@best-practices
-
Namespace your keys to avoid conflicts:
1module.locals['myPlugin:data'] = value; -
Document the data structure you’re storing:
1interface MyPluginData {2version: string;3timestamp: number;4}5module.locals['myPlugin:data'] = {6version: '1.0.0',7timestamp: Date.now()8} as MyPluginData; -
Use type-safe accessors when possible:
1const getPluginData = (module: Module): MyPluginData =>2module.locals['myPlugin:data'];
Inherited from
Source
meta
meta:
object
absPath
absPath:
string
id
id:
string
Inherited from
Source
name?
optional
name:string
Inherited from
Source
onEvent
onEvent:
ControlPlugin
<any
[]>[]
Inherited from
Source
plugins
plugins:
InitPlugin
<any
[]>[]
Inherited from
Source
type
type:
RoleSelect