Merge pull request #3789 from thelounge/xpaw/fix-unhandled-chan

Fix sending unhandled numerics to target channel
This commit is contained in:
Pavel Djundik 2020-03-09 10:35:49 +02:00 committed by GitHub
commit 464c54b2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,18 +8,19 @@ module.exports = function(irc, network) {
irc.on("unknown command", function(command) { irc.on("unknown command", function(command) {
let target = network.channels[0]; let target = network.channels[0];
if (command.params.length > 0) { // Do not display users own name
// Do not display users own name if (command.params.length > 0 && command.params[0] === network.irc.user.nick) {
if (command.params[0] === network.irc.user.nick) { command.params.shift();
command.params.shift(); }
} else {
// If this numeric starts with a channel name that exists
// put this message in that channel
const channel = network.getChannel(command.params[0]);
if (typeof channel !== "undefined") { // Check the length again because we may shift the nick above
target = channel; if (command.params.length > 0) {
} // If this numeric starts with a channel name that exists
// put this message in that channel
const channel = network.getChannel(command.params[0]);
if (typeof channel !== "undefined") {
target = channel;
} }
} }