ILLEST Developers

illest.py 2.3.1

Slash commands (app_commands)

Read from the library itself: every signature and every word here is its own docstring.

CommandTree

class

illest.app_commands.CommandTree

class CommandTree(client: "'Client'", *, fallback_to_global: 'bool' = True, allowed_contexts: 'Any' = None, allowed_installs: 'Any' = None)

add_command

add_command(command: 'Any', /, *, guild: 'Any' = None, guilds: 'Any' = <object object>, override: 'bool' = False) -> 'None'

remove_command

remove_command(command: 'str', /, *, guild: 'Any' = None, type: 'AppCommandType' = <AppCommandType.chat_input: 1>) -> 'Any'

clear_commands

clear_commands(*, guild: 'Any' = None, type: 'AppCommandType | None' = None) -> 'None'

get_command

get_command(command: 'str', /, *, guild: 'Any' = None, type: 'AppCommandType' = <AppCommandType.chat_input: 1>) -> 'Any'

get_commands

get_commands(*, guild: 'Any' = None, type: 'AppCommandType | None' = None) -> 'list[Any]'

walk_commands

walk_commands(*, guild: 'Any' = None, type: 'AppCommandType' = <AppCommandType.chat_input: 1>) -> 'Iterator[Any]'

copy_global_to

copy_global_to(*, guild: 'Any') -> 'None'

command

command(*, name: 'str | None' = None, description: 'str | None' = None, nsfw: 'bool' = False, guild: 'Any' = None, guilds: 'Any' = <object object>, auto_locale_strings: 'bool' = True, extras: 'dict | None' = None) -> 'Callable[[Callable], Command]'

context_menu

context_menu(*, name: 'str | None' = None, nsfw: 'bool' = False, guild: 'Any' = None, guilds: 'Any' = <object object>, auto_locale_strings: 'bool' = True, extras: 'dict | None' = None) -> 'Callable[[Callable], ContextMenu]'

error

error(function: 'Callable') -> 'Callable'

on_error

async
async on_error(interaction: "'Interaction'", error: 'AppCommandError') -> 'None'

Without a handler of its own, the error is logged.

interaction_check

async
async interaction_check(interaction: "'Interaction'") -> 'bool'

sync

async
async sync(*, guild: 'Any' = None) -> 'list[AppCommand]'

Send this tree's commands (the global ones, or one server's) to the server, replacing what it held for that scope.

fetch_commands

async
async fetch_commands(*, guild: 'Any' = None) -> 'list[AppCommand]'

fetch_command

async
async fetch_command(command_id: 'Any', /, *, guild: 'Any' = None) -> 'AppCommand'

Command

class

illest.app_commands.Command

class Command(*, name: 'str', description: 'str', callback: 'Callable[..., Awaitable[Any]]', nsfw: 'bool' = False, parent: "'Group | None'" = None, guild_ids: 'list[int] | None' = None, auto_locale_strings: 'bool' = True, extras: 'dict | None' = None)

A slash command.

callback

property

parameters

property

get_parameter

get_parameter(name: 'str') -> 'Parameter | None'

qualified_name

property

root_parent

property

mention

property

to_dict

to_dict(tree: 'Any' = None) -> 'dict[str, Any]'

error

error(function: 'Callable') -> 'Callable'

autocomplete

autocomplete(name: 'str') -> 'Callable[[Callable], Callable]'

add_check

add_check(predicate: 'Callable') -> 'None'

remove_check

remove_check(predicate: 'Callable') -> 'None'

Group

class

illest.app_commands.Group

class Group(*, name: 'str | None' = None, description: 'str | None' = None, parent: "'Group | None'" = None, guild_ids: 'list[int] | None' = None, guild_only: 'bool | None' = None, nsfw: 'bool | None' = None, default_permissions: 'Permissions | None' = None, extras: 'dict | None' = None, **_: 'Any')

A command with subcommands: /tag create, /tag delete. Subclass it (each method a @app_commands.command) or make one and add to it with @group.command().

