From c53015c1af885c9dd898c0aabf431c3ea8c4bba9 Mon Sep 17 00:00:00 2001 From: Alexandre Oliveira Date: Wed, 3 Jan 2018 14:46:48 -0200 Subject: [PATCH] Show channel name on channel-related errors Fixes #1207 --- src/plugins/irc-events/error.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/irc-events/error.js b/src/plugins/irc-events/error.js index 8baf4e2d..6b67f8ae 100644 --- a/src/plugins/irc-events/error.js +++ b/src/plugins/irc-events/error.js @@ -6,10 +6,18 @@ module.exports = function(irc, network) { const client = this; irc.on("irc error", function(data) { - let text = data.error; + let text = ""; - if (data.reason) { - text = data.reason + " (" + text + ")"; + if (data.channel) { + 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];