Make sure unhandled command has params

This commit is contained in:
Pavel Djundik 2019-07-03 11:20:29 +03:00 committed by GitHub
parent 1b38e6cc02
commit 4765f06940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,16 +8,18 @@ module.exports = function(irc, network) {
irc.on("unknown command", function(command) {
let target = network.channels[0];
// Do not display users own name
if (command.params[0] === network.irc.user.nick) {
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 (command.params.length > 0) {
// Do not display users own name
if (command.params[0] === network.irc.user.nick) {
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") {
target = channel;
if (typeof channel !== "undefined") {
target = channel;
}
}
}