feat: filter emotes, mentions and channels

This commit is contained in:
2026-01-19 00:56:00 -03:00
parent 049897fb07
commit f282a77411
+3 -1
View File
@@ -10,6 +10,7 @@ import { config } from '../../utils/config';
import { DatabaseManager } from '../../modules/db';
const URL_REGEX = /(?:https?|ftp):\/\/[\n\S]+/g;
const DISCORD_REGEX = /<(?::\w+:|@!*&*|#)[0-9]+>/g; // from: https://www.reddit.com/r/discordapp/comments/iibxms/if_anyone_needs_regex_to_match_an_emote_mention/
class TTSListener implements Command {
private log: Logger;
@@ -67,7 +68,8 @@ class TTSListener implements Command {
if (!voices) return;
if (!voices.includes(voiceName)) return;
const msgFiltered = msg.content.replace(URL_REGEX, 'a link');
let msgFiltered = msg.content.replace(URL_REGEX, 'a link');
msgFiltered = msgFiltered.replace(DISCORD_REGEX, '');
const audio = await ttsModule.generate(voiceName, msgFiltered);