Skip to content

Slash Commands#

SlashCommand #

Bases: CallableCommandBase[ClientT, SlashCommandBuilder]

A slash command outside of any group.

autodefer property #

autodefer: AutodeferMode

The resolved autodefer configuration for this command.

callback instance-attribute #

callback: CommandCallbackT[ClientT]

The callback to invoke when this command is called.

client property #

client: ClientT

The client that is handling this command.

command_type property #

command_type: CommandType

The type of command this object represents.

concurrency_limiter property writable #

concurrency_limiter: ConcurrencyLimiterProto[ClientT] | None

The concurrency limiter for this command.

default_permissions property #

default_permissions: Permissions | UndefinedType

The resolved default permissions for this command.

description class-attribute instance-attribute #

description: str = 'No description provided.'

The description of this slash command.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The localizations for this command's description.

display_name property #

display_name: str

The display name of this command.

error_handler property writable #

error_handler: ErrorHandlerCallbackT[ClientT] | None

The error handler for this command.

guilds class-attribute instance-attribute #

The guilds this command is available in.

hooks property #

hooks: MutableSequence[HookT[ClientT]]

The pre-execution hooks for this command.

instances property #

instances: Mapping[Snowflake | None, PartialCommand]

A mapping of guild IDs to command instances. None corresponds to the global instance, if any.

is_dm_enabled property #

is_dm_enabled: bool

Whether this command is enabled in DMs.

is_nsfw property #

is_nsfw: bool

Whether this command is NSFW. If true, the command will only be available in NSFW channels.

name instance-attribute #

name: str

The name of this command.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

The localizations for this command's name.

options class-attribute instance-attribute #

options: dict[str, CommandOptionBase[Any, ClientT, Any]] = field(factory=dict)

The options of this slash command.

plugin property #

plugin: PluginBase[ClientT] | None

The plugin that this command belongs to, if any.

post_hooks property #

post_hooks: MutableSequence[PostHookT[ClientT]]

The post-execution hooks for this command.

qualified_name property #

qualified_name: Sequence[str]

The fully qualified name of this command.

__call__ async #

__call__(ctx: Context[ClientT], *args: Any, **kwargs: Any) -> None

Call the callback of the command with the given context and arguments.

PARAMETER DESCRIPTION
ctx

The context to invoke this command with.

TYPE: ContextT

args

The positional arguments to pass to the callback.

TYPE: tuple[Any] DEFAULT: ()

kwargs

The keyword arguments to pass to the callback.

TYPE: dict[str, Any] DEFAULT: {}

add_hook #

add_hook(hook: HookT[ClientT]) -> Self

Add a new pre-execution hook to this object.

Any function that takes a Context as its sole parameter and returns either a HookResult or None can be used as a hook.

PARAMETER DESCRIPTION
hook

The hook to add.

TYPE: HookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

add_post_hook #

add_post_hook(hook: PostHookT[ClientT]) -> Self

Add a new post-execution hook to this object.

Any function that takes a Context as its sole parameter and returns None can be used as a post-hook.

PARAMETER DESCRIPTION
hook

The post-execution hook to add.

TYPE: PostHookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

invoke async #

invoke(
    interaction: CommandInteraction, *args: Any, **kwargs: Any
) -> Future[ResponseBuilderT] | None

Invoke this command with the given interaction.

PARAMETER DESCRIPTION
interaction

The interaction to invoke this command with.

TYPE: CommandInteraction

args

The positional arguments to pass to the callback.

TYPE: tuple[Any] DEFAULT: ()

kwargs

The keyword arguments to pass to the callback.

TYPE: dict[str, Any] DEFAULT: {}

RETURNS DESCRIPTION
None | Future[ResponseBuilderT]

If this is a REST client, returns the response builder.

RAISES DESCRIPTION
RuntimeError

If this command has not been added to a client.

make_mention #

make_mention(*, guild: Snowflakeish | PartialGuild | None = None) -> str

Make a slash mention for this command.

PARAMETER DESCRIPTION
guild

The guild the command is registered in. If None, the global command's ID is used.

TYPE: SnowflakeishOr[PartialGuild] | None DEFAULT: None

RETURNS DESCRIPTION
str

The slash command mention.

RAISES DESCRIPTION
KeyError

If the command has not been published in the given guild or globally.

publish async #

