diff --git a/src/utility/message-formatting.ts b/src/utility/message-formatting.ts index b2f5d08..547391b 100644 --- a/src/utility/message-formatting.ts +++ b/src/utility/message-formatting.ts @@ -129,6 +129,15 @@ export const applyTextFormat = ( ? str : `${IRC_FMT_FORMAT_MAP[format]}${str}${IRC_FMT_RESET}`; +/** + * Apply CTCP control characters with a command. + * @param message Message + * @param command CTCP command, e.g. `ACTION` + * @returns Text with control characters + */ +export const applyCTCP = (message: string, command = 'ACTION') => + `\x01${command.toUpperCase()} ${message}\x01`; + const styleCheckRe = /[\x00-\x1F]/; const backRe = /^(\d{1,2})(,(\d{1,2}))?/; const colourKey = '\x03';