add ERR_ERRONEUSNICKNAME handler
This commit is contained in:
parent
79d4af0a46
commit
a5c7c22d54
24
src/irc.ts
24
src/irc.ts
@ -248,7 +248,28 @@ export class IRCConnectionWrapper
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '433': // ERR_NICKNAMEINUSE
|
||||
case '432': {
|
||||
// ERR_ERRONEUSNICKNAME
|
||||
// No backing away from this, we don't know what is wrong exactly.
|
||||
if (!this.authenticated) {
|
||||
this.emit('error', {
|
||||
error: new Error('Invalid nickname'),
|
||||
fatal: true,
|
||||
});
|
||||
this.connection?.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
const resetNick = line.arguments[0];
|
||||
this.emit('nick', {
|
||||
oldNick: this.options.nick,
|
||||
newNick: resetNick,
|
||||
});
|
||||
this.options.nick = resetNick;
|
||||
break;
|
||||
}
|
||||
case '433': {
|
||||
// ERR_NICKNAMEINUSE
|
||||
const newNick = this.options.nick + '_';
|
||||
this.write('NICK %s', newNick);
|
||||
|
||||
@ -259,6 +280,7 @@ export class IRCConnectionWrapper
|
||||
|
||||
this.options.nick = newNick;
|
||||
break;
|
||||
}
|
||||
case '902': // ERR_NICKLOCKED
|
||||
case '904': // ERR_SASLFAIL
|
||||
case '905': // ERR_SASLTOOLONG
|
||||
|
Loading…
Reference in New Issue
Block a user