Converter
You can see detailed converter use on this page.
A converter class that handles the conversion of Context to desired type.
class Anjani.util.converter.Converter
Base class of custom converters that require the ~Context
to be passed.
Class that derived this base converter need to have the __call__
to do the conversion. This method should also be a coroutine
.
async def __call__()
The base method that should be overrided and will be called on conversion.
Parameters:
- ctx (
~Context
): The command invocation context that the argument used in. - arg (
str
): The argument that is being converted.
class Anjani.util.converter.UserConverter
Converts to a ~pyrogram.types.User
.
Conversion priority:
- By user id.
- By username.
- By text mention.
async def __call__()
The base method that should be overrided and will be called on conversion.
Parameters:
- ctx (
~Context
): The command invocation context that the argument used in. - arg (
str
): The argument that is being converted.
class Anjani.util.converter.ChatConverter
Converts to a ~pyrogram.types.ChatMember
.
Conversion priority:
- By chat id.
- By chat username (with '@').
- By chat username (without '@').
async def __call__()
The base method that should be overrided and will be called on conversion.
Parameters:
- ctx (
~Context
): The command invocation context that the argument used in. - arg (
str
): The argument that is being converted.
class Anjani.util.converter.ChatMemberConverter
Converts to a ~pyrogram.types.ChatMember
.
Conversion priority:
- By user id.
- By username.
- By text mention.
async def __call__()
The base method that should be overrided and will be called on conversion.
Parameters:
- ctx (
~Context
): The command invocation context that the argument used in. - arg (
str
): The argument that is being converted.