Module
Extended by
BothCommand
ContextMenuMsg
ContextMenuUser
SlashCommand
TextCommand
ButtonCommand
StringSelectCommand
MentionableSelectCommand
UserSelectCommand
ChannelSelectCommand
RoleSelectCommand
ModalSubmitCommand
DiscordEventCommand
SernEventCommand
ExternalEventCommand
Properties
description?
optional
description:string
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
Example
Example
Example
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:
-
Document the data structure you’re storing:
-
Use type-safe accessors when possible:
Source
meta
meta:
object
absPath
absPath:
string
id
id:
string
Source
name?
optional
name:string
Source
onEvent
onEvent:
ControlPlugin
<any
[]>[]
Source
plugins
plugins:
InitPlugin
<any
[]>[]
Source
type
type:
CommandType
|EventType
Source
Methods
execute()
execute(…
args
):any
Parameters
• …args: any
[]
Returns
any