Skip to content

Commit

Permalink
Allow mentioning a user with support commands
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 1, 2023
1 parent 70ac88d commit cebe4f3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ const slashApiCommands: any[] = [
new SlashCommandBuilder()
.setName("help")
.setDescription("Show list of commands")
.addUserOption(option => option.setName('user').setDescription('Mention a specific user with the command'))
.toJSON()
]

for (const command of commands) {
const slashCommand = new SlashCommandBuilder()
.setName(command.name)
.setDescription("Support help command")
.addUserOption(option => option.setName('user').setDescription('Mention a specific user with the command'))

slashApiCommands.push(slashCommand.toJSON())
}
Expand Down Expand Up @@ -86,6 +88,8 @@ export default async (client: Client): Promise<void> => {
// Ignore if trigger is blank
if (trigger === '') return

const user = interaction.options.getUser('user')

// Initiate the embed
const embed = new EmbedBuilder()

Expand Down Expand Up @@ -159,6 +163,11 @@ export default async (client: Client): Promise<void> => {
})
}

await interaction.reply({embeds: [embed]})
let message
if (user != null) {
message = `<@${user.id}>`
}

await interaction.reply({content: message, embeds: [embed]})
})
}

0 comments on commit cebe4f3

Please sign in to comment.