An open API service indexing awesome lists of open source software.

https://github.com/typicalbot/events

Minimalistic event library for Discord.js
https://github.com/typicalbot/events

discordjs framework library

Last synced: about 1 year ago
JSON representation

Minimalistic event library for Discord.js

Awesome Lists containing this project

README

          

# TypicalBot Events

Minimalistic event library for [Discord.js](https://github.com/discordjs/discord.js).

## Handling Events

```ts
import { EventHandler } from '@typicalbot/events';

// Add events to a collection
const events = new Collection[]>();

// Register events in client logic
events.forEach((value, key) => {
if (key === 'ready') {
client.once(key, (...args) => {
for (const handler of value) {
handler(client, ...args);
}
});
} else {
client.on(key, (...args) => {
for (const handler of value) {
handler(client, ...args);
}
});
}
})
```