@antiraid-ext/appcommands
API reference for @antiraid-ext/appcommands
@antiraid-ext/appcommands
Types
ParsedApplicationCommand
Parsed application command type created using `parseApplicationCommand`
Raw Type
--- Parsed application command type created using \`parseApplicationCommand\`
type ParsedApplicationCommand = {
--- The base name of the slash command
baseName: string,
--- The command name list of the slash command
nameList: {string},
--- The inner data of the interaction
data: discord.InteractionDataObject,
--- The inner options of the slash command
options: {ResolvedOption}
}
Prop | Type | Description |
---|---|---|
baseName | The base name of the slash command | |
nameList | The command name list of the slash command | |
data | The inner data of the interaction | |
options | The inner options of the slash command |
ResolvedOption
An option that is resolved from the slash command interaction options.
Note that Subcommand and SubcommandGroup will probably not be observed unless resolveOption is called directly outside
of parseApplicationCommand due to the extra parsing logic in `parseApplicationCommand` that unwraps subcommands and subcommand groups.
Raw Type
--- An option that is resolved from the slash command interaction options.
---
--- Note that Subcommand and SubcommandGroup will probably not be observed unless resolveOption is called directly outside
--- of parseApplicationCommand due to the extra parsing logic in \`parseApplicationCommand\` that unwraps subcommands and subcommand groups.
type ResolvedOption = {
name: string,
value: ResolvedValue,
focused: boolean,
isMentionable: boolean
}
Prop | Type | Description |
---|---|---|
name | - | |
value | - | |
focused | - | |
isMentionable | - |
ResolvedValue
Raw Type
type ResolvedValue = {
kind: "Subcommand",
options: {ResolvedOption}
} | {
kind: "SubcommandGroup",
options: {ResolvedOption}
} | {
kind: "String",
value: string
} | {
kind: "Integer",
value: number
} | {
kind: "Boolean",
value: boolean
} | {
kind: "User",
user: discord.UserObject,
member: discord.GuildMemberObject?
} | {
kind: "Channel",
channel: discord.ChannelObject
} | {
kind: "Role",
role: discord.GuildRoleObject
} | {
kind: "Number",
value: number
} | {
kind: "Attachment",
attachment: discord.AttachmentObject
} | {
kind: "Unresolved",
type: "User" | "Channel" | "Role" | "Mentionable" | "Attachment",
id: string
}
Union with variants:
Variant 1
Prop | Type | Description |
---|---|---|
kind | 'Subcommand' | - |
options | - |
Variant 2
Prop | Type | Description |
---|---|---|
kind | 'SubcommandGroup' | - |
options | - |
Variant 3
Prop | Type | Description |
---|---|---|
kind | 'String' | - |
value | - |
Variant 4
Prop | Type | Description |
---|---|---|
kind | 'Integer' | - |
value | - |
Variant 5
Prop | Type | Description |
---|---|---|
kind | 'Boolean' | - |
value | - |
Variant 6
Prop | Type | Description |
---|---|---|
kind | 'User' | - |
user | - | |
member? | - |
Variant 7
Prop | Type | Description |
---|---|---|
kind | 'Channel' | - |
channel | - |
Variant 8
Prop | Type | Description |
---|---|---|
kind | 'Role' | - |
role | - |
Variant 9
Prop | Type | Description |
---|---|---|
kind | 'Number' | - |
value | - |
Variant 10
Prop | Type | Description |
---|---|---|
kind | 'Attachment' | - |
attachment | - |
Variant 11
Prop | Type | Description |
---|---|---|
kind | 'Unresolved' | - |
type | ('User' | 'Channel' | 'Role' | 'Mentionable' | 'Attachment') | - |
id | - |
ParsedCommandDataArgument
ParsedCommandDataArgument is the type of a parsed command data argument
Raw Type
--- ParsedCommandDataArgument is the type of a parsed command data argument
type ParsedCommandDataArgument = {
name: string,
description: string,
type: "String" | "Integer" | "Boolean" | "User" | "Channel" | "Role" | "Number" | "Attachment",
required: boolean,
choices: {discord.ApplicationCommandOptionChoiceObject}?,
min_length: number?,
max_length: number?
}
Prop | Type | Description |
---|---|---|
name | - | |
description | - | |
type | ('String' | 'Integer' | 'Boolean' | 'User' | 'Channel' | 'Role' | 'Number' | 'Attachment') | - |
required | - | |
choices? | - | |
min_length? | - | |
max_length? | - |
ParsedCommandData
ParsedCommandData is the parsed ``discordRestTypes.CreateGuildApplicationCommandRequest``
Raw Type
--- ParsedCommandData is the parsed \`\`discordRestTypes.CreateGuildApplicationCommandRequest\`\`
type ParsedCommandData = {
name: string,
description: string?,
options: {ParsedCommandDataArgument},
subcommands: {ParsedCommandData}
}
Prop | Type | Description |
---|---|---|
name | - | |
description? | - | |
options | - | |
subcommands | - |
AppCommandDataLike
Raw Type
type AppCommandDataLike = {
name: string,
description: string?,
options: {discord.ApplicationCommandOptionObject}?
}
Prop | Type | Description |
---|---|---|
name | - | |
description? | - | |
options? | - |
Functions
resolveOptions
Resolves discords option into a more type-safe structure for handling slash commands
Function Signature
--- Resolves discords option into a more type-safe structure for handling slash commands
function resolveOptions(opts: {discord.ApplicationCommandInteractionDataOptionObject}, resolved: discord.ResolvedDataStructure) -> {ResolvedOption} end
Arguments
opts
{discord.ApplicationCommandInteractionDataOptionObject}
resolved
Returns
ret1
parseApplicationCommand
Parses a/an application/slash command from an AntiRaid interaction create event into a parsed slash command object.
Function Signature
--- Parses a/an application/slash command from an AntiRaid interaction create event into a parsed slash command object.
function parseApplicationCommand(interaction: discord.InteractionObject) -> ParsedApplicationCommand? end
Arguments
interaction
Returns
ret1
parseApplicationCommandData
Parses a command data object from a discordRestTypes.CreateGuildApplicationCommandRequest into a parsed command data object.
Function Signature
--- Parses a command data object from a discordRestTypes.CreateGuildApplicationCommandRequest into a parsed command data object.
function parseApplicationCommandData(data: AppCommandDataLike) -> ParsedCommandData end
Arguments
data
Returns
ret1
Last updated on