2022-08-27 23:27:05 +00:00
|
|
|
const Eris = require("eris");
|
2022-08-28 00:14:10 +00:00
|
|
|
const chalk = require("chalk");
|
|
|
|
|
2022-08-27 23:27:05 +00:00
|
|
|
const token = process.argv[2];
|
2022-08-28 00:14:10 +00:00
|
|
|
const stdin = process.stdin;
|
|
|
|
const stdout = process.stdout;
|
|
|
|
|
|
|
|
stdin.setRawMode(true);
|
|
|
|
stdin.resume();
|
|
|
|
stdin.setEncoding("utf8");
|
2022-08-27 23:27:05 +00:00
|
|
|
|
|
|
|
let currentGuild,
|
|
|
|
currentChannel,
|
2022-08-28 00:14:10 +00:00
|
|
|
inSendMode = false,
|
2022-08-28 02:43:00 +00:00
|
|
|
inEmoteMode = false,
|
2022-08-28 01:53:55 +00:00
|
|
|
guildSwitch = false,
|
|
|
|
channelSwitch = false,
|
2022-08-28 00:14:10 +00:00
|
|
|
nameLength = 2;
|
2022-08-27 23:27:05 +00:00
|
|
|
|
|
|
|
const messageQueue = [];
|
|
|
|
|
2022-08-28 00:49:02 +00:00
|
|
|
const commands = {
|
|
|
|
q: "quit comcord",
|
|
|
|
e: "emote",
|
|
|
|
g: "goto a channel",
|
|
|
|
G: "goto a guild",
|
|
|
|
l: "list channels",
|
|
|
|
L: "list guilds",
|
|
|
|
w: "who is in guild",
|
|
|
|
f: "finger",
|
|
|
|
r: "channel history",
|
|
|
|
R: "extended channel history",
|
|
|
|
h: "command help",
|
|
|
|
c: "clear",
|
|
|
|
};
|
|
|
|
|
2022-08-27 23:27:05 +00:00
|
|
|
const client = new Eris("Bot " + token, {
|
|
|
|
defaultImageFormat: "png",
|
|
|
|
defaultImageSize: 1024,
|
|
|
|
intents: Eris.Constants.Intents.all,
|
|
|
|
});
|
|
|
|
|
|
|
|
client.once("ready", function () {
|
|
|
|
console.log(
|
2022-08-28 00:14:10 +00:00
|
|
|
"Logged in as: " +
|
|
|
|
chalk.yellow(
|
|
|
|
`${client.user.username}#${client.user.discriminator} (${client.user.id})`
|
|
|
|
)
|
2022-08-27 23:27:05 +00:00
|
|
|
);
|
2022-08-28 00:14:10 +00:00
|
|
|
nameLength = client.user.username.length + 2;
|
2022-08-28 01:53:55 +00:00
|
|
|
|
|
|
|
listGuilds();
|
2022-08-27 23:27:05 +00:00
|
|
|
});
|
|
|
|
|
2022-08-28 02:43:00 +00:00
|
|
|
function processMessage({name, content, bot, attachments}) {
|
2022-08-28 00:14:10 +00:00
|
|
|
if (name.length + 2 > nameLength) nameLength = name.length + 2;
|
|
|
|
|
|
|
|
if (
|
|
|
|
(content.startsWith("*") && content.endsWith("*")) ||
|
|
|
|
(content.startsWith("_") && content.endsWith("_"))
|
|
|
|
) {
|
2022-08-28 02:43:00 +00:00
|
|
|
console.log(
|
|
|
|
chalk.bold.green(`<${name} ${content.substring(1, content.length - 1)}>`)
|
|
|
|
);
|
2022-08-28 00:14:10 +00:00
|
|
|
} else {
|
2022-08-28 02:13:25 +00:00
|
|
|
let nameColor = chalk.bold.cyan;
|
|
|
|
if (bot) nameColor = chalk.bold.yellow;
|
|
|
|
|
2022-08-28 00:14:10 +00:00
|
|
|
// TODO: markdown
|
|
|
|
console.log(
|
2022-08-28 02:13:25 +00:00
|
|
|
nameColor(`[${name}]`) +
|
|
|
|
" ".repeat(nameLength - (name.length + 2)) +
|
2022-08-28 01:53:55 +00:00
|
|
|
chalk.reset(" " + content)
|
2022-08-28 00:14:10 +00:00
|
|
|
);
|
2022-08-28 02:43:00 +00:00
|
|
|
for (const attachment of attachments) {
|
|
|
|
console.log(chalk.bold.yellow(`<attachment: ${attachment.url} >`));
|
|
|
|
}
|
2022-08-28 00:14:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function processQueue() {
|
|
|
|
for (const msg of messageQueue) {
|
|
|
|
if (msg.content.indexOf("\n") > -1) {
|
|
|
|
const lines = msg.content.split("\n");
|
2022-08-28 02:43:00 +00:00
|
|
|
for (const index in lines) {
|
|
|
|
const line = lines[index];
|
2022-08-28 00:14:10 +00:00
|
|
|
processMessage({
|
2022-08-28 02:13:25 +00:00
|
|
|
name: msg.author.username,
|
2022-08-28 00:14:10 +00:00
|
|
|
bot: msg.author.bot,
|
|
|
|
content: line,
|
2022-08-28 02:43:00 +00:00
|
|
|
attachments: index == lines.length - 1 ? msg.attachments : null,
|
2022-08-28 00:14:10 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
processMessage({
|
2022-08-28 02:13:25 +00:00
|
|
|
name: msg.author.username,
|
2022-08-28 00:14:10 +00:00
|
|
|
bot: msg.author.bot,
|
|
|
|
content: msg.content,
|
2022-08-28 02:43:00 +00:00
|
|
|
attachments: msg.attachments,
|
2022-08-28 00:14:10 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 02:43:00 +00:00
|
|
|
|
|
|
|
messageQueue.splice(0, messageQueue.length);
|
2022-08-28 00:14:10 +00:00
|
|
|
}
|
|
|
|
|
2022-08-27 23:27:05 +00:00
|
|
|
client.on("messageCreate", function (msg) {
|
2022-08-28 02:13:25 +00:00
|
|
|
if (msg.author.id === client.user.id) return;
|
|
|
|
|
2022-08-27 23:27:05 +00:00
|
|
|
if (msg.channel.id == currentChannel) {
|
2022-08-28 02:43:00 +00:00
|
|
|
if (inSendMode || inEmoteMode) {
|
2022-08-27 23:27:05 +00:00
|
|
|
messageQueue.push(msg);
|
|
|
|
} else {
|
2022-08-28 00:14:10 +00:00
|
|
|
if (msg.content.indexOf("\n") > -1) {
|
|
|
|
const lines = msg.content.split("\n");
|
2022-08-28 02:43:00 +00:00
|
|
|
for (const index in lines) {
|
|
|
|
const line = lines[index];
|
2022-08-28 00:14:10 +00:00
|
|
|
processMessage({
|
2022-08-28 02:13:25 +00:00
|
|
|
name: msg.author.username,
|
2022-08-28 00:14:10 +00:00
|
|
|
bot: msg.author.bot,
|
|
|
|
content: line,
|
2022-08-28 02:43:00 +00:00
|
|
|
attachments: index == lines.length - 1 ? msg.attachments : null,
|
2022-08-28 00:14:10 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
processMessage({
|
2022-08-28 02:13:25 +00:00
|
|
|
name: msg.author.username,
|
2022-08-28 00:14:10 +00:00
|
|
|
bot: msg.author.bot,
|
|
|
|
content: msg.content,
|
2022-08-28 02:43:00 +00:00
|
|
|
attachments: msg.attachments,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
client.on("messageUpdate", function (msg, old) {
|
|
|
|
if (msg.author.id === client.user.id) return;
|
|
|
|
|
|
|
|
if (msg.channel.id == currentChannel) {
|
|
|
|
if (msg.content == old.content) return;
|
|
|
|
|
|
|
|
if (inSendMode || inEmoteMode) {
|
|
|
|
messageQueue.push(msg);
|
|
|
|
} else {
|
|
|
|
if (msg.content.indexOf("\n") > -1) {
|
|
|
|
const lines = msg.content.split("\n");
|
|
|
|
for (const index in lines) {
|
|
|
|
const line = lines[index];
|
|
|
|
processMessage({
|
|
|
|
name: msg.author.username,
|
|
|
|
bot: msg.author.bot,
|
|
|
|
content: line + index == lines.length - 1 ? " (edited)" : null,
|
|
|
|
attachments: index == lines.length - 1 ? msg.attachments : null,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
processMessage({
|
|
|
|
name: msg.author.username,
|
|
|
|
bot: msg.author.bot,
|
|
|
|
content: msg.content + " (edited)",
|
|
|
|
attachments: msg.attachments,
|
2022-08-28 00:14:10 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
let toSend = "";
|
2022-08-28 01:53:55 +00:00
|
|
|
async function setupSendMode() {
|
2022-08-28 00:14:10 +00:00
|
|
|
inSendMode = true;
|
|
|
|
toSend = "";
|
|
|
|
stdout.write(
|
2022-08-28 02:13:25 +00:00
|
|
|
chalk.bold.cyan(`[${client.user.username}]`) +
|
|
|
|
" ".repeat(nameLength - (client.user.username.length + 2)) +
|
2022-08-28 00:49:02 +00:00
|
|
|
chalk.reset(" ")
|
2022-08-28 00:14:10 +00:00
|
|
|
);
|
2022-08-28 01:53:55 +00:00
|
|
|
try {
|
|
|
|
await client.guilds
|
|
|
|
.get(currentGuild)
|
|
|
|
.channels.get(currentChannel)
|
|
|
|
.sendTyping();
|
|
|
|
} catch (err) {
|
|
|
|
//
|
|
|
|
}
|
2022-08-28 00:14:10 +00:00
|
|
|
}
|
2022-08-28 01:53:55 +00:00
|
|
|
async function sendMessage() {
|
2022-08-28 00:14:10 +00:00
|
|
|
toSend = toSend.trim();
|
|
|
|
if (toSend === "") {
|
|
|
|
stdout.write("<no message sent>\n");
|
|
|
|
} else {
|
2022-08-28 01:53:55 +00:00
|
|
|
try {
|
2022-08-28 02:43:00 +00:00
|
|
|
stdout.write("\n");
|
2022-08-28 01:53:55 +00:00
|
|
|
await client.createMessage(currentChannel, toSend);
|
|
|
|
} catch (err) {
|
|
|
|
console.log("<failed to send message: " + err.message + ">");
|
|
|
|
}
|
2022-08-28 00:14:10 +00:00
|
|
|
}
|
|
|
|
inSendMode = false;
|
|
|
|
processQueue();
|
|
|
|
}
|
|
|
|
|
2022-08-28 00:49:02 +00:00
|
|
|
function showHelp() {
|
|
|
|
console.log("\nCOMcord (c)left 2022\n");
|
|
|
|
|
|
|
|
const keys = Object.keys(commands);
|
|
|
|
keys.sort();
|
|
|
|
|
|
|
|
let index = 0;
|
|
|
|
for (const key of keys) {
|
|
|
|
const desc = commands[key];
|
|
|
|
|
|
|
|
stdout.write(
|
2022-08-28 01:53:55 +00:00
|
|
|
(" " + chalk.bold.yellow(key) + chalk.reset(" - " + desc)).padEnd(
|
|
|
|
25,
|
|
|
|
" "
|
|
|
|
)
|
2022-08-28 00:49:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
if (index % 3 == 0) stdout.write("\n");
|
|
|
|
}
|
|
|
|
if (index % 3 != 0) stdout.write("\n");
|
|
|
|
|
|
|
|
console.log("\nTo begin TALK MODE, press [SPACE]\n");
|
|
|
|
}
|
|
|
|
|
2022-08-28 01:53:55 +00:00
|
|
|
function listGuilds() {
|
|
|
|
let longest = 0;
|
|
|
|
const guilds = [];
|
|
|
|
|
|
|
|
for (const guild of client.guilds.values()) {
|
|
|
|
if (guild.name.length > longest) longest = guild.name.length;
|
|
|
|
|
|
|
|
const online = [...guild.members.values()].filter((m) => m.status).length;
|
|
|
|
guilds.push({name: guild.name, members: guild.memberCount, online});
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("");
|
|
|
|
console.log(" " + "guild-name".padStart(longest, " ") + " online total");
|
|
|
|
console.log("-".repeat(80));
|
|
|
|
for (const guild of guilds) {
|
|
|
|
console.log(
|
|
|
|
" " +
|
|
|
|
guild.name.padStart(longest, " ") +
|
|
|
|
" " +
|
|
|
|
guild.online.toString().padStart(6, " ") +
|
|
|
|
" " +
|
|
|
|
guild.members.toString().padStart(5, " ")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
console.log("");
|
|
|
|
}
|
|
|
|
|
|
|
|
let targetGuild = "";
|
|
|
|
function gotoGuild() {
|
|
|
|
targetGuild = "";
|
|
|
|
guildSwitch = true;
|
|
|
|
|
|
|
|
stdout.write(":guild> ");
|
|
|
|
}
|
|
|
|
|
|
|
|
function findTopChannel(guildId) {
|
|
|
|
const guild = client.guilds.get(guildId);
|
|
|
|
const channels = [...guild.channels.values()].filter((c) => c.type == 0);
|
|
|
|
channels.sort((a, b) => a.position - b.position);
|
|
|
|
|
|
|
|
return channels[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getStatus(status) {
|
|
|
|
let color;
|
|
|
|
switch (status) {
|
|
|
|
case "online":
|
|
|
|
color = chalk.bold.green;
|
|
|
|
break;
|
|
|
|
case "idle":
|
|
|
|
color = chalk.bold.yellow;
|
|
|
|
break;
|
|
|
|
case "dnd":
|
|
|
|
color = chalk.bold.red;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
color = chalk.bold;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return color(" \u2022 ");
|
|
|
|
}
|
|
|
|
|
|
|
|
function listUsers() {
|
|
|
|
const guild = client.guilds.get(currentGuild);
|
|
|
|
const channel = guild.channels.get(currentChannel);
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
`\n[you are in '${guild.name}' in '${channel.name}' among ${guild.memberCount}]\n`
|
|
|
|
);
|
|
|
|
|
|
|
|
const online = [...guild.members.values()].filter((m) => m.status);
|
|
|
|
online.sort((a, b) => a.name - b.name);
|
|
|
|
|
|
|
|
let longest = 0;
|
|
|
|
for (const member of online) {
|
|
|
|
const name = member.user.username + "#" + member.user.discriminator;
|
|
|
|
if (name.length + 3 > longest) longest = name.length + 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
const columns = Math.ceil(stdout.columns / longest);
|
|
|
|
|
|
|
|
let index = 0;
|
|
|
|
for (const member of online) {
|
|
|
|
const name = member.user.username + "#" + member.user.discriminator;
|
|
|
|
const status = getStatus(member.status);
|
|
|
|
const nameAndStatus = chalk.reset(name) + status;
|
|
|
|
|
|
|
|
index++;
|
|
|
|
stdout.write(
|
|
|
|
nameAndStatus +
|
|
|
|
" ".repeat(
|
|
|
|
index % columns == 0 ? 0 : Math.abs(longest - (name.length + 3))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (index % columns == 0) stdout.write("\n");
|
|
|
|
}
|
|
|
|
if (index % columns != 0) stdout.write("\n");
|
|
|
|
console.log("");
|
|
|
|
|
|
|
|
if (channel.topic != null) {
|
|
|
|
console.log("--Topic".padEnd(80, "-"));
|
|
|
|
console.log(channel.topic);
|
|
|
|
console.log("-".repeat(80));
|
|
|
|
console.log("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchGuild() {
|
2022-08-28 02:13:25 +00:00
|
|
|
if (targetGuild == "") {
|
|
|
|
listUsers();
|
|
|
|
guildSwitch = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-28 01:53:55 +00:00
|
|
|
let target;
|
|
|
|
|
|
|
|
for (const guild of client.guilds.values()) {
|
|
|
|
if (guild.name.toLowerCase().indexOf(targetGuild.toLowerCase()) > -1) {
|
|
|
|
target = guild.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target == null) {
|
|
|
|
console.log("<guild not found>");
|
|
|
|
} else {
|
|
|
|
currentGuild = target;
|
2022-08-28 02:13:25 +00:00
|
|
|
// TODO: store last visited channel and switch to it if we've been to this guild before
|
2022-08-28 01:53:55 +00:00
|
|
|
const topChannel = findTopChannel(target);
|
|
|
|
currentChannel = topChannel.id;
|
|
|
|
|
|
|
|
listUsers();
|
|
|
|
}
|
|
|
|
|
|
|
|
guildSwitch = false;
|
|
|
|
}
|
|
|
|
|
2022-08-28 02:13:25 +00:00
|
|
|
let targetChannel = "";
|
|
|
|
function gotoChannel() {
|
|
|
|
targetChannel = "";
|
|
|
|
channelSwitch = true;
|
|
|
|
|
|
|
|
stdout.write(":channel> ");
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchChannel() {
|
|
|
|
if (targetChannel == "") {
|
|
|
|
listUsers();
|
|
|
|
channelSwitch = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let target;
|
|
|
|
|
|
|
|
const guild = client.guilds.get(currentGuild);
|
|
|
|
const channels = [...guild.channels.values()].filter((c) => c.type == 0);
|
2022-08-28 02:43:00 +00:00
|
|
|
channels.sort((a, b) => a.position - b.position);
|
2022-08-28 02:13:25 +00:00
|
|
|
|
|
|
|
for (const channel of channels) {
|
|
|
|
if (channel.name.toLowerCase().indexOf(targetChannel.toLowerCase()) > -1) {
|
|
|
|
target = channel.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target == null) {
|
|
|
|
console.log("<channel not found>");
|
|
|
|
} else {
|
|
|
|
currentChannel = target;
|
|
|
|
|
|
|
|
listUsers();
|
|
|
|
}
|
|
|
|
|
|
|
|
channelSwitch = false;
|
|
|
|
}
|
|
|
|
|
2022-08-28 02:43:00 +00:00
|
|
|
function startEmote() {
|
|
|
|
toSend = "";
|
|
|
|
inEmoteMode = true;
|
|
|
|
|
|
|
|
stdout.write(":emote> ");
|
|
|
|
}
|
|
|
|
|
|
|
|
async function sendEmote() {
|
|
|
|
toSend = toSend.trim();
|
|
|
|
if (toSend === "") {
|
|
|
|
console.log("<no message sent>");
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
await client.createMessage(currentChannel, "*" + toSend + "*");
|
|
|
|
console.log(`<${client.user.username} ${toSend}>`);
|
|
|
|
} catch (err) {
|
|
|
|
console.log("<failed to send message: " + err.message + ">");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inEmoteMode = false;
|
|
|
|
processQueue();
|
|
|
|
}
|
|
|
|
|
2022-08-28 00:14:10 +00:00
|
|
|
stdin.on("data", function (key) {
|
2022-08-28 01:53:55 +00:00
|
|
|
if (guildSwitch) {
|
|
|
|
if (key === "\r") {
|
|
|
|
console.log("");
|
|
|
|
switchGuild();
|
|
|
|
} else {
|
|
|
|
if (key === "\b") {
|
|
|
|
if (targetGuild.length > 0) {
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
stdout.write(" ");
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
targetGuild = targetGuild.substring(0, targetGuild.length - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stdout.write(key);
|
|
|
|
targetGuild += key;
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 02:13:25 +00:00
|
|
|
} else if (channelSwitch) {
|
|
|
|
if (key === "\r") {
|
|
|
|
console.log("");
|
|
|
|
switchChannel();
|
|
|
|
} else {
|
|
|
|
if (key === "\b") {
|
|
|
|
if (targetChannel.length > 0) {
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
stdout.write(" ");
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
targetChannel = targetChannel.substring(0, targetChannel.length - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stdout.write(key);
|
|
|
|
targetChannel += key;
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 01:53:55 +00:00
|
|
|
} else if (inSendMode) {
|
2022-08-28 00:14:10 +00:00
|
|
|
if (key === "\r") {
|
|
|
|
sendMessage();
|
|
|
|
} else {
|
|
|
|
if (key === "\b") {
|
|
|
|
if (toSend.length > 0) {
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
stdout.write(" ");
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
toSend = toSend.substring(0, toSend.length - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stdout.write(key);
|
|
|
|
toSend += key;
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 02:43:00 +00:00
|
|
|
} else if (inEmoteMode) {
|
|
|
|
if (key === "\r") {
|
|
|
|
console.log("");
|
|
|
|
sendEmote();
|
|
|
|
} else {
|
|
|
|
if (key === "\b") {
|
|
|
|
if (toSend.length > 0) {
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
stdout.write(" ");
|
|
|
|
stdout.moveCursor(-1);
|
|
|
|
toSend = toSend.substring(0, toSend.length - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stdout.write(key);
|
|
|
|
toSend += key;
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 00:14:10 +00:00
|
|
|
} else {
|
|
|
|
switch (key) {
|
|
|
|
case "\u0003":
|
2022-08-28 00:49:02 +00:00
|
|
|
case "q": {
|
2022-08-28 00:14:10 +00:00
|
|
|
client.disconnect(false);
|
|
|
|
process.exit(0);
|
|
|
|
break;
|
2022-08-28 00:49:02 +00:00
|
|
|
}
|
|
|
|
case "h": {
|
|
|
|
showHelp();
|
|
|
|
break;
|
|
|
|
}
|
2022-08-28 01:53:55 +00:00
|
|
|
case "g": {
|
|
|
|
if (currentGuild == null) {
|
|
|
|
console.log("<not in a guild>");
|
|
|
|
break;
|
|
|
|
}
|
2022-08-28 02:13:25 +00:00
|
|
|
gotoChannel();
|
2022-08-28 01:53:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "G": {
|
|
|
|
gotoGuild();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "l": {
|
|
|
|
if (currentGuild == null) {
|
|
|
|
console.log("<not in a guild>");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "L": {
|
|
|
|
listGuilds();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "w": {
|
|
|
|
if (currentGuild == null) {
|
|
|
|
console.log("<not in a guild>");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
listUsers();
|
|
|
|
break;
|
|
|
|
}
|
2022-08-28 02:43:00 +00:00
|
|
|
case "e": {
|
|
|
|
if (currentChannel == null) {
|
|
|
|
console.log("<not in a channel>");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
startEmote();
|
|
|
|
break;
|
|
|
|
}
|
2022-08-28 00:14:10 +00:00
|
|
|
case " ":
|
|
|
|
case "\r":
|
|
|
|
default: {
|
|
|
|
if (currentChannel == null) {
|
2022-08-28 00:49:02 +00:00
|
|
|
console.log("<not in a channel>");
|
2022-08-28 00:14:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
setupSendMode();
|
|
|
|
break;
|
|
|
|
}
|
2022-08-27 23:27:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
client.connect();
|
2022-08-28 00:49:02 +00:00
|
|
|
|
|
|
|
console.log("COMcord (c)left 2022");
|
|
|
|
console.log("Type 'h' for Commands");
|