Metadata-Version: 2.4
Name: nonebot-plugin-class-schedule
Version: 1.0.5
Summary: NoneBot2 course schedule plugin with queries, imports, reminders, and holiday checks
Author: INKT-love
License-Expression: MIT
Project-URL: Homepage, https://github.com/INKT-love/nonebot-plugin-class-schedule
Project-URL: Repository, https://github.com/INKT-love/nonebot-plugin-class-schedule
Project-URL: Issues, https://github.com/INKT-love/nonebot-plugin-class-schedule/issues
Keywords: nonebot,nonebot2,class,schedule,course
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nonebot2>=2.0.0
Requires-Dist: nonebot-adapter-onebot>=2.0.0
Requires-Dist: nonebot-plugin-localstore>=0.7.0
Provides-Extra: image
Requires-Dist: nonebot-plugin-htmlrender>=0.2.0; extra == "image"
Provides-Extra: reminder
Requires-Dist: nonebot-plugin-apscheduler>=0.2.0; extra == "reminder"
Provides-Extra: all
Requires-Dist: nonebot-plugin-htmlrender>=0.2.0; extra == "all"
Requires-Dist: nonebot-plugin-apscheduler>=0.2.0; extra == "all"
Dynamic: license-file

# nonebot-plugin-class-schedule

适用于 NoneBot2 + OneBot V11 的课程表插件，支持课程查询、课表导入、作息表导入、课前提醒、节假日识别和文字/图片输出。

## 功能

- 实时查询：`/现在什么课`、`/等会什么课`
- 每日查询：`/今天什么课`、`/明天什么课`、`/周一` 到 `/周日`
- 汇总查询：`/本周课表`、`/第几周`、`/我的课表`
- 数据导入：`/导入课表`、`/导入作息表`、`/确认导入`、`/确认导入作息`
- 提醒功能：`/课前提醒`、`/假期订阅`
- 其他：`/查课 <课目>`、`/放假没`、`/课表风格`

## 安装

推荐使用 NB-CLI 安装：

```bash
nb plugin install nonebot-plugin-class-schedule
```

也可以使用 pip 安装基础版：

```bash
pip install nonebot-plugin-class-schedule
```

如果需要图片输出：

```bash
pip install "nonebot-plugin-class-schedule[image]"
```

如果需要课前提醒和假期订阅：

```bash
pip install "nonebot-plugin-class-schedule[reminder]"
```

全部功能：

```bash
pip install "nonebot-plugin-class-schedule[all]"
```

## 加载插件

如果使用 NB-CLI 安装，通常会自动写入项目配置。

手动安装时，推荐在 `pyproject.toml` 中配置：

```toml
[tool.nonebot]
plugins = ["nonebot_plugin_class_schedule"]
```

也可以在自定义入口中手动加载：

```python
nonebot.load_plugin("nonebot_plugin_class_schedule")
```

## 数据存储

插件默认使用 `nonebot-plugin-localstore` 保存用户数据，不会把课程表写入插件安装目录。

你也可以在 `.env` 中指定数据目录：

```env
CLASS_SCHEDULE_DATA_DIR=/path/to/class_schedule_data
```

数据文件包括：

- `schedules/{qq_user_id}.json`：用户课程表
- `preferences.json`：输出风格、提醒设置、作息表等用户偏好

## 配置项

| 配置名 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| `CLASS_SCHEDULE_DATA_DIR` | `str | Path | None` | `None` | 自定义课程表数据目录；不填时使用 `nonebot-plugin-localstore`。 |

## 常用命令

| 命令 | 功能 |
| --- | --- |
| `/课程表帮助` | 查看帮助 |
| `/现在什么课` | 查询当前课程状态 |
| `/等会什么课` | 查询下一节课和倒计时 |
| `/今天什么课` 或 `/课表` | 查询今日课表 |
| `/明天什么课` | 查询明日课表 |
| `/周一` 到 `/周日` | 查询指定星期课表 |
| `/本周课表` | 查询本周概览 |
| `/第几周` | 查询当前教学周 |
| `/我的课表` | 查看完整课表 |
| `/查课 <课目>` | 搜索今天的某门课 |
| `/导入课表` | 进入课表导入流程 |
| `/导入作息表` | 进入作息表导入流程 |
| `/课表风格 文字` | 切换为文字输出 |
| `/课表风格 图片` | 切换为图片输出，需要 image 额外依赖 |
| `/课前提醒 开/关` | 开关课前提醒，需要 reminder 额外依赖 |
| `/假期订阅 开/关` | 开关假期提醒，需要 reminder 额外依赖 |
| `/放假没` | 查询今天是否节假日或补班 |

## 导入课表

发送 `/导入课表` 后，按提示发送课程内容：

```text
周一：
早读 英语（李老师）
第1节 数学 @A201
第2节 物理(王老师)
第3节 化学
晚自习 语文

周二：
第1节 英语
第2节 数学
```

支持：

- 星期：`周一`、`星期一`、`周一：`
- 节次：`早读`、`第1节`、`第一节`、`1节`、`晚自习`
- 老师：`(老师名)` 或 `（老师名）`
- 地点：`@地点` 或 `#地点`

解析完成后发送 `/确认导入` 保存，或 `/取消导入` 放弃。

## 导入作息表

发送 `/导入作息表` 后，按提示发送作息时间：

```text
早读 07:00-07:30
第1节 08:00-08:45
第2节 08:55-09:40
午休 12:00-14:00
第5节 14:00-14:45
晚自习 18:20-21:00
```

解析完成后发送 `/确认导入作息` 保存，或 `/取消导入作息` 放弃。

## 提醒

课前提醒：

```text
/课前提醒 开
/课前提醒 关
/课前提醒 提前5分钟
```

假期订阅：

```text
/假期订阅 开
/假期订阅 关
```

提醒功能依赖 `nonebot-plugin-apscheduler`。如果没有安装，查询和导入功能仍可正常使用。

## License

MIT
