From 1934dc75021296dea50f2c6c3064e69ef2b5f4c3 Mon Sep 17 00:00:00 2001 From: rishabh7923 Date: Fri, 11 Oct 2024 17:13:06 +0530 Subject: [PATCH] Improved help command --- interactions/commands/help.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/interactions/commands/help.js b/interactions/commands/help.js index 60109ca..5e2afc6 100644 --- a/interactions/commands/help.js +++ b/interactions/commands/help.js @@ -1,17 +1,22 @@ -import { SlashCommandBuilder } from "discord.js"; +import { SlashCommandBuilder, EmbedBuilder, CommandInteraction} from "discord.js"; export default { data: new SlashCommandBuilder() .setName('help') .setDescription('Get the list of commands available for use'), - run: async (interaction) => { - const helpMessage = `**Available Commands:**\n - \`/potd\` - Shows the LeetCode Daily Challenge\n - \`/random [difficulty]\` - Shows a random LeetCode problem (optional: specify difficulty)\n - \`/user \` - Shows user Info\n - \`/streak \` - Shows user Streak Info\n - \`/topics\` - Shows a list of LeetCode topics to choose from\n - \`/help\` - Shows this help message`; - return interaction.reply({ content: helpMessage}); + /** + * + * @param {CommandInteraction} interaction + * @returns + */ + run: async (interaction, client=interaction.client) => { + const embed = new EmbedBuilder() + .setDescription(`Hey __${interaction.user.displayName}__ 👋, I am a discord bot which integrates with LeetCode to provide daily challenges, random problems, user information, and more.\n`) + .setColor(0xD1006C) + .addFields( + ...client.commands.map(command => ({ name: `> /${command.data.name}`, value: `${command.data.description}`, inline: true })), + { name: '‎', value: 'Please consider giving me a ⭐ on GitHub ([DDoL](https://github.com/jinx-vi-0/DDoL)) to show your support!'} + ) + return interaction.reply({ embeds: [ embed ] }); } } \ No newline at end of file