Metadata-Version: 2.4
Name: salim
Version: 1.11.0
Summary: Control your entire laptop from Telegram — screenshots, shell, files, processes, power, browser automation, SSH, vision AI, TTS, scheduler, QR, speed test, file watcher, and more.
Author: Salim Contributors
License: MIT
Project-URL: Homepage, https://github.com/salim/salim
Project-URL: Documentation, https://salim.dev/docs
Project-URL: Repository, https://github.com/salim/salim
Project-URL: Bug Tracker, https://github.com/salim/salim/issues
Keywords: telegram,bot,remote,desktop,control,automation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-telegram-bot[job-queue]>=21.0
Requires-Dist: psutil>=5.9
Requires-Dist: Pillow>=10.0
Requires-Dist: pyautogui>=0.9.54
Requires-Dist: pyperclip>=1.8
Requires-Dist: rich>=13.0
Requires-Dist: questionary>=2.0
Requires-Dist: cryptography>=41.0
Requires-Dist: httpx>=0.25
Requires-Dist: aiofiles>=23.0
Requires-Dist: python-dotenv>=1.0
Requires-Dist: openpyxl>=3.1
Requires-Dist: faster-whisper>=1.0
Requires-Dist: opencv-python-headless>=4.8
Requires-Dist: mss>=9.0
Requires-Dist: pynput>=1.7
Requires-Dist: gTTS>=2.4
Requires-Dist: pyttsx3>=2.90
Requires-Dist: asyncssh>=2.14
Requires-Dist: playwright>=1.40
Requires-Dist: pydub>=0.25
Requires-Dist: qrcode[pil]>=7.4
Requires-Dist: speedtest-cli>=2.1
Requires-Dist: watchdog>=4.0
Requires-Dist: pytz>=2024.1
Requires-Dist: python-magic>=0.4
Requires-Dist: paramiko>=3.4
Requires-Dist: pulsectl>=23.0
Requires-Dist: pycaw>=20240210; sys_platform == "win32"
Requires-Dist: sounddevice>=0.4.6
Provides-Extra: vision-offline
Requires-Dist: transformers>=4.40; extra == "vision-offline"
Requires-Dist: torch; extra == "vision-offline"
Provides-Extra: windows
Requires-Dist: pywin32>=306; extra == "windows"
Provides-Extra: barcode
Requires-Dist: python-barcode>=0.15; extra == "barcode"
Provides-Extra: qrread
Requires-Dist: pyzbar>=0.1.9; extra == "qrread"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Provides-Extra: all
Requires-Dist: transformers>=4.40; extra == "all"
Requires-Dist: torch; extra == "all"
Requires-Dist: python-barcode>=0.15; extra == "all"
Requires-Dist: pyzbar>=0.1.9; extra == "all"
Requires-Dist: pywin32>=306; sys_platform == "win32" and extra == "all"
Requires-Dist: plyer>=2.1; extra == "all"
Requires-Dist: Babel>=2.14; extra == "all"
Dynamic: license-file

# 🖥️ Salim — Control Your Laptop from Telegram

<p align="center">
  <strong>Type a message on your phone. Your laptop does it.</strong><br>
  Screenshots · Files · Shell · Volume · Apps · Mic · AI · SSH · Vision · TTS · Browser
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-3.9+-blue.svg">
  <img src="https://img.shields.io/badge/version-1.11.0-brightgreen.svg">
  <img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey">
  <img src="https://img.shields.io/badge/License-MIT-green.svg">
  <img src="https://img.shields.io/badge/AI-NVIDIA%20%7C%20Groq%20%7C%20Z.AI-orange">
</p>

---

## 🤔 What Is This?

Salim turns your laptop into a bot you can control from **anywhere in the world** using Telegram.

Left your laptop at home? Need to grab a file? Want to check if it's overheating? Need to mute the volume?

**Just text your bot. It does it.**