publish(guild: SnowflakeishOr[PartialGuild] | None = None) -> PartialCommand

Publish this command to the given guild, or globally if no guild is provided.

PARAMETER DESCRIPTION
guild

The guild to publish this command to. If None, publish globally.

TYPE: Snowflakeish | None DEFAULT: None

RETURNS DESCRIPTION
PartialCommand

The published command.

reset_all_limiters #

reset_all_limiters(context: Context[ClientT]) -> None

Reset all limiter hooks for this command.

PARAMETER DESCRIPTION
context

The context to reset the limiters for.

TYPE: Context

set_concurrency_limiter #

set_concurrency_limiter(limiter: ConcurrencyLimiterProto[ClientT]) -> Self

Set the concurrency limiter for this object.

set_error_handler #

set_error_handler(
    callback: ErrorHandlerCallbackT[ClientT] | None = None,
) -> (
    ErrorHandlerCallbackT[ClientT]
    | Callable[[ErrorHandlerCallbackT[ClientT]], ErrorHandlerCallbackT[ClientT]]
)

Decorator to set an error handler for this object. This can be added to commands, groups, or plugins.

This function will be called when an exception is raised during the invocation of a command.

Example
@client.include
@arc.slash_command("foo", "Foo command description")
async def foo(ctx: arc.GatewayContext) -> None:
    raise RuntimeError("foo")

@foo.set_error_handler
async def foo_error_handler(ctx: arc.GatewayContext, exc: Exception) -> None:
    if isinstance(exc, RuntimeError):
        await ctx.respond("foo failed")
        return

    raise exc

Warning

Errors that cannot be handled by the error handler should be re-raised. Otherwise they will not propagate to the next error handler.

unpublish async #

unpublish(guild: SnowflakeishOr[PartialGuild] | None = None) -> None

Unpublish this command from the given guild, or globally if no guild is provided.

PARAMETER DESCRIPTION
guild

The guild to unpublish this command from. If None, unpublish globally.

TYPE: Snowflakeish | None DEFAULT: None

SlashGroup #

Bases: CommandBase[ClientT, SlashCommandBuilder]

A group for slash subcommands and subgroups.

autodefer property #

autodefer: AutodeferMode

The resolved autodefer configuration for this command.

children class-attribute instance-attribute #

children: dict[str, SlashSubCommand[ClientT] | SlashSubGroup[ClientT]] = field(
    factory=dict, init=False
)

Subcommands and subgroups that belong to this group.

client property #

client: ClientT

The client that is handling this command.

command_type property #

command_type: CommandType

The type of command this object represents.

concurrency_limiter property writable #

concurrency_limiter: ConcurrencyLimiterProto[ClientT] | None

The concurrency limiter for this command.

default_permissions property #

default_permissions: Permissions | UndefinedType

The resolved default permissions for this command.

description class-attribute instance-attribute #

description: str = 'No description provided.'

The description of this slash group.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The localizations for this group's description.

display_name property #

display_name: str

The display name of this command.

error_handler property writable #

error_handler: ErrorHandlerCallbackT[ClientT] | None

The error handler for this command.

guilds class-attribute instance-attribute #

The guilds this command is available in.

hooks property #

hooks: MutableSequence[HookT[ClientT]]

The pre-execution hooks for this command.

instances property #

instances: Mapping[Snowflake | None, PartialCommand]

A mapping of guild IDs to command instances. None corresponds to the global instance, if any.

is_dm_enabled property #

is_dm_enabled: bool

Whether this command is enabled in DMs.

is_nsfw property #

is_nsfw: bool

Whether this command is NSFW. If true, the command will only be available in NSFW channels.

name instance-attribute #

name: str

The name of this command.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

The localizations for this command's name.

plugin property #

plugin: PluginBase[ClientT] | None

The plugin that this command belongs to, if any.

post_hooks property #

post_hooks: MutableSequence[PostHookT[ClientT]]

The post-execution hooks for this command.

qualified_name property #

qualified_name: Sequence[str]

The fully qualified name of this command.

add_hook #

add_hook(hook: HookT[ClientT]) -> Self

Add a new pre-execution hook to this object.

Any function that takes a Context as its sole parameter and returns either a HookResult or None can be used as a hook.

PARAMETER DESCRIPTION
hook

The hook to add.

TYPE: HookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

add_post_hook #

