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 Messageableillest.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
classmethodfrom_interaction(interaction: 'Any', /) -> "'Context'"
A context for a hybrid command used as a slash command.
channel
propertyguild
propertyguild_id
propertyThe server this was typed in, when the bot knows the channel to be one (guilds.read); None in a direct message.
me
propertycog
propertyclean_prefix
propertyvalid
propertypermissions
propertybot_permissions
propertyvoice_client
propertyfilesize_limit
propertysend
asyncasync 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
asyncasync reply(content: 'Any' = None, *, ephemeral: 'bool' = False, **kwargs: 'Any')
typing
typing(*, ephemeral: 'bool' = False) -> 'Typing'
defer
asyncasync defer(*, ephemeral: 'bool' = False) -> 'None'
send_help
asyncasync send_help(*args: 'Any') -> 'Any'
invoke
asyncasync invoke(command: "'Command'", /, *args: 'Any', **kwargs: 'Any') -> 'Any'
reinvoke
asyncasync reinvoke(*, call_hooks: 'bool' = False, restart: 'bool' = True) -> 'None'
Command
classillest.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
propertyqualified_name
propertyshort_doc
propertyerror
error(handler: 'Callable[..., Awaitable[Any]]')
Handle this command's errors here, before on_command_error.
signature
propertyWhat the command takes: <needed> [optional].
clean_params
propertycog_name
propertyparents
propertyroot_parent
propertyfull_parent_name
propertymax_concurrency
propertyadd_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
propertyWhat the command takes, as <needed> [optional] [rest...].
usage_for
usage_for(prefix: 'str') -> 'str'
can_run
asyncasync can_run(ctx: 'Context') -> 'bool'
Whether every check passes; a check that says no raises CheckFailure (or its own subclass).
bind
asyncasync bind(ctx: 'Context', text: 'str') -> 'tuple[list[Any], dict[str, Any]]'
The positional and keyword arguments text gives this command, read and converted.
invoke
asyncasync invoke(ctx: 'Context', raw_args: 'Any') -> 'None'
Check, wait out nothing (a cooldown refuses), bind, and run.
Group
classfrom Commandillest.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
propertyEvery 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
asyncasync invoke(ctx: 'Context', raw_args: 'Any') -> 'None'
Check, wait out nothing (a cooldown refuses), bind, and run.
Cog
classillest.ext.commands.Cog
class Cog()
Subclass it; every @commands.command() and @Cog.listener() in the class is collected when it is added.
qualified_name
propertydescription
propertylistener
staticmethodlistener(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
asyncasync cog_load() -> 'None'
Run when the cog is added.
cog_unload
asyncasync cog_unload() -> 'None'
Run when the cog is taken out.
cog_command_error
asyncasync 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
asyncasync cog_app_command_error(interaction: 'Any', error: 'Exception') -> 'None'
An app command of this cog raised.
cog_before_invoke
asyncasync cog_before_invoke(ctx: 'Any') -> 'None'
Runs before each of this cog's commands.
cog_after_invoke
asyncasync 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
decoratorillest.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
decoratorillest.ext.commands.group
group(name: 'str | None' = None, **options)
hybrid_command
decoratorillest.ext.commands.hybrid_command
hybrid_command(name: 'str | None' = None, *, with_app_command: 'bool' = True, **attrs: 'Any')
check
decoratorillest.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
decoratorillest.ext.commands.has_permissions
has_permissions(**perms: 'bool')
The person has these permissions in the channel the command was used in.
cooldown
decoratorillest.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 Genericillest.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
classillest.ext.commands.FlagConverter
class FlagConverter()
get_flags
classmethodget_flags() -> 'dict[str, Flag]'
parse_flags
classmethodparse_flags(argument: 'str') -> 'dict[str, list[str]]'
convert
classmethodconvert(ctx: "'Context'", argument: 'str') -> "'FlagConverter'"
HelpCommand
classillest.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
asyncasync command_callback(ctx: 'Context', /, *, command: 'str | None' = None) -> 'None'
send
asyncasync 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
propertyget_command_signature
get_command_signature(command: 'Command', /) -> 'str'
remove_mentions
remove_mentions(string: 'str', /) -> 'str'
filter_commands
asyncasync filter_commands(commands: 'Any', /, *, sort: 'bool' = False, key: 'Any' = None) -> 'list[Command]'
runnable
asyncasync 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
asyncasync command_not_found(string: 'str', /) -> 'str'
subcommand_not_found
asyncasync subcommand_not_found(command: 'Command', string: 'str', /) -> 'str'
send_error_message
asyncasync send_error_message(error: 'str', /) -> 'None'
on_help_command_error
asyncasync on_help_command_error(ctx: 'Context', error: 'CommandError', /) -> 'None'
prepare_help_command
asyncasync prepare_help_command(ctx: 'Context', command: 'str | None' = None, /) -> 'None'
send_bot_help
asyncasync send_bot_help(mapping: 'Mapping[Any, list[Command]]', /) -> 'None'
send_cog_help
asyncasync send_cog_help(cog: "'Cog'", /) -> 'None'
send_group_help
asyncasync send_group_help(group: 'Group', /) -> 'None'
send_command_help
asyncasync send_command_help(command: 'Command', /) -> 'None'