```
You:    "open chrome"
Salim:  🚀 Launched Google Chrome

You:    "mute the volume"
Salim:  🔇 Muted

You:    "find my day 3 recording"
Salim:  🔍 Found 3 results:
        1️⃣ 🎬 Day3_recording.mp4 — ~/Videos — 2.1 GB
           [⬇️ Send]  [🚀 Open]  [▶️ Play]  [🗑️ Del]

You:    "record 20 seconds of audio"
Salim:  🎙️ Recording 20s... → sends voice message inline
```

---

## ⚡ Get Started in 3 Minutes

### Step 1 — Install

```bash
pip install salim
```

**That's it.** All dependencies install automatically after this one command.

### Step 2 — Setup

```bash
salim setup
```

Wizard asks you for:
1. A Telegram bot token from **@BotFather** (takes 30 seconds)
2. Your Telegram user ID (find it at **@userinfobot**)
3. Optional: free AI API keys (NVIDIA / Groq / Z.AI)

### Step 3 — Start

```bash
salim start
```

Open Telegram → find your bot → send `/start` → you're in control.

---

## 🤖 AI Mode — Just Type Naturally

| You type | Salim does |
|---|---|
| `open spotify` | Launches Spotify |
| `mute` | Mutes volume |
| `set volume to 60` | Sets volume to 60% |
| `find my day 3 video` | Searches laptop, shows file buttons |
| `take a screenshot` | Sends screenshot |
| `how's my battery` | Reports battery level |
| `record 30 seconds of audio` | Records mic, sends voice message |
| `open youtube` | Opens YouTube in browser |
| `create a resume` | Generates Word document |
| `what's running` | Lists active processes |
| `shutdown` | Confirms then shuts down |

---

## 📋 Full Command Reference

Every command is also listed in Telegram's **/** menu — tap `/` to see them all.

### 🖥️ System
```
/info           Full system overview
/cpu            CPU usage & cores
/mem            RAM usage
/disk           Disk space
/battery        Battery level & status
/network        Network info & IP
/uptime         System uptime
/top            Live resource monitor
/ps [name]      List processes
/kill <pid>     Kill a process
```

### 💻 Shell
```
/run <cmd>           Run shell command
/runbg <cmd>         Run in background
/pipe <cmd>          Pipe command
/env                 Environment variables
/which <prog>        Find executable path
/cron <sched> <cmd>  Add cron job
/cronjobs            List cron jobs
/cronstop <id>       Remove cron job
```

### 📂 Files
```
/ls [path]           List directory
/cd <path>           Change directory
/pwd                 Current directory
/cat <file>          Read file contents
/stat <file>         File info & size
/find <pattern>      Find files
/grep <pattern>      Search text in files
/mkdir <name>        Create folder
/rm <path>           Delete file/folder
/mv <src> <dst>      Move/rename
/cp <src> <dst>      Copy file
/write <file> <txt>  Write to file
/download <path>     Send file to Telegram
/upload              Receive file from Telegram
/zip <path>          Create zip
/unzip <file>        Extract zip
```

### 📸 Screen & Input
```
/screenshot [delay]      Take screenshot
/ss                      Quick screenshot
/stream [interval] [s]   Live screen stream
/streamstop              Stop stream
/type <text>             Type on keyboard
/key <shortcut>          Press key (e.g. ctrl+c)
/click <x> <y>           Mouse click
/scroll <n>              Scroll up/down
/move <x> <y>            Move mouse
/mousepos                Get mouse position
/brightness <0-100>      Screen brightness
```

### 🚀 Open App / File / URL
```
/open chrome             → Launches Google Chrome
/open spotify            → Launches Spotify
/open terminal           → Opens Terminal
/open ~/file.pdf         → Opens with default viewer
/open https://x.com      → Opens in browser
```
All common apps supported: `chrome firefox safari brave edge vscode spotify discord slack zoom telegram vlc obs gimp terminal steam` and more.

