ILLEST Developers

illest.py 2.3.1

Commands (ext.commands)

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

Context

classfrom Messageable

illest.ext.commands.Context

class Context(bot: "'Bot'", message: 'Any', invoked_with: 'str', args: 'list', kwargs: 'dict', *, prefix: 'str' = '', command: "'Command | None'" = None, view: 'str' = '', interaction: 'Any' = None, current_parameter: 'Any' = None)

One invocation: ctx.send, ctx.reply, ctx.author, ctx.guild, ctx.channel, ctx.command.

A hybrid command run as a slash command has ctx.interaction, and ctx.send answers the interaction.

from_interaction

classmethod
from_interaction(interaction: 'Any', /) -> "'Context'"

A context for a hybrid command used as a slash command.

channel

property

guild

property

guild_id

property

The server this was typed in, when the bot knows the channel to be one (guilds.read); None in a direct message.

author

property

me

property

cog

property

clean_prefix

property

valid

property

permissions

property

bot_permissions

property

voice_client

property

filesize_limit

property

send

async
async send(content: 'Any' = None, *, ephemeral: 'bool' = False, reference: 'Any' = None, **kwargs: 'Any')

Send to where the command was used. ephemeral=True shows it to the person who used it alone.

reply

async
async reply(content: 'Any' = None, *, ephemeral: 'bool' = False, **kwargs: 'Any')

typing

typing(*, ephemeral: 'bool' = False) -> 'Typing'

defer

async
async defer(*, ephemeral: 'bool' = False) -> 'None'

send_help

async
async send_help(*args: 'Any') -> 'Any'

invoke

async
async invoke(command: "'Command'", /, *args: 'Any', **kwargs: 'Any') -> 'Any'

reinvoke

async
async reinvoke(*, call_hooks: 'bool' = False, restart: 'bool' = True) -> 'None'

Command

class

illest.ext.commands.Command

class Command(function: 'Callable[..., Awaitable[Any]]', name: 'str | None' = None, help: 'str | None' = None, *, aliases: 'list[str] | tuple[str, ...]' = (), brief: 'str | None' = None, usage: 'str | None' = None, hidden: 'bool' = False, enabled: 'bool' = True, description: 'str | None' = None, extras: 'dict | None' = None, ignore_extra: 'bool' = True, cooldown_after_parsing: 'bool' = False, checks: 'list | None' = None, cooldown: 'Any' = None, **_unused: 'Any')

A function the bot runs when a message names it. Calling the object calls the function.

function

property

qualified_name

property

short_doc

property

error

error(handler: 'Callable[..., Awaitable[Any]]')

Handle this command's errors here, before on_command_error.

signature

property

What the command takes: <needed> [optional].

clean_params

property

cog_name

property

parents

property

root_parent

property

full_parent_name

property

max_concurrency

property

add_check

add_check(func: 'Check', /) -> 'None'

remove_check

remove_check(func: 'Check', /) -> 'None'

before_invoke

before_invoke(coro: 'Callable[..., Awaitable[Any]]')

after_invoke

after_invoke(coro: 'Callable[..., Awaitable[Any]]')

is_on_cooldown

is_on_cooldown(ctx: 'Context') -> 'bool'

reset_cooldown

reset_cooldown(ctx: 'Context') -> 'None'

copy

copy() -> "'Command'"

usage_hint

property

What the command takes, as <needed> [optional] [rest...].

usage_for

usage_for(prefix: 'str') -> 'str'

can_run

async
async can_run(ctx: 'Context') -> 'bool'

Whether every check passes; a check that says no raises CheckFailure (or its own subclass).

bind

async
async bind(ctx: 'Context', text: 'str') -> 'tuple[list[Any], dict[str, Any]]'

The positional and keyword arguments text gives this command, read and converted.

invoke

async
async invoke(ctx: 'Context', raw_args: 'Any') -> 'None'

Check, wait out nothing (a cooldown refuses), bind, and run.

Group

classfrom Command

illest.ext.commands.Group

class Group(function, name=None, help=None, *, invoke_without_command: 'bool' = True, **options)

A command with subcommands: !tag add name text, !tag list.

The group's own function runs first when invoke_without_command is False; with True (the usual), it runs only when no subcommand was named.

commands

property

Every subcommand once. By name (aliases too): all_commands.

add_command

add_command(command: 'Command') -> 'None'

command

command(name: 'str | None' = None, **options)

group

group(name: 'str | None' = None, **options)

invoke

async
async invoke(ctx: 'Context', raw_args: 'Any') -> 'None'

Check, wait out nothing (a cooldown refuses), bind, and run.

Cog

class

illest.ext.commands.Cog

class Cog()

Subclass it; every @commands.command() and @Cog.listener() in the class is collected when it is added.

qualified_name

property

description

property

listener

staticmethod
listener(name: 'str | None' = None) -> 'Callable'

Mark a method as listening to an event (on_message, on_member_join): any number of cogs can listen to one.

get_commands

get_commands() -> 'list[Command]'

