Print IRC error messages in red

This commit is contained in:
Simon Ser 2020-06-29 14:29:31 +02:00
parent 20be67503b
commit 99004165f2
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 24 additions and 0 deletions

View file

@ -7,6 +7,7 @@ export const RPL_TOPIC = "332";
export const RPL_WHOREPLY = "352";
export const RPL_NAMREPLY = "353";
export const RPL_ENDOFNAMES = "366";
export const ERR_NOMOTD = "422";
export const ERR_PASSWDMISMATCH = "464";
// https://ircv3.net/specs/extensions/sasl-3.1
export const RPL_LOGGEDIN = "900";
@ -240,3 +241,19 @@ export function isHighlight(text, nick) {
text = text.slice(i + nick.length);
}
}
export function isError(cmd) {
if (cmd >= "400" && cmd <= "568") {
return true;
}
switch (cmd) {
case ERR_NICKLOCKED:
case ERR_SASLFAIL:
case ERR_SASLTOOLONG:
case ERR_SASLABORTED:
case ERR_SASLALREADY:
return true;
default:
return false;
}
}