discord-interactions.py

create_file

Function

Attached file shown in the message (type 13). Send the file itself with files=.

from discord_interactions import create_file

Signature

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

Parameters

NameTypeDefaultDescription
filenamestrrequiredName of the attached file; attachment:// is added when missing.
spoilerboolFalseHidden until clicked.
component_idint | NoneNone

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])

Type a name: create_button, ModalBuilder, cooldown.