The cog's top-level commands (a group's subcommands come with it).

get_app_commands

get_app_commands() -> 'list[Any]'

The cog's slash commands, context menus and groups (@app_commands.command() in the class). A GroupCog is one group holding them all.

walk_commands

walk_commands()

walk_app_commands

walk_app_commands()

has_error_handler

has_error_handler() -> 'bool'

has_app_command_error_handler

has_app_command_error_handler() -> 'bool'

get_listeners

get_listeners() -> 'list[tuple[str, Callable]]'

cog_load

async
async cog_load() -> 'None'

Run when the cog is added.

cog_unload

async
async cog_unload() -> 'None'

Run when the cog is taken out.

cog_command_error

async
async cog_command_error(ctx: 'Any', error: 'Exception') -> 'None'

A command of this cog raised: handled here before on_command_error (define it to use it).

cog_app_command_error

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

An app command of this cog raised.

cog_before_invoke

async
async cog_before_invoke(ctx: 'Any') -> 'None'

Runs before each of this cog's commands.

cog_after_invoke

async
async cog_after_invoke(ctx: 'Any') -> 'None'

Runs after each of this cog's commands.

bot_check

bot_check(ctx: 'Any') -> 'bool'

bot_check_once

bot_check_once(ctx: 'Any') -> 'bool'

interaction_check

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

command

decorator

illest.ext.commands.command

command(name: 'str | None' = None, cls: 'type[Command]' = <class 'illest.ext.commands.core.Command'>, **options)

Make a command of a function, to bot.add_command or to put in a cog.

group

decorator

illest.ext.commands.group

group(name: 'str | None' = None, **options)

hybrid_command

decorator

illest.ext.commands.hybrid_command

hybrid_command(name: 'str | None' = None, *, with_app_command: 'bool' = True, **attrs: 'Any')

check

decorator

illest.ext.commands.check

check(predicate: 'Check')

Run predicate(ctx) before the command; a false answer stops it with CheckFailure. Stacks with other checks.

has_permissions

decorator

illest.ext.commands.has_permissions

has_permissions(**perms: 'bool')

The person has these permissions in the channel the command was used in.

cooldown

decorator

illest.ext.commands.cooldown

cooldown(rate: 'int', per: 'float', type: 'BucketType' = <BucketType.default: 0>)

At most rate uses each per seconds, counted per type (the whole bot, each user, each channel, each server).

Greedy

classfrom Generic

illest.ext.commands.Greedy

class Greedy(*, converter: 'Any')

Greedy[illest.Member]: as many arguments in a row as read as one, and none is an error only if nothing follows.

FlagConverter

class

illest.ext.commands.FlagConverter

class FlagConverter()

get_flags

classmethod
get_flags() -> 'dict[str, Flag]'

parse_flags

classmethod
parse_flags(argument: 'str') -> 'dict[str, list[str]]'

convert

classmethod
convert(ctx: "'Context'", argument: 'str') -> "'FlagConverter'"

HelpCommand

class

illest.ext.commands.HelpCommand

class HelpCommand(*, show_hidden: 'bool' = False, verify_checks: 'bool | None' = True, command_attrs: 'dict | None' = None, **_: 'Any')

The help command. One object, copied for each use, so self.context is the use's own.

as_command

as_command() -> 'Command'

command_callback

async
async command_callback(ctx: 'Context', /, *, command: 'str | None' = None) -> 'None'

send

async
async send(ctx: 'Context', command: 'Any' = None) -> 'None'

What ctx.send_help(...) runs: help on command (a command, a cog, or None for everything).

get_bot_mapping

get_bot_mapping() -> 'dict[Any, list[Command]]'

invoked_with

property

get_command_signature

get_command_signature(command: 'Command', /) -> 'str'

remove_mentions

remove_mentions(string: 'str', /) -> 'str'

filter_commands

async
async filter_commands(commands: 'Any', /, *, sort: 'bool' = False, key: 'Any' = None) -> 'list[Command]'

runnable

async
async runnable(ctx: 'Context', commands: 'list[Command]') -> 'list[Command]'

get_max_size

get_max_size(commands: 'Any', /) -> 'int'

get_destination

get_destination() -> 'Any'

command_not_found

async
async command_not_found(string: 'str', /) -> 'str'

subcommand_not_found

async
async subcommand_not_found(command: 'Command', string: 'str', /) -> 'str'

send_error_message

async
async send_error_message(error: 'str', /) -> 'None'

on_help_command_error

async
async on_help_command_error(ctx: 'Context', error: 'CommandError', /) -> 'None'

prepare_help_command

async
async prepare_help_command(ctx: 'Context', command: 'str | None' = None, /) -> 'None'

send_bot_help

async
async send_bot_help(mapping: 'Mapping[Any, list[Command]]', /) -> 'None'

send_cog_help

async
async send_cog_help(cog: "'Cog'", /) -> 'None'

send_group_help

async
async send_group_help(group: 'Group', /) -> 'None'

send_command_help

async
async send_command_help(command: 'Command', /) -> 'None'