Print IRC error messages in red
This commit is contained in:
parent
20be67503b
commit
99004165f2
3 changed files with 24 additions and 0 deletions
17
lib/irc.js
17
lib/irc.js
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue