discord-interactions.py

create_file

Fonction

Fichier joint affiché dans le message (type 13). Le fichier doit être envoyé avec files=.

from discord_interactions import create_file

Signature

def create_file(    filename: str,    spoiler: bool = False,    component_id: int | None = None,) -> Dict[str, Any]

Paramètres

NomTypeDéfautDescription
filenamestrrequisNom du fichier joint ; attachment:// est ajouté si absent.
spoilerboolFalseFichier masqué jusqu'au clic.
component_idint | NoneNone

Retour

Dict[str, Any]

Exemple

import discordfrom discord_interactions import container, create_file fichier = discord.File("rapport.pdf")carte = container("## Rapport mensuel").add(create_file("rapport.pdf"))await ctx.respond(components=[carte], files=[fichier])

Tape un nom : create_button, ModalBuilder, cooldown.