feat: add file/photo sending to Telegram bot#23
Open
Fenrur wants to merge 1 commit intomoazbuilds:masterfrom
Open
feat: add file/photo sending to Telegram bot#23Fenrur wants to merge 1 commit intomoazbuilds:masterfrom
Fenrur wants to merge 1 commit intomoazbuilds:masterfrom
Conversation
Add support for sending local files and photos via Telegram using [file:/path/to/file] directives in Claude's response text. - sendPhotoFile(): sends images (png, jpg, jpeg, gif, webp) via sendPhoto API - sendFileDocument(): sends any other file via sendDocument API - sendLocalFile(): auto-detects image vs document based on extension - extractFileDirectives(): parses [file:/absolute/path] patterns from response - File directives are stripped from displayed text before sending - Errors (file not found, upload failure) send a user-friendly error message - Uses Bun's native FormData and Blob APIs, no external dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fenrur
added a commit
to Fenrur/claudeclaw
that referenced
this pull request
Mar 13, 2026
- Add [file:/path] directive extraction from Claude responses - Send images via sendPhoto, other files via sendDocument - Export sendLocalFile, sendPhotoFile, sendFileDocument Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[file:/path/to/file]directive support in Claude's responses to send local files via TelegramsendPhotoAPI; all other files viasendDocumentAPIFormDataandBlob— zero new dependenciesHow it works
When Claude includes
[file:/absolute/path/to/file.png]in its response:sendPhotoorsendDocumentFunctions added
sendPhotoFile()— uploads an image via Telegram'ssendPhotoendpointsendFileDocument()— uploads any file via Telegram'ssendDocumentendpointsendLocalFile()— auto-routes to photo or document based on extensionextractFileDirectives()— parses[file:/path]patterns from response textTest plan
[file:/path/to/image.png]→ image is sent as photo[file:/path/to/doc.pdf]→ file is sent as document[file:...]directives in one response🤖 Generated with Claude Code