2016-10-09 21:14:02 +02:00
|
|
|
"use strict";
|
|
|
|
|
2019-02-02 12:01:37 +01:00
|
|
|
const Msg = require("../../models/msg");
|
|
|
|
|
2016-03-27 17:57:59 +02:00
|
|
|
exports.commands = ["ctcp"];
|
|
|
|
|
2017-11-22 07:39:32 +01:00
|
|
|
exports.input = function({irc}, chan, cmd, args) {
|
2019-02-02 12:01:37 +01:00
|
|
|
if (args.length < 2) {
|
2019-07-17 11:33:59 +02:00
|
|
|
chan.pushMessage(
|
|
|
|
this,
|
|
|
|
new Msg({
|
|
|
|
type: Msg.Type.ERROR,
|
|
|
|
text: "Usage: /ctcp <nick> <ctcp_type>",
|
|
|
|
})
|
|
|
|
);
|
2019-02-02 12:01:37 +01:00
|
|
|
return;
|
2016-03-27 17:57:59 +02:00
|
|
|
}
|
2019-02-02 12:01:37 +01:00
|
|
|
|
2019-07-17 11:33:59 +02:00
|
|
|
chan.pushMessage(
|
|
|
|
this,
|
|
|
|
new Msg({
|
|
|
|
type: Msg.Type.CTCP_REQUEST,
|
|
|
|
ctcpMessage: `"${args.slice(1).join(" ")}" to ${args[0]}`,
|
|
|
|
from: chan.getUser(irc.user.nick),
|
|
|
|
})
|
|
|
|
);
|
2019-02-02 12:01:37 +01:00
|
|
|
|
|
|
|
irc.ctcpRequest(...args);
|
2016-03-27 17:57:59 +02:00
|
|
|
};
|