From a78e373b16f44a9585cd96d9151e8d85e7fcd25d Mon Sep 17 00:00:00 2001 From: Shikhir Arora Date: Wed, 24 Aug 2022 06:15:10 -0400 Subject: [PATCH] v4.0.0 - Reflected for self-hosting only - Updated to work with discord.js v14 (breaking changes) --- karma.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/karma.js b/karma.js index 910fede..e53979d 100644 --- a/karma.js +++ b/karma.js @@ -137,7 +137,7 @@ client.on('messageCreate', async (message) => { console.error(e) } } - /** TODO + const clean = (text) => { if (typeof (text) === 'string') { return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)) } else { return text } } @@ -159,14 +159,14 @@ client.on('messageCreate', async (message) => { if (clean(evaled).length > 1800) { await gist(clean(evaled)) .then(res => { - const embed = new Discord.MessageEmbed() + const embed = new EmbedBuilder() .setTitle('Eval output exceeds 2000 characters. View on Gist.') .setURL(`${res.html_url}`) .setColor(randomColor()) .setDescription(`Eval output exceeds 2000 characters. View Gist [here](${res.html_url}).`) - .setFooter('Eval Output') .setTimestamp() - message.channel.send({ embed }).catch((e) => message.channel.send(e.message)) + .setFooter('Eval Output') + message.channel.send({ embeds: [embed] }).catch((e) => message.channel.send(e.message)) }) } else { message.channel.send(clean(evaled), { @@ -194,9 +194,9 @@ client.on('messageCreate', async (message) => { .setURL(`${res.html_url}`) .setColor(randomColor()) .setDescription(`Console output exceeds 2000 characters. View Gist [here](${res.html_url}).`) - .setFooter('Exec Output') .setTimestamp() - message.channel.send({ embed }).catch((e) => message.channel.send(e.message)) + .setFooter('Exec Output') + message.channel.send({ embeds: [embed] }).catch((e) => message.channel.send(e.message)) }) } else { stdout && message.channel.send(`\`INFO:\`\n\n\`\`\`fix\n${stdout}\`\`\``) @@ -204,7 +204,7 @@ client.on('messageCreate', async (message) => { if (!stderr && !stdout) { message.react('\u2705') } } }) - } **/ + } })