Skip to content

Interaction

Bases: Interaction, Generic[K_contra]

The QalibInteraction class is a subclass of discord.Interaction, and is used to add additional functionality to the interaction. It is meant to be used in the on_interaction event, and is responsible for deserializing the requested modal and sending it to the user.

__init__(interaction, renderer)

Constructor method for the QalibInteraction class.

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 (K) –

    identifies the message in the template file

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

    callable coroutines that are called when the user interacts with the message

  • 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.

menu(key, callbacks=None, keywords=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

  • **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 hooked to 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.

respond_with_modal(key, methods=None, keywords=None) async

Method that is responsible for templating the document, and then deserializing the requested modal based on its key and sending it to the user.

Parameters:

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

    methods that are used to override the default methods of the modal

  • key (str) –

    key that identifies the modal in the route file

  • keywords (Any, default: None ) –

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