add all events to Client#events Collection<Function>
parent
387983cece
commit
946568a230
|
@ -9,6 +9,8 @@ export default class Client extends eris.Client {
|
|||
|
||||
public commands: Collection<Command>;
|
||||
|
||||
public events: Collection<Function>;
|
||||
|
||||
public intervals: Collection<NodeJS.Timeout>;
|
||||
|
||||
public util: Util;
|
||||
|
@ -21,6 +23,7 @@ export default class Client extends eris.Client {
|
|||
constructor(token: string, options?: eris.ClientOptions) {
|
||||
super(token, options);
|
||||
this.commands = new Collection<Command>();
|
||||
this.events = new Collection<Function>();
|
||||
this.intervals = new Collection<NodeJS.Timeout>();
|
||||
this.db = { member: Member, moderation: Moderation, redirect: Redirect };
|
||||
}
|
||||
|
@ -52,6 +55,7 @@ export default class Client extends eris.Client {
|
|||
if (file === 'index.js') return;
|
||||
// eslint-disable-next-line
|
||||
const event = new (require(`${__dirname}/../events/${file}`).default)(this);
|
||||
this.events.add(eventName, event);
|
||||
this.on(eventName, (...args) => event.run(...args));
|
||||
this.util.signale.success(`Successfully loaded event: ${eventName}`);
|
||||
delete require.cache[require.resolve(`${__dirname}/../events/${file}`)];
|
||||
|
|
Loading…
Reference in New Issue