diff --git a/plugins/Censorship/index.js b/plugins/Censorship/index.js index 2544a45..42878b4 100644 --- a/plugins/Censorship/index.js +++ b/plugins/Censorship/index.js @@ -34,6 +34,18 @@ module.exports = { description: 'Select custom replacement style to use this', default: 'uwu', }, + keepFirstLetter: { + type: 'boolean', + label: 'Keep first letter', + description: 'Show the first letter of a censored word instead of masking it', + default: false, + }, + keepLastLetter: { + type: 'boolean', + label: 'Keep last letter', + description: 'Show the last letter of a censored word instead of masking it', + default: false, + }, }, renderer: fs.readFileSync(path.join(__dirname, 'renderer.js'), 'utf8'), diff --git a/plugins/Censorship/renderer.js b/plugins/Censorship/renderer.js index 3e89a95..ec6fee4 100644 --- a/plugins/Censorship/renderer.js +++ b/plugins/Censorship/renderer.js @@ -30,6 +30,8 @@ var matcher = null; var style = 'stars'; var replacement = 'uwu'; + var keepFirst = false; + var keepLast = false; var applying = false; function settings() { @@ -58,20 +60,32 @@ function termPattern(term) { var pattern = term.split(/\s+/).map(esc).join('\\s+'); - if (isWordChar(term[0])) pattern = '(?