pylav.type_hints package#

Submodules#

pylav.type_hints.bot module#

class pylav.type_hints.bot.BotClientWithLavalinkType(*args, cli_flags=None, bot_dir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/pylav/checkouts/latest/docs'), **kwargs)[source]#

Bases: Red

async get_context(message, *, cls=None)[source]#

Returns the invocation context from the message or interaction.

This is a more low-level counter-part for process_commands() to allow users more fine grained control over the processing.

The returned context is not guaranteed to be a valid invocation context, Context.valid must be checked to make sure it is. If the context is not valid then it is not a valid candidate to be invoked under invoke().

Note

In order for the custom context to be used inside an interaction-based context (such as HybridCommand) then this method must be overridden to return that class.

Changed in version 2.0: message parameter is now positional-only and renamed to origin.

Parameters:
  • origin (Union[:class:`discord.Message`, discord.Interaction]) – The message or interaction to get the invocation context from.

  • cls – The factory class that will be used to create the context. By default, this is Context. Should a custom class be provided, it must be similar enough to Context's interface.

Returns:

The invocation context. The type of this can change via the cls parameter.

Return type:

Context

pylav#
class pylav.type_hints.bot.DISCORD_COG_TYPE_MIXIN(*args, **kwargs)[source]#

Bases: Cog

bot#
pylav#
class pylav.type_hints.bot.DISCORD_INTERACTION_TYPE_BASE(*, data, state)[source]#

Bases: Interaction

application_id#
channel#
command_failed#
data#
extras#
guild_id#
guild_locale#
id#
locale#
message#
token#
type#
user#
version#

pylav.type_hints.cogs module#

pylav.type_hints.dict_typing module#

pylav.type_hints.generics module#

class pylav.type_hints.generics.SupportsStr(*args, **kwargs)[source]#

Bases: Protocol

Module contents#