Checks

The following section outlines all the checks available for interaction based commands.

discord_tools.app_commands.max_usages(limit, bucket)[source]

A decorator that adds a limit of usages to a command.

Parameters:
  • limit (int) – The amount of allowed usages before the command is no longer usable.

  • bucket (BucketType) – The bucket in which the usages are restricted by.

discord_tools.app_commands.has_skus(*sku_ids)[source]

A decorator that checks if the interaction has all the provided skus.

Parameters:

sku_ids (int | str | Snowflake) – The SKU IDs to check for.

discord_tools.app_commands.max_concurrency(number, per=BucketType.default)[source]

A decorator that adds a maximum concurrency to a discord.app_commands.Command or its subclasses.

This enabled you to only allow a certain number of command invocations at the same time, for example if a command takes too long or if only one user can use it at a time. This differs from a cooldown in that there is no set waiting period or token bucket – only a set number of people can run the command.

This is the application command variant, for prefixed commands see discord.ext.commands.max_concurrency().

Unlike discord.ext.commands.max_concurrency(), this decorator cannot wait for the commands to finish because of the 3 seconds limit to respond to an interaction.

Parameters:
  • number (int) – The maximum number of concurrent invocations.

  • per (BucketType) – The bucket that this concurrency is based on, e.g. BucketType.guild would allow it to be used up to number times per guild.