A TUI application to send files to Telegram contacts directly from the command line.
- 📤 Send files to any Telegram contact
- 📁 Browse chat folders
- 🔐 Full authentication support (including 2FA)
- 🎨 Beautiful terminal user interface
- 🚀 Pure Go implementation (no external dependencies like TDLib)
- 🔒 API credentials embedded at build time
Go 1.21 or later is required.
The application requires Telegram API credentials to be embedded at build time.
-
Get your API credentials from https://my.telegram.org:
- Go to "API development tools"
- Create a new application if you don't have one
- Note down your
api_idandapi_hash
-
Create
.envfile from the example:
cp .env.example .env- Edit
.envwith your credentials:
API_ID=123456
API_HASH=your_api_hash_here- Build using Make:
make buildOr build manually:
source .env
go build -ldflags "-s -w -X 'sendtg/internal/config.apiID=${API_ID}' -X 'sendtg/internal/config.apiHash=${API_HASH}'" -o sendtg cmd/main.gosendtg <filename>For example:
sendtg document.pdf
sendtg ~/Downloads/photo.jpg- ↑/↓ - Navigate through chats
- ←/→ or Tab/Shift+Tab - Switch folders
- Enter - Send the file to the selected chat
- Esc - Clear search, cancel upload, or exit the application
sendtg/
├── cmd/
│ └── main.go # Application entry point
├── internal/
│ ├── config/ # Configuration handling
│ │ └── config.go
│ ├── domain/ # Domain layer (entities & interfaces)
│ │ ├── entity/
│ │ │ ├── auth_state.go
│ │ │ ├── chat.go
│ │ │ ├── contact.go
│ │ │ ├── file.go
│ │ │ └── folder.go
│ │ └── repository/
│ │ ├── auth_repository.go
│ │ ├── chat_repository.go
│ │ └── file_repository.go
│ ├── infrastructure/ # External dependencies
│ │ └── telegram/
│ │ ├── auth_repo.go
│ │ ├── authorizer.go
│ │ ├── chat_repo.go
│ │ ├── client.go
│ │ └── file_repo.go
│ ├── ui/ # TUI layer (bubbletea)
│ │ ├── app.go
│ │ ├── model.go
│ │ ├── state.go
│ │ └── styles.go
│ └── usecase/ # Application logic
│ ├── auth/
│ │ └── auth_usecase.go
│ ├── chat/
│ │ └── chat_usecase.go
│ └── file/
│ └── file_usecase.go
├── go.mod
├── go.sum
└── README.md
This project follows Clean Architecture principles:
- Domain Layer (
internal/domain/) - Contains business entities and repository interfaces - Use Case Layer (
internal/usecase/) - Contains application-specific business logic - Infrastructure Layer (
internal/infrastructure/) - Contains implementations for external services (Telegram) - Presentation Layer (
internal/ui/) - Contains the TUI implementation
MIT License