mirror of
https://github.com/thelounge/thelounge
synced 2024-11-27 06:20:26 +00:00
Generate a random hexadecimal nickname when servers says current nick is invalid
This commit is contained in:
parent
40a15b2676
commit
7fdd0e90c1
1 changed files with 15 additions and 0 deletions
|
@ -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 a new issue