Event Constructor - Paultje52/BananenBase GitHub Wiki
The event constructor is really easy! It's on BananenBase.event
, and just like the Command Constructor, you need to make your own class and extend it.
Constructor
The loader module gives one parameter: The main BananenBase class. That is the first argument for the super
function.
The second one is an object, with two keys.
- Event, String, Required, The name of the event
- Enabled, Boolean, Optional (Default: True), if the event is enabled
Run
When the event is called, the method run
is called in your class.
Note
If you want to have the message object after the modules added their things on it, use the event BananenBase.Message
.
Example
const BananenBase = require("bananenbase");
module.exports = class ReadyMessage extends BananenBase.event {
constructor(BananenBase) {
super(BananenBase, {
event: "ready",
enabled: true
});
}
run() {
console.log("Message of the custom ready event!");
}
}