2021-05-27 15:46:56 -04:00
|
|
|
import * as irc from "./lib/irc.js";
|
2021-06-10 13:32:00 -04:00
|
|
|
import { SERVER_BUFFER, BufferType, Unread } from "./state.js";
|
2020-07-13 11:22:24 -04:00
|
|
|
|
2021-01-22 11:36:53 -05:00
|
|
|
function getActiveClient(app) {
|
2021-06-10 12:11:11 -04:00
|
|
|
let buf = app.state.buffers.get(app.state.activeBuffer);
|
2021-01-22 11:36:53 -05:00
|
|
|
if (!buf) {
|
2021-06-03 04:13:24 -04:00
|
|
|
throw new Error("Not connected to server");
|
2021-01-22 11:36:53 -05:00
|
|
|
}
|
2021-06-03 05:46:50 -04:00
|
|
|
return app.clients.get(buf.server);
|
2021-01-22 11:36:53 -05:00
|
|
|
}
|
|
|
|
|
2021-06-09 04:17:32 -04:00
|
|
|
function getActiveTarget(app) {
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
2021-06-09 04:17:32 -04:00
|
|
|
if (!activeBuffer) {
|
|
|
|
throw new Error("Not in a buffer");
|
|
|
|
}
|
|
|
|
return activeBuffer.name;
|
|
|
|
}
|
|
|
|
|
2021-06-03 04:18:34 -04:00
|
|
|
function getActiveChannel(app) {
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
2021-06-04 13:13:59 -04:00
|
|
|
if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) {
|
2021-06-03 04:18:34 -04:00
|
|
|
throw new Error("Not in a channel");
|
|
|
|
}
|
|
|
|
return activeBuffer.name;
|
|
|
|
}
|
|
|
|
|
2023-04-19 06:51:13 -04:00
|
|
|
async function setUserHostMode(app, args, mode) {
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
2021-06-03 04:11:48 -04:00
|
|
|
if (!nick) {
|
|
|
|
throw new Error("Missing nick");
|
|
|
|
}
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeChannel = getActiveChannel(app);
|
|
|
|
let client = getActiveClient(app);
|
2023-04-19 06:51:13 -04:00
|
|
|
let whois = await client.whois(nick);
|
|
|
|
const info = whois[irc.RPL_WHOISUSER].params;
|
|
|
|
const user = info[2];
|
|
|
|
const host = info[3];
|
|
|
|
client.send({
|
|
|
|
command: "MODE",
|
|
|
|
params: [activeChannel, mode, `*!${user}@${host}`],
|
2021-06-03 04:11:48 -04:00
|
|
|
});
|
|
|
|
}
|
2021-05-27 16:02:08 -04:00
|
|
|
|
2021-06-10 13:32:00 -04:00
|
|
|
function markServerBufferUnread(app) {
|
2021-06-22 07:38:05 -04:00
|
|
|
let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
2021-06-10 13:32:00 -04:00
|
|
|
if (!activeBuffer || activeBuffer.type === BufferType.SERVER) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
app.setBufferState({ server: activeBuffer.server }, (buf) => {
|
|
|
|
return { unread: Unread.union(buf.unread, Unread.MESSAGE) };
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-05-27 08:13:22 -04:00
|
|
|
const join = {
|
2022-02-02 11:40:19 -05:00
|
|
|
usage: "<name> [password]",
|
2021-05-27 08:13:22 -04:00
|
|
|
description: "Join a channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let channel = args[0];
|
2021-05-27 08:13:22 -04:00
|
|
|
if (!channel) {
|
|
|
|
throw new Error("Missing channel name");
|
|
|
|
}
|
2022-02-02 11:40:19 -05:00
|
|
|
if (args.length > 1) {
|
|
|
|
app.open(channel, null, args[1]);
|
|
|
|
} else {
|
|
|
|
app.open(channel);
|
|
|
|
}
|
2021-05-27 08:13:22 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-05-27 16:02:08 -04:00
|
|
|
const kick = {
|
2022-01-31 12:30:48 -05:00
|
|
|
usage: "<nick> [comment]",
|
2021-05-27 16:02:08 -04:00
|
|
|
description: "Remove a user from the channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
|
|
|
let activeChannel = getActiveChannel(app);
|
|
|
|
let params = [activeChannel, nick];
|
2021-05-27 16:02:08 -04:00
|
|
|
if (args.length > 1) {
|
|
|
|
params.push(args.slice(1).join(" "));
|
|
|
|
}
|
|
|
|
getActiveClient(app).send({ command: "KICK", params });
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-04-14 04:53:35 -04:00
|
|
|
const 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");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-05-28 11:57:18 -04:00
|
|
|
function givemode(app, args, mode) {
|
|
|
|
// TODO: Handle several users at once
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
2021-05-28 11:57:18 -04:00
|
|
|
if (!nick) {
|
|
|
|
throw new Error("Missing nick");
|
|
|
|
}
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeChannel = getActiveChannel(app);
|
2021-06-03 04:18:34 -04:00
|
|
|
getActiveClient(app).send({
|
|
|
|
command: "MODE",
|
|
|
|
params: [activeChannel, mode, nick],
|
|
|
|
});
|
2021-05-28 11:57:18 -04:00
|
|
|
}
|
|
|
|
|
2020-07-13 11:22:24 -04:00
|
|
|
export default {
|
2021-12-13 11:31:35 -05:00
|
|
|
"away": {
|
|
|
|
usage: "[message]",
|
|
|
|
description: "Set away message",
|
|
|
|
execute: (app, args) => {
|
2024-09-29 05:48:45 -04:00
|
|
|
const params = [];
|
2021-12-13 11:31:35 -05:00
|
|
|
if (args.length) {
|
|
|
|
params.push(args.join(" "));
|
|
|
|
}
|
|
|
|
getActiveClient(app).send({command: "AWAY", params});
|
|
|
|
},
|
|
|
|
},
|
2022-04-14 04:53:35 -04:00
|
|
|
"ban": ban,
|
2021-03-08 11:25:00 -05:00
|
|
|
"buffer": {
|
|
|
|
usage: "<name>",
|
|
|
|
description: "Switch to a buffer",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let name = args[0];
|
|
|
|
for (let buf of app.state.buffers.values()) {
|
2021-03-08 11:25:00 -05:00
|
|
|
if (buf.name === name) {
|
|
|
|
app.switchBuffer(buf);
|
|
|
|
return;
|
|
|
|
}
|
2021-03-07 15:06:26 -05:00
|
|
|
}
|
2021-03-08 11:25:00 -05:00
|
|
|
throw new Error("Unknown buffer");
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"close": {
|
|
|
|
description: "Close the current buffer",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
2021-03-08 11:25:00 -05:00
|
|
|
if (!activeBuffer || activeBuffer.type == BufferType.SERVER) {
|
|
|
|
throw new Error("Not in a user or channel buffer");
|
|
|
|
}
|
|
|
|
app.close(activeBuffer.id);
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-05-27 13:48:49 -04:00
|
|
|
"deop": {
|
|
|
|
usage: "<nick>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Remove operator status for a user on this channel",
|
2021-05-28 11:57:18 -04:00
|
|
|
execute: (app, args) => givemode(app, args, "-o"),
|
|
|
|
},
|
|
|
|
"devoice": {
|
|
|
|
usage: "<nick>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Remove voiced status for a user on this channel",
|
2021-05-28 11:57:18 -04:00
|
|
|
execute: (app, args) => givemode(app, args, "-v"),
|
2021-05-27 13:48:49 -04:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"disconnect": {
|
|
|
|
description: "Disconnect from the server",
|
|
|
|
execute: (app, args) => {
|
|
|
|
app.disconnect();
|
|
|
|
},
|
2021-03-07 15:06:26 -05:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"help": {
|
|
|
|
description: "Show help menu",
|
|
|
|
execute: (app, args) => {
|
|
|
|
app.openHelp();
|
|
|
|
},
|
2021-03-08 11:05:48 -05:00
|
|
|
},
|
2021-05-28 12:21:05 -04:00
|
|
|
"invite": {
|
|
|
|
usage: "<nick>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Invite a user to the channel",
|
2021-05-28 12:21:05 -04:00
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
2021-05-28 12:21:05 -04:00
|
|
|
if (!nick) {
|
|
|
|
throw new Error("Missing nick");
|
|
|
|
}
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeChannel = getActiveChannel(app);
|
2021-05-28 12:21:05 -04:00
|
|
|
getActiveClient(app).send({ command: "INVITE", params: [
|
2021-06-03 04:18:34 -04:00
|
|
|
nick, activeChannel,
|
2021-05-28 12:21:05 -04:00
|
|
|
]});
|
|
|
|
},
|
|
|
|
},
|
2021-05-27 08:13:22 -04:00
|
|
|
"j": join,
|
|
|
|
"join": join,
|
2021-05-27 16:02:08 -04:00
|
|
|
"kick": kick,
|
|
|
|
"kickban": {
|
|
|
|
usage: "<target>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Ban a user and removes them from the channel",
|
2021-05-26 19:28:24 -04:00
|
|
|
execute: (app, args) => {
|
2021-05-27 16:02:08 -04:00
|
|
|
kick.execute(app, args);
|
|
|
|
ban.execute(app, args);
|
2021-05-26 19:28:24 -04:00
|
|
|
},
|
|
|
|
},
|
2021-05-28 19:02:16 -04:00
|
|
|
"lusers": {
|
|
|
|
usage: "[<mask> [<target>]]",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Request user statistics about the network",
|
2021-05-28 19:02:16 -04:00
|
|
|
execute: (app, args) => {
|
|
|
|
getActiveClient(app).send({ command: "LUSERS", params: args });
|
2021-06-10 13:32:00 -04:00
|
|
|
markServerBufferUnread(app);
|
2021-05-28 19:02:16 -04:00
|
|
|
},
|
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"me": {
|
|
|
|
usage: "<action>",
|
|
|
|
description: "Send an action message to the current buffer",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let action = args.join(" ");
|
|
|
|
let target = getActiveTarget(app);
|
|
|
|
let text = `\x01ACTION ${action}\x01`;
|
2021-06-09 04:17:32 -04:00
|
|
|
app.privmsg(target, text);
|
2021-03-08 11:25:00 -05:00
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-05-23 05:41:04 -04:00
|
|
|
"mode": {
|
2021-06-07 08:12:49 -04:00
|
|
|
usage: "[target] [modes] [mode args...]",
|
|
|
|
description: "Query or change a channel or user mode",
|
2021-05-23 05:41:04 -04:00
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let target = args[0];
|
2021-06-07 08:12:49 -04:00
|
|
|
if (!target || target.startsWith("+") || target.startsWith("-")) {
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeChannel = getActiveChannel(app);
|
2021-06-03 04:18:34 -04:00
|
|
|
args = [activeChannel, ...args];
|
2021-05-27 09:37:09 -04:00
|
|
|
}
|
2021-05-23 05:41:04 -04:00
|
|
|
getActiveClient(app).send({ command: "MODE", params: args });
|
|
|
|
},
|
|
|
|
},
|
2021-05-28 05:17:37 -04:00
|
|
|
"motd": {
|
|
|
|
usage: "[server]",
|
|
|
|
description: "Get the Message Of The Day",
|
|
|
|
execute: (app, args) => {
|
|
|
|
getActiveClient(app).send({ command: "MOTD", params: args });
|
2021-06-10 13:32:00 -04:00
|
|
|
markServerBufferUnread(app);
|
2021-05-28 05:17:37 -04:00
|
|
|
},
|
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"msg": {
|
|
|
|
usage: "<target> <message>",
|
|
|
|
description: "Send a message to a nickname or a channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let target = args[0];
|
|
|
|
let text = args.slice(1).join(" ");
|
2021-03-08 11:25:00 -05:00
|
|
|
getActiveClient(app).send({ command: "PRIVMSG", params: [target, text] });
|
|
|
|
},
|
2021-03-07 15:06:26 -05:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"nick": {
|
|
|
|
usage: "<nick>",
|
|
|
|
description: "Change current nickname",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let newNick = args[0];
|
2021-03-08 11:25:00 -05:00
|
|
|
getActiveClient(app).send({ command: "NICK", params: [newNick] });
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"notice": {
|
|
|
|
usage: "<target> <message>",
|
|
|
|
description: "Send a notice to a nickname or a channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let target = args[0];
|
|
|
|
let text = args.slice(1).join(" ");
|
2021-03-08 11:25:00 -05:00
|
|
|
getActiveClient(app).send({ command: "NOTICE", params: [target, text] });
|
|
|
|
},
|
2020-08-13 05:04:39 -04:00
|
|
|
},
|
2021-05-27 13:48:49 -04:00
|
|
|
"op": {
|
|
|
|
usage: "<nick>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Give a user operator status on this channel",
|
2021-05-28 11:57:18 -04:00
|
|
|
execute: (app, args) => givemode(app, args, "+o"),
|
2021-05-27 13:48:49 -04:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"part": {
|
|
|
|
usage: "[reason]",
|
|
|
|
description: "Leave a channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let reason = args.join(" ");
|
|
|
|
let activeChannel = getActiveChannel(app);
|
|
|
|
let params = [activeChannel];
|
2021-03-08 11:25:00 -05:00
|
|
|
if (reason) {
|
|
|
|
params.push(reason);
|
|
|
|
}
|
|
|
|
getActiveClient(app).send({ command: "PART", params });
|
|
|
|
},
|
2021-03-07 15:06:26 -05:00
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"query": {
|
2021-07-21 09:21:58 -04:00
|
|
|
usage: "<nick> [message]",
|
2021-03-08 11:25:00 -05:00
|
|
|
description: "Open a buffer to send messages to a nickname",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
2021-03-08 11:25:00 -05:00
|
|
|
if (!nick) {
|
|
|
|
throw new Error("Missing nickname");
|
|
|
|
}
|
|
|
|
app.open(nick);
|
2021-07-21 09:21:58 -04:00
|
|
|
|
|
|
|
if (args.length > 1) {
|
2021-09-06 10:53:25 -04:00
|
|
|
let text = args.slice(1).join(" ");
|
2021-07-21 09:21:58 -04:00
|
|
|
app.privmsg(nick, text);
|
|
|
|
}
|
2021-03-08 11:25:00 -05:00
|
|
|
},
|
2021-03-07 15:06:26 -05:00
|
|
|
},
|
2021-06-10 18:27:19 -04:00
|
|
|
"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");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"quit": {
|
|
|
|
description: "Quit",
|
|
|
|
execute: (app, args) => {
|
|
|
|
app.close({ name: SERVER_BUFFER });
|
|
|
|
},
|
2021-03-07 15:06:26 -05:00
|
|
|
},
|
2021-05-27 05:22:34 -04:00
|
|
|
"quote": {
|
|
|
|
usage: "<command>",
|
|
|
|
description: "Send a raw IRC command to the server",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let msg;
|
2021-05-27 05:22:34 -04:00
|
|
|
try {
|
|
|
|
msg = irc.parseMessage(args.join(" "));
|
|
|
|
} catch (err) {
|
2021-05-27 05:26:42 -04:00
|
|
|
throw new Error("Failed to parse IRC command: " + err.message);
|
2021-05-27 05:22:34 -04:00
|
|
|
}
|
|
|
|
getActiveClient(app).send(msg);
|
|
|
|
},
|
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"reconnect": {
|
|
|
|
description: "Reconnect to the server",
|
|
|
|
execute: (app, args) => {
|
|
|
|
app.reconnect();
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-05-25 14:22:21 -04:00
|
|
|
"setname": {
|
|
|
|
usage: "<realname>",
|
|
|
|
description: "Change current realname",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let newRealname = args.join(" ");
|
|
|
|
let client = getActiveClient(app);
|
2021-12-10 09:34:51 -05:00
|
|
|
if (!client.caps.enabled.has("setname")) {
|
2021-05-25 14:22:21 -04:00
|
|
|
throw new Error("Server doesn't support changing the realname");
|
|
|
|
}
|
|
|
|
client.send({ command: "SETNAME", params: [newRealname] });
|
2021-12-10 09:34:51 -05:00
|
|
|
// TODO: save to local storage
|
2021-05-25 14:22:21 -04:00
|
|
|
},
|
|
|
|
},
|
2021-05-27 08:36:46 -04:00
|
|
|
"stats": {
|
2021-05-28 07:58:39 -04:00
|
|
|
usage: "<query> [server]",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Request server statistics",
|
2021-05-27 08:36:46 -04:00
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let query = args[0];
|
2021-05-27 08:36:46 -04:00
|
|
|
if (!query) {
|
|
|
|
throw new Error("Missing query");
|
|
|
|
}
|
2021-06-10 12:11:11 -04:00
|
|
|
let params = [query];
|
2021-05-27 08:36:46 -04:00
|
|
|
if (args.length > 1) {
|
|
|
|
params.push(args.slice(1).join(" "));
|
|
|
|
}
|
|
|
|
getActiveClient(app).send({ command: "STATS", params });
|
2021-06-10 13:32:00 -04:00
|
|
|
markServerBufferUnread(app);
|
2021-05-27 08:36:46 -04:00
|
|
|
},
|
|
|
|
},
|
2021-03-08 11:25:00 -05:00
|
|
|
"topic": {
|
|
|
|
usage: "<topic>",
|
|
|
|
description: "Change the topic of the current channel",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let activeChannel = getActiveChannel(app);
|
|
|
|
let params = [activeChannel];
|
2021-03-08 11:25:00 -05:00
|
|
|
if (args.length > 0) {
|
|
|
|
params.push(args.join(" "));
|
|
|
|
}
|
|
|
|
getActiveClient(app).send({ command: "TOPIC", params });
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
},
|
2021-06-03 04:25:33 -04:00
|
|
|
"unban": {
|
|
|
|
usage: "<nick>",
|
|
|
|
description: "Remove a user from the ban list",
|
|
|
|
execute: (app, args) => {
|
|
|
|
return setUserHostMode(app, args, "-b");
|
|
|
|
},
|
|
|
|
},
|
2021-06-10 18:27:19 -04:00
|
|
|
"unquiet": {
|
|
|
|
usage: "<nick>",
|
|
|
|
description: "Remove a user from the quiet list",
|
|
|
|
execute: (app, args) => {
|
|
|
|
return setUserHostMode(app, args, "-q");
|
|
|
|
},
|
|
|
|
},
|
2021-05-28 11:57:18 -04:00
|
|
|
"voice": {
|
|
|
|
usage: "<nick>",
|
2021-06-03 04:28:04 -04:00
|
|
|
description: "Give a user voiced status on this channel",
|
2021-05-28 11:57:18 -04:00
|
|
|
execute: (app, args) => givemode(app, args, "+v"),
|
|
|
|
},
|
2021-05-31 11:02:56 -04:00
|
|
|
"who": {
|
2022-01-09 13:30:01 -05:00
|
|
|
usage: "<mask>",
|
2021-05-31 11:02:56 -04:00
|
|
|
description: "Retrieve a list of users",
|
|
|
|
execute: (app, args) => {
|
|
|
|
getActiveClient(app).send({ command: "WHO", params: args });
|
2021-06-10 13:32:00 -04:00
|
|
|
markServerBufferUnread(app);
|
2021-05-31 11:02:56 -04:00
|
|
|
},
|
|
|
|
},
|
2021-05-27 16:02:07 -04:00
|
|
|
"whois": {
|
|
|
|
usage: "<nick>",
|
|
|
|
description: "Retrieve information about a user",
|
|
|
|
execute: (app, args) => {
|
2021-06-10 12:11:11 -04:00
|
|
|
let nick = args[0];
|
2021-05-27 16:02:07 -04:00
|
|
|
if (!nick) {
|
|
|
|
throw new Error("Missing nick");
|
|
|
|
}
|
2021-05-31 11:02:56 -04:00
|
|
|
getActiveClient(app).send({ command: "WHOIS", params: [nick] });
|
2021-06-10 13:32:00 -04:00
|
|
|
markServerBufferUnread(app);
|
2021-05-27 16:02:07 -04:00
|
|
|
},
|
|
|
|
},
|
2021-07-03 13:24:20 -04:00
|
|
|
"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);
|
|
|
|
},
|
|
|
|
},
|
2021-11-18 10:19:20 -05:00
|
|
|
"list": {
|
|
|
|
usage: "[filter]",
|
|
|
|
description: "Retrieve a list of channels from a network",
|
|
|
|
execute: (app, args) => {
|
|
|
|
getActiveClient(app).send({ command: "LIST", params: args });
|
|
|
|
markServerBufferUnread(app);
|
|
|
|
},
|
|
|
|
},
|
2020-07-13 11:22:24 -04:00
|
|
|
};
|