# files

id: 5f84bd28-8813-4c30-b1d6-834fee8afe3d
title: commands.js
sha: 784ded74f6c8ab18360e5a093769a62954aa0656e87c4247ac1254eca9c0df6d
createdAt: 2022-03-29 06:51:19.965 +00:00
updatedAt: 2022-03-29 06:51:19.971 +00:00
userId: bbf6c27f-e7f6-42bd-a4d7-2b201390dc37
postId: 8ba6af73-4dc2-4fa5-a805-aaf81bf0b5f4
content:
  import * as irc from "./lib/irc.js";
  import { SERVER_BUFFER, BufferType, Unread } from "./state.js";

  function getActiveClient(app) {
  	let buf = app.state.buffers.get(app.state.activeBuffer);
  	if (!buf) {
  		throw new Error("Not connected to server");
  	}
  	return app.clients.get(buf.server);
  }

  function getActiveTarget(app) {
  	let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
  	if (!activeBuffer) {
  		throw new Error("Not in a buffer");
  	}
  	return activeBuffer.name;
  }

  function getActiveChannel(app) {
  	let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
  	if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) {
  		throw new Error("Not in a channel");
  	}
  	return activeBuffer.name;
  }

  function setUserHostMode(app, args, mode) {
  	let nick = args[0];
  	if (!nick) {
  		throw new Error("Missing nick");
  	}
  	let activeChannel = getActiveChannel(app);
  	let client = getActiveClient(app);
  	client.whois(nick).then((whois) => {
  		const info = whois[irc.RPL_WHOISUSER].params;
  		const user = info[2];
  		const host = info[3];
  		client.send({
  			command: "MODE",
  			params: [activeChannel, mode, `*!${user}@${host}`],
  		});
  	});
  }

  function markServerBufferUnread(app) {
  	let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
  	if (!activeBuffer || activeBuffer.type === BufferType.SERVER) {
  		return;
  	}
  	app.setBufferState({ server: activeBuffer.server }, (buf) => {
  		return { unread: Unread.union(buf.unread, Unread.MESSAGE) };
  	});
  }

  const join = {
  	usage: "<name>",
  	description: "Join a channel",
  	execute: (app, args) => {
  		let channel = args[0];
  		if (!channel) {
  			throw new Error("Missing channel name");
  		}
  		app.open(channel);
  	},
  };

  const kick = {
  	usage: "<nick>",
  	description: "Remove a user from the channel",
  	execute: (app, args) => {
  		let nick = args[0];
  		let activeChannel = getActiveChannel(app);
  		let params = [activeChannel, nick];
  		if (args.length > 1) {
  			params.push(args.slice(1).join(" "));
  		}
  		getActiveClient(app).send({ command: "KICK", params });
  	},
  };

  function givemode(app, args, mode) {
  	// TODO: Handle several users at once
  	let nick = args[0];
  	if (!nick) {
  		throw new Error("Missing nick");
  	}
  	let activeChannel = getActiveChannel(app);
  	getActiveClient(app).send({
  		command: "MODE",
  		params: [activeChannel, mode, nick],
  	});
  }

  export default {
  	"ban": {
  		usage: "[nick]",
  		description: "Ban a user from the channel, or display the current ban list",
  		execute: (app, args) => {
  			if (args.length == 0) {
  				let activeChannel = getActiveChannel(app);
  				getActiveClient(app).send({
  					command: "MODE",
  					params: [activeChannel, "+b"],
  				});
  			} else {
  				return setUserHostMode(app, args, "+b");
  			}
  		},
  	},
  	"buffer": {
  		usage: "<name>",
  		description: "Switch to a buffer",
  		execute: (app, args) => {
  			let name = args[0];
  			for (let buf of app.state.buffers.values()) {
  				if (buf.name === name) {
  					app.switchBuffer(buf);
  					return;
  				}
  			}
  			throw new Error("Unknown buffer");
  		},
  	},
  	"close": {
  		description: "Close the current buffer",
  		execute: (app, args) => {
  			let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
  			if (!activeBuffer || activeBuffer.type == BufferType.SERVER) {
  				throw new Error("Not in a user or channel buffer");
  			}
  			app.close(activeBuffer.id);
  		},
  	},
  	"deop": {
  		usage: "<nick>",
  		description: "Remove operator status for a user on this channel",
  		execute: (app, args) => givemode(app, args, "-o"),
  	},
  	"devoice": {
  		usage: "<nick>",
  		description: "Remove voiced status for a user on this channel",
  		execute: (app, args) => givemode(app, args, "-v"),
  	},
  	"disconnect": {
  		description: "Disconnect from the server",
  		execute: (app, args) => {
  			app.disconnect();
  		},
  	},
  	"help": {
  		description: "Show help menu",
  		execute: (app, args) => {
  			app.openHelp();
  		},
  	},
  	"invite": {
  		usage: "<nick>",
  		description: "Invite a user to the channel",
  		execute: (app, args) => {
  			let nick = args[0];
  			if (!nick) {
  				throw new Error("Missing nick");
  			}
  			let activeChannel = getActiveChannel(app);
  			getActiveClient(app).send({ command: "INVITE", params: [
  				nick, activeChannel,
  			]});
  		},
  	},
  	"j": join,
  	"join": join,
  	"kick": kick,
  	"kickban": {
  		usage: "<target>",
  		description: "Ban a user and removes them from the channel",
  		execute: (app, args) => {
  			kick.execute(app, args);
  			ban.execute(app, args);
  		},
  	},
  	"lusers": {
  		usage: "[<mask> [<target>]]",
  		description: "Request user statistics about the network",
  		execute: (app, args) => {
  			getActiveClient(app).send({ command: "LUSERS", params: args });
  			markServerBufferUnread(app);
  		},
  	},
  	"me": {
  		usage: "<action>",
  		description: "Send an action message to the current buffer",
  		execute: (app, args) => {
  			let action = args.join(" ");
  			let target = getActiveTarget(app);
  			let text = `\x01ACTION ${action}\x01`;
  			app.privmsg(target, text);
  		},
  	},
  	"mode": {
  		usage: "[target] [modes] [mode args...]",
  		description: "Query or change a channel or user mode",
  		execute: (app, args) => {
  			let target = args[0];
  			if (!target || target.startsWith("+") || target.startsWith("-")) {
  				let activeChannel = getActiveChannel(app);
  				args = [activeChannel, ...args];
  			}
  			getActiveClient(app).send({ command: "MODE", params: args });
  		},
  	},
  	"motd": {
  		usage: "[server]",
  		description: "Get the Message Of The Day",
  		execute: (app, args) => {
  			getActiveClient(app).send({ command: "MOTD", params: args });
  			markServerBufferUnread(app);
  		},
  	},
  	"msg": {
  		usage: "<target> <message>",
  		description: "Send a message to a nickname or a channel",
  		execute: (app, args) => {
  			let target = args[0];
  			let text = args.slice(1).join(" ");
  			getActiveClient(app).send({ command: "PRIVMSG", params: [target, text] });
  		},
  	},
  	"nick": {
  		usage: "<nick>",
  		description: "Change current nickname",
  		execute: (app, args) => {
  			let newNick = args[0];
  			getActiveClient(app).send({ command: "NICK", params: [newNick] });
  		},
  	},
  	"notice": {
  		usage: "<target> <message>",
  		description: "Send a notice to a nickname or a channel",
  		execute: (app, args) => {
  			let target = args[0];
  			let text = args.slice(1).join(" ");
  			getActiveClient(app).send({ command: "NOTICE", params: [target, text] });
  		},
  	},
  	"op": {
  		usage: "<nick>",
  		description: "Give a user operator status on this channel",
  		execute: (app, args) => givemode(app, args, "+o"),
  	},
  	"part": {
  		usage: "[reason]",
  		description: "Leave a channel",
  		execute: (app, args) => {
  			let reason = args.join(" ");
  			let activeChannel = getActiveChannel(app);
  			let params = [activeChannel];
  			if (reason) {
  				params.push(reason);
  			}
  			getActiveClient(app).send({ command: "PART", params });
  		},
  	},
  	"query": {
  		usage: "<nick> [message]",
  		description: "Open a buffer to send messages to a nickname",
  		execute: (app, args) => {
  			let nick = args[0];
  			if (!nick) {
  				throw new Error("Missing nickname");
  			}
  			app.open(nick);

  			if (args.length > 1) {
  				let text = args.slice(1).join(" ");
  				app.privmsg(nick, text);
  			}
  		},
  	},
  	"quiet": {
  		usage: "[nick]",
  		description: "Quiet a user in the channel, or display the current quiet list",
  		execute: (app, args) => {
  			if (args.length == 0) {
  				getActiveClient(app).send({
  					command: "MODE",
  					params: [getActiveChannel(app), "+q"],
  				});
  			} else {
  				return setUserHostMode(app, args, "+q");
  			}
  		},
  	},
  	"quit": {
  		description: "Quit",
  		execute: (app, args) => {
  			app.close({ name: SERVER_BUFFER });
  		},
  	},
  	"quote": {
  		usage: "<command>",
  		description: "Send a raw IRC command to the server",
  		execute: (app, args) => {
  			let msg;
  			try {
  				msg = irc.parseMessage(args.join(" "));
  			} catch (err) {
  				throw new Error("Failed to parse IRC command: " + err.message);
  			}
  			getActiveClient(app).send(msg);
  		},
  	},
  	"reconnect": {
  		description: "Reconnect to the server",
  		execute: (app, args) => {
  			app.reconnect();
  		},
  	},
  	"setname": {
  		usage: "<realname>",
  		description: "Change current realname",
  		execute: (app, args) => {
  			let newRealname = args.join(" ");
  			let client = getActiveClient(app);
  			if (!client.enabledCaps["setname"]) {
  				throw new Error("Server doesn't support changing the realname");
  			}
  			client.send({ command: "SETNAME", params: [newRealname] });
  		},
  	},
  	"stats": {
  		usage: "<query> [server]",
  		description: "Request server statistics",
  		execute: (app, args) => {
  			let query = args[0];
  			if (!query) {
  				throw new Error("Missing query");
  			}
  			let params = [query];
  			if (args.length > 1) {
  				params.push(args.slice(1).join(" "));
  			}
  			getActiveClient(app).send({ command: "STATS", params });
  			markServerBufferUnread(app);
  		},
  	},
  	"topic": {
  		usage: "<topic>",
  		description: "Change the topic of the current channel",
  		execute: (app, args) => {
  			let activeChannel = getActiveChannel(app);
  			let params = [activeChannel];
  			if (args.length > 0) {
  				params.push(args.join(" "));
  			}
  			getActiveClient(app).send({ command: "TOPIC", params });
  		},
  	},
  	"unban": {
  		usage: "<nick>",
  		description: "Remove a user from the ban list",
  		execute: (app, args) => {
  			return setUserHostMode(app, args, "-b");
  		},
  	},
  	"unquiet": {
  		usage: "<nick>",
  		description: "Remove a user from the quiet list",
  		execute: (app, args) => {
  			return setUserHostMode(app, args, "-q");
  		},
  	},
  	"unvoice": {
  		usage: "<nick>",
  		description: "Remove a user from the voiced list",
  		execute: (app, args) => givemode(app, args, "-v"),
  	},
  	"voice": {
  		usage: "<nick>",
  		description: "Give a user voiced status on this channel",
  		execute: (app, args) => givemode(app, args, "+v"),
  	},
  	"who": {
  		usage: "[<mask> [o]]",
  		description: "Retrieve a list of users",
  		execute: (app, args) => {
  			getActiveClient(app).send({ command: "WHO", params: args });
  			markServerBufferUnread(app);
  		},
  	},
  	"whois": {
  		usage: "<nick>",
  		description: "Retrieve information about a user",
  		execute: (app, args) => {
  			let nick = args[0];
  			if (!nick) {
  				throw new Error("Missing nick");
  			}
  			getActiveClient(app).send({ command: "WHOIS", params: [nick] });
  			markServerBufferUnread(app);
  		},
  	},
  	"whowas": {
  		usage: "<nick> [count]",
  		description: "Retrieve information about an offline user",
  		execute: (app, args) => {
  			if (args.length < 1) {
  				throw new Error("Missing nick");
  			}
  			getActiveClient(app).send({ command: "WHOWAS", params: args });
  			markServerBufferUnread(app);
  		},
  	},
  };

