thelounge/server/plugins/inputs/kick.ts
2024-04-21 15:10:45 +02:00

32 lines
632 B
TypeScript

import {PluginInputHandler} from "./index";
import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["kick"];
const input: PluginInputHandler = function ({irc}, chan, cmd, args) {
if (chan.type !== ChanType.CHANNEL) {
chan.pushMessage(
this,
new Msg({
type: MessageType.ERROR,
text: `${cmd} command can only be used in channels.`,
})
);
return;
}
if (args.length !== 0) {
irc.raw("KICK", chan.name, args[0], args.slice(1).join(" "));
}
return true;
};
export default {
commands,
input,
};