Skip to main content

Event

Events are used to listen to actions that happen on the platforms.

You can register a command by using the @Event decorator.

Usage

import { Event, User, Message, MessageBuilder } from "@michelo11/botjs";

export class ExampleEvent {
@Event("message")
async message(user: User, message: Message) {
if (message.content === "example") {
await user.send(new MessageBuilder("This is an example event."));
}
}
}

Parameters

The parameters are different depending on the event. Here is a table with all the parameters for each event:

EventParameters
joinuser: User, guild: Guild
leaveuser: User, guild: Guild
messageuser: User, message: Message
message-edituser: User, oldContent: string, message: Message