discord-interactions.py

update_component

Coroutineà attendre avec await

Recharge le message puis modifie chaque composant ciblé.

from discord_interactions import update_component

Signature

async def update_component(    message: Any,    selector: str | Callable[[Dict[str, Any]], bool],    updates: Dict[str, Any],) -> bool

Paramètres

NomTypeDéfautDescription
messageAnyrequisMessage contenant le composant.
selectorstr | Callable[[Dict[str, Any]], bool]requiscustom_id exact ou fonction (composant) -> bool.
updatesDict[str, Any]requisChamps à remplacer, par exemple {"disabled": True}.

Retour

bool True si au moins un composant a changé.

Exemple

from discord_interactions import defer_interaction, update_component await defer_interaction(interaction, update=True)await update_component(interaction.message, "valider", {"disabled": True, "label": "Validé"})

Tape un nom : create_button, ModalBuilder, cooldown.