add_post_hook(hook: PostHookT[ClientT]) -> Self

Add a new post-execution hook to this object.

Any function that takes a Context as its sole parameter and returns None can be used as a post-hook.

PARAMETER DESCRIPTION
hook

The post-execution hook to add.

TYPE: PostHookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

include #

include(
    command: SlashSubCommand[ClientT] | None = None,
) -> (
    SlashSubCommand[ClientT]
    | Callable[[SlashSubCommand[ClientT]], SlashSubCommand[ClientT]]
)

Decorator to add a subcommand to this group.

include_subgroup #

include_subgroup(
    name: str,
    description: str = "No description provided.",
    *,
    autodefer: AutodeferMode | bool | UndefinedType = hikari.UNDEFINED,
    name_localizations: Mapping[Locale, str] | None = None,
    description_localizations: Mapping[Locale, str] | None = None
) -> SlashSubGroup[ClientT]

Create a subgroup and add it to this group.

PARAMETER DESCRIPTION
name

The name of the subgroup.

TYPE: str

description

The description of the subgroup

TYPE: str DEFAULT: 'No description provided.'

autodefer

If True, all commands in this subgroup will automatically defer if it is taking longer than 2 seconds to respond. If not provided, then this setting will be inherited from the parent.

TYPE: bool | AutodeferMode | UndefinedType DEFAULT: UNDEFINED

name_localizations

Localizations for the name of the subgroup

TYPE: dict[Locale, str] | None DEFAULT: None

description_localizations

Localizations for the description of the subgroup

TYPE: dict[Locale, str] | None DEFAULT: None

invoke async #

invoke(
    interaction: CommandInteraction, *args: Any, **kwargs: Any
) -> Future[ResponseBuilderT] | None

Invoke this command with the given interaction.

PARAMETER DESCRIPTION
interaction

The interaction to invoke this command with.

TYPE: CommandInteraction

args

The positional arguments to pass to the callback.

TYPE: tuple[Any] DEFAULT: ()

kwargs

The keyword arguments to pass to the callback.

TYPE: dict[str, Any] DEFAULT: {}

RETURNS DESCRIPTION
None | Future[ResponseBuilderT]

If this is a REST client, returns the response builder.

RAISES DESCRIPTION
RuntimeError

If this command has not been added to a client.

publish async #

publish(guild: SnowflakeishOr[PartialGuild] | None = None) -> PartialCommand

Publish this command to the given guild, or globally if no guild is provided.

PARAMETER DESCRIPTION
guild

The guild to publish this command to. If None, publish globally.

TYPE: Snowflakeish | None DEFAULT: None

RETURNS DESCRIPTION
PartialCommand

The published command.

set_concurrency_limiter #

set_concurrency_limiter(limiter: ConcurrencyLimiterProto[ClientT]) -> Self

Set the concurrency limiter for this object.

set_error_handler #

set_error_handler(
    callback: ErrorHandlerCallbackT[ClientT] | None = None,
) -> (
    ErrorHandlerCallbackT[ClientT]
    | Callable[[ErrorHandlerCallbackT[ClientT]], ErrorHandlerCallbackT[ClientT]]
)

Decorator to set an error handler for this object. This can be added to commands, groups, or plugins.

This function will be called when an exception is raised during the invocation of a command.

Example
@client.include
@arc.slash_command("foo", "Foo command description")
async def foo(ctx: arc.GatewayContext) -> None:
    raise RuntimeError("foo")

@foo.set_error_handler
async def foo_error_handler(ctx: arc.GatewayContext, exc: Exception) -> None:
    if isinstance(exc, RuntimeError):
        await ctx.respond("foo failed")
        return

    raise exc

Warning

Errors that cannot be handled by the error handler should be re-raised. Otherwise they will not propagate to the next error handler.

unpublish async #

unpublish(guild: SnowflakeishOr[PartialGuild] | None = None) -> None

Unpublish this command from the given guild, or globally if no guild is provided.

PARAMETER DESCRIPTION
guild

The guild to unpublish this command from. If None, unpublish globally.

TYPE: Snowflakeish | None DEFAULT: None

SlashSubCommand #

Bases: SubCommandBase[ClientT, SlashGroup[ClientT] | SlashSubGroup[ClientT]], CallableCommandProto[ClientT]

A subcommand of a slash command group.

autodefer property #

