create_file
Function
Attached file shown in the message (type 13). Send the file itself with files=.
from discord_interactions import create_fileSignature
def create_file( filename: str, spoiler: bool = False, component_id: int | None = None,) -> Dict[str, Any]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
filename | str | required | Name of the attached file; attachment:// is added when missing. |
spoiler | bool | False | Hidden until clicked. |
component_id | int | None | None |
Returns
Dict[str, Any]
Example
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])