html:
  <pre><code class="prism-code language-js"><div class="token-line"><span class="token keyword module">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module">as</span><span class="token imports"> irc</span><span class="token plain"> </span><span class="token keyword module">from</span><span class="token plain"> </span><span class="token string">&quot;./lib/irc.js&quot;</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token keyword module">import</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token constant">SERVER_BUFFER</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token maybe-class-name">BufferType</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token maybe-class-name">Unread</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token plain"> </span><span class="token keyword module">from</span><span class="token plain"> </span><span class="token string">&quot;./state.js&quot;</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> buf </span><span class="token operator">=</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">activeBuffer</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">buf</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Not connected to server&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">return</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">clients</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">buf</span><span class="token punctuation">.</span><span class="token property-access">server</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">getActiveTarget</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> activeBuffer </span><span class="token operator">=</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">activeBuffer</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">activeBuffer</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Not in a buffer&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">return</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> activeBuffer </span><span class="token operator">=</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">activeBuffer</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">activeBuffer </span><span class="token operator">||</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">type</span><span class="token plain"> </span><span class="token operator">!==</span><span class="token plain"> </span><span class="token maybe-class-name">BufferType</span><span class="token punctuation">.</span><span class="token constant">CHANNEL</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Not in a channel&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">return</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">setUserHostMode</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token parameter punctuation">,</span><span class="token parameter"> mode</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nick&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> client </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    client</span><span class="token punctuation">.</span><span class="token method function property-access">whois</span><span class="token punctuation">(</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">whois</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">const</span><span class="token plain"> info </span><span class="token operator">=</span><span class="token plain"> whois</span><span class="token punctuation">[</span><span class="token plain">irc</span><span class="token punctuation">.</span><span class="token constant">RPL_WHOISUSER</span><span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token property-access">params</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">const</span><span class="token plain"> user </span><span class="token operator">=</span><span class="token plain"> info</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">const</span><span class="token plain"> host </span><span class="token operator">=</span><span class="token plain"> info</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        client</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MODE&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">,</span><span class="token plain"> mode</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token template-string template-punctuation string">`</span><span class="token template-string string">*!</span><span class="token template-string interpolation interpolation-punctuation punctuation">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation interpolation-punctuation punctuation">}</span><span class="token template-string string">@</span><span class="token template-string interpolation interpolation-punctuation punctuation">${</span><span class="token template-string interpolation">host</span><span class="token template-string interpolation interpolation-punctuation punctuation">}</span><span class="token template-string template-punctuation string">`</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> activeBuffer </span><span class="token operator">=</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">activeBuffer</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">activeBuffer </span><span class="token operator">||</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">type</span><span class="token plain"> </span><span class="token operator">===</span><span class="token plain"> </span><span class="token maybe-class-name">BufferType</span><span class="token punctuation">.</span><span class="token constant">SERVER</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">return</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    app</span><span class="token punctuation">.</span><span class="token method function property-access">setBufferState</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">server</span><span class="token operator">:</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">server</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">buf</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">unread</span><span class="token operator">:</span><span class="token plain"> </span><span class="token maybe-class-name">Unread</span><span class="token punctuation">.</span><span class="token method function property-access">union</span><span class="token punctuation">(</span><span class="token plain">buf</span><span class="token punctuation">.</span><span class="token property-access">unread</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token maybe-class-name">Unread</span><span class="token punctuation">.</span><span class="token constant">MESSAGE</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> join </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;name&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Join a channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">let</span><span class="token plain"> channel </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">channel</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing channel name&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        app</span><span class="token punctuation">.</span><span class="token method function property-access">open</span><span class="token punctuation">(</span><span class="token plain">channel</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> kick </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove a user from the channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword">let</span><span class="token plain"> params </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">,</span><span class="token plain"> nick</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">&gt;</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            params</span><span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;KICK&quot;</span><span class="token punctuation">,</span><span class="token plain"> params </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">function</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token parameter punctuation">,</span><span class="token parameter"> mode</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token comment">// TODO: Handle several users at once</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nick&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MODE&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">,</span><span class="token plain"> mode</span><span class="token punctuation">,</span><span class="token plain"> nick</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain"></span><span class="token keyword module">export</span><span class="token plain"> </span><span class="token keyword module">default</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;ban&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[nick]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Ban a user from the channel, or display the current ban list&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MODE&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+b&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"> </span><span class="token keyword control-flow">else</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token function">setUserHostMode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+b&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;buffer&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;name&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Switch to a buffer&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> name </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">for</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token keyword">let</span><span class="token plain"> buf </span><span class="token keyword">of</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">values</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">buf</span><span class="token punctuation">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator">===</span><span class="token plain"> name</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    app</span><span class="token punctuation">.</span><span class="token method function property-access">switchBuffer</span><span class="token punctuation">(</span><span class="token plain">buf</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    </span><span class="token keyword control-flow">return</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Unknown buffer&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;close&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Close the current buffer&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> activeBuffer </span><span class="token operator">=</span><span class="token plain"> app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">buffers</span><span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">activeBuffer</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">activeBuffer </span><span class="token operator">||</span><span class="token plain"> activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">type</span><span class="token plain"> </span><span class="token operator">==</span><span class="token plain"> </span><span class="token maybe-class-name">BufferType</span><span class="token punctuation">.</span><span class="token constant">SERVER</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Not in a user or channel buffer&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">close</span><span class="token punctuation">(</span><span class="token plain">activeBuffer</span><span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;deop&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove operator status for a user on this channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;-o&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;devoice&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove voiced status for a user on this channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;-v&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;disconnect&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Disconnect from the server&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">disconnect</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;help&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Show help menu&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">openHelp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;invite&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Invite a user to the channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nick&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;INVITE&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                nick</span><span class="token punctuation">,</span><span class="token plain"> activeChannel</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;j&quot;</span><span class="token operator">:</span><span class="token plain"> join</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;join&quot;</span><span class="token operator">:</span><span class="token plain"> join</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;kick&quot;</span><span class="token operator">:</span><span class="token plain"> kick</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;kickban&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;target&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Ban a user and removes them from the channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            kick</span><span class="token punctuation">.</span><span class="token method function property-access">execute</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            ban</span><span class="token punctuation">.</span><span class="token method function property-access">execute</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;lusers&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[&lt;mask&gt; [&lt;target&gt;]]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Request user statistics about the network&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;LUSERS&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> args </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;me&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;action&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Send an action message to the current buffer&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> action </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> target </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveTarget</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> text </span><span class="token operator">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string">`</span><span class="token template-string string">\x01ACTION </span><span class="token template-string interpolation interpolation-punctuation punctuation">${</span><span class="token template-string interpolation">action</span><span class="token template-string interpolation interpolation-punctuation punctuation">}</span><span class="token template-string string">\x01</span><span class="token template-string template-punctuation string">`</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">privmsg</span><span class="token punctuation">(</span><span class="token plain">target</span><span class="token punctuation">,</span><span class="token plain"> text</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;mode&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[target] [modes] [mode args...]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Query or change a channel or user mode&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> target </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">target </span><span class="token operator">||</span><span class="token plain"> target</span><span class="token punctuation">.</span><span class="token method function property-access">startsWith</span><span class="token punctuation">(</span><span class="token string">&quot;+&quot;</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token operator">||</span><span class="token plain"> target</span><span class="token punctuation">.</span><span class="token method function property-access">startsWith</span><span class="token punctuation">(</span><span class="token string">&quot;-&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                args </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token spread operator">...</span><span class="token plain">args</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MODE&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> args </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;motd&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[server]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Get the Message Of The Day&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MOTD&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> args </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;msg&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;target&gt; &lt;message&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Send a message to a nickname or a channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> target </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> text </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;PRIVMSG&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">target</span><span class="token punctuation">,</span><span class="token plain"> text</span><span class="token punctuation">]</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;nick&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Change current nickname&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> newNick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;NICK&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">newNick</span><span class="token punctuation">]</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;notice&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;target&gt; &lt;message&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Send a notice to a nickname or a channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> target </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> text </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;NOTICE&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">target</span><span class="token punctuation">,</span><span class="token plain"> text</span><span class="token punctuation">]</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;op&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Give a user operator status on this channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+o&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;part&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[reason]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Leave a channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> reason </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> params </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">reason</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                params</span><span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token plain">reason</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;PART&quot;</span><span class="token punctuation">,</span><span class="token plain"> params </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;query&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt; [message]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Open a buffer to send messages to a nickname&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nickname&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">open</span><span class="token punctuation">(</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
  </span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">&gt;</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword">let</span><span class="token plain"> text </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                app</span><span class="token punctuation">.</span><span class="token method function property-access">privmsg</span><span class="token punctuation">(</span><span class="token plain">nick</span><span class="token punctuation">,</span><span class="token plain"> text</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;quiet&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[nick]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Quiet a user in the channel, or display the current quiet list&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;MODE&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                    </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+q&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"> </span><span class="token keyword control-flow">else</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token function">setUserHostMode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+q&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;quit&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Quit&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">close</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token constant">SERVER_BUFFER</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;quote&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;command&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Send a raw IRC command to the server&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> msg</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">try</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                msg </span><span class="token operator">=</span><span class="token plain"> irc</span><span class="token punctuation">.</span><span class="token method function property-access">parseMessage</span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"> </span><span class="token keyword control-flow">catch</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">err</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Failed to parse IRC command: &quot;</span><span class="token plain"> </span><span class="token operator">+</span><span class="token plain"> err</span><span class="token punctuation">.</span><span class="token property-access">message</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token plain">msg</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;reconnect&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Reconnect to the server&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            app</span><span class="token punctuation">.</span><span class="token method function property-access">reconnect</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;setname&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;realname&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Change current realname&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> newRealname </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> client </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">client</span><span class="token punctuation">.</span><span class="token property-access">enabledCaps</span><span class="token punctuation">[</span><span class="token string">&quot;setname&quot;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Server doesn&#x27;t support changing the realname&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            client</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;SETNAME&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">newRealname</span><span class="token punctuation">]</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;stats&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;query&gt; [server]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Request server statistics&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> query </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">query</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing query&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> params </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">query</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">&gt;</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                params</span><span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;STATS&quot;</span><span class="token punctuation">,</span><span class="token plain"> params </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;topic&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;topic&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Change the topic of the current channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> activeChannel </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function">getActiveChannel</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> params </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">activeChannel</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">&gt;</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                params</span><span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;TOPIC&quot;</span><span class="token punctuation">,</span><span class="token plain"> params </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;unban&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove a user from the ban list&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token function">setUserHostMode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;-b&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;unquiet&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove a user from the quiet list&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token function">setUserHostMode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;-q&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;unvoice&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Remove a user from the voiced list&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;-v&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;voice&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Give a user voiced status on this channel&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token function">givemode</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">,</span><span class="token plain"> args</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token string">&quot;+v&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;who&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;[&lt;mask&gt; [o]]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Retrieve a list of users&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;WHO&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> args </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;whois&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt;&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Retrieve information about a user&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword">let</span><span class="token plain"> nick </span><span class="token operator">=</span><span class="token plain"> args</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token plain">nick</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nick&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;WHOIS&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">[</span><span class="token plain">nick</span><span class="token punctuation">]</span><span class="token plain"> </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token string-property property">&quot;whowas&quot;</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">usage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;&lt;nick&gt; [count]&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token literal-property property">description</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;Retrieve information about an offline user&quot;</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token function-variable function">execute</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">app</span><span class="token parameter punctuation">,</span><span class="token parameter"> args</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token keyword control-flow">if</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token plain">args</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator">&lt;</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">                </span><span class="token keyword control-flow">throw</span><span class="token plain"> </span><span class="token keyword">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">&quot;Missing nick&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token punctuation">}</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">getActiveClient</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token plain"> </span><span class="token literal-property property">command</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string">&quot;WHOWAS&quot;</span><span class="token punctuation">,</span><span class="token plain"> </span><span class="token literal-property property">params</span><span class="token operator">:</span><span class="token plain"> args </span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token function">markServerBufferUnread</span><span class="token punctuation">(</span><span class="token plain">app</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token punctuation">}</span><span class="token punctuation">;</span></div></code></pre>


id: ce08a9b2-131f-4849-8fda-0f8c483147bb
title: index.html
sha: 98560d8b707e35dfd2b65e2ea792778bfb42817fcab76d4f08ebc5e5174fb230
createdAt: 2022-03-29 06:51:52.152 +00:00
updatedAt: 2022-03-29 06:51:52.156 +00:00
userId: bbf6c27f-e7f6-42bd-a4d7-2b201390dc37
postId: 2e483d9d-edab-48c2-8c1c-2999786338fa
content:
  <!DOCTYPE html>
  <html>
  	<head>
  		<meta charset="utf-8">
  		<title>gamja IRC client</title>
  		<link rel="stylesheet" href="./style.css">
  		<meta name="viewport" content="width=device-width, initial-scale=1">
  		<link rel="manifest" href="manifest.json">
  	</head>
  	<body>
  		<noscript>
  			<p>Unfortunately gamja requires JavaScript. Please enable it!</p>
  		</noscript>
  		<script type="module">
  			import { html, render } from "./lib/index.js";
  			import App from "./components/app.js";

  			render(html`<${App}/>`, document.body);
  		</script>
  	</body>
  </html>

html:
  <pre><code class="prism-code language-html"><div class="token-line"><span class="token doctype punctuation">&lt;!</span><span class="token doctype doctype-tag">DOCTYPE</span><span class="token doctype"> </span><span class="token doctype name">html</span><span class="token doctype punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token tag punctuation">&lt;</span><span class="token tag">html</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token tag punctuation">&lt;</span><span class="token tag">head</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">meta</span><span class="token tag"> </span><span class="token tag attr-name">charset</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">utf-8</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">title</span><span class="token tag punctuation">&gt;</span><span class="token plain">gamja IRC client</span><span class="token tag punctuation">&lt;/</span><span class="token tag">title</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">link</span><span class="token tag"> </span><span class="token tag attr-name">rel</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">stylesheet</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag"> </span><span class="token tag attr-name">href</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">./style.css</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">meta</span><span class="token tag"> </span><span class="token tag attr-name">name</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">viewport</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag"> </span><span class="token tag attr-name">content</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">width=device-width, initial-scale=1</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">link</span><span class="token tag"> </span><span class="token tag attr-name">rel</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">manifest</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag"> </span><span class="token tag attr-name">href</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">manifest.json</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token tag punctuation">&lt;/</span><span class="token tag">head</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token tag punctuation">&lt;</span><span class="token tag">body</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">noscript</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">            </span><span class="token tag punctuation">&lt;</span><span class="token tag">p</span><span class="token tag punctuation">&gt;</span><span class="token plain">Unfortunately gamja requires JavaScript. Please enable it!</span><span class="token tag punctuation">&lt;/</span><span class="token tag">p</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;/</span><span class="token tag">noscript</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">        </span><span class="token tag punctuation">&lt;</span><span class="token tag">script</span><span class="token tag"> </span><span class="token tag attr-name">type</span><span class="token tag attr-value punctuation attr-equals">=</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag attr-value">module</span><span class="token tag attr-value punctuation">&quot;</span><span class="token tag punctuation">&gt;</span><span class="token script language-javascript"></span></div><div class="token-line"><span class="token script language-javascript">            </span><span class="token script language-javascript keyword module">import</span><span class="token script language-javascript"> </span><span class="token script language-javascript imports punctuation">{</span><span class="token script language-javascript imports"> html</span><span class="token script language-javascript imports punctuation">,</span><span class="token script language-javascript imports"> render </span><span class="token script language-javascript imports punctuation">}</span><span class="token script language-javascript"> </span><span class="token script language-javascript keyword module">from</span><span class="token script language-javascript"> </span><span class="token script language-javascript string">&quot;./lib/index.js&quot;</span><span class="token script language-javascript punctuation">;</span><span class="token script language-javascript"></span></div><div class="token-line"><span class="token script language-javascript">            </span><span class="token script language-javascript keyword module">import</span><span class="token script language-javascript"> </span><span class="token script language-javascript imports maybe-class-name">App</span><span class="token script language-javascript"> </span><span class="token script language-javascript keyword module">from</span><span class="token script language-javascript"> </span><span class="token script language-javascript string">&quot;./components/app.js&quot;</span><span class="token script language-javascript punctuation">;</span><span class="token script language-javascript"></span></div><div class="token-line"><span class="token script language-javascript">
  </span></div><div class="token-line"><span class="token script language-javascript">            </span><span class="token script language-javascript function">render</span><span class="token script language-javascript punctuation">(</span><span class="token script language-javascript">html</span><span class="token script language-javascript template-string template-punctuation string">`</span><span class="token script language-javascript template-string embedded-code html">&lt;${App}/&gt;</span><span class="token script language-javascript template-string template-punctuation string">`</span><span class="token script language-javascript punctuation">,</span><span class="token script language-javascript"> </span><span class="token script language-javascript dom variable">document</span><span class="token script language-javascript punctuation">.</span><span class="token script language-javascript property-access">body</span><span class="token script language-javascript punctuation">)</span><span class="token script language-javascript punctuation">;</span><span class="token script language-javascript"></span></div><div class="token-line"><span class="token script language-javascript">        </span><span class="token tag punctuation">&lt;/</span><span class="token tag">script</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">    </span><span class="token tag punctuation">&lt;/</span><span class="token tag">body</span><span class="token tag punctuation">&gt;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token tag punctuation">&lt;/</span><span class="token tag">html</span><span class="token tag punctuation">&gt;</span></div></code></pre>


