UNPKG

twiedenbein-thelounge

Version:

The self-hosted Web IRC client

32 lines (31 loc) 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const msg_1 = __importDefault(require("../../models/msg")); const msg_2 = require("../../../shared/types/msg"); const chan_1 = require("../../../shared/types/chan"); const commands = ["invite", "invitelist"]; const input = function ({ irc }, chan, cmd, args) { if (cmd === "invitelist") { irc.inviteList(chan.name); return; } if (args.length === 2) { irc.raw("INVITE", args[0], args[1]); // Channel provided in the command } else if (args.length === 1 && chan.type === chan_1.ChanType.CHANNEL) { irc.raw("INVITE", args[0], chan.name); // Current channel } else { chan.pushMessage(this, new msg_1.default({ type: msg_2.MessageType.ERROR, text: `${cmd} command can only be used in channels or by specifying a target.`, })); } }; exports.default = { commands, input, };