mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-08-07 05:23:22 +08:00
167 lines
18 KiB
XML
167 lines
18 KiB
XML
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Usage on Save Any Bot</title><link>https://sabot.unv.app/en/usage/</link><description>Recent content in Usage on Save Any Bot</description><generator>Hugo</generator><language>en</language><atom:link href="https://sabot.unv.app/en/usage/index.xml" rel="self" type="application/rss+xml"/><item><title>Silent Mode</title><link>https://sabot.unv.app/en/usage/silent/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/silent/</guid><description><h1 id="silent-mode-silent">
|
|
Silent Mode (silent)
|
|
<a class="anchor" href="#silent-mode-silent">#</a>
|
|
</h1>
|
|
<p>Use the <code>/silent</code> command to toggle silent mode.</p>
|
|
<p>By default, silent mode is off, and the bot will ask you for the save location of each file.</p>
|
|
<p>When silent mode is enabled, the bot will save files directly to the default location without confirmation.</p>
|
|
<p>Before enabling silent mode, you need to set the default save location using the <code>/storage</code> command.</p></description></item><item><title>Storage Rules</title><link>https://sabot.unv.app/en/usage/rules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/rules/</guid><description><h1 id="storage-rules">
|
|
Storage Rules
|
|
<a class="anchor" href="#storage-rules">#</a>
|
|
</h1>
|
|
<p>Storage rules allow you to define redirection rules when the bot uploads files to storage, so that saved files are automatically organized.</p>
|
|
<p>See: <a href="https://github.com/krau/SaveAny-Bot/issues/28" target="_blank">#28</a></p>
|
|
<p>Currently supported rule types:</p>
|
|
<ol>
|
|
<li>FILENAME-REGEX</li>
|
|
<li>MESSAGE-REGEX</li>
|
|
<li>IS-ALBUM</li>
|
|
</ol>
|
|
<p>Basic syntax for adding rules:</p>
|
|
<p>&ldquo;RuleType RuleContent StorageName Path&rdquo;</p>
|
|
<p>Pay attention to spaces; the bot can only parse correctly formatted syntax. Below is an example of a valid rule command:</p>
|
|
<pre tabindex="0"><code>/rule add FILENAME-REGEX (?i)\.(mp4|mkv|ts|avi|flv)$ MyAlist /videos
|
|
</code></pre><p>In addition, if <code>CHOSEN</code> is used as the storage name in the rule, it means files will be stored under the path of the storage you selected by clicking the inline button.</p></description></item><item><title>Watch Chats</title><link>https://sabot.unv.app/en/usage/watch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/watch/</guid><description><h1 id="watch-chats">
|
|
Watch Chats
|
|
<a class="anchor" href="#watch-chats">#</a>
|
|
</h1>
|
|
<blockquote class="book-hint warning">
|
|
|
|
This feature requires enabling UserBot integration.
|
|
|
|
</blockquote>
|
|
|
|
<p>You can watch messages in a specific chat and automatically save them to the default storage, following storage rules. You can also add filters so that only matching messages are saved.</p>
|
|
<p>Watch a chat:</p>
|
|
<pre tabindex="0"><code>/watch &lt;chat_id/username&gt; [filter]
|
|
</code></pre><p>Stop watching:</p>
|
|
<pre tabindex="0"><code>/unwatch &lt;chat_id/username&gt;
|
|
</code></pre><p>Filter types:</p>
|
|
<h2 id="msgre">
|
|
msgre
|
|
<a class="anchor" href="#msgre">#</a>
|
|
</h2>
|
|
<p>Regex-match the message text. For example:</p>
|
|
<pre tabindex="0"><code>/watch 12345678 msgre:.*hello.*
|
|
</code></pre><p>This will watch the chat with ID <code>12345678</code>, and only save messages whose text contains <code>hello</code>.</p></description></item><item><title>Direct Download Links</title><link>https://sabot.unv.app/en/usage/directlinks/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/directlinks/</guid><description><h1 id="direct-download-links">
|
|
Direct Download Links
|
|
<a class="anchor" href="#direct-download-links">#</a>
|
|
</h1>
|
|
<p>Use the <code>/dl</code> command to directly download one or more HTTP/HTTPS files to storage.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/dl &lt;url1&gt; <span style="color:#f92672">[</span>url2<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>url3<span style="color:#f92672">]</span> ...
|
|
</span></span></code></pre></div><p>Examples:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/dl https://example.com/file.zip
|
|
</span></span><span style="display:flex;"><span>/dl https://example.com/file1.zip https://example.com/file2.zip
|
|
</span></span></code></pre></div><p>The bot will validate the link format and then ask you to select the target storage location.</p></description></item><item><title>Aria2 Download</title><link>https://sabot.unv.app/en/usage/aria2/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/aria2/</guid><description><h1 id="aria2-download">
|
|
Aria2 Download
|
|
<a class="anchor" href="#aria2-download">#</a>
|
|
</h1>
|
|
<blockquote class="book-hint warning">
|
|
|
|
This feature requires enabling Aria2 in the configuration file and configuring the RPC connection.
|
|
|
|
</blockquote>
|
|
|
|
<p>Use the <code>/aria2dl</code> command to download files via the Aria2 download manager, supporting HTTP/HTTPS, FTP, BitTorrent, and other protocols.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/aria2dl &lt;uri1&gt; <span style="color:#f92672">[</span>uri2<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>uri3<span style="color:#f92672">]</span> ...
|
|
</span></span></code></pre></div><p>Examples:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Download HTTP link</span>
|
|
</span></span><span style="display:flex;"><span>/aria2dl https://example.com/file.zip
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Download magnet link</span>
|
|
</span></span><span style="display:flex;"><span>/aria2dl magnet:?xt<span style="color:#f92672">=</span>urn:btih:...
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Download torrent file (need to upload .torrent file first)</span>
|
|
</span></span><span style="display:flex;"><span>/aria2dl https://example.com/file.torrent
|
|
</span></span></code></pre></div><p>Configure Aria2:</p></description></item><item><title>yt-dlp Video Download</title><link>https://sabot.unv.app/en/usage/ytdlp/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/ytdlp/</guid><description><h1 id="yt-dlp-video-download">
|
|
yt-dlp Video Download
|
|
<a class="anchor" href="#yt-dlp-video-download">#</a>
|
|
</h1>
|
|
<blockquote class="book-hint warning">
|
|
|
|
This feature requires the yt-dlp command-line tool installed on your system.
|
|
|
|
</blockquote>
|
|
|
|
<p>Use the <code>/ytdlp</code> command to download videos and audio from supported video websites, including YouTube, Bilibili, Twitter, and 1000+ other sites.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/ytdlp &lt;url1&gt; <span style="color:#f92672">[</span>url2<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>flags...<span style="color:#f92672">]</span>
|
|
</span></span></code></pre></div><p>Examples:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Basic download</span>
|
|
</span></span><span style="display:flex;"><span>/ytdlp https://www.youtube.com/watch?v<span style="color:#f92672">=</span>dQw4w9WgXcQ
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Download multiple videos</span>
|
|
</span></span><span style="display:flex;"><span>/ytdlp https://www.youtube.com/watch?v<span style="color:#f92672">=</span>video1 https://www.youtube.com/watch?v<span style="color:#f92672">=</span>video2
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Use custom parameters</span>
|
|
</span></span><span style="display:flex;"><span>/ytdlp https://www.youtube.com/watch?v<span style="color:#f92672">=</span>dQw4w9WgXcQ -f best
|
|
</span></span><span style="display:flex;"><span>/ytdlp https://www.youtube.com/watch?v<span style="color:#f92672">=</span>dQw4w9WgXcQ --extract-audio --audio-format mp3
|
|
</span></span></code></pre></div><p>Common parameters:</p></description></item><item><title>Storage Transfer</title><link>https://sabot.unv.app/en/usage/transfer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/transfer/</guid><description><h1 id="storage-transfer">
|
|
Storage Transfer
|
|
<a class="anchor" href="#storage-transfer">#</a>
|
|
</h1>
|
|
<p>Use the <code>/transfer</code> command to transfer files directly between different storages without going through Telegram.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/transfer &lt;source_storage&gt;:/&lt;source_path&gt; <span style="color:#f92672">[</span>filter<span style="color:#f92672">]</span>
|
|
</span></span></code></pre></div><p>Parameters:</p>
|
|
<ul>
|
|
<li><code>source_storage</code>: Source storage name</li>
|
|
<li><code>source_path</code>: Source path</li>
|
|
<li><code>filter</code>: Optional regex filter to transfer only matching files</li>
|
|
</ul>
|
|
<p>Examples:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Transfer entire directory</span>
|
|
</span></span><span style="display:flex;"><span>/transfer local1:/downloads
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Transfer files from specified path</span>
|
|
</span></span><span style="display:flex;"><span>/transfer alist1:/media/photos
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Transfer only mp4 files</span>
|
|
</span></span><span style="display:flex;"><span>/transfer webdav1:/videos <span style="color:#e6db74">&#34;.*\.mp4</span>$<span style="color:#e6db74">&#34;</span>
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Transfer image files</span>
|
|
</span></span><span style="display:flex;"><span>/transfer local1:/pictures <span style="color:#e6db74">&#34;(?i)\.(jpg|png|gif)</span>$<span style="color:#e6db74">&#34;</span>
|
|
</span></span></code></pre></div><p>The bot will:</p></description></item><item><title>Save Files Outside Telegram</title><link>https://sabot.unv.app/en/usage/parsers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/parsers/</guid><description><h1 id="save-files-outside-telegram">
|
|
Save Files Outside Telegram
|
|
<a class="anchor" href="#save-files-outside-telegram">#</a>
|
|
</h1>
|
|
<p>Besides files on Telegram, the bot can also save files from other websites via JavaScript plugins or built-in parsers.</p>
|
|
<blockquote>
|
|
<p>See the <a href="../contribute">Contributing Parsers</a> document for details.</p></blockquote>
|
|
<p>Just send links that match the requirements of a parser to the bot. Currently built-in parsers include:</p>
|
|
<ul>
|
|
<li>Twitter</li>
|
|
<li>Kemono</li>
|
|
</ul></description></item><item><title>File Naming & Conflict Strategies</title><link>https://sabot.unv.app/en/usage/config/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/config/</guid><description><h1 id="file-naming--conflict-strategies">
|
|
File Naming &amp; Conflict Strategies
|
|
<a class="anchor" href="#file-naming--conflict-strategies">#</a>
|
|
</h1>
|
|
<p>SaveAny-Bot lets you customize how saved files are named and how collisions with existing files are resolved, directly in Telegram via the <code>/config</code> and <code>/fnametmpl</code> commands.</p>
|
|
<h2 id="config--user-configuration">
|
|
<code>/config</code> — User Configuration
|
|
<a class="anchor" href="#config--user-configuration">#</a>
|
|
</h2>
|
|
<p>The <code>/config</code> command opens an inline menu where you can change two per-user settings:</p>
|
|
<ul>
|
|
<li><strong>Filename strategy</strong> — how the saved file is named</li>
|
|
<li><strong>Duplicate file strategy</strong> — what happens when a file with the same name already exists in the target storage</li>
|
|
</ul>
|
|
<p>Settings are stored per user and apply to all of that user&rsquo;s subsequent save/transfer tasks.</p></description></item><item><title>HTTP API</title><link>https://sabot.unv.app/en/usage/api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/api/</guid><description><h1 id="http-api">
|
|
HTTP API
|
|
<a class="anchor" href="#http-api">#</a>
|
|
</h1>
|
|
<p>SaveAny-Bot provides an HTTP API that allows you to programmatically create download/transfer tasks, query task status, cancel tasks, and more — without going through Telegram.</p>
|
|
<h2 id="enabling-the-api">
|
|
Enabling the API
|
|
<a class="anchor" href="#enabling-the-api">#</a>
|
|
</h2>
|
|
<p>Add or modify the following section in <code>config.toml</code>:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#a6e22e">api</span>]
|
|
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">enable</span> = <span style="color:#66d9ef">true</span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">host</span> = <span style="color:#e6db74">&#34;0.0.0.0&#34;</span> <span style="color:#75715e"># Bind address, default 0.0.0.0</span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">port</span> = <span style="color:#ae81ff">8080</span> <span style="color:#75715e"># Listen port, default 8080</span>
|
|
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">token</span> = <span style="color:#e6db74">&#34;your-token&#34;</span> <span style="color:#75715e"># Auth token — strongly recommended</span>
|
|
</span></span></code></pre></div><p>You can also override these settings with environment variables (prefix <code>SAVEANY_</code>):</p></description></item><item><title>CLI Subcommands</title><link>https://sabot.unv.app/en/usage/cli/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sabot.unv.app/en/usage/cli/</guid><description><h1 id="cli-subcommands">
|
|
CLI Subcommands
|
|
<a class="anchor" href="#cli-subcommands">#</a>
|
|
</h1>
|
|
<p>Besides running the Telegram bot with <code>./saveany-bot</code> (no subcommand), the binary exposes two helper subcommands for moving local files into a storage backend: <code>upload</code> (one-shot) and <code>watch</code> (continuous).</p>
|
|
<p>These subcommands load the same <code>config.toml</code> as the bot, initialize the database and caches, then perform their task. They do <strong>not</strong> start the Telegram bot itself, although storages of type <code>telegram</code> will spin up the bot client just for the upload.</p></description></item></channel></rss> |