diff --git a/docs/configuration.md b/docs/configuration.md index dbfcf1af5..a5b3a493e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -308,6 +308,11 @@ If enabled, a system message will be posted into any open threads if the user jo **Default:** `on` If enabled, a system message will be posted into any open threads if the user leaves a main server +#### overrideRoleNameDisplay +**Default:** `None` +Role name to display in all replies. This completely overrides normal role selection, all replies will contain the string entered. For example; `overrideRoleNameDisplay = Moderator` + + #### pingOnBotMention **Default:** `on` If enabled, the bot will mention staff (see `mentionRole` option) on the inbox server when the bot is mentioned on the main server. diff --git a/src/data/cfg.jsdoc.js b/src/data/cfg.jsdoc.js index 2b56fa24a..1e673baa3 100644 --- a/src/data/cfg.jsdoc.js +++ b/src/data/cfg.jsdoc.js @@ -78,6 +78,7 @@ * @property {boolean} [errorOnUnknownInlineSnippet=true] * @property {boolean} [allowChangingDisplayRole=true] * @property {string} [fallbackRoleName=null] + * @property {string} [overrideRoleNameDisplay] Overrides the role displayed on replies * @property {boolean} [breakFormattingForNames=true] * @property {boolean} [autoAlert=false] * @property {string} [autoAlertDelay="2m"] Delay before auto-alert kicks in. Uses the same format as timed close; for example 1m30s for 1 minute and 30 seconds. diff --git a/src/data/cfg.schema.json b/src/data/cfg.schema.json index 583dbe98b..76ae31ff8 100644 --- a/src/data/cfg.schema.json +++ b/src/data/cfg.schema.json @@ -404,6 +404,12 @@ "default": null }, + "overrideRoleNameDisplay": { + "$comment": "Overrides the role displayed on replies", + "type": "string", + "default": null + }, + "breakFormattingForNames": { "$ref": "#/definitions/customBoolean", "default": true diff --git a/src/formatters.js b/src/formatters.js index b85cc8034..a19a26384 100644 --- a/src/formatters.js +++ b/src/formatters.js @@ -101,7 +101,7 @@ const bot = require("./bot"); */ const defaultFormatters = { formatStaffReplyDM(threadMessage) { - const roleName = threadMessage.role_name || config.fallbackRoleName; + const roleName = config.overrideRoleNameDisplay || threadMessage.role_name || config.fallbackRoleName; const modInfo = threadMessage.is_anonymous ? roleName : (roleName ? `(${roleName}) ${threadMessage.user_name}` : threadMessage.user_name); @@ -112,7 +112,7 @@ const defaultFormatters = { }, formatStaffReplyThreadMessage(threadMessage) { - const roleName = threadMessage.role_name || config.fallbackRoleName; + const roleName = config.overrideRoleNameDisplay || threadMessage.role_name || config.fallbackRoleName; const modInfo = threadMessage.is_anonymous ? (roleName ? `(Anonymous) (${threadMessage.user_name}) ${roleName}` : `(Anonymous) (${threadMessage.user_name})`) : (roleName ? `(${roleName}) ${threadMessage.user_name}` : threadMessage.user_name);