mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-27 17:50:24 +02:00
38 lines
850 B
JavaScript
38 lines
850 B
JavaScript
"use strict";
|
|
|
|
const Msg = require("../../models/msg");
|
|
|
|
module.exports = function (irc, network) {
|
|
const client = this;
|
|
|
|
irc.on("unknown command", function (command) {
|
|
let target = network.channels[0];
|
|
|
|
// Do not display users own name
|
|
if (command.params.length > 0 && command.params[0] === network.irc.user.nick) {
|
|
command.params.shift();
|
|
}
|
|
|
|
// Check the length again because we may shift the nick above
|
|
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;
|
|
}
|
|
}
|
|
|
|
target.pushMessage(
|
|
client,
|
|
new Msg({
|
|
type: Msg.Type.UNHANDLED,
|
|
command: command.command,
|
|
params: command.params,
|
|
}),
|
|
true
|
|
);
|
|
});
|
|
};
|