A modern, React-based Telegram bot client built with TypeScript, shadcn/ui, and Vite. Previously converted from Vanilla JavaScript to provide better developer experience and maintainability.
- Modern React Architecture with TypeScript and hooks
- Multi-language Support (Vietnamese & English)
- Multi-chat interface with sidebar and message history
- Real-time messaging via Telegram Bot API polling with Grammy.js
- Media support for photos, videos, audio, documents, and stickers
- Inline message replies and message deletion
- Bot profile-based storage using localStorage with Zustand persistence
- Local notifications with visual toasts and browser notifications
- Responsive design with Tailwind CSS
- Modern UI Components powered by shadcn/ui and Radix UI
- CORS proxy support for API access
- Comprehensive Settings with tabbed configuration interface
- React 18 with TypeScript
- Vite for fast development and building
- shadcn/ui components built on Radix UI
- Tailwind CSS for styling
- Zustand for state management
- Grammy.js for Telegram Bot API
- Lucide React for icons
src/
├── main.tsx # Application entry point
├── index.html # HTML template
├── components/
│ ├── App.tsx # Main application component
│ ├── Sidebar.tsx # Chat list sidebar
│ ├── ChatArea.tsx # Main chat interface
│ ├── ChatList.tsx # Chat list with search
│ ├── InputArea.tsx # Message input area
│ ├── MessageList.tsx # Message display area
│ ├── SettingsDialog.tsx # Comprehensive settings
│ ├── ThemeProvider.tsx # Theme context provider
│ └── ui/ # shadcn/ui components
├── hooks/
│ └── useBotConnection.ts # Bot connection & polling
├── services/
│ └── botService.ts # Grammy.js bot service
├── store/
│ └── botStore.ts # Zustand state management
├── i18n/
│ ├── translations.ts # Translation definitions
│ └── useTranslation.ts # Translation hook
├── lib/
│ └── utils.ts # Utility functions
└── styles/
└── globals.css # Global styles & Tailwind
npm install
npm run devThis will start a development server with hot module reloading at http://localhost:5173.
npm run buildThe built application will be in the dist/ directory.
npm run previewPreview the production build locally.
- Get a Telegram Bot Token from BotFather
- Open the application and click the Settings icon in the sidebar
- Go to the "Connection" tab and enter your Bot Token
- Optionally add a CORS proxy prefix if needed for API access
- Click "Save & Connect" or "Test Connection"
- The bot will start polling for updates and display incoming messages
- Use the "Appearance" tab to switch themes (Light/Dark/System) and languages (Vietnamese/English)
- Bot Token: Stored in localStorage with Zustand persistence
- Chat History: Stored in localStorage, organized by chat ID
- Settings: Theme, language, and preferences persisted
- Update IDs: Tracked for polling continuity
- Bot Info: Cached for quick access
The application supports multiple languages:
- Vietnamese (vi): Default language with comprehensive translations
- English (en): Full English translation support
Language can be switched in Settings > Appearance > Language.
- Bot token configuration
- CORS proxy setup
- Connection testing
- Current bot information display
- Webhook deletion
- Data clearing
- Theme selection (Light/Dark/System)
- Language switching
- Real-time theme preview
- Auto-scroll behavior
- Notification sounds
- Push notifications
- Application preferences
- Version information
- Framework details
- Polling status
- Copyright information
The application uses Zustand for state management with the following features:
- Persistent Storage: Automatic localStorage persistence
- Type Safety: Full TypeScript support
- Chat Management: Efficient chat and message handling
- Settings Sync: Synchronized theme and language settings
- Connection State: Real-time connection status tracking
Built with Grammy.js for robust Telegram Bot API integration:
- Real-time Polling: Automatic message polling and processing
- File Handling: Support for all Telegram media types
- Error Handling: Comprehensive error management
- API Methods: Full support for Telegram Bot API methods
This project was migrated from Vanilla JavaScript to React while maintaining all original functionality. The migration includes:
- Modern component architecture
- Type safety with TypeScript
- Improved developer experience
- Better code organization
- Enhanced UI with shadcn/ui
- Comprehensive internationalization
This project is released under the GNU General Public License v3.0.