Skip to content

Commit

Permalink
optional text argument for links
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler committed Oct 6, 2023
1 parent 1ead81e commit 1fe897a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/commands/slashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const helpTexts: Record<string, string> = {
export class Commands {
@Slash({ description: 'Links to Immich pages' })
link(
interaction: CommandInteraction,
@SlashChoice(...Object.keys(linkCommands))
@SlashOption({
description: 'Which docs do you need?',
Expand All @@ -34,10 +35,16 @@ export class Commands {
type: ApplicationCommandOptionType.String,
})
name: string,
interaction: CommandInteraction,
@SlashOption({
description: 'Text that will be prepended before the link',
name: 'text',
required: false,
type: ApplicationCommandOptionType.String,
})
message?: string,
): void {
interaction.reply({
content: linkCommands[name],
content: message ? `${message}: ${linkCommands[name]}` : linkCommands[name],
flags: [MessageFlags.SuppressEmbeds],
});
}
Expand Down

0 comments on commit 1fe897a

Please sign in to comment.