mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-29 11:52:28 +02:00
32 lines
632 B
TypeScript
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,
|
|
};
|