diff --git a/CHANGELOG.md b/CHANGELOG.md index b83d333..e2d95cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/data/Thread.js b/src/data/Thread.js index 27f9a0e..09c75dc 100644 --- a/src/data/Thread.js +++ b/src/data/Thread.js @@ -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"); diff --git a/src/data/moderatorRoleOverrides.js b/src/data/displayRoles.js similarity index 100% rename from src/data/moderatorRoleOverrides.js rename to src/data/displayRoles.js diff --git a/src/modules/roles.js b/src/modules/roles.js index 5ba59a8..9b77744 100644 --- a/src/modules/roles.js +++ b/src/modules/roles.js @@ -8,7 +8,7 @@ const { getModeratorThreadDisplayRoleName, getModeratorDefaultDisplayRoleName, -} = require("../data/moderatorRoleOverrides"); +} = require("../data/displayRoles"); const ROLE_OVERRIDES_METADATA_KEY = "moderatorRoleOverrides"; diff --git a/src/pluginApi.js b/src/pluginApi.js index 4fdcac9..8ea5fc7 100644 --- a/src/pluginApi.js +++ b/src/pluginApi.js @@ -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 */ /** diff --git a/src/plugins.js b/src/plugins.js index c0741fe..894c529 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -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, }; }, };