Generate a random hexadecimal nickname when servers says current nick is invalid
This commit is contained in:
parent
40a15b2676
commit
7fdd0e90c1
@ -40,4 +40,19 @@ module.exports = function(irc, network) {
|
|||||||
var random = irc.user.nick + Math.floor(10 + (Math.random() * 89));
|
var random = irc.user.nick + Math.floor(10 + (Math.random() * 89));
|
||||||
irc.changeNick(random);
|
irc.changeNick(random);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
irc.on("nick invalid", function(data) {
|
||||||
|
var lobby = network.channels[0];
|
||||||
|
var msg = new Msg({
|
||||||
|
type: Msg.Type.ERROR,
|
||||||
|
text: "Nickname " + data.nick + " is invalid: " + data.reason,
|
||||||
|
});
|
||||||
|
client.emit("msg", {
|
||||||
|
chan: lobby.id,
|
||||||
|
msg: msg
|
||||||
|
});
|
||||||
|
|
||||||
|
var random = "i" + Math.random().toString(36).substr(2, 10); // 'i' so it never begins with a number
|
||||||
|
irc.changeNick(random);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user