1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2026-04-26 22:39:51 +08:00

fix: 修复中文定时关机无法识别的BUG (#510)

Co-authored-by: sj13112442872 <891771212@qq.com>
This commit is contained in:
13112442872
2025-07-04 11:05:57 +08:00
committed by GitHub
parent f4377069ad
commit 06de73e8ed

View File

@@ -1170,7 +1170,12 @@ class XiaoMusic:
# 定时关机
async def stop_after_minute(self, did="", arg1=0, **kwargs):
minute = int(arg1)
try:
# 尝试转换中文数字
minute = chinese_to_number(str(arg1))
except (KeyError, ValueError):
# 如果中文数字转换失败,尝试阿拉伯数字
minute = int(arg1)
return await self.devices[did].stop_after_minute(minute)
# 添加歌曲到收藏列表