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
- Host: GitHub
- URL: https://github.com/typicalbot/events
- Owner: typicalbot
- License: apache-2.0
- Created: 2021-11-16T20:29:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-27T22:55:37.000Z (over 4 years ago)
- Last Synced: 2025-03-06T04:15:37.875Z (about 1 year ago)
- Topics: discordjs, framework, library
- Language: TypeScript
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
}
});
}
})
```