# Special events

## `messageEmitter`

An instance of `EventEmitter` specifically designed to handle message events.

***

## `onceMessage` Function

The `onceMessage` function allows you to register a callback for a specific event that will only be executed once. After it is triggered, it will be removed automatically.

### Parameters:

* **`emitter`**: The specific event emitter (from `EventEmitters`).
* **`cb`**: The callback function to execute when the event is emitted.

### Example:

```ts
onceMessage("messageCreate", (message) => {
  console.log(`Message received: ${message.content}`)
})
```

***

## More default Client events

The `MoreClientEvents` interface extends the default Discord client events by adding custom events, such as `raw` and `afterReady`.

### Example:

```ts
export interface MoreClientEvents {
  raw: [packet: apiTypes.GatewayDispatchPayload]
  afterReady: [discord.Client<true>] // Wait for all "ready" asyncronous listeners before triggering
}
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ghom.gitbook.io/bot.ts/utilities/special-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