autodefer: AutodeferMode

The resolved autodefer configuration for this subcommand.

callback instance-attribute #

callback: CommandCallbackT[ClientT]

The callback that will be invoked when this subcommand is invoked.

client property #

client: ClientT

The client that includes this subcommand.

command_type property #

command_type: CommandType

The type of command this object represents.

concurrency_limiter property writable #

concurrency_limiter: ConcurrencyLimiterProto[ClientT] | None

The concurrency limiter for this object.

description instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

display_name property #

display_name: str

The display name of this command. This is what is shown in the Discord client.

Note

Slash commands can also be mentioned, see SlashCommand.make_mention.

error_handler property writable #

error_handler: ErrorHandlerCallbackT[ClientT] | None

The error handler for this object.

hooks property #

hooks: MutableSequence[HookT[ClientT]]

The pre-execution hooks for this object.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

The name of the option in different locales.

option_type property #

option_type: OptionType

The type of the option. Used to register the command.

options class-attribute instance-attribute #

options: MutableMapping[str, CommandOptionBase[ClientT, Any, Any]] = field(
    factory=dict
)

The options of this subcommand.

parent property #

parent: SlashGroup[ClientT] | SlashSubGroup[ClientT]

The parent of this subcommand.

plugin property #

plugin: PluginBase[ClientT] | None

The plugin that includes this subcommand.

post_hooks property #

post_hooks: MutableSequence[PostHookT[ClientT]]

The post-execution hooks for this object.

qualified_name property #

qualified_name: Sequence[str]

The fully qualified name of this command.

root property #

root: SlashGroup[ClientT]

The root group of this subcommand.

__call__ async #

__call__(ctx: Context[ClientT], *args: Any, **kwargs: Any) -> None

Invoke this subcommand with the given context.

PARAMETER DESCRIPTION
ctx

The context to invoke this subcommand with.

TYPE: Context

args

The positional arguments to pass to the callback.

TYPE: Any DEFAULT: ()

kwargs

The keyword arguments to pass to the callback.

TYPE: dict[str, Any] DEFAULT: {}

add_hook #

add_hook(hook: HookT[ClientT]) -> Self

Add a new pre-execution hook to this object.

Any function that takes a Context as its sole parameter and returns either a HookResult or None can be used as a hook.

PARAMETER DESCRIPTION
hook

The hook to add.

TYPE: HookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

add_post_hook #

add_post_hook(hook: PostHookT[ClientT]) -> Self

Add a new post-execution hook to this object.

Any function that takes a Context as its sole parameter and returns None can be used as a post-hook.

PARAMETER DESCRIPTION
hook

The post-execution hook to add.

TYPE: PostHookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

invoke async #

invoke(
    interaction: CommandInteraction, *args: Any, **kwargs: Any
) -> Future[ResponseBuilderT] | None

Invoke this command with the given context.

PARAMETER DESCRIPTION
interaction

The interaction to invoke this command with.

TYPE: CommandInteraction

args

The positional arguments to pass to the callback.

TYPE: tuple[Any] DEFAULT: ()

kwargs

The keyword arguments to pass to the callback.

TYPE: dict[str, Any] DEFAULT: {}

RETURNS DESCRIPTION
None | Future[ResponseBuilderT]

If this is a REST client, returns the response builder.

RAISES DESCRIPTION
RuntimeError

If this command has not been added to a client.

make_mention #

make_mention(guild: Snowflakeish | PartialGuild | None = None) -> str

Make a slash mention for this command.

RETURNS DESCRIPTION
str

The slash command mention.

reset_all_limiters #

reset_all_limiters(context: Context[ClientT]) -> None

Reset all limiter hooks for this command.

PARAMETER DESCRIPTION
context

The context to reset the limiters for.

TYPE: Context

set_concurrency_limiter #

set_concurrency_limiter(limiter: ConcurrencyLimiterProto[ClientT]) -> Self

Set the concurrency limiter for this object.

set_error_handler #

set_error_handler(
    callback: ErrorHandlerCallbackT[ClientT] | None = None,
) -> (
    ErrorHandlerCallbackT[ClientT]
    | Callable[[ErrorHandlerCallbackT[ClientT]], ErrorHandlerCallbackT[ClientT]]
)

Decorator to set an error handler for this object. This can be added to commands, groups, or plugins.

