Skip to content

s3r1msultan/telecli

Repository files navigation

TeleCLI - Telegram Terminal Client

A terminal-based Telegram client built with Rust using the grammers library.

Features

  • 📱 MTProto protocol implementation (official Telegram API)
  • 🖥️ Terminal User Interface (TUI) with ratatui
  • 💾 SQLite session storage
  • 🔐 Two-factor authentication support (WIP)
  • 📜 Chat listing and message viewing
  • ✉️ Message sending

Prerequisites

1. Get Telegram API Credentials

Before using this client, you need to obtain API credentials from Telegram:

  1. Visit https://my.telegram.org/auth
  2. Log in with your phone number
  3. Go to "API development tools"
  4. Create a new application
  5. Note your API ID and API Hash

2. Install Rust

Make sure you have Rust installed. Visit https://rustup.rs/ or run:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Installation

From Source

# Clone the repository
git clone <repository-url>
cd telecli

# Build the project
cargo build --release

# Binary will be at: target/release/telecli

Pre-built Binaries

Download pre-built binaries from the Releases page:

  • Linux: telecli-<version>-x86_64-unknown-linux-gnu.tar.gz (64-bit)
  • Linux ARM64: telecli-<version>-aarch64-unknown-linux-gnu.tar.gz
  • macOS Intel: telecli-<version>-x86_64-apple-darwin.tar.gz
  • macOS Apple Silicon: telecli-<version>-aarch64-apple-darwin.tar.gz
  • Windows: telecli-<version>-x86_64-pc-windows-msvc.zip

Using cargo install

cargo install telecli

Cross-Platform Builds

Build for Your Current Platform

cargo build --release

Build for Other Platforms

The project includes a helper script for cross-compilation:

# Install cross (required for cross-compilation)
cargo install cross

# Build for all supported targets
./scripts/build-release.sh

# Build for a specific target
./scripts/build-release.sh x86_64-unknown-linux-gnu

Supported targets:

  • x86_64-unknown-linux-gnu - Linux 64-bit
  • aarch64-unknown-linux-gnu - Linux ARM64
  • x86_64-apple-darwin - macOS Intel
  • aarch64-apple-darwin - macOS Apple Silicon
  • x86_64-pc-windows-gnu - Windows 64-bit

Built binaries will be placed in the releases/ directory.

Configuration

On first run, the application will create a configuration file at:

  • Linux: ~/.config/telecli/config.toml
  • macOS: ~/Library/Application Support/telecli/config.toml
  • Windows: %APPDATA%\telecli\config.toml

Edit the configuration file with your API credentials:

api_id = 123456  # Your API ID from my.telegram.org
api_hash = "your_api_hash_here"
session_path = null  # null uses default location

Usage

# Run the TUI interface
cargo run

# Run with verbose logging
RUST_LOG=debug cargo run

TUI Controls

  • q - Quit
  • ↑/k - Navigate up in chat list
  • ↓/j - Navigate down in chat list
  • r - Refresh chats
  • Type to input messages (WIP)

Project Structure

telecli/
├── src/
│   ├── main.rs      # Application entry point
│   ├── cli.rs       # CLI argument parsing
│   ├── config.rs    # Configuration management
│   ├── error.rs     # Error types
│   ├── telegram.rs  # Telegram client wrapper
│   └── tui.rs       # Terminal UI implementation
├── Cargo.toml       # Dependencies and project metadata
└── README.md        # This file

Dependencies

  • grammers-client - High-level Telegram MTProto client
  • grammers-session - Session storage (SQLite)
  • tokio - Async runtime
  • ratatui - Terminal UI framework
  • crossterm - Cross-platform terminal manipulation
  • clap - Command-line argument parsing

Development

# Run in debug mode
cargo run

# Run with logging
RUST_LOG=telecli=debug cargo run

# Build release
cargo build --release

# Run tests
cargo test

Limitations

This is a work-in-progress project. Current limitations include:

  • Two-factor authentication flow needs improvement
  • Message input/sending in TUI is incomplete
  • No media file support yet
  • Limited error handling for edge cases

License

MIT License

Acknowledgments

  • grammers - Excellent Telegram MTProto client library
  • ratatui - Terminal UI library

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors