Skip to content

Commit

Permalink
feat(discord): add natural number/bigint support (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhx-12243 authored Jun 4, 2024
1 parent ab78834 commit 58a0064
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ const types = {
number: Discord.ApplicationCommand.OptionType.NUMBER,
integer: Discord.ApplicationCommand.OptionType.INTEGER,
posint: Discord.ApplicationCommand.OptionType.INTEGER,
natural: Discord.ApplicationCommand.OptionType.INTEGER,
bigint: Discord.ApplicationCommand.OptionType.INTEGER,
user: Discord.ApplicationCommand.OptionType.STRING,
channel: Discord.ApplicationCommand.OptionType.STRING,
guild: Discord.ApplicationCommand.OptionType.STRING,
Expand Down Expand Up @@ -401,7 +403,7 @@ export function encodeCommandOptions(cmd: Universal.Command): Discord.Applicatio
name: option.name.toLowerCase(),
type: types[option.type] ?? types.text,
required: false,
min_value: option.type === 'posint' ? 1 : undefined,
min_value: option.type === 'posint' ? 1 : option.type === 'natural' ? 0 : undefined,
})
}
}
Expand Down

0 comments on commit 58a0064

Please sign in to comment.