Skip to content

Commit 3bde14f

Browse files
committed
v0.3.0rc1: remove OLD_MORNING_COMPATIBLE setting
1 parent bbfa06a commit 3bde14f

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _🌈 おはよう! 🌈_
1818
<img src="https://img.shields.io/badge/nonebot2-2.0.0b3+-green">
1919
</a>
2020

21-
<a href="https://github.com/MinatoAquaCrews/nonebot_plugin_morning/releases/tag/v0.3.0a6">
21+
<a href="https://github.com/MinatoAquaCrews/nonebot_plugin_morning/releases/tag/v0.3.0rc1">
2222
<img src="https://img.shields.io/github/v/release/MinatoAquaCrews/nonebot_plugin_morning?color=orange&include_prereleases">
2323
</a>
2424

@@ -30,11 +30,11 @@ _🌈 おはよう! 🌈_
3030

3131
## 版本
3232

33-
v0.3.0a6
33+
v0.3.0rc1
3434

3535
⚠ 适配nonebot2-2.0.0beta.3+
3636

37-
[更新日志](https://github.com/MinatoAquaCrews/nonebot_plugin_morning/releases/tag/v0.3.0a6)
37+
[更新日志](https://github.com/MinatoAquaCrews/nonebot_plugin_morning/releases/tag/v0.3.0rc1)
3838

3939
## 安装
4040

@@ -44,7 +44,6 @@ v0.3.0a6
4444

4545
``` python
4646
MORNING_PATH="path-to-your-resource" # For example: ./my_data/morning_resource/
47-
OLD_MORNING_COMPATIBLE=false # 是否开启旧版数据文件自动更新,默认开启
4847
```
4948

5049
## 功能
@@ -95,9 +94,9 @@ v0.3.0a6
9594

9695
💥 `v0.3.0`新增更多的群组及个人早晚安信息!
9796

98-
4. **新增** 将自动更新`v0.2.x`的数据文件`data.json`为新版`morning.json`;将自动更新`v0.2.x`的配置文件`config.json`部分键值。启用配置`OLD_MORNING_COMPATIBLE`在插件初始化时,若不存在新版数据文件且存在旧版数据文件`data.json`,则更新数据字段、保留原始数据,否则创建空的新版数据文件。
97+
4. **新增** 将自动更新`v0.2.x`的数据文件`data.json`为新版`morning.json`;将自动更新`v0.2.x`的配置文件`config.json`部分键值。在插件初始化时,若不存在新版数据文件且存在旧版数据文件`data.json`,则更新数据字段、保留原始数据,否则创建空的新版数据文件。
9998

100-
⚠ 若存在新版数据文件`morning.json`则忽略配置选项`OLD_MORNING_COMPATIBLE`
99+
⚠ 若存在新版数据文件`morning.json`则不会重复更新
101100

102101
⚠ 自动检测配置文件`config.json`的部分键值是否为旧版并自动更新,后续版本将弃用该部分兼容
103102

nonebot_plugin_morning/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
require("nonebot_plugin_apscheduler")
1111
from nonebot_plugin_apscheduler import scheduler
1212

13-
__morning_version__ = "v0.3.0a6"
13+
__morning_version__ = "v0.3.0rc1"
1414
__morning_notes__ = f'''
1515
おはよう! {__morning_version__}
1616
[早安] 早安/哦哈哟/おはよう

nonebot_plugin_morning/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
class PluginConfig(BaseModel, extra=Extra.ignore):
99
morning_path: Path = Path(__file__).parent / "resource"
10-
old_morning_compatible: bool = True
1110

1211
mor_switcher: Dict[str, str] = {
1312
"时限": "morning_intime",
@@ -102,7 +101,7 @@ async def _() -> None:
102101
new_data_path: Path = morning_config.morning_path / "morning.json"
103102

104103
if not new_data_path.exists():
105-
if morning_config.old_morning_compatible and old_data_path.exists():
104+
if old_data_path.exists():
106105
with open(old_data_path, 'r', encoding='utf-8') as f:
107106
_d: Dict[str, Dict[str, Dict[str, int]]] = json.load(f)
108107
_nfile = morning_json_update(_d)
@@ -112,7 +111,9 @@ async def _() -> None:
112111
json.dump(_nfile, f, ensure_ascii=False, indent=4)
113112

114113
logger.info("旧版数据文件已自动更新至新版,后续可关闭 OLD_MORNING_COMPATIBLE 选项!")
115-
old_data_path.unlink()
114+
115+
old_data_path.unlink()
116+
116117
else:
117118
with open(new_data_path, 'w', encoding='utf-8') as f:
118119
json.dump(dict(), f, ensure_ascii=False, indent=4)

nonebot_plugin_morning/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def total_seconds2tuple_time(secs: int) -> Tuple[int, int, int, int]:
5454
def sleeptime_update(_lold: List[int], _sleep: timedelta) -> List[int]:
5555
'''
5656
Add a timedelta to another one
57+
- _lold: days, hrs, mins, secs
5758
'''
5859
t_old: timedelta = timedelta(days=_lold[0], hours=_lold[1], minutes=_lold[2], seconds=_lold[3])
5960
t_new: timedelta = t_old + _sleep

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nonebot-plugin-morning"
3-
version = "0.3.0a6"
3+
version = "0.3.0rc1"
44
description = "Good morning & good night!"
55
authors = ["KafCoppelia <k740677208@gmail.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)