diff --git a/CHANGELOG.md b/CHANGELOG.md index c22f131..3f128b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v2.25.0 +* Fix regression introduced in v2.24.0 where line breaks would get turned to spaces in replies and snippets ([https://github.com/Dragory/modmailbot/issues/304](#304)) +* Replace the internal command handler with a new one. This should be fairly thoroughly tested, but please report any issues you encounter! +* Plugins are now called with a fourth parameter that allows you to easily add specific types of commands + * Due to the command handler change, any calls to `bot.registerCommand` should be replaced with the new system + ## v2.24.0 * Switch to the new stable version of Eris (0.10.0) instead of the dev version diff --git a/README.md b/README.md index e2e8a7b..31d22d6 100644 --- a/README.md +++ b/README.md @@ -126,18 +126,23 @@ The path is relative to the bot's folder. ### Creating a plugin Create a `.js` file that exports a function. -This function will be called when the plugin is loaded with the following arguments: `(bot, knex, config)` +This function will be called when the plugin is loaded with the following arguments: `(bot, knex, config, commands)` where `bot` is the [Eris Client object](https://abal.moe/Eris/docs/Client), `knex` is the [Knex database object](https://knexjs.org/#Builder), -and `config` is the loaded config object. +`config` is the loaded config object, +and `commands` is an object with functions to add and manage commands (see bottom of [src/commands.js](src/commands.js)) #### Example plugin file ```js -module.exports = function(bot, knex, config) { - console.log('Plugin loaded!'); +module.exports = function(bot, knex, config, commands) { + commands.addInboxThreadCommand('mycommand', [], (msg, args, thread) => { + thread.replyToUser(msg.author, 'Reply from my custom plugin!'); + }); } ``` ### Work in progress The current plugin API is fairly rudimentary and will be expanded in the future. +The API can change in non-major releases during this early stage. Keep an eye on [CHANGELOG.md](CHANGELOG.md) for any changes. + Please send any feature suggestions to the [issue tracker](https://github.com/Dragory/modmailbot/issues)!