discord-interactions.py

row_update

Coroutineà attendre avec await

Transforme chaque composant d'une ou plusieurs rangées avec une fonction.

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

Paramètres

NomTypeDéfautDescription
messageAnyrequis
row_selectorstr | int | Callable[[Dict[str, Any], int], bool]requisIndex de rangée, custom_id d'un composant de la rangée, ou fonction (rangée, index) -> bool.
updaterCallable[[Dict[str, Any]], Dict[str, Any] | None] | Callable[[Dict[str, Any]], Awaitable[Dict[str, Any] | None]]requisFonction (synchrone ou async) qui renvoie le composant modifié, ou None pour le retirer.

Retour

bool

Exemple

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

Tape un nom : create_button, ModalBuilder, cooldown.