LemonChannels. Adapters. Discord. FileOperations
(lemon_channels v0.1.0)
View Source
File upload/download operations for the Discord transport.
Handles /file put, /file get, and auto-put for bare attachment uploads.
Reuses shared path-validation and write helpers from the Telegram FileOperations
module where possible, adapting the download/upload paths for Discord's API.
Summary
Functions
Download attachment bytes from a Discord CDN URL.
Extract the resolved attachment struct from a /file put interaction.
Process auto-put for attachments on a regular (non-slash-command) message.
Handle the /file get slash command interaction.
Handle the /file put slash command interaction.
Returns true when the inbound message has attachments and auto-put is enabled in the files config.
Functions
Download attachment bytes from a Discord CDN URL.
Extract the resolved attachment struct from a /file put interaction.
Discord option type 11 (ATTACHMENT) stores the snowflake ID as the option
value. The actual attachment data lives in interaction.data.resolved.attachments
keyed by that snowflake.
Process auto-put for attachments on a regular (non-slash-command) message.
Returns a list of {:ok, rel_path} or {:error, reason} tuples, one per
attachment processed.
Handle the /file get slash command interaction.
Reads a file from disk and sends it to the Discord channel as an attachment.
Returns {:ok, msg} or {:error, msg}.
Handle the /file put slash command interaction.
Downloads the resolved attachment from its URL, validates the destination path, and writes the file to disk.
Returns a reply string for the interaction response.
Returns true when the inbound message has attachments and auto-put is enabled in the files config.