mirror of
https://github.com/thelounge/thelounge
synced 2024-12-26 04:13:08 +00:00
21 lines
468 B
JavaScript
21 lines
468 B
JavaScript
var Msg = require("../../models/msg");
|
|
|
|
module.exports = function(irc, network) {
|
|
var client = this;
|
|
irc.on("errors", function(data) {
|
|
var msg = new Msg({
|
|
type: Msg.Type.ERROR,
|
|
from: "*",
|
|
text: data.message,
|
|
});
|
|
client.emit("msg", {
|
|
msg: msg
|
|
});
|
|
if (!network.connected) {
|
|
if (data.cmd == "ERR_NICKNAMEINUSE") {
|
|
var random = client.nick + Math.floor(10 + (Math.random() * 89));
|
|
irc.nick(random);
|
|
}
|
|
}
|
|
});
|
|
};
|