Bridging curiosity and confidence β one fact at a time.
A Telegram bot that transforms learning into daily habit. Born from a simple realization: people don't lack intelligence, they just lack access to everyday learning.
During a casual hangout game, a friend admitted she couldn't answer basic general knowledge questions. She felt embarrassed, not because she wasn't intelligent, but because she'd never had consistent access to learning.
That moment sparked an idea: What if learning could be as easy as checking your phone?
Knowledge Drop is the answer β a friendly Telegram bot that delivers fascinating facts across themes like history, nature, countries, and African heritage. No pressure, no tests, just pure discovery.
- 5 curated themes: Countries, Nature, History, Africa Focus, Origins
- 300+ hand-crafted facts with emoji-rich formatting
- Random Mix mode for daily surprises
- Daily streaks β track your learning consistency
- Achievement badges β earn rewards for milestones
- Leaderboards β compete with friends (facts viewed, streaks, saves)
- Save favorites β bookmark facts for later
- Test your knowledge with multiple-choice questions
- Track quiz performance over time
- Compete on quiz leaderboards
- Daily fact reminders at your preferred time
- Timezone-aware scheduling (24 timezones supported)
- Opt-in/opt-out anytime
- User engagement metrics
- Theme popularity insights
- Active user tracking
- Deep-dive into individual user stats
- Generate Instagram-ready fact cards
- Customizable themes and colors
- One-tap social sharing
- Node.js 18+ (Download)
- MongoDB Atlas account (Sign up free)
- Telegram Bot Token from @BotFather
# Clone the repository
git clone https://github.com/successdanesy/knowledge-drop-bot.git
cd knowledge-drop-bot
# Install dependencies
npm install
# Create environment file
cp .env.example .envEdit .env with your credentials:
# Telegram Bot Token from @BotFather
BOT_TOKEN=your_telegram_bot_token
# MongoDB Atlas connection string
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/knowledge-drop
# Admin Telegram User IDs (comma-separated, no spaces)
ADMIN_IDS=123456789,987654321
# Optional: Port for health checks (default: 8080)
PORT=8080
# Optional: Environment
NODE_ENV=production# Development mode (auto-restart on changes)
npm run dev
# Production mode
npm startVisit your bot on Telegram and send /start to begin! π
# Install Fly CLI
curl -L https://fly.io/install.sh | sh
# Login to Fly
fly auth login
# Launch (follow prompts)
fly launch
# Set secrets
fly secrets set BOT_TOKEN="your_token"
fly secrets set MONGODB_URI="your_mongo_uri"
fly secrets set ADMIN_IDS="your_telegram_id"
# Deploy
fly deployHealth Check URL: https://your-app.fly.dev/health
- Connect your GitHub repository
- Select Worker service type
- Add environment variables in dashboard
- Deploy automatically on push
# Install Railway CLI
npm i -g @railway/cli
# Login
railway login
# Initialize
railway init
# Add environment variables
railway variables set BOT_TOKEN="your_token"
railway variables set MONGODB_URI="your_mongo_uri"
railway variables set ADMIN_IDS="your_telegram_id"
# Deploy
railway up| Command | Description |
|---|---|
/start |
Launch bot and see theme menu |
/saved |
View your saved facts |
/stats |
See your personal statistics |
/leaderboard |
Global and themed leaderboards |
/share |
Generate shareable fact cards |
/analytics |
Admin-only dashboard |
- Choose a theme from the menu
- Read the fact (drop β expand β CTA)
- Save favorites, Share with friends, or Next for more
- Build your streak by returning daily!
- Tap π Notifications in the main menu
- Select your preferred time (00:00 - 23:00)
- Receive a daily fact at your chosen time
- Disable anytime with π Disable Notifications
knowledge-drop-bot/
βββ data/ # Fact JSON files
β βββ africa_focus.json
β βββ countries.json
β βββ history.json
β βββ nature.json
β βββ origins.json
βββ src/
β βββ bot.js # Main entry point
β βββ database/
β β βββ connection.js # MongoDB setup
β β βββ userSchema.js # User data model
β βββ handlers/ # Command handlers
β β βββ analyticsHandler.js
β β βββ callbackHandler.js
β β βββ factHandler.js
β β βββ leaderboardHandler.js
β β βββ notificationHandler.js
β β βββ quizHandler.js
β β βββ shareCardHandler.js
β β βββ startHandler.js
β βββ services/ # Business logic
β β βββ analyticsService.js
β β βββ factService.js
β β βββ leaderboardService.js
β β βββ notificationScheduler.js
β β βββ notificationService.js
β β βββ quizService.js
β β βββ shareCardService.js
β β βββ streakService.js
β β βββ userService.js
β βββ utils/ # Helpers
β βββ constants.js
β βββ formatters.js
βββ .env # Environment variables
βββ .gitignore
βββ dockerfile # Docker config
βββ fly.toml # Fly.io config
βββ package.json
βββ README.md
Add new themes by creating JSON files in data/:
[
{
"drop": "Short teaser fact here π",
"hook": "Tap to see more...",
"expand": "Full explanation with context and details...",
"cta": "Would you explore this? β",
"share_text": "Quick shareable version. π\nTap to see..."
}
]Update src/services/factService.js to load your theme:
const themes = {
// ... existing themes
your_theme: JSON.parse(fs.readFileSync("./data/your_theme.json"))
};Edit cron timing in src/services/notificationScheduler.js:
// Check every minute (default)
cron.schedule("*/1 * * * *", async () => { ... });
// Alternative: Check every 5 minutes
cron.schedule("*/5 * * * *", async () => { ... });Add new achievements in src/services/streakService.js:
// Example: "Power User" badge for 200 facts viewed
if (user.stats.factsViewed >= 200 && !user.badges?.includes("power_user")) {
newBadges.push("power_user");
}{
telegramId: Number, // Unique Telegram ID
username: String, // Telegram username
firstName: String, // Display name
savedFacts: [{
themeId: String,
factText: String,
savedAt: Date
}],
preferences: {
favoriteTheme: String, // Default theme
notificationsEnabled: Boolean,
dailyNotificationTime: String, // "HH:MM" format
timezone: String // e.g., "Africa/Lagos"
},
stats: {
factsViewed: Number,
factsSaved: Number,
currentStreak: Number, // Consecutive days
longestStreak: Number,
lastViewedDate: Date,
lastNotificationSent: Date
},
badges: [String], // Achievement IDs
quizStats: {
totalQuizzes: Number,
totalScore: Number,
bestScore: Number,
averageScore: Number,
recentScores: [{ score, totalQuestions, percentage, theme, date }]
},
createdAt: Date,
updatedAt: Date
}We welcome contributions! Here's how:
- 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
- Follow existing code style (ES6 modules, async/await)
- Add JSDoc comments for new functions
- Test thoroughly before submitting
- Update README if adding new features
# Check if bot is running
curl https://your-app.fly.dev/health
# View logs
fly logs --app your-app-name
# Restart bot
fly restart --app your-app-name- Verify your IP is whitelisted in MongoDB Atlas
- Check connection string format:
mongodb+srv://... - Ensure credentials are URL-encoded
Add to src/bot.js:
bot.on("polling_error", (error) => {
if (error.code === "ETELEGRAM") return; // Ignore timeout errors
console.error("Polling error:", error);
});- Inspired by a friend's curiosity and courage to learn
- Built with β€οΈ for anyone who believes learning should be accessible
- Special thanks to the open-source community for tools that made this possible
- Questions: Open a discussion on GitHub
- Email: successdanesy@gmail.com
- Core fact delivery system
- User stats and streaks
- Leaderboards (facts, streaks, saves)
- Daily notifications
- Admin analytics dashboard
- Quiz mode with scoring
- Beautiful share cards
- Web dashboard for fact management
- Multi-language support
- Audio fact narration
- Community-contributed facts
Made with β€οΈ by [Success] β Because everyone deserves to feel smart.