Skip to content

Context

Bases: Context, Generic[K_contra]

QalibContext object is responsible for handling messages that are to be sent to the client.

__init__(ctx, renderer)

Constructor for the QalibContext object

Parameters:

  • ctx (context) –

    context object that is passed to the command

  • renderer (RendererProxy) –

    renderer object that is used to render the embeds and views

display(key, callables=None, keywords=None, events=None, **kwargs) async

this is the main function that we use to send one message, and one message only. However, edits to that message can take place.

Parameters:

  • key (str) –

    identifies the embed in the route file

  • callables (Optional[Dict[str, Callback]], default: None ) –

    callable coroutines that are called when the user interacts

  • keywords (Optional[Dict[str, Any]], default: None ) –

    keywords that are passed to the embed renderer to format the text

  • events (Optional[EventCallback], default: None ) –

    callbacks that are called on the event

  • **kwargs

    kwargs that are passed to the context send method or the message edit method

Returns (discord.message.Message): Message object that got sent to the client.

get_message() async

This method waits for a message to be sent by the user

menu(key, callbacks=None, keywords=None, events=None, **kwargs) async

This method is used to create a menu for the user to select from.

Parameters:

  • key (K) –

    identifies the menu in the template file

  • callbacks (Dict[str, Callback], default: None ) –

    callbacks that are called when the user interacts with the menu

  • keywords (Dict[str, Any], default: None ) –

    keywords that are passed to the embed renderer to format the text

  • events (Optional[EventCallback], default: None ) –

    callbacks that are called on the event

  • **kwargs

    kwargs that are passed to the context's send method

rendered_send(identifier, callables=None, keywords=None, events=None, **kwargs) async

Methods that is fires a message to the client and returns the message object. Doesn't save/keep track of the message.

Parameters:

  • identifier (str) –

    identifies the embed in the route file

  • callables (Optional[Dict[str, Callback]]) , default: None ) –

    functions that are hooked to components

  • keywords (Dict[str, Any], default: None ) –

    keywords that are passed to the embed renderer to format the text

  • events (Optional[EventCallback], default: None ) –

    callbacks that are called on the event

  • **kwargs

    kwargs that are passed to the context's send method

Returns (discord.message.Message): Message object that got sent to the client.

verify(message)

Method verifies if the content of the message is in the contents

Parameters:

  • message (Message) –

    message that is getting verified

Returns:

  • bool ( bool ) –

    true of false that indicates whether the data is valid.