From b524a5c1cae996ed9be43b61fa492e6e6dab0a26 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Mon, 28 Jun 2021 22:16:38 -0500 Subject: [PATCH] Fix non-string message types Discord.js's update led to MessageEmbed's classifying non-string fields (e.g. booleans) as empty, which is unallowed and would cause errors. --- bot.js | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bot.js b/bot.js index d2666cd..3c3535a 100644 --- a/bot.js +++ b/bot.js @@ -615,7 +615,7 @@ async function roleInfo(message) { .setTitle(`Role \`${role.name}\` Info`) .setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true, size: 1024 })) .addField("Permissions", role.permissions.toArray().map(p => `\`${p}\``.toLowerCase()).join(' • ')) - .addField("Mentionable", role.mentionable) + .addField("Mentionable", `${role.mentionable}`) .setFooter("Role ID: " + role.id) .setThumbnail(message.author.displayAvatarURL({ dynamic: true, size: 1024 })) .setTimestamp() @@ -1098,7 +1098,7 @@ client.on('messageDeleteBulk', messages => { const messagesChannel = messages.array()[0].channel; const bulkDeleteEmbed = new Discord.MessageEmbed() .setTitle(`${numMessages} Messages Bulk Deleted`) - .addField(`Channel`, messagesChannel) + .addField(`Channel`, `<#${messagesChannel.id}>`) .setFooter("Channel ID: " + messagesChannel.id) .setTimestamp() .setColor('e7778b'); @@ -1166,7 +1166,7 @@ client.on('channelCreate', channel => { } const channelCreateEmbed = new Discord.MessageEmbed() .setTitle("Channel Created") - .addField("Name", channel) + .addField("Name", `<#${channel.id}>`) .addField("Type", channelType) .addField("Category", channelCategory) .setFooter("ID: " + channelID) @@ -1432,7 +1432,7 @@ client.on('roleCreate', role => { .setTitle("Role Added") .addField("Name", role.name) .addField("Permissions", role.permissions.toArray().map(p => `\`${p}\``.toLowerCase()).join(' • ')) - .addField("Mentionable", role.mentionable) + .addField("Mentionable", `${role.mentionable}`) .setFooter("Role ID: " + role.id) .setTimestamp() .setColor('00aaff'); diff --git a/package.json b/package.json index 0c21527..65da546 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "prod": "node index.js", + "prod": "pm2 start index.js", "test": "node index.js", - "dev": "nodemon index.js" + "dev": "index.js" }, "author": "Abheek", "license": "Apache-2.0",