Skip to content

Commit

Permalink
feat(discord): support required for slash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 16, 2024
1 parent 3ca9245 commit 4dbb629
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,20 @@ export function encodeCommandOptions(cmd: Universal.Command): Discord.Applicatio
description_localizations: pick(cmd.description, Discord.Locale),
})))
} else {
// `getGlobalApplicationCommands()` does not return `required` property.
for (const arg of cmd.arguments) {
result.push({
...encodeDescription(arg),
name: arg.name.toLowerCase().replace(/[^a-z0-9]/g, ''),
type: types[arg.type] ?? types.text,
// required: arg.required ?? false,
required: arg.required ?? false,
})
}
for (const option of cmd.options) {
result.push({
...encodeDescription(option),
name: option.name.toLowerCase(),
type: types[option.type] ?? types.text,
// required: option.required ?? false,
required: option.required ?? false,
min_value: option.type === 'posint' ? 1 : undefined,
})
}
Expand Down

0 comments on commit 4dbb629

Please sign in to comment.