From c58ebf56985db1b95a1296f645add21817a70590 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 4 Oct 2020 17:19:49 +0300 Subject: [PATCH] Update CHANGELOG and documentation on plugin loading --- CHANGELOG.md | 2 ++ docs/plugins.md | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d6fa76..ed335f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Please report any bugs you encounter by [creating a GitHub issue](https://github **General changes:** * Fix occasional bug with expiring blocks where the bot would send the expiry message multiple times +* Plugins can now also be installed from NPM modules + * Example: `plugins[] = npm:some-plugin-package` **Plugins:** * Log storage functions `getLogUrl()`, `getLogFile()`, `getLogCustomResponse()` now take the entire thread object as an argument rather than the thread ID diff --git a/docs/plugins.md b/docs/plugins.md index b323f38..b264533 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -2,9 +2,15 @@ The bot supports loading external plugins. ## Specifying plugins to load -For each plugin file you'd like to load, add the file path to the [`plugins` option](configuration.md#plugins). -The path is relative to the bot's folder. -Plugins are automatically loaded on bot startup. +Plugins can be loaded either from local files or NPM. Examples: +```ini +# Local file +plugins[] = ./path/to/plugin.js +# NPM package +plugins[] = npm:some-plugin-package +``` +Paths to local files are always relative to the bot's folder. +NPM plugins are automatically installed on bot start-up. ## Creating a plugin Plugins are simply `.js` files that export a function that gets called when the plugin is loaded.