### 🔊 Volume Control
```
/volume           Show current volume with progress bar
/volume 75        Set to 75%
/volume up        Increase 10%
/volume down      Decrease 10%
/volume mute      Mute
/volume unmute    Unmute
/volume toggle    Toggle mute on/off
```
Uses **pulsectl** (Linux), **osascript** (macOS), **pycaw** (Windows).

### 📋 Clipboard
```
/paste            Read clipboard (text or image)
/copy <text>      Copy text to clipboard
/copyphoto        Reply to photo → copies it to clipboard
```

### 🎙️ Microphone Recording
```
/mic              Record 10 seconds (default)
/mic 30           Record 30 seconds
/mic 60           Record 60 seconds (max 120)
/mictest          List available microphone devices
```
Sends as an **inline voice message** that plays in Telegram. Uses PyAudio → WAV → OGG Opus via ffmpeg.

### 🗣️ Text-to-Speech
```
/tts <text>         Speak text aloud on laptop
/say <text>         Same as /tts
/tts_lang <code>    Set language (en, ar, fr, ...)
/tts_speed <0.5-2>  Set speed
/tts_engine         Switch online/offline engine
/tts_voice          List/set voices
```

### 🌐 Browser Automation (Playwright)
```
/browse <url>              Open URL + send screenshot
/browse_click <selector>   Click CSS selector or text
/browse_type <sel> <text>  Type in form field
/browse_scroll [direction] Scroll page
/browse_js <code>          Run JavaScript
/browse_back               Navigate back
/browse_get <url>          Fetch page HTML
/browse_close              Close browser session
```

### 🔌 SSH Remote Control
```
/ssh_add <alias> <user@host> [port]   Register host
/ssh <alias> <command>                Run remote command
/ssh_list                             List hosts
/ssh_remove <alias>                   Remove host
/ssh_upload <alias> <local> <remote>  Upload file
/ssh_download <alias> <remote_path>   Download file
```

### 👁️ Vision AI
```
Send any photo → ask questions about it:
"what error is shown?" / "read this text" / "what app is open?"

/vision             Status & instructions
/vision on          Auto-describe all photos
/askvision <q>      Ask about last photo
```

### 📷 Camera & Recording
```
/cam              Webcam snapshot
/cam list         List cameras
/record <secs>    Screen recording
```

### 🔔 Alerts
```
/alert add cpu > 80       Alert when CPU > 80%
/alert add mem > 90       Alert when RAM > 90%
/alert add battery < 20   Alert when battery < 20%
/alert list               List alerts
/alert del <id>           Remove alert
```

### 📄 Document Writer
```
/doc resume         AI-generated resume (.docx)
/doc invoice        Invoice spreadsheet (.xlsx)
/doc cover letter   Cover letter (.docx)
/doc budget         Budget spreadsheet (.xlsx)
/doc report         Business report (.docx)
/doc memo           Office memo (.docx)
```

### 🧑‍💻 AI Code Runner
```
/code build a Python script that renames files in a folder
/code create a Flask API with user authentication
```
AI writes code → runs it → sends output + file.

### 🛡️ Security Guard
```
/guard on              Arm intrusion detection
/guard off             Disarm
/guard status          Show status
/guard grace <secs>    Set grace period
```
When armed: detects movement/input → takes screenshot + webcam photo → sends alert to Telegram.

### 🔋 Power
```
/shutdown    Shutdown (with confirmation)
/restart     Restart (with confirmation)
/sleep       Sleep/suspend
/hibernate   Hibernate
/lock        Lock screen
/logout      Logout
```

### ⏰ Scheduler
```
/at 14:30 <command>         Run at specific time
/every 30 min <command>     Repeat every N minutes
/every 1 hour df -h         Disk report every hour
/jobs                       List scheduled jobs
/jobcancel <id>             Cancel a job
```

### 📱 QR Code
```
/qr <text|url>    Generate QR code image
/qrread           Read QR code from photo you send
```

### 🌐 Speed Test
```
/speedtest        Download / upload / ping test
```

