The Ultimate Accountability Bot - Track habits, build streaks, and achieve your goals!
- Weekday-only tracking (Monday-Friday focus)
- Empty day logging support (
/logwithout activities still counts!) - Double letter activities (KK40, MM15, etc.)
- Real-time message editing with automatic stats updates
- Smart private messaging with group chat fallback
- 6-tier level system (Beginner โ Legend)
- Achievement badges for streaks, milestones, and consistency
- Monthly challenges with special recognition
- Streak tracking with consecutive day counting
- Personal goals with weekly targets and progress tracking
- Bulk editing (
/edit yesterday M20 S30) - Activity templates for common combinations
- Multi-week history with detailed analytics
- Data export functionality
- Custom activity definitions
- Calendar view with visual activity indicators
- Sunday 18:00: Weekly celebration with leader boards
- Sunday evening: Private weekly breakdowns
- Weekdays 21:00: Optional daily reminders
- Intelligent help system for unrecognized messages
- Python 3.8+
- A Telegram Bot Token (Get one from @BotFather)
-
Clone the repository
git clone https://github.com/yourusername/telegram-accountability-bot.git cd telegram-accountability-bot -
Install dependencies
pip install python-telegram-bot pytz
-
Set up your bot token
# Create token file mkdir -p ~/bin/telegram_bot_robert echo "YOUR_BOT_TOKEN_HERE" > ~/bin/telegram_bot_robert/token
-
Run the bot
python3 telegram_bot_robert.py
/log M20 S30 # Log 20 min meditation, 30 min sport
/log KK40 # Log 40 units of kickboxing (double letters supported)
/log # Log empty day (counts for attendance!)
/status # View current week progress
/help # Complete command guide/history # Last 4 weeks of activity
/history 8 # Last 8 weeks
/analytics # Personal insights and trends
/level # Check level and achievements
/calendar # Visual monthly calendar/goals # View current weekly goals
/goals set M 100 # Set 100 units of M per week
/define M Meditation # Define what activity codes mean
/reminder on/off # Toggle 21:00 daily reminders/edit yesterday M30 S20 # Edit past activities
/template save morning M20 S30 # Save activity templates
/template use morning # Use saved template
/export # Export your data- Database: JSON-based local storage with automatic backups
- Timezone: Configurable (default: Europe/Helsinki)
- Scheduling: Built-in job queue for automated messages
- Error Handling: Comprehensive logging and graceful recovery
- Beginner ๐ฑ (0-49 points)
- Explorer ๐ (50-149 points)
- Achiever โญ (150-299 points)
- Champion ๐ (300-499 points)
- Master ๐ (500-749 points)
- Legend ๐ (750+ points)
- Streak Badges: 7, 14, 30+ day streaks
- Unit Milestones: 100, 500, 1000+ total units
- Monthly Awards: Consistency, Variety, Powerhouse
- Special Recognition: Early Bird, First Month Warrior
- Sunday 18:00: Weekly celebration with stats and leader board
- Sunday evening: Individual weekly breakdown (private message)
- Monday 08:00: New week motivation message
- Weekdays 21:00: Daily reminders (if enabled and not logged)
Update the TOKEN_FILE_PATH in the script:
TOKEN_FILE_PATH = "/path/to/your/token/file"TIMEZONE = pytz.timezone('Your/Timezone') # e.g., 'America/New_York'Update admin username for backup commands:
if user.username != "your_admin_username":telegram_bot_robert/
โโโ telegram_bot_robert.py # Main bot file
โโโ accountability_db.json # Database (auto-created)
โโโ backup_YYYYMMDD_HHMMSS.json # Automatic backups
โโโ README.md # This file
โโโ requirements.txt # Python dependencies
โโโ DEPLOYMENT_GUIDE.md # Detailed deployment guide
โโโ IMPLEMENTATION_STATUS.md # Development progress
โโโ FEATURE_CHECKLIST.md # Feature selection guide
-
"Token file not found"
- Ensure the token file exists and contains only your bot token
- Check file permissions
-
"Database corruption"
- Bot automatically restores from backup
- Manual restore: copy a backup file to
accountability_db.json
-
"Private messages not working"
- Users must start a conversation with the bot first
- Bot gracefully falls back to group messages
Logs are written to console with INFO level. For debugging:
logging.basicConfig(level=logging.DEBUG)Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
{
"users": {
"user_id": {
"username": "string",
"joined_date": "ISO_date",
"activity_totals": {"M": 100, "S": 200},
"current_streak": 5,
"longest_streak": 12,
"achievements": ["streak_7", "total_100"],
"goals": {"M": 100},
"templates": {"morning": "M20 S30"}
}
},
"weekly_logs": {
"2024-W01": {
"user_id": {
"logs": {"2024-1-1": {"M": 20, "S": 30}},
"missed_days": []
}
}
}
}- All data stored locally in JSON format
- No external API calls except to Telegram
- User data never shared or transmitted
- Automatic backup system with rotation
- Graceful error handling prevents data loss
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with python-telegram-bot
- Timezone handling by pytz
- Inspired by the accountability and habit-tracking community
Need help? Check out:
- Deployment Guide for setup instructions
- Implementation Status for feature details
- Open an issue for bugs or feature requests
Made with โค๏ธ for the accountability community
"Small steps every day lead to big changes every year!" ๐