Skip to content
sern

eventModule

eventModule<T>(mod): Module

Creates an event module for handling Discord.js or custom events.

Type parameters

T extends keyof ClientEvents = keyof ClientEvents

Event name from ClientEvents

Parameters

mod: InputEvent<T>

Event module configuration

Returns

Module

Processed event module ready for registration

Since

1.0.0

Throws

If ControlPlugins are used in event modules

Example

1
// Discord event listener
2
export default eventModule({
3
type: EventType.Discord,
4
execute: async (message) => {
5
console.log(`${message.author.tag}: ${message.content}`);
6
}
7
});

Example

1
// Custom sern event
2
export default eventModule({
3
type: EventType.Sern,
4
execute: async (eventData) => {
5
// Handle sern-specific event
6
}
7
});

Source

src/core/modules.ts:83