API reference
Yami modules
args
Module containing the command arguments interface.
- class yami.args.MessageArg(param: Parameter, value: str)
Bases:
object
Represents a
MessageCommand
argument.- Parameters
param (
inspect.Parameter
) – The raw inspect parameter.value (
str
) – The value for this argument.
Warning
This class should not be instantiated manually, it will be injected during argument conversion when commands are invoked.
- property kind: _ParameterKind
The parameter kind this arg is.
- async convert(ctx: context.MessageContext) None
Attempts to convert the argument to its type hint.
- Parameters
ctx (
MessageContext
) – The message context.
bot
Module that contains the yami.Bot implementation.
- class yami.bot.Bot(token: str, prefix: Union[str, Sequence[str]], *, owner_ids: Sequence[int] = (), allow_extra_args: bool = False, raise_cmd_not_found: bool = False, **kwargs: Any)
Bases:
GatewayBot
A subclass of
GatewayBot
that provides an interface for handling commands.This is the class you will instantiate to utilize command features on top of the
GatewayBot
superclass.Warning
This class is slotted, if you want to set your own custom properties you have 2 choices:
Use the
Bot.shared
property which is an instance ofShared
.Subclass
Bot
, but this can lead to issues if you overwrite private or public attributes in your subclass.
- Parameters
- Keyword Arguments
owner_ids (
Sequence
[int
]) – A sequence of integers representing the Snowflakes of the bots owners. Defaults to()
.allow_extra_args (
bool
) – Whether or not the bot should allow extra args in command invocations. Defaults toFalse
.raise_cmd_not_found (
bool
) – Whether or not to raise theCommandNotFound
exception. Defaults toFalse
.**kwargs (
Any
) – The remaining kwargs forGatewayBot
.
- property commands: dict[str, yami.commands.MessageCommand]
A dictionary of name,
MessageCommand
pairs bound to the bot, including commands from any loaded modules.
- property aliases: dict[str, str]
A dictionary of aliases to their corresponding
MessageCommand
name.
- property modules: dict[str, yami.modules.Module]
A dictionary of name,
Module
pairs that are added to the bot, this includes unloaded modules.
The
Shared
instance associated with this bot.
- property raise_cmd_not_found: bool
Returns
True
if this bot will raise aCommandNotFound
exception when a prefix is used, but no command was found.
- load_all_modules(*paths: str | pathlib.Path, recursive: bool = True) None
Loads all modules from each of the given paths.
Note
This method looks for all
.py
files that do not begin with an _. It is recursive by default.If this method fails partway through, the bots modules are reverted to their previous state and no modules will be loaded.
- Parameters
*paths (
str
|Path
) – One or more paths to load modules from.- Keyword Arguments
recursive (
bool
) – Whether or not to recurse into sub directories while loading modules.- Raises
ModuleLoadException – When a module with the same name is already loaded on the bot, or when the named module is not found inside the given path’s source file.
ModuleAddException – When there is a failure with one of the commands in the module.
- load_module(name: str, path: str | pathlib.Path) None
Loads a single module class from the path specified.
Note
If this method fails partway through, the bots modules are reverted to their previous state and the module will not be loaded.
- Parameters
- Raises
ModuleLoadException – When a module with the same name is already loaded on the bot, or when the named module is not found inside the given paths source file.
ModuleAddException – When there is a failure with one of the commands in the module.
- unload_module(name: str) Module
Unloads a single module class with the given name. It will remain in
Bot.modules
, but just in an unloaded state and its commands will no longer be executable until it is loaded again.- Parameters
name (
str
) – The name of the module class to unload. (case sensitive)- Returns
The module that was unloaded.
- Return type
- Raises
ModuleUnloadException – When no module with this name was found.
- remove_module(name: str) Module
Removes a single module class with the given name. It will no longer be accessible via
Bot.modules
.- Parameters
name (
str
) – The name of the module class to remove. (case sensitive)- Returns
The module that was removed.
- Return type
- Raises
ModuleRemoveException – When no module with this name was found.
- add_command(command: Union[Callable[[...], Any], MessageCommand], *, name: Optional[str] = None, description: str = '', aliases: list[str] | tuple[str, ...] = [], raise_conversion: bool = False) MessageCommand
Adds a command to the bot.
- Parameters
command (
Callable
[…,Any
] |MessageCommand
) – The command or callback to add.- Keyword Arguments
name (
str
|None
) – The name of the command. Defaults to the function name.description (
str
) – The commands description. Defaults to""
.aliases (
Iterable
[str
]) – The commands aliases. Defaults to[]
.raise_conversion (
bool
) – Whether or not to raise an exception if argument conversion fails. Defaults toFalse
.
- Returns
The command that was added.
- Return type
- Raises
DuplicateCommand – If the command shares a name or alias with an existing command.
TypeError – If aliases is not a list or a tuple.
- remove_command(name: str) MessageCommand
Removes a
MessageCommand
from theBot
, and itsyami.Module
if it has one.- Parameters
name (
str
) – The name of the command to remove.- Returns
The command that was removed.
- Return type
- Raises
CommandNotFound – When the command was not found.
- iter_commands() Generator[MessageCommand, None, None]
Iterates the bots commands.
- Returns
A generator over the commands.
- Return type
- Yields
MessageCommand
– Each command.
- iter_modules() Generator[Module, None, None]
Iterates over the modules attached to the bot. This will included both loaded and unloaded modules.
- iter_loaded_modules() Generator[Module, None, None]
Iterates over the modules attached to the bot. This will only include loaded modules.
- get_command(name: str) yami.commands.MessageCommand | None
Gets a command.
- get_module(name: str) yami.modules.Module | None
Gets a module.
- command(name: Optional[str] = None, description: str = '', *, aliases: Sequence[str] = (), raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], Any]
Decorator to add a
MessageCommand
to the bot. This should be placed immediately above the command callback. Any checks should be placed above this decorator.- Parameters
- Keyword Arguments
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
Callable
[…,MessageCommand
]
checks
Module containing all the Yami Checks.
- class yami.checks.Check
Bases:
ABC
Base class all Yami checks inherit from.
- classmethod get_name() str
Returns the name of this
Check
subclass.- Returns
The name of the class.
- Return type
- abstract async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.is_owner
Bases:
Check
Fails if the author of the command is not the bots owner.
Hint
Who is the bots owner?
Any user with an id matching one of the ids passed into the bots constructor for the kwarg
owner_ids
.The application owner fetched from Discord if no
owner_ids
were passed to the constructor.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.is_in_guild
Bases:
Check
Fails if the command was not run in a guild.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.is_in_dm
Bases:
Check
Fails if the command was not run in a DM.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.has_roles(*roles: str | int)
Bases:
Check
Fails if the author does not have all of the roles passed to this check decorator.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.- Parameters
*roles (
str
|int
) – The name or id of the role or roles the user must have.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.has_any_role(*roles: str | int)
Bases:
Check
Fails if the author does not have any of the role names or ids passed to this check.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.- Parameters
*roles (
str
| int) – The names or ids of the roles the user must have at least one of.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.has_perms(**perms: bool)
Bases:
Check
Fails if the author does not have all of the specified permissions. This accumulates all permissions the user has.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.Warning
If you pass something like
manage_messages=False
to this check, it will do nothing.It will not require the user to have the permission. Make sure you use
manage_messages=True
.- Keyword Arguments
**perms (
bool
) – Keyword arguments for each of the available hikari perms.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.custom_check(check: Union[Callable[[MessageContext], Any], Check], *, message: str = '')
Bases:
Check
A custom check.
Hint
- Parameters
check (
Callable
[[MessageContext
],Any
]) –The callback function that should be used for the check.
Note
It should accept one argument of type
MessageContext
and returnFalse
or raise an error if it fails.This can be an async, or sync function.
- Keyword Arguments
message – (
str
): The optional message to use in theCheckFailed
exception. The default message is"a custom check was failed"
.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.checks.is_the_cutest
Bases:
Check
Fails if you aren’t Jaxtar.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
commands
Module containing all Command related objects.
- class yami.commands.MessageCommand(callback: Callable[[...], Any], name: str, description: str, *, aliases: Iterable[str], raise_conversion: bool, parent: Optional[MessageCommand] = None, invoke_with: bool = False)
Bases:
object
An object that represents a message content command.
Note
You should not instantiate this class manually, instead use:
The
yami.Bot.command
decorator outside aModule
.
- Parameters
callback (
typing.Callable
[…,typing.Any
]) – The async callback function for the command.name (
str
) – The name of the command.description (
str
) – The description for the command.
- Keyword Arguments
aliases (
typing.Iterable
[str
]) – The aliases for the command.raise_conversion (
bool
) – Whether or not to raise an error when a type hint conversion for the command arguments fails.parent (
MessageCommand
|None
) – The parent of this command if it is a subcommand, orNone
if not.invoke_with (
bool
) – Whether or not to invoke this command with its subcommands, if it has any. Defaults toFalse
.
- property checks: dict[str, yami.checks.Check]
A dictionary containing name,
Check
pairs that are registered to this command.
- property module: yami.modules.Module | None
The
Module
this command originates from, if any.
- property raise_conversion: bool
Whether or not to raise an error when a type hint conversion for the command arguments fails.
- property was_globally_added: bool
True
if this command was created with thecommand
decorator, andFalse
if not.
- property subcommands: dict[str, yami.commands.MessageCommand]
A dictionary containing name,
MessageCommand
pairs that are registered to this command.
- property parent: yami.commands.MessageCommand | None
The parent of this command, or
None
if this command is not a subcommand.
- property invoke_with: bool
Whether or not to invoke this command if one of its subcommands are invoked.
- add_check(check: Union[Type[Check], Check]) Check
Adds a check to be run before this command.
- Parameters
check (
Check
) – The check to add.- Returns
The check that was added.
- Return type
- Raises
CheckAddFailed – If the check is not a
Check
object.
- remove_check(check: Union[Type[Check], Check]) yami.checks.Check | None
Removes a check from this command. If this check is not bound to this command, it will do nothing.
- Parameters
check (
Check
) – The check to remove.- Returns
The removed check, or none if it was not found.
- Return type
- Raises
CheckRemovalFailed – When an invalid type is passed as an argument to this method.
- add_subcommand(command: Union[Callable[[...], Any], MessageCommand], *, name: Optional[str] = None, description: str = '', aliases: list[str] | tuple[str, ...] = [], raise_conversion: bool = False) MessageCommand
Adds a subcommand to the command.
- Parameters
command (
typing.Callable
[…,typing.Any
] |yami.MessageCommand
) – The subcommand to add.- Keyword Arguments
name (
str
|None
) – The name of the subcommand. (defaults to the function name)description (
str
) – The subcommands description. (defaults to""
)aliases (
typing.Iterable
[str
]) – The subcommands aliases (defaults to[]
)raise_conversion (
bool
) – Whether or not to raise an error when argument conversion fails. (Defaults toFalse
)
- Returns
The subcommand that was added.
- Return type
- Raises
DuplicateCommand – If the subcommand shares a name or alias with an existing subcommand.
TypeError – If aliases is not a list or a tuple.
- iter_subcommands() Generator[MessageCommand, None, None]
Iterates the subcommands for this command.
- Returns
A generator over the subcommands.
- Return type
- Yields
MessageCommand
– Each subcommand.
- subcommand(name: Optional[str] = None, description: str = '', *, aliases: Iterable[str] = [], raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], MessageCommand]
Decorator to add a subcommand to an existing command. It should decorate the callback that should fire when this subcommand is run.
- Parameters
- Keyword Arguments
aliases (
Iterable
[str
]) – A list or tuple of aliases for the command.raise_conversion (
bool
) – Whether or not to raiseConversionFailed
when converting a commands argument fails.invoke_with (
bool
) – Whether or not to invoke this commands callback, when its subcommand is invoked.
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
Callable
[…,MessageCommand
]
- yami.commands.command(name: Optional[str] = None, description: str = '', *, aliases: Iterable[str] = [], raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], MessageCommand]
Decorator to add commands to the bot inside of modules. It should decorate the callback that should fire when this command is run.
- Parameters
- Keyword Arguments
aliases (
Iterable
[str
]) – A list or tuple of aliases for the command.raise_conversion (
bool
) – Whether or not to raiseConversionFailed
when converting a commands argument fails.invoke_with (
bool
) – Whether or not to invoke this commands callback, when its subcommand is invoked.
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
context
Module containing Context objects.
- class yami.context.Context(bot: Bot, message: Message, command: MessageCommand, prefix: str, invoked_subcommands: list[yami.commands.MessageCommand] = [])
Bases:
ABC
Base Context all Yami contexts inherit from.
- abstract property rest: RESTClient
Shortcut to the bots rest client.
- abstract property guild_id: hikari.snowflakes.Snowflake | None
The guild id associated with the context, or
None
if this context was aDMChannel
.
- abstract property args: list[yami.args.MessageArg]
A list of converted
MessageArgs
passed to this context. Context will not be present here even though it was passed to the command callback.Note
If this context was invoked with subcommands and parent commands, only the final subcommands args will be present here.
- abstract property exceptions: list[Exception]
Any exceptions that were generated when this context was created, including failed check exceptions.
- abstract property command: MessageCommand
The command invoked during the creation of this context.
A
Shared
object that can be used to share data between subcommands.Hint
Also houses cached data from the checks that were run for this context.
- class yami.context.MessageContext(bot: Bot, message: Message, command: MessageCommand, prefix: str, invoked_subcommands: list[yami.commands.MessageCommand] = [])
Bases:
Context
The context surrounding a message commands invocation.
- Parameters
bot (
Bot
) – The bot instance associated with the context.message (
hikari.Message
) – The message that created this context.command (
yami.MessageCommand
) – The command that was invoked to create this context.prefix (
str
) – The prefix that was used to create this context.
- property rest: RESTClient
Shortcut to the bots rest client.
- property guild_id: hikari.snowflakes.Snowflake | None
The guild id associated with the context, or
None
if this context was aDMChannel
.
- property args: list[yami.args.MessageArg]
A list of converted
MessageArgs
passed to this context. Context will not be present here even though it was passed to the command callback.Note
If this context was invoked with subcommands and parent commands, only the final subcommands args will be present here.
- property exceptions: list[Exception]
Any exceptions that were generated when this context was created, including failed check exceptions.
- property command: MessageCommand
The command invoked during the creation of this context.
A
Shared
object that can be used to share data between subcommands.Hint
Also houses cached data from the checks that were run for this context.
- property invoked_subcommands: list[yami.commands.MessageCommand]
The subcommands that were invoked with this context, or
None
if there were none.Note
If subcommands were chained and the parent callback was not actually run (due to having
invoke_with
set toFalse
) it will not appear here.
- trigger_typing() special_endpoints.TypingIndicator
Shortcut method to
ctx.rest.trigger_typing
in the current channel.async with ctx.trigger_typing(): # do work here and typing will stop # when the context manager is exited.
- Returns
An async context manager for the typing indicator on Discord.
- Return type
- async respond(content: Union[Any, UndefinedType], *, delete_after: Optional[int] = None, **kwargs: Any) Message
Respond to the message that created this context.
- Parameters
content (
Any
) – The content of this response.- Keyword Arguments
- Returns
The message this response created.
- Return type
- async getch_member() hikari.guilds.Member | None
Get or fetch the
hikari.Member
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- async getch_guild() hikari.guilds.Guild | None
Get or fetch the
hikari.guilds.Guild
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- async getch_channel() hikari.channels.GuildChannel | hikari.channels.PartialChannel
Get or fetch the
hikari.channels.PartialChannel
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Note
This method can return any of the following:
DMChannel
,GroupDMChannel
,GuildTextChannel
,GuildVoiceChannel
,GuildStoreChannel
,GuildNewsChannel
.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- Returns
The channel object associated with this context.
- Return type
converters
Module containing the Yami converters.
- class yami.converters.Converter(value: Any)
Bases:
ABC
Base class all Yami converters inherit from.
- class yami.converters.BuiltinConverter(value: Any)
Bases:
Converter
Converts to the builtin types.
- Parameters
value (
Any
) – The value to perform the conversion on.
- classmethod can_convert(type_: Any) bool
Whether or not this converter can convert an object to this type.
- as_type(type_: BuiltinTypeT, *, encoding: str = 'utf8') BuiltinTypeT
Converts the value to the given type.
- Parameters
type (
BuiltinTypeT
) – The type to try converting to.- Keyword Arguments
encoding (
str
) – The encoding iftype_
isbytes
. Defaults to"utf8"
.- Returns
The converted value.
- Return type
BuiltinTypeT
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_bool() bool
Converts the value to
bool
.Hint
'true'
and'True'
will beTrue
'false'
and'False'
will beFalse
- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_str() str
Converts the value to
str
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_bytes(encoding: str = 'utf8') bytes
Converts the value to
bytes
.- Parameters
encoding (
str
) – The encoding to use. Defaults to"utf8"
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_int() int
Converts the value to
int
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_complex() complex
Converts to
complex
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_float() float
Converts the value to
float
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
events
Module for Yami events.
- class yami.events.YamiEvent
-
The base class all Yami events inherit from.
- class yami.events.CommandInvokeEvent(ctx: Context)
Bases:
YamiEvent
Fires when any command is invoked.
- property command: MessageCommand
The command that triggered this event.
- class yami.events.CommandExceptionEvent(ctx: Context)
Bases:
YamiEvent
Fires when a command encounters an exception of any kind.
- property command: MessageCommand
The command that triggered this event.
- class yami.events.CommandSuccessEvent(ctx: Context)
Bases:
YamiEvent
Fires when any command invocation is successful.
- property command: MessageCommand
The command that triggered this event.
exceptions
Yami exceptions.
- exception yami.exceptions.YamiException
Bases:
Exception
Base exception all Yami exceptions inherit from.
- exception yami.exceptions.CommandException
Bases:
YamiException
Raised when an exception relating to a command occurs.
- exception yami.exceptions.CommandNotFound
Bases:
CommandException
Raised when a command is invoked, or attempted to be accessed but no command with that name is found.
- exception yami.exceptions.BadArgument
Bases:
CommandException
Raised when a bad argument is passed to a message command.
- exception yami.exceptions.DuplicateCommand
Bases:
CommandException
Raised when a command is added that shares a name or aliases with an existing command, or subcommand on the same level.
- exception yami.exceptions.ModuleException
Bases:
YamiException
Raised when an error associated with a module occurs.
- exception yami.exceptions.ModuleRemoveException
Bases:
ModuleException
Raised when a module fails to be removed from the bot.
- exception yami.exceptions.ModuleAddException
Bases:
ModuleException
Raised when a module fails to be added to the bot.
- exception yami.exceptions.ModuleLoadException
Bases:
ModuleException
Raised when a module fails to be loaded to the bot.
- exception yami.exceptions.ModuleUnloadException
Bases:
ModuleException
Raised when a module fails to be unloaded from the bot.
- exception yami.exceptions.CheckException
Bases:
CommandException
Raised when an exception relating to a check occurs.
- exception yami.exceptions.BadCheck
Bases:
CheckException
Raised when a check decorator is placed below the command decorator, or otherwise used incorrectly.
- exception yami.exceptions.CheckRemovalFailed
Bases:
CheckException
Raised when an invalid type is passed to remove_check.
- exception yami.exceptions.CheckFailed
Bases:
CheckException
Raised when a check is failed during command invocation.
- exception yami.exceptions.CheckAddFailed
Bases:
CheckException
Raised when an invalid type is passed to add_check.
- exception yami.exceptions.ListenerException
Bases:
YamiException
Raised when an exception occurs relating to a module listener.
- exception yami.exceptions.TooManyArgs
Bases:
CommandException
Raised when too many arguments are passed to a command.
- exception yami.exceptions.MissingArgs
Bases:
CommandException
Raised when a command is run, but not all args are supplied.
- exception yami.exceptions.ConversionFailed
Bases:
YamiException
Raised when the conversion performed by a converter fails.
modules
Houses the Yami Module system.
- class yami.modules.Module(bot: Bot)
Bases:
object
A collection of commands and functions that typically share a need for the same data, or are related in some way.
- Parameters
bot (
Bot
) – The bot instance.
Hint
You should subclass
Module
to create your own modules.Modules do not require any special functions in their file.
Modules are loaded via the
load_module
andload_all_modules
methods.
Warning
If you overwrite the
__init__
method, it should take only 1 argument which is of typeBot
.class MyMod(yami.Module): def __init__(self, bot: yami.Bot) -> None: super().__init__(bot) # Do whatever else you need here.
- property commands: dict[str, yami.commands.MessageCommand]
A dictionary of
name
,MessageCommand
pairs this module contains.
- iter_commands() Generator[MessageCommand, None, None]
Iterates the modules commands.
- Returns
A generator over the commands.
- Return type
- Yields
MessageCommand
– Each command.
- add_command(command: MessageCommand) None
Adds a command to the module.
- Parameters
command (
MessageCommand
) – The command to add.- Raises
DuplicateCommand – When a command with this name already exists.
- remove_command(name: str) MessageCommand
Removes a command from the module.
- Parameters
name (
str
) – The name of the command to remove. (case sensitive)- Returns
The command that was removed.
- Return type
- Raises
CommandNotFound – When a command with this name is not found.
Full API
- class yami.Bot(token: str, prefix: Union[str, Sequence[str]], *, owner_ids: Sequence[int] = (), allow_extra_args: bool = False, raise_cmd_not_found: bool = False, **kwargs: Any)
Bases:
GatewayBot
A subclass of
GatewayBot
that provides an interface for handling commands.This is the class you will instantiate to utilize command features on top of the
GatewayBot
superclass.Warning
This class is slotted, if you want to set your own custom properties you have 2 choices:
Use the
Bot.shared
property which is an instance ofShared
.Subclass
Bot
, but this can lead to issues if you overwrite private or public attributes in your subclass.
- Parameters
- Keyword Arguments
owner_ids (
Sequence
[int
]) – A sequence of integers representing the Snowflakes of the bots owners. Defaults to()
.allow_extra_args (
bool
) – Whether or not the bot should allow extra args in command invocations. Defaults toFalse
.raise_cmd_not_found (
bool
) – Whether or not to raise theCommandNotFound
exception. Defaults toFalse
.**kwargs (
Any
) – The remaining kwargs forGatewayBot
.
- property commands: dict[str, yami.commands.MessageCommand]
A dictionary of name,
MessageCommand
pairs bound to the bot, including commands from any loaded modules.
- property aliases: dict[str, str]
A dictionary of aliases to their corresponding
MessageCommand
name.
- property modules: dict[str, yami.modules.Module]
A dictionary of name,
Module
pairs that are added to the bot, this includes unloaded modules.
The
Shared
instance associated with this bot.
- property raise_cmd_not_found: bool
Returns
True
if this bot will raise aCommandNotFound
exception when a prefix is used, but no command was found.
- load_all_modules(*paths: str | pathlib.Path, recursive: bool = True) None
Loads all modules from each of the given paths.
Note
This method looks for all
.py
files that do not begin with an _. It is recursive by default.If this method fails partway through, the bots modules are reverted to their previous state and no modules will be loaded.
- Parameters
*paths (
str
|Path
) – One or more paths to load modules from.- Keyword Arguments
recursive (
bool
) – Whether or not to recurse into sub directories while loading modules.- Raises
ModuleLoadException – When a module with the same name is already loaded on the bot, or when the named module is not found inside the given path’s source file.
ModuleAddException – When there is a failure with one of the commands in the module.
- load_module(name: str, path: str | pathlib.Path) None
Loads a single module class from the path specified.
Note
If this method fails partway through, the bots modules are reverted to their previous state and the module will not be loaded.
- Parameters
- Raises
ModuleLoadException – When a module with the same name is already loaded on the bot, or when the named module is not found inside the given paths source file.
ModuleAddException – When there is a failure with one of the commands in the module.
- unload_module(name: str) Module
Unloads a single module class with the given name. It will remain in
Bot.modules
, but just in an unloaded state and its commands will no longer be executable until it is loaded again.- Parameters
name (
str
) – The name of the module class to unload. (case sensitive)- Returns
The module that was unloaded.
- Return type
- Raises
ModuleUnloadException – When no module with this name was found.
- remove_module(name: str) Module
Removes a single module class with the given name. It will no longer be accessible via
Bot.modules
.- Parameters
name (
str
) – The name of the module class to remove. (case sensitive)- Returns
The module that was removed.
- Return type
- Raises
ModuleRemoveException – When no module with this name was found.
- add_command(command: Union[Callable[[...], Any], MessageCommand], *, name: Optional[str] = None, description: str = '', aliases: list[str] | tuple[str, ...] = [], raise_conversion: bool = False) MessageCommand
Adds a command to the bot.
- Parameters
command (
Callable
[…,Any
] |MessageCommand
) – The command or callback to add.- Keyword Arguments
name (
str
|None
) – The name of the command. Defaults to the function name.description (
str
) – The commands description. Defaults to""
.aliases (
Iterable
[str
]) – The commands aliases. Defaults to[]
.raise_conversion (
bool
) – Whether or not to raise an exception if argument conversion fails. Defaults toFalse
.
- Returns
The command that was added.
- Return type
- Raises
DuplicateCommand – If the command shares a name or alias with an existing command.
TypeError – If aliases is not a list or a tuple.
- remove_command(name: str) MessageCommand
Removes a
MessageCommand
from theBot
, and itsyami.Module
if it has one.- Parameters
name (
str
) – The name of the command to remove.- Returns
The command that was removed.
- Return type
- Raises
CommandNotFound – When the command was not found.
- iter_commands() Generator[MessageCommand, None, None]
Iterates the bots commands.
- Returns
A generator over the commands.
- Return type
- Yields
MessageCommand
– Each command.
- iter_modules() Generator[Module, None, None]
Iterates over the modules attached to the bot. This will included both loaded and unloaded modules.
- iter_loaded_modules() Generator[Module, None, None]
Iterates over the modules attached to the bot. This will only include loaded modules.
- get_command(name: str) yami.commands.MessageCommand | None
Gets a command.
- get_module(name: str) yami.modules.Module | None
Gets a module.
- command(name: Optional[str] = None, description: str = '', *, aliases: Sequence[str] = (), raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], Any]
Decorator to add a
MessageCommand
to the bot. This should be placed immediately above the command callback. Any checks should be placed above this decorator.- Parameters
- Keyword Arguments
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
Callable
[…,MessageCommand
]
- class yami.MessageContext(bot: Bot, message: Message, command: MessageCommand, prefix: str, invoked_subcommands: list[yami.commands.MessageCommand] = [])
Bases:
Context
The context surrounding a message commands invocation.
- Parameters
bot (
Bot
) – The bot instance associated with the context.message (
hikari.Message
) – The message that created this context.command (
yami.MessageCommand
) – The command that was invoked to create this context.prefix (
str
) – The prefix that was used to create this context.
- property rest: RESTClient
Shortcut to the bots rest client.
- property guild_id: hikari.snowflakes.Snowflake | None
The guild id associated with the context, or
None
if this context was aDMChannel
.
- property args: list[yami.args.MessageArg]
A list of converted
MessageArgs
passed to this context. Context will not be present here even though it was passed to the command callback.Note
If this context was invoked with subcommands and parent commands, only the final subcommands args will be present here.
- property exceptions: list[Exception]
Any exceptions that were generated when this context was created, including failed check exceptions.
- property command: MessageCommand
The command invoked during the creation of this context.
A
Shared
object that can be used to share data between subcommands.Hint
Also houses cached data from the checks that were run for this context.
- property invoked_subcommands: list[yami.commands.MessageCommand]
The subcommands that were invoked with this context, or
None
if there were none.Note
If subcommands were chained and the parent callback was not actually run (due to having
invoke_with
set toFalse
) it will not appear here.
- trigger_typing() special_endpoints.TypingIndicator
Shortcut method to
ctx.rest.trigger_typing
in the current channel.async with ctx.trigger_typing(): # do work here and typing will stop # when the context manager is exited.
- Returns
An async context manager for the typing indicator on Discord.
- Return type
- async respond(content: Union[Any, UndefinedType], *, delete_after: Optional[int] = None, **kwargs: Any) Message
Respond to the message that created this context.
- Parameters
content (
Any
) – The content of this response.- Keyword Arguments
- Returns
The message this response created.
- Return type
- async getch_member() hikari.guilds.Member | None
Get or fetch the
hikari.Member
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- async getch_guild() hikari.guilds.Guild | None
Get or fetch the
hikari.guilds.Guild
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- async getch_channel() hikari.channels.GuildChannel | hikari.channels.PartialChannel
Get or fetch the
hikari.channels.PartialChannel
object associated with the context. This method calls to the cache first, and falls back to rest if not found.Note
This method can return any of the following:
DMChannel
,GroupDMChannel
,GuildTextChannel
,GuildVoiceChannel
,GuildStoreChannel
,GuildNewsChannel
.Warning
This method can utilize both cache, and rest. For more fine grained control consider using cache or rest yourself explicitly.
- Returns
The channel object associated with this context.
- Return type
- class yami.MessageCommand(callback: Callable[[...], Any], name: str, description: str, *, aliases: Iterable[str], raise_conversion: bool, parent: Optional[MessageCommand] = None, invoke_with: bool = False)
Bases:
object
An object that represents a message content command.
Note
You should not instantiate this class manually, instead use:
The
yami.Bot.command
decorator outside aModule
.
- Parameters
callback (
typing.Callable
[…,typing.Any
]) – The async callback function for the command.name (
str
) – The name of the command.description (
str
) – The description for the command.
- Keyword Arguments
aliases (
typing.Iterable
[str
]) – The aliases for the command.raise_conversion (
bool
) – Whether or not to raise an error when a type hint conversion for the command arguments fails.parent (
MessageCommand
|None
) – The parent of this command if it is a subcommand, orNone
if not.invoke_with (
bool
) – Whether or not to invoke this command with its subcommands, if it has any. Defaults toFalse
.
- property checks: dict[str, yami.checks.Check]
A dictionary containing name,
Check
pairs that are registered to this command.
- property module: yami.modules.Module | None
The
Module
this command originates from, if any.
- property raise_conversion: bool
Whether or not to raise an error when a type hint conversion for the command arguments fails.
- property was_globally_added: bool
True
if this command was created with thecommand
decorator, andFalse
if not.
- property subcommands: dict[str, yami.commands.MessageCommand]
A dictionary containing name,
MessageCommand
pairs that are registered to this command.
- property parent: yami.commands.MessageCommand | None
The parent of this command, or
None
if this command is not a subcommand.
- property invoke_with: bool
Whether or not to invoke this command if one of its subcommands are invoked.
- add_check(check: Union[Type[Check], Check]) Check
Adds a check to be run before this command.
- Parameters
check (
Check
) – The check to add.- Returns
The check that was added.
- Return type
- Raises
CheckAddFailed – If the check is not a
Check
object.
- remove_check(check: Union[Type[Check], Check]) yami.checks.Check | None
Removes a check from this command. If this check is not bound to this command, it will do nothing.
- Parameters
check (
Check
) – The check to remove.- Returns
The removed check, or none if it was not found.
- Return type
- Raises
CheckRemovalFailed – When an invalid type is passed as an argument to this method.
- add_subcommand(command: Union[Callable[[...], Any], MessageCommand], *, name: Optional[str] = None, description: str = '', aliases: list[str] | tuple[str, ...] = [], raise_conversion: bool = False) MessageCommand
Adds a subcommand to the command.
- Parameters
command (
typing.Callable
[…,typing.Any
] |yami.MessageCommand
) – The subcommand to add.- Keyword Arguments
name (
str
|None
) – The name of the subcommand. (defaults to the function name)description (
str
) – The subcommands description. (defaults to""
)aliases (
typing.Iterable
[str
]) – The subcommands aliases (defaults to[]
)raise_conversion (
bool
) – Whether or not to raise an error when argument conversion fails. (Defaults toFalse
)
- Returns
The subcommand that was added.
- Return type
- Raises
DuplicateCommand – If the subcommand shares a name or alias with an existing subcommand.
TypeError – If aliases is not a list or a tuple.
- iter_subcommands() Generator[MessageCommand, None, None]
Iterates the subcommands for this command.
- Returns
A generator over the subcommands.
- Return type
- Yields
MessageCommand
– Each subcommand.
- subcommand(name: Optional[str] = None, description: str = '', *, aliases: Iterable[str] = [], raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], MessageCommand]
Decorator to add a subcommand to an existing command. It should decorate the callback that should fire when this subcommand is run.
- Parameters
- Keyword Arguments
aliases (
Iterable
[str
]) – A list or tuple of aliases for the command.raise_conversion (
bool
) – Whether or not to raiseConversionFailed
when converting a commands argument fails.invoke_with (
bool
) – Whether or not to invoke this commands callback, when its subcommand is invoked.
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
Callable
[…,MessageCommand
]
- class yami.Module(bot: Bot)
Bases:
object
A collection of commands and functions that typically share a need for the same data, or are related in some way.
- Parameters
bot (
Bot
) – The bot instance.
Hint
You should subclass
Module
to create your own modules.Modules do not require any special functions in their file.
Modules are loaded via the
load_module
andload_all_modules
methods.
Warning
If you overwrite the
__init__
method, it should take only 1 argument which is of typeBot
.class MyMod(yami.Module): def __init__(self, bot: yami.Bot) -> None: super().__init__(bot) # Do whatever else you need here.
- property commands: dict[str, yami.commands.MessageCommand]
A dictionary of
name
,MessageCommand
pairs this module contains.
- iter_commands() Generator[MessageCommand, None, None]
Iterates the modules commands.
- Returns
A generator over the commands.
- Return type
- Yields
MessageCommand
– Each command.
- add_command(command: MessageCommand) None
Adds a command to the module.
- Parameters
command (
MessageCommand
) – The command to add.- Raises
DuplicateCommand – When a command with this name already exists.
- remove_command(name: str) MessageCommand
Removes a command from the module.
- Parameters
name (
str
) – The name of the command to remove. (case sensitive)- Returns
The command that was removed.
- Return type
- Raises
CommandNotFound – When a command with this name is not found.
Bases:
object
Represents data container for shared storage.
An instance of Shared is stored on each context, and on the bot.
Feel free to examine this in your own contexts, and even store things in one on your bot. You can instantiate a Shared anywhere you want, in fact.
You can dynamically add attributes to the shared object.
s = yami.Shared() s.hello = "hello" s.hello # returns "hello" s.doesnt_exist # returns yami.SharedNone
A dictionary of attribute name, value pairs that have been stored inside this Shared instance.
Checks whether the Shared instance contains an attribute with the given name. If so, you can assume the attribute will not return a SharedNone.
- Args
- name:
str
The name of the attribute to check for.
- name:
- Returns
bool
True if the attribute exists, otherwise False.
Bases:
object
The type returned from Shared if an attribute is not set, this class can not be instantiated.
When a SharedNone is returned, it is this class, but its type() will be YamiNoneType.
To check if a value returned by Shared was SharedNone use shared.obj is SharedNone.
- class yami.MessageArg(param: Parameter, value: str)
Bases:
object
Represents a
MessageCommand
argument.- Parameters
param (
inspect.Parameter
) – The raw inspect parameter.value (
str
) – The value for this argument.
Warning
This class should not be instantiated manually, it will be injected during argument conversion when commands are invoked.
- property kind: _ParameterKind
The parameter kind this arg is.
- async convert(ctx: context.MessageContext) None
Attempts to convert the argument to its type hint.
- Parameters
ctx (
MessageContext
) – The message context.
- class yami.BuiltinConverter(value: Any)
Bases:
Converter
Converts to the builtin types.
- Parameters
value (
Any
) – The value to perform the conversion on.
- classmethod can_convert(type_: Any) bool
Whether or not this converter can convert an object to this type.
- as_type(type_: BuiltinTypeT, *, encoding: str = 'utf8') BuiltinTypeT
Converts the value to the given type.
- Parameters
type (
BuiltinTypeT
) – The type to try converting to.- Keyword Arguments
encoding (
str
) – The encoding iftype_
isbytes
. Defaults to"utf8"
.- Returns
The converted value.
- Return type
BuiltinTypeT
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_bool() bool
Converts the value to
bool
.Hint
'true'
and'True'
will beTrue
'false'
and'False'
will beFalse
- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_str() str
Converts the value to
str
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_bytes(encoding: str = 'utf8') bytes
Converts the value to
bytes
.- Parameters
encoding (
str
) – The encoding to use. Defaults to"utf8"
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_int() int
Converts the value to
int
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_complex() complex
Converts to
complex
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- as_float() float
Converts the value to
float
.- Returns
The converted value.
- Return type
- Raises
ConversionFailed – If the conversion fails for any reason.
- class yami.HikariConverter
Bases:
Converter
Converts to the hikari types.
Warning
Not yet implemented!
- class yami.Check
Bases:
ABC
Base class all Yami checks inherit from.
- classmethod get_name() str
Returns the name of this
Check
subclass.- Returns
The name of the class.
- Return type
- abstract async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.is_owner
Bases:
Check
Fails if the author of the command is not the bots owner.
Hint
Who is the bots owner?
Any user with an id matching one of the ids passed into the bots constructor for the kwarg
owner_ids
.The application owner fetched from Discord if no
owner_ids
were passed to the constructor.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.is_in_guild
Bases:
Check
Fails if the command was not run in a guild.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.is_in_dm
Bases:
Check
Fails if the command was not run in a DM.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.has_roles(*roles: str | int)
Bases:
Check
Fails if the author does not have all of the roles passed to this check decorator.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.- Parameters
*roles (
str
|int
) – The name or id of the role or roles the user must have.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.has_any_role(*roles: str | int)
Bases:
Check
Fails if the author does not have any of the role names or ids passed to this check.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.- Parameters
*roles (
str
| int) – The names or ids of the roles the user must have at least one of.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.has_perms(**perms: bool)
Bases:
Check
Fails if the author does not have all of the specified permissions. This accumulates all permissions the user has.
This is inherently an
is_in_guild
check as well, because a user cannot have a role outside of a guild.Warning
If you pass something like
manage_messages=False
to this check, it will do nothing.It will not require the user to have the permission. Make sure you use
manage_messages=True
.- Keyword Arguments
**perms (
bool
) –Keyword arguments for each of the available hikari perms.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.custom_check(check: Union[Callable[[MessageContext], Any], Check], *, message: str = '')
Bases:
Check
A custom check.
Hint
- Parameters
check (
Callable
[[MessageContext
],Any
]) –The callback function that should be used for the check.
Note
It should accept one argument of type
MessageContext
and returnFalse
or raise an error if it fails.This can be an async, or sync function.
- Keyword Arguments
message – (
str
): The optional message to use in theCheckFailed
exception. The default message is"a custom check was failed"
.- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- class yami.is_the_cutest
Bases:
Check
Fails if you aren’t Jaxtar.
- Raises
CheckFailed – When the check fails.
- async execute(ctx: MessageContext) None
Executes the check.
- Parameters
ctx (
MessageContext
) – The context to execute the check against.- Raises
CheckFailed – When the check fails.
- yami.command(name: Optional[str] = None, description: str = '', *, aliases: Iterable[str] = [], raise_conversion: bool = False, invoke_with: bool = False) Callable[[...], MessageCommand]
Decorator to add commands to the bot inside of modules. It should decorate the callback that should fire when this command is run.
- Parameters
- Keyword Arguments
aliases (
Iterable
[str
]) – A list or tuple of aliases for the command.raise_conversion (
bool
) – Whether or not to raiseConversionFailed
when converting a commands argument fails.invoke_with (
bool
) – Whether or not to invoke this commands callback, when its subcommand is invoked.
- Returns
A message command crafted from the callback, and decorator arguments.
- Return type
- exception yami.CommandNotFound
Bases:
CommandException
Raised when a command is invoked, or attempted to be accessed but no command with that name is found.
- exception yami.BadArgument
Bases:
CommandException
Raised when a bad argument is passed to a message command.
- exception yami.DuplicateCommand
Bases:
CommandException
Raised when a command is added that shares a name or aliases with an existing command, or subcommand on the same level.
- exception yami.ModuleException
Bases:
YamiException
Raised when an error associated with a module occurs.
- exception yami.ModuleRemoveException
Bases:
ModuleException
Raised when a module fails to be removed from the bot.
- exception yami.ModuleAddException
Bases:
ModuleException
Raised when a module fails to be added to the bot.
- exception yami.ModuleLoadException
Bases:
ModuleException
Raised when a module fails to be loaded to the bot.
- exception yami.ModuleUnloadException
Bases:
ModuleException
Raised when a module fails to be unloaded from the bot.
- exception yami.CheckException
Bases:
CommandException
Raised when an exception relating to a check occurs.
- exception yami.CheckRemovalFailed
Bases:
CheckException
Raised when an invalid type is passed to remove_check.
- exception yami.BadCheck
Bases:
CheckException
Raised when a check decorator is placed below the command decorator, or otherwise used incorrectly.
- exception yami.CheckFailed
Bases:
CheckException
Raised when a check is failed during command invocation.
- exception yami.CheckAddFailed
Bases:
CheckException
Raised when an invalid type is passed to add_check.
- exception yami.ListenerException
Bases:
YamiException
Raised when an exception occurs relating to a module listener.
- exception yami.TooManyArgs
Bases:
CommandException
Raised when too many arguments are passed to a command.
- exception yami.MissingArgs
Bases:
CommandException
Raised when a command is run, but not all args are supplied.
- exception yami.ConversionFailed
Bases:
YamiException
Raised when the conversion performed by a converter fails.
- class yami.Context(bot: Bot, message: Message, command: MessageCommand, prefix: str, invoked_subcommands: list[yami.commands.MessageCommand] = [])
Bases:
ABC
Base Context all Yami contexts inherit from.
- abstract property rest: RESTClient
Shortcut to the bots rest client.
- abstract property guild_id: hikari.snowflakes.Snowflake | None
The guild id associated with the context, or
None
if this context was aDMChannel
.
- abstract property args: list[yami.args.MessageArg]
A list of converted
MessageArgs
passed to this context. Context will not be present here even though it was passed to the command callback.Note
If this context was invoked with subcommands and parent commands, only the final subcommands args will be present here.
- abstract property exceptions: list[Exception]
Any exceptions that were generated when this context was created, including failed check exceptions.
- abstract property command: MessageCommand
The command invoked during the creation of this context.
A
Shared
object that can be used to share data between subcommands.Hint
Also houses cached data from the checks that were run for this context.
- class yami.YamiEvent
-
The base class all Yami events inherit from.
- class yami.CommandInvokeEvent(ctx: Context)
Bases:
YamiEvent
Fires when any command is invoked.
- property command: MessageCommand
The command that triggered this event.
- class yami.CommandExceptionEvent(ctx: Context)
Bases:
YamiEvent
Fires when a command encounters an exception of any kind.
- property command: MessageCommand
The command that triggered this event.
- class yami.CommandSuccessEvent(ctx: Context)
Bases:
YamiEvent
Fires when any command invocation is successful.
- property command: MessageCommand
The command that triggered this event.