2022-06-19 00:25:21 +00:00
|
|
|
import Msg, {MessageType} from "../../models/msg";
|
|
|
|
import {PluginInputHandler} from "./index";
|
|
|
|
|
|
|
|
const commands = ["ctcp"];
|
|
|
|
|
|
|
|
const input: PluginInputHandler = function ({irc}, chan, cmd, args) {
|
|
|
|
if (args.length < 2) {
|
|
|
|
chan.pushMessage(
|
|
|
|
this,
|
|
|
|
new Msg({
|
|
|
|
type: MessageType.ERROR,
|
|
|
|
text: "Usage: /ctcp <nick> <ctcp_type>",
|
|
|
|
})
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const target = args.shift()!;
|
2022-07-07 05:28:18 +00:00
|
|
|
const type = args.shift()!;
|
2022-06-19 00:25:21 +00:00
|
|
|
|
|
|
|
chan.pushMessage(
|
|
|
|
this,
|
|
|
|
new Msg({
|
|
|
|
type: MessageType.CTCP_REQUEST,
|
2022-07-07 05:28:18 +00:00
|
|
|
ctcpMessage: `"${type}" to ${target}`,
|
2022-06-19 00:25:21 +00:00
|
|
|
from: chan.getUser(irc.user.nick),
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
irc.ctcpRequest(target, type, ...args);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
commands,
|
|
|
|
input,
|
|
|
|
};
|