-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from rishabh7923/slash
Improved Help Command
- Loading branch information
Showing
1 changed file
with
15 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ] }); | ||
} | ||
} |