Show channel name on channel-related errors

Fixes #1207
This commit is contained in:
Alexandre Oliveira 2018-01-03 14:46:48 -02:00
parent 0b3741859f
commit c53015c1af

View File

@ -6,10 +6,18 @@ module.exports = function(irc, network) {
const client = this; const client = this;
irc.on("irc error", function(data) { irc.on("irc error", function(data) {
let text = data.error; let text = "";
if (data.reason) { if (data.channel) {
text = data.reason + " (" + text + ")"; text = `${data.channel}: `;
}
if (data.error === "user_on_channel") {
text += `User (${data.nick}) is already on channel`;
} else if (data.reason) {
text += `${data.reason} (${data.error})`;
} else {
text += data.error;
} }
const lobby = network.channels[0]; const lobby = network.channels[0];