ctcp wrapper function

This commit is contained in:
Evert Prants 2022-09-24 12:20:31 +03:00
parent d11a983319
commit 02d221ff4c
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -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';