{"id":39778211,"url":"https://github.com/pooryas98/habit_trackerbot","last_synced_at":"2026-01-18T12:00:45.059Z","repository":{"id":323379091,"uuid":"956264443","full_name":"pooryas98/Habit_TrackerBot","owner":"pooryas98","description":"A feature-rich, asynchronous Telegram bot for tracking daily habits. Built with Python, python-telegram-bot, and a modern, testable architecture. Includes reminders, stats, and history.","archived":false,"fork":false,"pushed_at":"2025-11-09T19:13:45.000Z","size":206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-09T21:13:20.815Z","etag":null,"topics":["aiosqlite","asyncio","bot","habit-tracker","portfolio-project","pydantic","python","sqlite","telegram-bot","todo-app"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pooryas98.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-28T00:59:00.000Z","updated_at":"2025-11-09T19:13:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pooryas98/Habit_TrackerBot","commit_stats":null,"previous_names":["pooryas98/habit_trackerbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/pooryas98/Habit_TrackerBot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pooryas98%2FHabit_TrackerBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pooryas98%2FHabit_TrackerBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pooryas98%2FHabit_TrackerBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pooryas98%2FHabit_TrackerBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pooryas98","download_url":"https://codeload.github.com/pooryas98/Habit_TrackerBot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pooryas98%2FHabit_TrackerBot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiosqlite","asyncio","bot","habit-tracker","portfolio-project","pydantic","python","sqlite","telegram-bot","todo-app"],"created_at":"2026-01-18T12:00:18.571Z","updated_at":"2026-01-18T12:00:44.993Z","avatar_url":"https://github.com/pooryas98.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Habit Tracker Bot\n\nA feature-rich Telegram bot built with Python and the python-telegram-bot library that helps users track and manage their daily habits with reminders and analytics.\n\n## 🌟 Features\n\n- **Habit Management**: Add, edit, and delete habits\n- **Progress Tracking**: Mark habits as done, pending, or skipped\n- **Daily View**: View today's habits with completion status\n- **History**: Browse habit completion history with pagination\n- **Statistics**: Detailed analytics including completion rates and streaks\n- **Reminders**: Customizable daily reminders for habits\n- **Membership Check**: Optional channel membership verification\n- **Multi-user Support**: Each user manages their own habits independently\n\n## 🛠️ Tech Stack\n\n- **Python 3.10+**\n- **python-telegram-bot** (v22.5 with JobQueue)\n- **aiosqlite** (async SQLite interface)\n- **Pydantic** (v2.x for configuration management)\n- **Pydantic Settings** (for environment configuration)\n- **APScheduler** (for reminder scheduling)\n\n## 🚀 Installation\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/pooryas98/Habit_TrackerBot.git\n   cd Habit_TrackerBot\n   ```\n\n2. **Create a virtual environment:**\n   ```bash\n   python -m venv .venv\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   ```\n\n3. **Install dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. **Set up environment variables:**\n   - Copy `.env.example` to `.env`:\n     ```bash\n     cp .env.example .env\n     ```\n   - Edit `.env` and add your bot token and other configuration\n\n## ⚙️ Configuration\n\nThe bot uses Pydantic Settings for configuration management. All parameters are loaded from environment variables:\n\n### Required:\n- `BOT_TOKEN`: Your Telegram bot token from @BotFather\n\n### Optional:\n- `DATABASE_FILE`: Path to SQLite database file (default: `habits_data.db`)\n- `USER_TIMEZONE`: User timezone for scheduling (default: `UTC`, e.g., `America/New_York`)\n- `LOG_LEVEL`: Logging level (default: `INFO`)\n- `RESET_DB_ON_START`: Set to `1` to reset database on startup (default: `0`)\n- `DEVELOPER_CHAT_ID`: Chat ID for receiving error notifications (optional)\n- `REQUIRED_CHANNEL_IDS`: Comma-separated list of required channels for access (optional)\n- `CHANNEL_MEMBERSHIP_CACHE_TTL`: Cache TTL in seconds for membership checks (default: `300`)\n\n## 🏃‍♂️ Running the Bot\n\n```bash\npython main.py\n```\n\nThe bot will connect to Telegram and start processing messages.\n\n## 🤖 Available Commands\n\n### Core Commands\n- `/start` - Welcome message and initial setup\n- `/help` - Show help information and available commands\n\n### Habit Management\n- `/add_habit` - Add a new habit\n- `/edit_habit` - Edit an existing habit\n- `/delete_habit` - Delete a habit and all related data\n\n### Tracking \u0026 Reporting\n- `/today` - View today's habits and mark them as done\n- `/done [habit_name]` - Mark a specific habit as done\n- `/history` - View habit completion history\n- `/stats` - View habit completion statistics\n\n### Reminders\n- `/set_reminder` - Set daily reminders for a habit\n- `/manage_reminders` - View and manage active reminders\n\n### Other\n- `/refresh_membership` - Refresh channel membership status (if channel lock is enabled)\n- `/cancel` - Cancel ongoing conversations\n\n## 🏗️ Architecture\n\n### Database Layer\n- **DatabaseService**: Central service for all database operations with dependency injection\n- **Optimized queries**: Single-query approach for fetching habit statuses\n- **SQLite**: Local database with WAL mode for better concurrency\n\n### Configuration\n- **Pydantic Settings**: Robust configuration management with validation\n- **Environment variables**: Secure configuration loading from `.env`\n\n### Structure\n```\nhabit-tracker-bot/\n├── main.py                 # Entry point\n├── config.py              # Configuration management\n├── database/              # Database layer\n│   ├── service.py         # DatabaseService class\n│   └── connection.py      # Connection management\n├── bot/                   # Bot application lifecycle\n├── handlers/              # Command handlers\n│   ├── common/            # Shared functionality\n│   ├── habits/            # Habit management\n│   ├── tracking/          # Habit tracking\n│   └── reminders/         # Reminder management\n├── scheduling/            # Reminder scheduling\n├── utils/                 # Utilities and helpers\n└── requirements.txt       # Dependencies\n```\n\n## 🧪 Testing\n\nTo run tests (Comimg soon!)\n\n## 🔒 Security\n\n- Environment variables for sensitive configuration\n- Input validation through Pydantic\n- Proper error handling and logging\n- Optional channel membership verification\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Add tests if applicable\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## 📞 Support\n\nIf you encounter any issues or have questions, please open an issue in the repository.\n\n## 🙏 Acknowledgments\n\n- [python-telegram-bot](https://python-telegram-bot.org/) for the excellent Telegram bot framework\n- [Pydantic](https://pydantic.dev/) for configuration management\n- All contributors who help maintain and improve this project","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpooryas98%2Fhabit_trackerbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpooryas98%2Fhabit_trackerbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpooryas98%2Fhabit_trackerbot/lists"}