2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2017-11-10 20:44:14 +00:00
|
|
|
const Msg = require("../../models/msg");
|
2016-04-24 15:12:54 +00:00
|
|
|
|
|
|
|
module.exports = function(irc, network) {
|
2017-11-10 20:44:14 +00:00
|
|
|
const client = this;
|
2016-04-24 15:12:54 +00:00
|
|
|
|
|
|
|
irc.on("unknown command", function(command) {
|
2019-02-22 12:04:33 +00:00
|
|
|
let target = network.channels[0];
|
|
|
|
|
2019-07-03 08:20:29 +00:00
|
|
|
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]);
|
2019-02-22 12:04:33 +00:00
|
|
|
|
2019-07-03 08:20:29 +00:00
|
|
|
if (typeof channel !== "undefined") {
|
|
|
|
target = channel;
|
|
|
|
}
|
2019-02-22 12:04:33 +00:00
|
|
|
}
|
2016-04-24 15:12:54 +00:00
|
|
|
}
|
|
|
|
|
2019-02-22 12:04:33 +00:00
|
|
|
target.pushMessage(client, new Msg({
|
2016-04-24 15:12:54 +00:00
|
|
|
type: Msg.Type.UNHANDLED,
|
|
|
|
command: command.command,
|
2017-11-15 06:35:15 +00:00
|
|
|
params: command.params,
|
2016-09-25 06:41:10 +00:00
|
|
|
}), true);
|
2016-04-24 15:12:54 +00:00
|
|
|
});
|
|
|
|
};
|