This function will be called when an exception is raised during the invocation of a command.

Example
@client.include
@arc.slash_command("foo", "Foo command description")
async def foo(ctx: arc.GatewayContext) -> None:
    raise RuntimeError("foo")

@foo.set_error_handler
async def foo_error_handler(ctx: arc.GatewayContext, exc: Exception) -> None:
    if isinstance(exc, RuntimeError):
        await ctx.respond("foo failed")
        return

    raise exc

Warning

Errors that cannot be handled by the error handler should be re-raised. Otherwise they will not propagate to the next error handler.

to_command_option #

to_command_option() -> CommandOption

Convert this option to a hikari.CommandOption.

SlashSubGroup #

Bases: SubCommandBase[ClientT, SlashGroup[ClientT]]

A subgroup of a slash command group.

autodefer property #

autodefer: AutodeferMode

The resolved autodefer configuration for this subcommand.

children class-attribute instance-attribute #

children: dict[str, SlashSubCommand[ClientT]] = field(factory=dict, init=False)

Subcommands that belong to this subgroup.

client property #

client: ClientT

The client that includes this subgroup.

concurrency_limiter property writable #

concurrency_limiter: ConcurrencyLimiterProto[ClientT] | None

The concurrency limiter for this object.

description instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

display_name property #

display_name: str

The display name of this command. This is what is shown in the Discord client.

Note

Slash commands can also be mentioned, see SlashCommand.make_mention.

error_handler property writable #

error_handler: ErrorHandlerCallbackT[ClientT] | None

The error handler for this object.

hooks property #

hooks: MutableSequence[HookT[ClientT]]

The pre-execution hooks for this object.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

The name of the option in different locales.

option_type property #

option_type: OptionType

The type of the option. Used to register the command.

parent property #

parent: ParentT

The parent of this subcommand or subgroup.

plugin property #

plugin: PluginBase[ClientT] | None

The plugin that includes this subgroup.

post_hooks property #

post_hooks: MutableSequence[PostHookT[ClientT]]

The post-execution hooks for this object.

add_hook #

add_hook(hook: HookT[ClientT]) -> Self

Add a new pre-execution hook to this object.

Any function that takes a Context as its sole parameter and returns either a HookResult or None can be used as a hook.

PARAMETER DESCRIPTION
hook

The hook to add.

TYPE: HookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

add_post_hook #

add_post_hook(hook: PostHookT[ClientT]) -> Self

Add a new post-execution hook to this object.

Any function that takes a Context as its sole parameter and returns None can be used as a post-hook.

PARAMETER DESCRIPTION
hook

The post-execution hook to add.

TYPE: PostHookT[ClientT]

RETURNS DESCRIPTION
Self

This object for chaining.

include #

include(
    command: SlashSubCommand[ClientT] | None = None,
) -> (
    SlashSubCommand[ClientT]
    | Callable[[SlashSubCommand[ClientT]], SlashSubCommand[ClientT]]
)

First-order decorator to add a subcommand to this group.

reset_all_limiters #

reset_all_limiters(context: Context[ClientT]) -> None

Reset all limiter hooks for this command.

PARAMETER DESCRIPTION
context

The context to reset the limiters for.

TYPE: Context

set_concurrency_limiter #

set_concurrency_limiter(limiter: ConcurrencyLimiterProto[ClientT]) -> Self

Set the concurrency limiter for this object.

set_error_handler #

set_error_handler(
    callback: ErrorHandlerCallbackT[ClientT] | None = None,
) -> (
    ErrorHandlerCallbackT[ClientT]
    | Callable[[ErrorHandlerCallbackT[ClientT]], ErrorHandlerCallbackT[ClientT]]
)

Decorator to set an error handler for this object. This can be added to commands, groups, or plugins.

This function will be called when an exception is raised during the invocation of a command.

Example
@client.include
@arc.slash_command("foo", "Foo command description")
async def foo(ctx: arc.GatewayContext) -> None:
    raise RuntimeError("foo")

@foo.set_error_handler
async def foo_error_handler(ctx: arc.GatewayContext, exc: Exception) -> None:
    if isinstance(exc, RuntimeError):
        await ctx.respond("foo failed")
        return

    raise exc

Warning

Errors that cannot be handled by the error handler should be re-raised. Otherwise they will not propagate to the next error handler.

to_command_option #

to_command_option() -> CommandOption

