thelounge/server/plugins/inputs/kick.ts
Reto Brunner 3eb19135f5 wip: msg
2024-04-21 15:10:41 +02:00

32 lines
623 B
TypeScript

import {PluginInputHandler} from "./index";
import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg";
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,
};