{"_id":"@dieugene/kak-dela-bot","name":"@dieugene/kak-dela-bot","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"dependencies":{"@dialogai/dialog-class":"^1.5.20","@dialogai/user-controller":"^1.1.5","@dieugene/callbacks":"^1.0.7","@dieugene/key-object-db":"^1.3.13","@dieugene/logger":"^1.0.3","@dieugene/queuer":"^1.0.6","@dieugene/sessions":"^1.0.2","@dieugene/social-graph":"^1.0.0","@dieugene/tg-messages-cache":"^1.0.11","@dieugene/utils":"^1.14.0","@dieugene/voicer":"^1.0.1","@dieugene/ydb":"^1.3.28","@langchain/community":"^0.3.5","@langchain/core":"^0.3.37","@langchain/langgraph":"0.0.29","@langchain/openai":"^0.4.2","fuse.js":"^7.1.0","telegraf":"^4.15.3","zod":"^3.23.8"},"description":"This repository contains a template for creating Telegram bots with a robust architecture and extensive feature set. It's designed to be a foundation for building various types of Telegram bots with AI capabilities, user management, and advanced dialog ha","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Eugene Ditkovsky"},"license":"ISC","version":"1.0.0","name":"@dieugene/kak-dela-bot","devDependencies":{},"_id":"@dieugene/kak-dela-bot@1.0.0","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-U1AzgQ4WO4r7S1JQtjLiERuLkY2022EUDcxaWpLO037gNBjJxkOJdHnlR34GlALEuNrp7KTDphG2NTgzAdackg==","shasum":"7b43672b37de7d869e1943b5d281d65a895bb78b","tarball":"https://registry.npmjs.org/@dieugene/kak-dela-bot/-/kak-dela-bot-1.0.0.tgz","fileCount":16,"unpackedSize":83544,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDlMMw7Sq3pvQPo6NvPNfQongE8gtgW8axMEvGnGx2YCwIhAPuKZoUMLLF0Litq9bURK5ps8LgZPlT+/Zvywkc+Ywe9"}]},"_npmUser":{"name":"di.eugene","email":"ditkovsky.eugene@gmail.com"},"directories":{},"maintainers":[{"name":"di.eugene","email":"ditkovsky.eugene@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kak-dela-bot_1.0.0_1748437036937_0.6254572899156052"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-28T12:57:16.937Z","1.0.0":"2025-05-28T12:57:17.136Z","modified":"2025-05-28T12:57:17.881Z"},"maintainers":[{"name":"di.eugene","email":"ditkovsky.eugene@gmail.com"}],"description":"This repository contains a template for creating Telegram bots with a robust architecture and extensive feature set. It's designed to be a foundation for building various types of Telegram bots with AI capabilities, user management, and advanced dialog ha","author":{"name":"Eugene Ditkovsky"},"license":"ISC","readme":"# Template Telegram Bot\r\n\r\nThis repository contains a template for creating Telegram bots with a robust architecture and extensive feature set. It's designed to be a foundation for building various types of Telegram bots with AI capabilities, user management, and advanced dialog handling.\r\n\r\n## 🚀 Features\r\n\r\n### Core Functionality\r\n- **Dialog Management**: Built-in dialog system using `@dialogai/dialog-class`\r\n- **User Management**: Comprehensive user control system via `@dialogai/user-controller`\r\n- **AI Integration**: LangChain integration for AI/LLM capabilities\r\n- **Database Support**: YDB (Yandex Database) integration\r\n- **File Handling**: Support for various file types (documents, photos, audio, video)\r\n- **Voice Message Processing**: Built-in voice message recognition\r\n- **Session Management**: Advanced session handling and cleanup\r\n- **Error Handling**: Comprehensive error management system\r\n- **Admin Functions**: Built-in administrative capabilities\r\n- **Onboarding**: Customizable onboarding flow\r\n- **Queue System**: Support for queues and timers\r\n- **Logging**: Integrated logging system\r\n\r\n### Technical Stack\r\n- **Runtime**: Node.js\r\n- **Telegram API**: Telegraf library\r\n- **Dialog System**: `@dialogai/dialog-class` - for building dialogs\r\n- **User Management**: `@dialogai/user-controller` - for user data management (get_user_data, set_user_data)\r\n- **Database**: \r\n  - `@dieugene/key-object-db` or `@dieugene/ydb` - for storing profiles and events\r\n- **Utilities**:\r\n  - `@dieugene/utils` - for link generation and command parsing\r\n  - `@dieugene/sessions` - for session management\r\n  - `@dieugene/tg-messages-cache` - for message caching\r\n  - `@dieugene/callbacks` - for inline button handling\r\n- **AI/LLM**: `@langchain/openai` - for AI-powered features\r\n- **Additional Tools**: QR code generation (`qrcode` npm package)\r\n\r\n## 📋 Data Structure\r\n\r\n### Identifiers and Timestamps\r\n- All string identifiers use UUID format\r\n- Timestamps (`created_on`) are stored as Unix time\r\n- Dates are stored in ISO date format\r\n\r\n## 🔧 Implementation Guidelines\r\n\r\n### Dialog Implementation\r\nThe template uses `@dialogai/dialog-class` for building natural conversations. This module provides:\r\n- Dialog state management\r\n- Natural conversation flow\r\n- Integration with message caching and sessions\r\n\r\n### User Management\r\nThe template uses `@dialogai/user-controller` for user data management with basic operations:\r\n- `get_user_data` - retrieve user information\r\n- `set_user_data` - store user information\r\n\r\n### File Handling\r\nThe template supports file handling through Telegram's API with:\r\n- Document upload and processing\r\n- Photo handling\r\n- Audio and video message support\r\n- Voice message recognition\r\n\r\n### Inline Buttons\r\nThe template uses `@dieugene/callbacks` for handling inline buttons:\r\n- Registration of callback functions\r\n- Parameter passing through callbacks\r\n- Callback lifecycle management\r\n\r\n### Database Usage\r\nThe template supports two database options:\r\n- `@dieugene/key-object-db` - for key-object storage\r\n- `@dieugene/ydb` - for Yandex Database integration\r\n\r\n## 🛠️ Getting Started\r\n\r\n1. Clone the repository\r\n2. Install dependencies:\r\n   ```bash\r\n   npm install\r\n   ```\r\n3. Configure environment variables\r\n4. Set up your database connection\r\n5. Start the bot:\r\n   ```bash\r\n   npm start\r\n   ```\r\n\r\n## 📦 Module Integration\r\n\r\n### Career Dialog Bot Integration\r\nThe template is compatible with `@dieugene/career-dialog-bot` for file handling:\r\n- Uses the same architectural components\r\n- Supports resume and portfolio management\r\n- Implements file processing workflows\r\n\r\n### File Processing Workflow\r\n1. Handle file uploads through Telegram events\r\n2. Store file metadata in user database\r\n3. Process files as needed (e.g., resume parsing)\r\n4. Manage file access and updates\r\n\r\n## 🔐 Security Considerations\r\n\r\n1. Never expose API keys in the code\r\n2. Implement proper user authentication\r\n3. Validate all user inputs\r\n4. Use secure session management\r\n5. Implement rate limiting where necessary\r\n\r\n## 📝 Best Practices\r\n\r\n1. Always use UUID for identifiers\r\n2. Implement proper error handling\r\n3. Use the built-in logging system\r\n4. Follow the established dialog patterns\r\n5. Implement proper session cleanup\r\n6. Use the callback system for inline buttons\r\n7. Maintain proper database indexing\r\n\r\n## 🤝 Contributing\r\n\r\n1. Fork the repository\r\n2. Create your feature branch\r\n3. Commit your changes\r\n4. Push to the branch\r\n5. Create a Pull Request\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details. ","readmeFilename":"README.md","_rev":"1-e966d4a3cdf30d7fcc363136199d8c00"}