Skip to content

TimoZhou1024/Dev-Cheatsheet-Daily

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Cheatsheet Daily

Let developers subscribe to tech stacks they care about in Discord and receive daily "master-at-a-glance" cheat sheet cards + small examples

An intelligent Discord Bot that helps developers manage and receive tech stack cheat sheets, making learning and referencing technical documentation more convenient.

✨ Features

  • 🔔 Subscription Management: Use commands like /stack add rust to subscribe to tech stacks you care about
  • 📅 Scheduled Delivery: Automatically push cheat sheets to DM daily at specified times
  • 🎨 Beautiful Cards: Render Markdown cheat sheets into easy-to-read image formats
  • Instant Query: Use /cheat <tech_stack> to get the latest cheat sheets immediately
  • 🌍 Multi-language Support: Support for multiple languages and timezone settings
  • 🔄 Smart Caching: Automatically cache and update cheat sheet content
  • 🤖 AI Examples: Optional LLM-generated code examples

🚀 Quick Start

1. Environment Setup

Using uv (Recommended - Faster and more reliable):

# Clone the project
git clone https://github.com/your-username/Dev-Cheatsheet-Daily.git
cd Dev-Cheatsheet-Daily

# Install uv (if not already installed)
# On Windows:
# winget install astral-software.uv
# Or visit: https://docs.astral.sh/uv/getting-started/installation/

# Create virtual environment and install dependencies
uv sync

# Copy environment configuration
cp .env.example .env

Using pip (Traditional method):

# Clone the project
git clone https://github.com/your-username/Dev-Cheatsheet-Daily.git
cd Dev-Cheatsheet-Daily

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Copy environment configuration
cp .env.example .env

2. Configuration Setup

Edit the .env file and fill in the necessary configuration:

# Discord Bot Token (Required)
DISCORD_TOKEN=your_discord_bot_token_here

# OpenAI API Key (Optional, for generating examples)
OPENAI_API_KEY=your_openai_api_key_here

# Other configurations
DATABASE_URL=sqlite:///bot.db
DEBUG=true

3. Start the Bot

Using uv:

# Direct run
uv run python main.py

# Or use the provided scripts
# Windows:
.\run.bat

# Linux/macOS:
./run.sh

Using pip:

# Activate virtual environment first
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Run the bot
python main.py

📱 Usage Guide

Basic Commands

Command Description
/stack add <lang> Subscribe to tech stack
/stack remove <lang> Unsubscribe
/stack list View subscription list
/cheat <lang> Get cheat sheet immediately
/daily time <HH:MM> Set delivery time
/daily timezone <tz> Set timezone
/daily info View delivery settings

Admin Commands

Command Description
/status View Bot runtime status
/cache clear [stack] Clear cache

Usage Examples

# Subscribe to Rust tech stack
/stack add rust

# Set daily delivery at 9 AM
/daily time 09:00

# Get Python cheat sheet immediately
/cheat python

# View current subscriptions
/stack list

🏗️ 项目结构

Dev-Cheatsheet-Daily/
├── src/
│   ├── bot.py              # 主 Bot 类
│   ├── config.py           # 配置管理
│   ├── models/
│   │   └── database.py     # 数据库模型
│   ├── cogs/               # Discord 命令组
│   │   ├── stack_commands.py
│   │   ├── cheat_commands.py
│   │   ├── daily_commands.py
│   │   └── admin_commands.py
│   ├── services/           # 核心服务
│   │   ├── cheatsheet_loader.py
│   │   ├── image_renderer.py
│   │   └── scheduler.py
│   └── utils/              # 工具函数
├── cache/                  # 缓存目录
├── cheatsheets/           # 本地速查表
├── main.py                # 启动入口
├── requirements.txt       # 依赖列表
└── README.md

🔧 技术栈

  • 框架: nextcord (Discord.py v2)
  • 数据库: SQLModel + SQLite
  • 网络请求: httpx
  • HTML 解析: BeautifulSoup4
  • 图片生成: Pillow + Rich
  • 任务调度: APScheduler
  • AI 集成: OpenAI GPT (可选)

📈 开发路线图

Day 1 ✅

  • 项目初始化和基础结构
  • 数据库模型设计
  • Discord Bot 连接
  • 基本命令框架

Day 2 (进行中)

  • Cheatsheet 加载器
  • 图片渲染功能
  • /stack 命令组实现

Day 3 (计划中)

  • /cheat 即时查询
  • 图片生成和发送
  • 错误处理优化

Day 4 (计划中)

  • APScheduler 集成
  • 每日推送功能
  • 用户时区处理

Day 5 (计划中)

  • LLM 示例生成
  • 管理员功能
  • 性能优化和日志

🤝 贡献指南

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

🙏 致谢

  • devhints.io - 提供优质的技术速查表
  • nextcord - 强大的 Discord API 库
  • Discord 开发者社区的支持和反馈

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages