<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Guide on tgs</title><link>https://garenal1v3.github.io/tgs-cli/guide/</link><description>Recent content in Guide on tgs</description><generator>Hugo</generator><language>en</language><atom:link href="https://garenal1v3.github.io/tgs-cli/guide/index.xml" rel="self" type="application/rss+xml"/><item><title>Profiles</title><link>https://garenal1v3.github.io/tgs-cli/guide/profiles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://garenal1v3.github.io/tgs-cli/guide/profiles/</guid><description>&lt;h1 id="profiles"&gt;Profiles&lt;a class="anchor" href="#profiles"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;tgs supports multiple Telegram accounts through profiles — similar to how AWS CLI handles credentials. Each profile has its own independent session stored in a separate database file.&lt;/p&gt;
&lt;h2 id="how-profile-resolution-works"&gt;How Profile Resolution Works&lt;a class="anchor" href="#how-profile-resolution-works"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you run any tgs command, the active profile is determined by this priority chain (highest wins):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;--profile&lt;/code&gt; flag passed to the command&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TGS_PROFILE&lt;/code&gt; environment variable&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.tgs.yaml&lt;/code&gt; file in the current directory or any parent directory&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;default&amp;quot;&lt;/code&gt; (fallback)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="per-directory-profiles"&gt;Per-Directory Profiles&lt;a class="anchor" href="#per-directory-profiles"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can bind a profile to a directory by creating a &lt;code&gt;.tgs.yaml&lt;/code&gt; file. Use &lt;code&gt;tgs profile switch&lt;/code&gt; to do this automatically:&lt;/p&gt;</description></item><item><title>Search</title><link>https://garenal1v3.github.io/tgs-cli/guide/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://garenal1v3.github.io/tgs-cli/guide/search/</guid><description>&lt;h1 id="search"&gt;Search&lt;a class="anchor" href="#search"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;tgs provides four search subcommands that map directly to Telegram&amp;rsquo;s MTProto search methods. All output is JSON, making it straightforward to pipe into &lt;code&gt;jq&lt;/code&gt;, feed to an AI agent, or process programmatically.&lt;/p&gt;
&lt;h2 id="searching-in-a-chat"&gt;Searching in a Chat&lt;a class="anchor" href="#searching-in-a-chat"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The most common operation: search for messages within a specific chat.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tgs search messages &lt;span style="color:#98c379"&gt;&amp;#34;docker compose&amp;#34;&lt;/span&gt; -c @devops_notes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The query argument is required. The &lt;code&gt;-c&lt;/code&gt; / &lt;code&gt;--chat&lt;/code&gt; flag specifies which chat to search. See &lt;a href="#chat-resolution"&gt;Chat Resolution&lt;/a&gt; below for all supported formats.&lt;/p&gt;</description></item><item><title>Sources</title><link>https://garenal1v3.github.io/tgs-cli/guide/sources/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://garenal1v3.github.io/tgs-cli/guide/sources/</guid><description>&lt;h1 id="sources"&gt;Sources&lt;a class="anchor" href="#sources"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;tgs sources&lt;/code&gt; lets you enumerate and inspect the Telegram dialogs in your account — channels, supergroups, groups, users, and bots. All output is JSON, ready to pipe into &lt;code&gt;jq&lt;/code&gt; or feed to an AI agent.&lt;/p&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;&lt;strong&gt;Piping to &lt;code&gt;jq&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;tgs&lt;/code&gt; writes diagnostic logs (&lt;code&gt;[tgs] retry: …&lt;/code&gt;, &lt;code&gt;[tgs] FLOOD_WAIT: …&lt;/code&gt;) to &lt;strong&gt;stderr&lt;/strong&gt; and JSON to &lt;strong&gt;stdout&lt;/strong&gt;. When piping into &lt;code&gt;jq&lt;/code&gt;, drop stderr to keep the parser happy:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tgs sources list --with-stats 2&amp;gt;/dev/null | jq &lt;span style="color:#98c379"&gt;&amp;#39;.sources[].title&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Avoid &lt;code&gt;2&amp;gt;&amp;amp;1 | jq …&lt;/code&gt; — that mixes log lines into stdout and breaks JSON parsing.&lt;/p&gt;</description></item></channel></rss>