Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Help Command #45

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions interactions/commands/help.js
Original file line number Diff line number Diff line change
@@ -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 <username>\` - Shows user Info\n
\`/streak <username>\` - 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 ] });
}
}