### 👁 File Watcher
```
/watch <path>     Watch file/folder for any changes
/watchlist        List active watchers
/watchstop <id>   Stop a watcher
```

### 📝 Notes
```
/note <text>    Save a quick note
/notes          List all notes
/notedel <id>   Delete a note
/noteclear      Clear all notes
```

### ⚙️ Bot Management
```
/status     Bot & system status
/config     View/edit settings
/logs [n]   Last N command logs
/history    AI conversation history
/uploads    Upload history
/voicestatus Voice transcription status
```

---

## 🔍 Smart File Search

Type **"find my day 3 recording"** or **"download the invoice"** — Salim:

1. Extracts keywords using AI
2. Searches your **entire laptop** (all folders)
3. Shows results with **action buttons per file**:

```
🔍 Found 2 results:

1️⃣ 🎬 Day3_Recording.mp4
   📁 ~/Videos/Course
   💾 2.1 GB · 3 days ago
   [⬇️ Send]  [🚀 Open]  [▶️ Play]  [🗑️ Del]

2️⃣ 📄 day3_notes.txt
   📁 ~/Documents
   💾 4.2 KB · 3 days ago
   [⬇️ Send]  [🚀 Open]  [👁️ Read]  [🗑️ Del]
```

- **⬇️ Send** — downloads file to Telegram
- **🚀 Open** — opens file on laptop with default app
- **▶️ Play** — plays video/audio in media player
- **👁️ Read** — shows text file contents in chat
- **🗑️ Del** — deletes with confirmation

---

## 🎙️ Voice Commands

Send a **voice note** → Salim transcribes it offline → executes it as a command.

- No internet needed for transcription (faster-whisper, runs on CPU)
- No API key needed
- Model downloaded once (~150MB) on first use
- Supports auto-detection of 50+ languages

---

## 🚀 Running as a Service

### Linux (systemd — recommended)
```bash
sudo tee /etc/systemd/system/salim.service << EOF
[Unit]
Description=Salim Telegram Bot
After=network.target

[Service]
User=$USER
ExecStart=$(which salim) start --no-banner
Restart=always
RestartSec=5
Environment=DISPLAY=:0

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable salim
sudo systemctl start salim
```

### macOS (launchd)
```bash
cat > ~/Library/LaunchAgents/com.salim.bot.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>com.salim.bot</string>
  <key>ProgramArguments</key>
  <array>
    <string>$(which salim)</string>
    <string>start</string>
    <string>--no-banner</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
</dict>
</plist>
EOF
launchctl load ~/Library/LaunchAgents/com.salim.bot.plist
```

---

## 📦 Dependencies

All installed automatically. You never need to run a second pip command.

**Auto-installed system libs if missing:**
- `ffmpeg` — for audio/video (`sudo apt install ffmpeg` or `brew install ffmpeg`)
- `portaudio19-dev` — for microphone on Linux (`sudo apt install portaudio19-dev`)

---

## 🔒 Security

- Only your Telegram user ID can control the bot
- Config stored in `~/.salim/config.env` (mode 600)
- All commands logged to `~/.salim/audit.log`
- Destructive actions (shutdown, delete, kill) require inline confirmation
- Bot token never sent anywhere except Telegram API

---

## 🆘 Troubleshooting

**Volume not working (Linux):**
```bash
pip install pulsectl
pulseaudio --check   # ensure PulseAudio is running
```

**Mic not working:**
```bash
sudo apt install portaudio19-dev   # Linux
pip install PyAudio
# Or: pip install sounddevice
/mictest   # list devices in Telegram
```

**App not opening:**
```bash
which google-chrome   # check it's installed
# Then: /open chrome
```

**Playwright browser missing:**
```bash
python -m playwright install chromium
```

**Bot not responding:**
```bash
salim status    # check config
salim test      # test Telegram connection
```

---

## 📜 License

MIT License — see [LICENSE](LICENSE)
