thelounge/server/plugins/inputs/rejoin.ts
Max Leiter dd05ee3a65
TypeScript and Vue 3 (#4559)
Co-authored-by: Eric Nemchik <eric@nemchik.com>
Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
2022-06-18 17:25:21 -07:00

29 lines
532 B
TypeScript

import {PluginInputHandler} from "./index";
import Msg, {MessageType} from "../../models/msg";
import {ChanType} from "../../models/chan";
const commands = ["cycle", "rejoin"];
const input: PluginInputHandler = function ({irc}, chan) {
if (chan.type !== ChanType.CHANNEL) {
chan.pushMessage(
this,
new Msg({
type: MessageType.ERROR,
text: "You can only rejoin channels.",
})
);
return;
}
irc.part(chan.name, "Rejoining");
irc.join(chan.name);
return true;
};
export default {
commands,
input,
};