Upload #
Upload Files #
Upload specified files and directories to Saved Messages:
tdl up -p /path/to/file -p /path/to/dir
Custom Destination #
Upload to custom chat.
CHAT Examples
Specific Chat #
Upload to specific one chat:
tdl up -p /path/to/file -c CHAT
Upload to specific topic in a forum chat:
tdl up -p /path/to/file -c CHAT --topic TOPIC_ID
Message Routing #
Upload to different chats by message router which is based on expression.
The--toflag is conflicted with the-c/--chatand--topicflags. You can only use one of them.
List all available fields:
tdl up -p /path/to/file --to -
Upload to CHAT1 if MIME contains video, otherwise upload to Saved Messages:
You must return a string or struct as the target CHAT, and empty string means upload to Saved Messages.
tdl up -p /path/to/file \--to 'MIME contains "video" ? "CHAT1" : ""'
Upload to CHAT1 if MIME contains video, otherwise upload to reply to message/topic 4 in CHAT2:
tdl up -p /path/to/file \--to 'MIME contains "video" ? "CHAT1" : { Peer: "CHAT2", Thread: 4 }'
Pass a file name if the expression is complex:
router.txt
Write your expression like switch:
MIME contains "video" ? "CHAT1" :
FileExt contains ".mp3" ? "CHAT2" :
FileName contains "chat3" > 30 ? {Peer: "CHAT3", Thread: 101} :
""
tdl up -p /path/to/file --to router.txt
Custom Parameters #
Upload with 8 threads per task, 4 concurrent tasks:
tdl up -p /path/to/file -t 8 -l 4
Custom Caption #
Custom caption is based on expression.
List all available fields:
tdl up -p /path/to/file --caption -
Custom simple caption:
tdl up -p /path/to/file --caption 'FileName + " - uploaded by tdl"'
Write styled message with HTML:
tdl up -p /path/to/file --caption \'FileName + `<b>Bold</b> <a href="https://example.com">Link</a>`'
Pass a file name if the expression is complex:
caption.txt
repeat(FileName, 2) + `
<a href="https://www.google.com">Google</a>
<a href="https://www.bing.com">Bing</a>
<b>bold</b>
<i>italic</i>
<code>code</code>
<tg-spoiler>spoiler</tg-spoiler>
<pre><code class="language-go">
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
</code></pre>
` + MIME
tdl up -p /path/to/file --caption caption.txt
Filters #
Upload files with extension filters:
The extension is only matched with the file name, not the MIME type. So it may not work as expected.
Whitelist and blacklist can not be used at the same time.
Whitelist: Only upload files with .jpg .png extension
tdl up -p /path/to/file -p /path/to/dir -i jpg,png
Blacklist: Upload all files except .mp4 .flv extension
tdl up -p /path/to/file -p /path/to/dir -e mp4 -e flv
Delete Local #
Delete the uploaded file after uploading successfully:
tdl up -p /path/to/file --rm
Photo #
Upload images as photos instead of documents:
tdl up -p /path/to/file --photo