From 53dc6edb6a7a16fd33c9751fe3d5d57e85d7a967 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 1 Nov 2020 22:16:15 +0200 Subject: [PATCH] Update plugin API docs --- docs/plugin-api.md | 33 ++++++++++++++++++++++++++++++++- docs/plugins.md | 2 ++ src/pluginApi.js | 28 ++++++++++++++++++++++++---- 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/docs/plugin-api.md b/docs/plugin-api.md index fa62912..87f013e 100644 --- a/docs/plugin-api.md +++ b/docs/plugin-api.md @@ -16,6 +16,14 @@ Scroll down to [PluginAPI](#PluginAPI) for a list of properties available to plu
object
displayRoles
threads
express.Application
FormattersExport
PluginAttachmentsAPI
](#PluginAttachmentsAPI) |
| logs | [PluginLogsAPI
](#PluginLogsAPI) |
| hooks | [PluginHooksAPI
](#PluginHooksAPI) |
-| formats | FormattersExport
|
+| formats | [PluginFormattersAPI
](#PluginFormattersAPI) |
+| webserver | [PluginWebServerAPI
](#PluginWebServerAPI) |
+| threads | [PluginThreadsAPI
](#PluginThreadsAPI) |
+| displayRoles | [PluginDisplayRolesAPI
](#PluginDisplayRolesAPI) |
@@ -85,3 +96,23 @@ Scroll down to [PluginAPI](#PluginAPI) for a list of properties available to plu
| beforeNewThread | AddBeforeNewThreadHookFn
|
| afterThreadClose | AddAfterThreadCloseHookFn
|
+
+
+## PluginDisplayRolesAPI : displayRoles
+**Kind**: global typedef
+**See**: https://github.com/Dragory/modmailbot/blob/master/src/data/displayRoles.js
+
+
+## PluginThreadsAPI : threads
+**Kind**: global typedef
+**See**: https://github.com/Dragory/modmailbot/blob/master/src/data/threads.js
+
+
+## PluginWebServerAPI : express.Application
+**Kind**: global typedef
+**See**: https://expressjs.com/en/api.html#app
+
+
+## PluginFormattersAPI : FormattersExport
+**Kind**: global typedef
+**See**: https://github.com/Dragory/modmailbot/blob/master/src/formatters.js
diff --git a/docs/plugins.md b/docs/plugins.md
index b264533..3b6300a 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -73,6 +73,8 @@ The first and only argument to the plugin function is an object with the followi
| `hooks` | An object with functions to add *hooks* that are called at specific times, e.g. before a new thread is created |
| `formats` | An object with functions that allow you to replace the default functions used for formatting messages and logs |
| `webserver` | An [Express Application object](https://expressjs.com/en/api.html#app) that functions as the bot's web server |
+| `threads` | An object with functions to find and create threads |
+| `displayRoles` | An object with functions to set and get moderators' display roles |
See the auto-generated [Plugin API](plugin-api.md) page for details.
diff --git a/src/pluginApi.js b/src/pluginApi.js
index 8ea5fc7..0a101dc 100644
--- a/src/pluginApi.js
+++ b/src/pluginApi.js
@@ -14,10 +14,10 @@ const displayRoles = require("./data/displayRoles");
* @property {PluginAttachmentsAPI} attachments
* @property {PluginLogsAPI} logs
* @property {PluginHooksAPI} hooks
- * @property {FormattersExport} formats
- * @property {express.Application} webserver
- * @property {threads} threads
- * @property {displayRoles} displayRoles
+ * @property {PluginFormattersAPI} formats
+ * @property {PluginWebServerAPI} webserver
+ * @property {PluginThreadsAPI} threads
+ * @property {PluginDisplayRolesAPI} displayRoles
*/
/**
@@ -49,3 +49,23 @@ const displayRoles = require("./data/displayRoles");
* @property {AddBeforeNewThreadHookFn} beforeNewThread
* @property {AddAfterThreadCloseHookFn} afterThreadClose
*/
+
+/**
+ * @typedef {displayRoles} PluginDisplayRolesAPI
+ * @see https://github.com/Dragory/modmailbot/blob/master/src/data/displayRoles.js
+ */
+
+/**
+ * @typedef {threads} PluginThreadsAPI
+ * @see https://github.com/Dragory/modmailbot/blob/master/src/data/threads.js
+ */
+
+/**
+ * @typedef {express.Application} PluginWebServerAPI
+ * @see https://expressjs.com/en/api.html#app
+ */
+
+/**
+ * @typedef {FormattersExport} PluginFormattersAPI
+ * @see https://github.com/Dragory/modmailbot/blob/master/src/formatters.js
+ */