$npx -y skills add himself65/finance-skills --skill telegram-readerRead Telegram channels and groups for financial news and market research using tdl (read-only). Use this skill whenever the user wants to read Telegram channels, export messages from financial Telegram groups, list their Telegram chats, search for news in Telegram channels, or ga
| 1 | # Telegram News Skill (Read-Only) |
| 2 | |
| 3 | Reads Telegram channels and groups for financial news and market research using [tdl](https://github.com/iyear/tdl), a Telegram CLI tool. |
| 4 | |
| 5 | **This skill is read-only.** It is designed for financial research: reading channel messages, monitoring financial news channels, and exporting message history. It does NOT support sending messages, joining/leaving channels, or any write operations. |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## Step 1: Ensure tdl Is Installed |
| 10 | |
| 11 | **Current environment status:** |
| 12 | |
| 13 | ``` |
| 14 | !`(command -v tdl && tdl version 2>&1 | head -3 || echo "TDL_NOT_INSTALLED") 2>/dev/null` |
| 15 | ``` |
| 16 | |
| 17 | If the status above shows a version number, tdl is installed — skip to Step 2. |
| 18 | |
| 19 | If `TDL_NOT_INSTALLED`, install tdl based on the user's platform: |
| 20 | |
| 21 | | Platform | Install Command | |
| 22 | |----------|----------------| |
| 23 | | macOS / Linux | `curl -sSL https://docs.iyear.me/tdl/install.sh \| sudo bash` | |
| 24 | | macOS (Homebrew) | `brew install telegram-downloader` | |
| 25 | | Linux (Termux) | `pkg install tdl` | |
| 26 | | Linux (AUR) | `yay -S tdl` | |
| 27 | | Linux (Nix) | `nix-env -iA nixos.tdl` | |
| 28 | | Go (any platform) | `go install github.com/iyear/tdl@latest` | |
| 29 | |
| 30 | Ask the user which installation method they prefer. Default to Homebrew on macOS, curl script on Linux. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## Step 2: Ensure tdl Is Authenticated |
| 35 | |
| 36 | **Current auth status:** |
| 37 | |
| 38 | ``` |
| 39 | !`(tdl chat ls --limit 1 2>&1 >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED") 2>/dev/null` |
| 40 | ``` |
| 41 | |
| 42 | If `AUTH_OK`, skip to Step 3. |
| 43 | |
| 44 | If `AUTH_NEEDED`, guide the user through login. **Login requires interactive input** — the user must enter their phone number and verification code manually. |
| 45 | |
| 46 | ### Login methods |
| 47 | |
| 48 | **Method A: QR Code (recommended — fastest)** |
| 49 | |
| 50 | ```bash |
| 51 | tdl login -T qr |
| 52 | ``` |
| 53 | |
| 54 | A QR code will be displayed in the terminal. The user scans it with their Telegram mobile app (Settings > Devices > Link Desktop Device). |
| 55 | |
| 56 | **Method B: Phone + Code** |
| 57 | |
| 58 | ```bash |
| 59 | tdl login -T code |
| 60 | ``` |
| 61 | |
| 62 | The user enters their phone number, then the verification code sent to their Telegram app. |
| 63 | |
| 64 | **Method C: Import from Telegram Desktop** |
| 65 | |
| 66 | If the user has Telegram Desktop installed and logged in: |
| 67 | |
| 68 | ```bash |
| 69 | tdl login |
| 70 | ``` |
| 71 | |
| 72 | This imports the session from the existing desktop client. The desktop client must be from the [official website](https://desktop.telegram.org/), NOT from the App Store or Microsoft Store. |
| 73 | |
| 74 | ### Namespaces |
| 75 | |
| 76 | By default, tdl uses a `default` namespace. To manage multiple accounts: |
| 77 | |
| 78 | ```bash |
| 79 | tdl login -n work -T qr # Login to "work" namespace |
| 80 | tdl chat ls -n work # Use "work" namespace for commands |
| 81 | ``` |
| 82 | |
| 83 | ### Important login notes |
| 84 | |
| 85 | - Login is a **one-time** operation. The session persists on disk after successful login. |
| 86 | - If login fails, ask the user to check their internet connection and try again. |
| 87 | - **Never ask for or handle Telegram passwords/2FA codes programmatically** — always let the user enter them interactively. |
| 88 | |
| 89 | --- |
| 90 | |
| 91 | ## Step 3: Identify What the User Needs |
| 92 | |
| 93 | Match the user's request to one of the read operations below. |
| 94 | |
| 95 | | User Request | Command | Key Flags | |
| 96 | |---|---|---| |
| 97 | | List all chats/channels | `tdl chat ls` | `-o json`, `-f "FILTER"` | |
| 98 | | List only channels | `tdl chat ls -f "Type contains 'channel'"` | `-o json` | |
| 99 | | Export recent messages | `tdl chat export -c CHAT -T last -i N` | `--all`, `--with-content` | |
| 100 | | Export messages by time range | `tdl chat export -c CHAT -T time -i START,END` | `--all`, `--with-content` | |
| 101 | | Export messages by ID range | `tdl chat export -c CHAT -T id -i FROM,TO` | `--all`, `--with-content` | |
| 102 | | Export from a topic/thread | `tdl chat export -c CHAT --topic TOPIC_ID` | `--all`, `--with-content` | |
| 103 | | Search for a channel by name | `tdl chat ls -f "VisibleName contains 'NAME'"` | `-o json` | |
| 104 | |
| 105 | ### Chat identifiers |
| 106 | |
| 107 | The `-c` flag accepts multiple formats: |
| 108 | |
| 109 | | Format | Example | |
| 110 | |--------|---------| |
| 111 | | Username (with @) | `-c @channel_name` | |
| 112 | | Username (without @) | `-c channel_name` | |
| 113 | | Numeric chat ID | `-c 123456789` | |
| 114 | | Public link | `-c https://t.me/channel_name` | |
| 115 | | Phone number | `-c "+1 123456789"` | |
| 116 | | Saved Messages | `-c ""` (empty) | |
| 117 | |
| 118 | --- |
| 119 | |
| 120 | ## Step 4: Execute the Command |
| 121 | |
| 122 | ### Listing chats |
| 123 | |
| 124 | ```bash |
| 125 | # List all chats |
| 126 | tdl chat ls |
| 127 | |
| 128 | # JSON output for processing |
| 129 | tdl chat ls -o json |
| 130 | |
| 131 | # |