lightbulb.components.base

class BaseComponent[source]

Abstract base class for a component that can be added to an action row builder.

abstractmethod add_to_row(row: RowT) RowT[source]

Add this component to the given action row builder, and return the updated builder.

Parameters:

row – The row to add the component to.

Returns:

The updated builder.

abstract property custom_id: str

The custom ID for this component.

class BuildableComponentContainer[source]

Abstract base class allowing subclasses to be used as containers for BaseComponent`s, as well as being passed to the ``components=` kwarg of respond methods.

This class does not require super().__init__() to be called within subclasses.

add(component: BaseComponentT) BaseComponentT[source]

Adds the given component to the container.

Parameters:

component – The component to add.

Returns:

The added component.

clear_current_row() t_ex.Self[source]

Remove all components from the current row.

clear_rows() t_ex.Self[source]

Remove all components from this container.

next_row() t_ex.Self[source]

Move the current row pointer to the next row.

previous_row() t_ex.Self[source]

Move the current row pointer back to the previous row.

class MessageResponseMixinWithEdit[source]

Abstract mixin derived from MessageResponseMixin that additionally allows creating an initial response of type hikari.interactions.base_interactions.ResponseType.MESSAGE_UPDATE (and the deferred variant).

async defer(*, ephemeral: bool = False, edit: bool = False) None[source]

Defer the creation of a response for the interaction that this context represents.

Parameters:
  • ephemeral – Whether to defer ephemerally (message only visible to the user that triggered the command).

  • edit – Whether the eventual response should cause an edit instead of creating a new message.

Returns:

None

async respond(content: hikari.UndefinedOr[t.Any] = UNDEFINED, *, ephemeral: bool = False, edit: bool = False, flags: int | MessageFlag | UndefinedType = UNDEFINED, tts: hikari.UndefinedOr[bool] = UNDEFINED, attachment: hikari.UndefinedOr[hikari.Resourceish] = UNDEFINED, attachments: hikari.UndefinedOr[Sequence[hikari.Resourceish]] = UNDEFINED, component: hikari.UndefinedOr[special_endpoints.ComponentBuilder] = UNDEFINED, components: hikari.UndefinedOr[Sequence[special_endpoints.ComponentBuilder]] = UNDEFINED, embed: hikari.UndefinedOr[Embed] = UNDEFINED, embeds: hikari.UndefinedOr[Sequence[Embed]] = UNDEFINED, poll: hikari.UndefinedOr[special_endpoints.PollBuilder] = UNDEFINED, mentions_everyone: hikari.UndefinedOr[bool] = UNDEFINED, user_mentions: hikari.UndefinedOr[hikari.SnowflakeishSequence[PartialUser] | bool] = UNDEFINED, role_mentions: hikari.UndefinedOr[hikari.SnowflakeishSequence[PartialRole] | bool] = UNDEFINED) hikari.Snowflakeish[source]

Create a response to the interaction that this context represents.

Parameters:
  • content – The message contents.

  • ephemeral – Whether the message should be ephemeral (only visible to the user that triggered the command). This is just a convenience argument - passing flags=hikari.MessageFlag.EPHEMERAL will function the same way.

  • edit – Whether the response should cause an edit instead of creating a new message.

  • attachment – The message attachment.

  • attachments – The message attachments.

  • component – The builder object of the component to include in this message.

  • components – The sequence of the component builder objects to include in this message.

  • embed – The message embed.

  • embeds – The message embeds.

  • poll – The poll to include with the message. Ignored when edit=True.

  • flags – The message flags this response should have.

  • tts – Whether the message will be read out by a screen reader using Discord’s TTS (text-to-speech) system.

  • mentions_everyone – Whether the message should parse @everyone/@here mentions.

  • user_mentions – The user mentions to include in the message.

  • role_mentions – The role mentions to include in the message.

Returns:

An identifier for the response. This can then be used to edit,

delete, or fetch the response message using the appropriate methods.

Return type:

hikari.snowflakes.Snowflakeish

Note

This documentation does not contain a full description of the parameters as they would just be copy-pasted from the hikari documentation. See create_initial_response() for a more detailed description.

Note

If this is not creating an initial response and edit is True, then this will always edit the initial response, not the most recently created response.