Change how nick errors are displayed

This commit is contained in:
Pavel Djundik 2016-04-04 21:32:21 +03:00 committed by Maxime Poulin
parent 7fdd0e90c1
commit 34af38ff92

View File

@ -30,14 +30,14 @@ module.exports = function(irc, network) {
var lobby = network.channels[0]; var lobby = network.channels[0];
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.ERROR, type: Msg.Type.ERROR,
text: "Nickname " + data.nick + " is already in use: " + data.reason, text: data.nick + ": " + (data.reason || "Nickname is already in use."),
}); });
client.emit("msg", { client.emit("msg", {
chan: lobby.id, chan: lobby.id,
msg: msg msg: msg
}); });
var random = irc.user.nick + Math.floor(10 + (Math.random() * 89)); var random = (data.nick || irc.user.nick) + Math.floor(10 + (Math.random() * 89));
irc.changeNick(random); irc.changeNick(random);
}); });
@ -45,7 +45,7 @@ module.exports = function(irc, network) {
var lobby = network.channels[0]; var lobby = network.channels[0];
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.ERROR, type: Msg.Type.ERROR,
text: "Nickname " + data.nick + " is invalid: " + data.reason, text: data.nick + ": " + (data.reason || "Nickname is invalid."),
}); });
client.emit("msg", { client.emit("msg", {
chan: lobby.id, chan: lobby.id,