Convert this option to a hikari.CommandOption.

slash_command #

slash_command(
    name: str,
    description: str = "No description provided.",
    *,
    guilds: (
        Sequence[PartialGuild | Snowflakeish] | UndefinedType
    ) = hikari.UNDEFINED,
    is_dm_enabled: bool | UndefinedType = hikari.UNDEFINED,
    is_nsfw: bool | UndefinedType = hikari.UNDEFINED,
    autodefer: bool | AutodeferMode | UndefinedType = hikari.UNDEFINED,
    default_permissions: Permissions | UndefinedType = hikari.UNDEFINED,
    name_localizations: Mapping[Locale, str] | None = None,
    description_localizations: Mapping[Locale, str] | None = None
) -> Callable[[CommandCallbackT[ClientT]], SlashCommand[ClientT]]

A decorator that creates a slash command.

PARAMETER DESCRIPTION
name

The name of the slash command.

TYPE: str

description

The description of the command

TYPE: str DEFAULT: 'No description provided.'

guilds

The guilds this command should be enabled in, if left as undefined, the command is global

TYPE: Sequence[PartialGuild | Snowflakeish] | UndefinedType DEFAULT: UNDEFINED

is_dm_enabled

If True, the command is usable in direct messages

TYPE: bool | UndefinedType DEFAULT: UNDEFINED

is_nsfw

If True, the command is only usable in NSFW channels

TYPE: bool | UndefinedType DEFAULT: UNDEFINED

autodefer

If True, this command will be automatically deferred if it takes longer than 2 seconds to respond

TYPE: bool | AutodeferMode | UndefinedType DEFAULT: UNDEFINED

default_permissions

The default permissions required to use this command, these can be overriden by guild admins

TYPE: Permissions | UndefinedType DEFAULT: UNDEFINED

name_localizations

Localizations for the name of this command

TYPE: dict[Locale, str] | None DEFAULT: None

description_localizations

Localizations for the description of this command

TYPE: dict[Locale, str] | None DEFAULT: None

RETURNS DESCRIPTION
Callable[[Callable[Concatenate[Context[ClientT], ...], Awaitable[None]]], SlashCommand[ClientT]]

The decorated slash command.

!!! note

Parameters left as hikari.UNDEFINED will be inherited from the parent plugin or client.

Example
@client.include
@arc.slash_command("hi", "Say hi!")
async def hi_slash(
    ctx: arc.GatewayContext,
    user: arc.Option[hikari.User, arc.UserParams("The user to say hi to.")]
) -> None:
    await ctx.respond(f"Hey {user.mention}!")

slash_subcommand #

slash_subcommand(
    name: str,
    description: str = "No description provided.",
    *,
    autodefer: bool | AutodeferMode | UndefinedType = hikari.UNDEFINED,
    name_localizations: Mapping[Locale, str] | None = None,
    description_localizations: Mapping[Locale, str] | None = None
) -> Callable[[CommandCallbackT[ClientT]], SlashSubCommand[ClientT]]

A decorator that creates a slash sub command. It should be included in a slash command group.

PARAMETER DESCRIPTION
name

The name of the slash command.

TYPE: str

description

The description of the command

TYPE: str DEFAULT: 'No description provided.'

autodefer

If True, this command will be automatically deferred if it takes longer than 2 seconds to respond If undefined, then this setting will be be inherited from the parent

TYPE: bool | AutodeferMode | UndefinedType DEFAULT: UNDEFINED

name_localizations

Localizations for the name of this command

TYPE: dict[Locale, str] | None DEFAULT: None

description_localizations

Localizations for the description of this command

TYPE: dict[Locale, str] | None DEFAULT: None

RETURNS DESCRIPTION
Callable[[Callable[Concatenate[Context[ClientT], ...], Awaitable[None]]], SlashCommand[ClientT]]

The decorated slash command.

!!! note

Parameters left as hikari.UNDEFINED will be inherited from the parent group, plugin or client.

Example
group = client.include_slash_group("group", "A group of slash commands.")

@group.include
@arc.slash_subcommand(name="hi", description="Say hi!")
async def hi_slashsub(
    ctx: arc.GatewayContext,
    user: arc.Option[hikari.User, arc.UserParams(description="The user to say hi to.")]
) -> None:
    await ctx.respond(f"Hey {user.mention}!")