Represents a file to upload to Discord.
Use the builder functions to create file structs:
# From binary data
EDA.File.from_binary(png_data, "image.png")
EDA.File.from_binary(png_data, "image.png", description: "Alt text", spoiler: true)
# From a file path
EDA.File.from_path("/path/to/image.png")
EDA.File.from_path("/path/to/image.png", name: "custom.png", description: "Alt text")Then pass files to message functions:
EDA.API.Message.create(channel_id, content: "Check this!", files: [file])
Summary
Functions
Returns the effective filename, with SPOILER_ prefix if spoiler is true.
Creates a file from binary data.
Creates a file from a filesystem path.
Types
Functions
Returns the effective filename, with SPOILER_ prefix if spoiler is true.
Creates a file from binary data.
Accepts both Elixir binaries (<<...>>) and byte lists ([0, 1, 2, ...]).
Lists are automatically converted — this is useful when receiving data from
Rust NIFs that return Vec<u8> (Rustler converts these to Erlang lists).
Options
:description- Alt text for the file (max 1024 chars):spoiler- Iftrue, prefixes the filename withSPOILER_
Creates a file from a filesystem path.
Reads the file and extracts the filename from the path.
Options
:name- Override the filename (defaults to basename of path):description- Alt text for the file (max 1024 chars):spoiler- Iftrue, prefixes the filename withSPOILER_