quick fixes

This commit is contained in:
Cynthia Foxwell 2022-08-28 09:12:26 -06:00
parent bc9bf22163
commit e8860722f0

View file

@ -99,7 +99,7 @@ function processMessage({
(content.startsWith("_") && content.endsWith("_")) (content.startsWith("_") && content.endsWith("_"))
) { ) {
if (isHistory) { if (isHistory) {
console.log(`<${name} ${content.subString(1, content.length - 1)}>`); console.log(`<${name} ${content.substring(1, content.length - 1)}>`);
} else { } else {
console.log( console.log(
chalk.bold.green( chalk.bold.green(
@ -124,6 +124,7 @@ function processMessage({
} }
} }
if (attachments) {
for (const attachment of attachments) { for (const attachment of attachments) {
if (isHistory) { if (isHistory) {
console.log(`<attachment: ${attachment.url} >`); console.log(`<attachment: ${attachment.url} >`);
@ -131,6 +132,7 @@ function processMessage({
console.log(chalk.bold.yellow(`<attachment: ${attachment.url} >`)); console.log(chalk.bold.yellow(`<attachment: ${attachment.url} >`));
} }
} }
}
} }
function processQueue() { function processQueue() {
@ -143,7 +145,7 @@ function processQueue() {
name: msg.author.username, name: msg.author.username,
bot: msg.author.bot, bot: msg.author.bot,
content: line, content: line,
attachments: index == lines.length - 1 ? msg.attachments : null, attachments: index == lines.length - 1 ? msg.attachments : [],
reply: index == 0 ? msg.referencedMessage : null, reply: index == 0 ? msg.referencedMessage : null,
}); });
} }
@ -176,7 +178,7 @@ client.on("messageCreate", function (msg) {
name: msg.author.username, name: msg.author.username,
bot: msg.author.bot, bot: msg.author.bot,
content: line, content: line,
attachments: index == lines.length - 1 ? msg.attachments : null, attachments: index == lines.length - 1 ? msg.attachments : [],
reply: index == 0 ? msg.referencedMessage : null, reply: index == 0 ? msg.referencedMessage : null,
}); });
} }
@ -208,8 +210,8 @@ client.on("messageUpdate", function (msg, old) {
processMessage({ processMessage({
name: msg.author.username, name: msg.author.username,
bot: msg.author.bot, bot: msg.author.bot,
content: line + index == lines.length - 1 ? " (edited)" : null, content: line + (index == lines.length - 1 ? " (edited)" : ""),
attachments: index == lines.length - 1 ? msg.attachments : null, attachments: index == lines.length - 1 ? msg.attachments : [],
reply: index == 0 ? msg.referencedMessage : null, reply: index == 0 ? msg.referencedMessage : null,
}); });
} }