Skip to content

Minimalistic event library for Discord.js

License

Notifications You must be signed in to change notification settings

typicalbot/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypicalBot Events

Minimalistic event library for Discord.js.

Handling Events

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

// Add events to a collection
const events = new Collection<keyof ClientEvents, EventHandler<any>[]>();

// 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);
            }
        });
    }
})

About

Minimalistic event library for Discord.js

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published