Skip to content

Class: Module

Constructors

constructor

new Module(data?)

Creates a new module

Parameters

Name Type Description
data ModuleOptions Options for a module

Properties

name

name: string

The name of this module


commands

commands: Command[]

The commands belonging to this module


events

events: Event[]

The event handlers belonging to this module


intents

intents: any

The intents this module requires


options

options: object

ModuleOptions.options

Methods

registerGuildCommands

Static registerGuildCommands(modules, options): Promise<object>

Registers command for a guild

Parameters

Name Type Description
modules Module[] The modules you want to register commands from
options RegisterGuildCommandOptions Options for registering commands

Returns

Promise<object>

The raw response from discord

Examples

await Module.registerGuildCommands([myModule], {
  app: '826883237992988733',
  token: 'DEFINITELYMYTOKEN',
  guild: '838473416310652998',
});

registerGlobalCommands

Static registerGlobalCommands(modules, options): Promise<object>

Registers command globally

Parameters

Name Type Description
modules Module[] The modules you want to register commands from
options RegisterCommandOptions Options for registering commands

Returns

Promise<object>

The raw response from discord

Examples

await Module.registerGuildCommands([myModule], {
  app: '886305122232172554',
  token: 'MUSTBEMYTOKEN',
});
Back to top