hardlounge/lib/plugins/errors.js

21 lines
453 B
JavaScript
Raw Normal View History

2014-06-19 15:28:53 +00:00
var Msg = require("../models/msg");
2014-06-23 17:28:36 +00:00
module.exports = function(slate, network) {
var client = this;
slate.on("errors", function(data) {
client.emit("msg", {
2014-06-19 15:28:53 +00:00
msg: new Msg({
type: "error",
from: "-!-",
text: data.message,
}),
});
if (!network.connected) {
if (data.cmd == "ERR_NICKNAMEINUSE") {
2014-06-23 17:28:36 +00:00
var random = client.nick + Math.floor(10 + (Math.random() * 89));
slate.nick(random);
2014-06-19 15:28:53 +00:00
}
}
});
};