Expose the display roles module to plugins

cshd
Dragory 2020-10-22 00:53:13 +03:00
parent f4ced372ba
commit d05672a2dc
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
6 changed files with 8 additions and 2 deletions

View File

@ -43,6 +43,8 @@ Please report any bugs you encounter by [creating a GitHub issue](https://github
* System messages now have a formatter
* The `beforeNewThread` hook's parameters now also include the original DM message object
* Plugins can now access the `threads` module (via `pluginApi.threads`) to create and fetch threads
* Plugins can now access the `displayRoles` module (via `pluginApi.displayRoles`) to get, set, and reset display role overrides for moderators,
and to get the final role that will be displayed in moderator replies (by default or per-thread)
**Internal/technical updates:**
* Modmail now uses [Express](https://expressjs.com/) as its web server for logs/attachments

View File

@ -9,7 +9,7 @@ const attachments = require("./attachments");
const { formatters } = require("../formatters");
const { callAfterThreadCloseHooks } = require("../hooks/afterThreadClose");
const snippets = require("./snippets");
const { getModeratorThreadDisplayRoleName } = require("./moderatorRoleOverrides");
const { getModeratorThreadDisplayRoleName } = require("./displayRoles");
const ThreadMessage = require("./ThreadMessage");

View File

@ -8,7 +8,7 @@ const {
getModeratorThreadDisplayRoleName,
getModeratorDefaultDisplayRoleName,
} = require("../data/moderatorRoleOverrides");
} = require("../data/displayRoles");
const ROLE_OVERRIDES_METADATA_KEY = "moderatorRoleOverrides";

View File

@ -3,6 +3,7 @@ const { CommandManager } = require("knub-command-manager");
const { Client } = require("eris");
const Knex = require("knex");
const threads = require("./data/threads");
const displayRoles = require("./data/displayRoles");
/**
* @typedef {object} PluginAPI
@ -16,6 +17,7 @@ const threads = require("./data/threads");
* @property {FormattersExport} formats
* @property {express.Application} webserver
* @property {threads} threads
* @property {displayRoles} displayRoles
*/
/**

View File

@ -8,6 +8,7 @@ const childProcess = require("child_process");
const pacote = require("pacote");
const path = require("path");
const threads = require("./data/threads");
const displayRoles = require("./data/displayRoles");
const pluginSources = {
npm: {
@ -130,6 +131,7 @@ module.exports = {
formats,
webserver,
threads,
displayRoles,
};
},
};