pylav.core package¶
Submodules¶
pylav.core.bot_overrides module¶
pylav.core.client module¶
pylav.core.context module¶
- class pylav.core.context.PyLavContext(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, subcommand_passed=None, command_failed=False, current_parameter=None, current_argument=None, interaction=None)[source]¶
Bases:
Context- author¶
Union[
User,Member]: Returns the author associated with this context’s command. Shorthand forMessage.author
- bot¶
- channel¶
Returns the channel associated with this context’s command. Shorthand for
Message.channel.- Type:
Union[
abc.Messageable]
- client¶
- property cog¶
Returns the cog associated with this context’s command. None if it does not exist
- Type:
Optional[
Cog]
- async construct_embed(*, embed=None, colour=None, color=None, title=None, embed_type='rich', url=None, description=None, timestamp=None, author_name=None, author_url=None, thumbnail=None, footer=None, footer_url=None, messageable=None)[source]¶
Construct embed
- async classmethod from_interaction(interaction, /)[source]¶
-
Creates a context from a
discord.Interaction. This only works on application command based interactions, such as slash commands or context menus.On slash command based interactions this creates a synthetic
Messagethat points to an ephemeral message that the command invoker has executed. This means thatContext.authorreturns the member that invoked the command.In a message context menu based interaction, the
Context.messageattribute is the message that the command is being executed on. This means thatContext.authorreturns the author of the message being targetted. To get the member that invoked the command thendiscord.Interaction.usershould be used instead.Added in version 2.0.
- Parameters:
interaction (
discord.Interaction) – The interaction to create a context with.- Raises:
ValueError – The interaction does not have a valid command.
TypeError – The interaction client is not derived from
BotorAutoShardedBot.
- guild¶
Returns the guild associated with this context’s command. None if not available
- Type:
Optional[
Guild]
- interaction¶
- property original_ctx_or_interaction¶
Get original ctx or interaction
- property player¶
Get player
- async send_interactive(messages, box_lang=None, timeout=15, embed=False)[source]¶
Send multiple messages interactively.
The user will be prompted for whether or not they would like to view the next message, one at a time. They will also be notified of how many messages are remaining on each prompt.
- Parameters:
messages (iterable of str) – The messages to send.
box_lang (
str) – If specified, each message will be contained within a codeblock of this language.timeout (
int) – How long the user has to respond to the prompt before it times out. After timing out, the bot deletes its prompt message.embed (
bool) – Whether or not to send the messages as embeds.