commands

property

walk_commands

walk_commands()

get_command

get_command(name: 'str') -> "'Command | Group | None'"

add_command

add_command(command: "'Command | Group'", *, override: 'bool' = False) -> 'None'

remove_command

remove_command(name: 'str') -> "'Command | Group | None'"

qualified_name

property

root_parent

property

command

command(*, name: 'str | None' = None, description: 'str | None' = None, nsfw: 'bool' = False, auto_locale_strings: 'bool' = True, extras: 'dict | None' = None) -> 'Callable[[Callable], Command]'

error

error(function: 'Callable') -> 'Callable'

interaction_check

async
async interaction_check(interaction: 'Any') -> 'bool'

on_error_default

async
async on_error_default(interaction: 'Any', error: 'Exception') -> 'None'

to_dict

to_dict(tree: 'Any' = None) -> 'dict[str, Any]'

ContextMenu

class

illest.app_commands.ContextMenu

class ContextMenu(*, name: 'str', callback: 'Callable[..., Awaitable[Any]]', type: 'AppCommandType | None' = None, nsfw: 'bool' = False, guild_ids: 'list[int] | None' = None, extras: 'dict | None' = None)

A command on the right-click menu of a member (illest.Member/User) or a message (illest.Message).

callback

property

qualified_name

property

to_dict

to_dict(tree: 'Any' = None) -> 'dict[str, Any]'

error

error(function: 'Callable') -> 'Callable'

Choice

classfrom Generic

illest.app_commands.Choice

class Choice(*, name: 'str', value: 'str | int | float')

One of an option's fixed answers: shown as name, handed to the callback as value.

Annotated as Choice[str] (or Choice[int], Choice[float]), the callback is handed the Choice picked rather than its value.

to_dict

to_dict() -> 'dict[str, Any]'

describe

decorator

illest.app_commands.describe

describe(**parameters: 'str') -> 'Callable[[Any], Any]'

choices

decorator

illest.app_commands.choices

choices(**parameters: 'list[Choice]') -> 'Callable[[Any], Any]'

autocomplete

decorator

illest.app_commands.autocomplete

autocomplete(**parameters: 'Callable') -> 'Callable[[Any], Any]'

rename

decorator

illest.app_commands.rename

rename(**parameters: 'str') -> 'Callable[[Any], Any]'

default_permissions

decorator

illest.app_commands.default_permissions

default_permissions(perms_obj: 'Permissions | None' = None, /, **perms: 'bool') -> 'Callable[[Any], Any]'

guild_only

decorator

illest.app_commands.guild_only

guild_only(target: 'Any' = None) -> 'Any'

Transformer

class

illest.app_commands.Transformer

class Transformer()

Turn what was typed into what the callback wants. Override transform; type is the option's own type.

type

property

min_value

property

max_value

property

choices

property

channel_types

property

transform

async
async transform(interaction: 'Any', value: 'Any', /) -> 'Any'

autocomplete

async
async autocomplete(interaction: 'Any', value: 'Any', /) -> 'list[Choice]'

checks

module

illest.app_commands.checks

app_commands.checks: what may stop a command before it runs.

has_role

has_role(item: 'int | str', /) -> 'Callable'

has_any_role

has_any_role(*items: 'int | str') -> 'Callable'

has_permissions

has_permissions(**perms: 'bool') -> 'Callable'

bot_has_permissions

bot_has_permissions(**perms: 'bool') -> 'Callable'

Cooldown

class
class Cooldown(rate: 'float', per: 'float')

cooldown

cooldown(rate: 'float', per: 'float', *, key: 'Callable[[Any], Hashable] | None' = <function _default_key>) -> 'Callable'

rate uses per per seconds, counted per user by default (key=None counts everybody together).

dynamic_cooldown

dynamic_cooldown(factory: 'Callable[[Any], Cooldown | None]', *, key: 'Callable[[Any], Hashable] | None' = <function _default_key>) -> 'Callable'