discord-interactions.py

row_update

Coroutinemust be awaited

Transforms every component of one or more rows with a function.

from discord_interactions import row_update

Signature

async def row_update(    message: Any,    row_selector: str | int | Callable[[Dict[str, Any], int], bool],    updater: Callable[[Dict[str, Any]], Dict[str, Any] | None] | Callable[[Dict[str, Any]], Awaitable[Dict[str, Any] | None]],) -> bool

Parameters

NameTypeDefaultDescription
messageAnyrequired
row_selectorstr | int | Callable[[Dict[str, Any], int], bool]requiredRow index, custom_id of a component in the row, or a (row, index) -> bool function.
updaterCallable[[Dict[str, Any]], Dict[str, Any] | None] | Callable[[Dict[str, Any]], Awaitable[Dict[str, Any] | None]]requiredFunction (sync or async) returning the updated component, or None to remove it.

Returns

bool

Example

from discord_interactions import row_update def eteindre(bouton):    bouton["style"] = 2    return bouton await row_update(interaction.message, 0, eteindre)

Type a name: create_button, ModalBuilder, cooldown.