Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Command.sendMessage resolves with message
- Loading branch information
1 parent
9adc676
commit 1b8c4b0
Showing
4 changed files
with
66 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Handles events emitted from eris | ||
* @abstract | ||
*/ | ||
class AbstractEventPlugin { | ||
/** | ||
* Creates a new AbstractEventPlugin | ||
* @abstract | ||
*/ | ||
constructor() { | ||
if (this.constructor === AbstractEventPlugin) | ||
throw new Error("Can't instantiate an abstract class!"); | ||
} | ||
|
||
/** | ||
* The name of the plugin | ||
* @type {String} | ||
* @abstract | ||
*/ | ||
get name() { | ||
throw new Error('name must be overwritten'); | ||
} | ||
|
||
/** | ||
* Loads the plugin | ||
* @param {Bot} bot The main client | ||
* @returns {Promise} Resolves with `this` | ||
*/ | ||
load(bot) { | ||
return new Promise(resolve => { | ||
this.logger = bot.logger; | ||
this.bot = bot; | ||
resolve(this); | ||
}); | ||
} | ||
|
||
/** | ||
* Destroys/unloads the plugin | ||
* @returns {Promise} Resolves with no value | ||
*/ | ||
destroy() { | ||
return new Promise(resolve => { | ||
this.logger = undefined; | ||
this.bot = undefined; | ||
resolve(); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = AbstractEventPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters