From 04ef587bc9c049fd7b37903d7e92f847f7a4aa7c Mon Sep 17 00:00:00 2001 From: liushuyu Date: Thu, 19 Oct 2023 17:06:30 -0600 Subject: [PATCH] server: beautify command logging embed --- src/server.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 800e522..931cee1 100644 --- a/src/server.ts +++ b/src/server.ts @@ -212,9 +212,16 @@ client.on('messageCreate', async (message) => { } } catch (err) { logger.error(err); } }; + const commandUsageEmbed = new discord.EmbedBuilder() + .setAuthor({ name: message.author.username, iconURL: message.author.displayAvatarURL() }) + .setDescription(`Command used in ${message.channel.toString()} [Jump To Message](${message.url})`) + .addFields({ name: 'Command', value: `\`\`\`\n${message.content}\n\`\`\``, inline: false }) + .setTimestamp() + .setColor('Blue'); + const userInfo = `${message.author?.toString()} (${message.author?.username}) (${message.author})`; await Promise.all( [ - state.msglogChannel?.send(`${message.author.username} ${message.author.id} [Channel: ${message.channel}] executed command: \`${message.content}\``), + state.msglogChannel?.send({ content: userInfo, embeds: [commandUsageEmbed] }), message.delete(), executeModule() ]