nonebot-plugin-maimaidx 2.0.2__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/PKG-INFO +3 -3
  2. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/README.md +2 -2
  3. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_alias.py +7 -8
  4. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_score.py +2 -2
  5. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_search.py +10 -16
  6. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_music.py +3 -3
  7. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx.egg-info/PKG-INFO +3 -3
  8. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/pyproject.toml +1 -1
  9. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/LICENSE +0 -0
  10. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/__init__.py +0 -0
  11. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/__init__.py +0 -0
  12. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_base.py +0 -0
  13. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_guess.py +0 -0
  14. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/command/mai_table.py +0 -0
  15. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/config.py +0 -0
  16. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/image.py +0 -0
  17. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_api_data.py +0 -0
  18. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_best_50.py +0 -0
  19. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_error.py +0 -0
  20. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_model.py +0 -0
  21. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_music_info.py +0 -0
  22. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_player_score.py +0 -0
  23. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/maimaidx_update_plate.py +0 -0
  24. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/libraries/tool.py +0 -0
  25. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx/maimaidxhelp.png +0 -0
  26. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx.egg-info/SOURCES.txt +0 -0
  27. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx.egg-info/dependency_links.txt +0 -0
  28. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx.egg-info/requires.txt +0 -0
  29. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/nonebot_plugin_maimaidx.egg-info/top_level.txt +0 -0
  30. {nonebot_plugin_maimaidx-2.0.2 → nonebot_plugin_maimaidx-2.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-maimaidx
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: maimaidx plugin for nonebot2
5
5
  Author-email: Yuri-YuzuChaN <806235364@qq.com>
6
6
  License-Expression: MIT
@@ -61,7 +61,7 @@ Dynamic: license-file
61
61
  ```
62
62
 
63
63
  2. 安装 `PhantomJS`,前往 https://phantomjs.org/download.html 下载对应平台支持
64
- 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染,例如 `ubuntu`:`apt install fonts-wqy-microhei`
64
+ 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染的问题,例如 `ubuntu`:`apt install fonts-wqy-microhei`
65
65
 
66
66
  > [!WARNING]
67
67
  > 未配置 `PhantomJS` 支持的Bot,在使用 `ginfo` 指令时会被强制关闭 Bot 进程
@@ -72,7 +72,7 @@ Dynamic: license-file
72
72
 
73
73
  - [私人云盘](https://cloud.yuzuchan.moe/f/1bUn/Resource.7z)
74
74
  - [AList网盘](https://share.yuzuchan.moe/p/Resource.7z?sign=EvCwaGwJrneyD1Olq00NG3HXNK7fQKpx_sa3Ck9Uzjs=:0)
75
- - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzuchan_yuzuai_onmicrosoft_com/EdGUKRSo-VpHjT2noa_9EroBVO27iYMSQO3oFnZjpYTbqA?e=FE4KXY)
75
+ - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzu_yuzuchan_moe/EdGUKRSo-VpHjT2noa_9EroBdFZci-tqWjVZzKZRTEeZkw?e=a1TM40)
76
76
 
77
77
  2. 在 `.env` 文件中配置静态文件绝对路径 `MAIMAIDXPATH`
78
78
 
@@ -36,7 +36,7 @@
36
36
  ```
37
37
 
38
38
  2. 安装 `PhantomJS`,前往 https://phantomjs.org/download.html 下载对应平台支持
39
- 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染,例如 `ubuntu`:`apt install fonts-wqy-microhei`
39
+ 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染的问题,例如 `ubuntu`:`apt install fonts-wqy-microhei`
40
40
 
41
41
  > [!WARNING]
42
42
  > 未配置 `PhantomJS` 支持的Bot,在使用 `ginfo` 指令时会被强制关闭 Bot 进程
@@ -47,7 +47,7 @@
47
47
 
48
48
  - [私人云盘](https://cloud.yuzuchan.moe/f/1bUn/Resource.7z)
49
49
  - [AList网盘](https://share.yuzuchan.moe/p/Resource.7z?sign=EvCwaGwJrneyD1Olq00NG3HXNK7fQKpx_sa3Ck9Uzjs=:0)
50
- - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzuchan_yuzuai_onmicrosoft_com/EdGUKRSo-VpHjT2noa_9EroBVO27iYMSQO3oFnZjpYTbqA?e=FE4KXY)
50
+ - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzu_yuzuchan_moe/EdGUKRSo-VpHjT2noa_9EroBdFZci-tqWjVZzKZRTEeZkw?e=a1TM40)
51
51
 
52
52
  2. 在 `.env` 文件中配置静态文件绝对路径 `MAIMAIDXPATH`
53
53
 
@@ -29,8 +29,8 @@ alias_local_apply = on_command('添加本地别名', aliases={'添加本地别
29
29
  alias_apply = on_command('添加别名', aliases={'增加别名', '增添别名', '添加别称'})
30
30
  alias_agree = on_command('同意别名', aliases={'同意别称'})
31
31
  alias_status = on_command('当前投票', aliases={'当前别名投票', '当前别称投票'})
32
- alias_switch = on_endswith(
33
- ('别名推送', '别称推送'),
32
+ alias_switch = on_regex(
33
+ r'^([开启关闭]+)别名推送$',
34
34
  permission=SUPERUSER | GROUP_OWNER | GROUP_ADMIN
35
35
  )
36
36
  alias_global_switch = on_regex(r'^全局([开启关闭]+)别名推送$', permission=SUPERUSER)
@@ -200,11 +200,10 @@ async def _(match = RegexMatched()):
200
200
 
201
201
 
202
202
  @alias_switch.handle()
203
- async def _(event: GroupMessageEvent, end: str = Endswith()):
204
- args = event.get_plaintext().lower()[0:-len(end)].strip()
205
- if args == '开启':
203
+ async def _(event: GroupMessageEvent, match = RegexMatched()):
204
+ if match.group(1) == '开启':
206
205
  msg = await alias.on(event.group_id)
207
- elif args == '关闭':
206
+ elif match.group(1) == '关闭':
208
207
  msg = await alias.off(event.group_id)
209
208
  else:
210
209
  raise ValueError('matcher type error')
@@ -215,10 +214,10 @@ async def _(event: GroupMessageEvent, end: str = Endswith()):
215
214
  @alias_global_switch.handle()
216
215
  async def _(match = RegexMatched()):
217
216
  if match.group(1) == '开启':
218
- alias.alias_global_change(True)
217
+ await alias.alias_global_change(True)
219
218
  await alias_global_switch.finish('已全局开启maimai别名推送')
220
219
  elif match.group(1) == '关闭':
221
- alias.alias_global_change(False)
220
+ await alias.alias_global_change(False)
222
221
  await alias_global_switch.finish('已全局关闭maimai别名推送')
223
222
  else:
224
223
  await alias_global_switch.finish()
@@ -147,11 +147,11 @@ async def _(message: Message = CommandArg()):
147
147
  reduce = 101 - line
148
148
  if reduce <= 0 or reduce >= 101:
149
149
  raise ValueError
150
- msg = dedent(f'''\
150
+ msg = dedent(f'''
151
151
  {music.title} {level_labels2[level_index]}
152
152
  分数线 {line}% 允许的最多 TAP GREAT 数量为 {(total_score * reduce / 10000):.2f}(每个-{10000 / total_score:.4f}%),
153
153
  BREAK 50落(一共{brk}个)等价于 {(break_50_reduce / 100):.3f} 个 TAP GREAT(-{break_50_reduce / total_score * 100:.4f}%)''')
154
- await score.finish(MessageSegment.image(text_to_bytes_io(msg)), reply_message=True)
154
+ await score.finish(msg.strip(), reply_message=True)
155
155
  except (AttributeError, ValueError) as e:
156
156
  log.exception(e)
157
157
  await score.finish('格式错误,输入“分数线 帮助”以查看帮助信息', reply_message=True)
@@ -70,27 +70,21 @@ async def _(event: GroupMessageEvent, message: Message = CommandArg()):
70
70
  @search_base.handle()
71
71
  async def _(message: Message = CommandArg()):
72
72
  args = message.extract_plain_text().strip().split()
73
- if len(args) > 2 or len(args) == 0:
73
+ if len(args) > 3 or len(args) == 0:
74
74
  await search_base.finish('命令格式:\n定数查歌 「定数」「页数」\n定数查歌 「定数下限」「定数上限」「页数」')
75
75
  page = 1
76
76
  if len(args) == 1:
77
- result = song_level(float(args[0]), float(args[0]))
77
+ ds1, ds2 = args[0], args[0]
78
78
  elif len(args) == 2:
79
- try:
80
- result = song_level(float(args[0]), float(args[1]))
81
- except:
82
- page = int(args[1]) if args[1].isdigit() else 1
83
- result = song_level(float(args[0]), float(args[0]))
84
- elif len(args) == 3:
85
- try:
86
- page = int(args[2]) if args[2].isdigit() else 1
87
- result = song_level(float(args[0]), float(args[1]))
88
- except:
89
- page = int(args[2]) if args[2].isdigit() else 1
90
- result = song_level(float(args[0]), float(args[0]))
79
+ if '.' in args[1]:
80
+ ds1, ds2 = args
81
+ else:
82
+ ds1, ds2 = args[0], args[0]
83
+ page = args[1]
91
84
  else:
92
- result = song_level(float(args[0]), float(args[1]))
93
- page = int(args[2]) if args[2].isdigit() else 1
85
+ ds1, ds2, page = args
86
+ page = int(page)
87
+ result = song_level(float(ds1), float(ds2))
94
88
  if not result:
95
89
  await search_base.finish('没有找到这样的乐曲。', reply_message=True)
96
90
 
@@ -547,7 +547,7 @@ class GroupAlias:
547
547
  self.push.enable.append(gid)
548
548
  if gid in self.push.disable:
549
549
  self.push.disable.remove(gid)
550
- await writefile(group_alias_file, self.push.model_dump())
550
+ await writefile(group_alias_file, self.push.model_dump(by_alias=True))
551
551
  return '群别名推送功能已开启'
552
552
 
553
553
  async def off(self, gid: int) -> str:
@@ -556,13 +556,13 @@ class GroupAlias:
556
556
  self.push.disable.append(gid)
557
557
  if gid in self.push.enable:
558
558
  self.push.enable.remove(gid)
559
- await writefile(group_alias_file, self.push.model_dump())
559
+ await writefile(group_alias_file, self.push.model_dump(by_alias=True))
560
560
  return '群别名推送功能已关闭'
561
561
 
562
562
  async def alias_global_change(self, set: bool):
563
563
  """修改全局开关"""
564
564
  self.push.global_switch = set
565
- await writefile(group_alias_file, self.push.model_dump())
565
+ await writefile(group_alias_file, self.push.model_dump(by_alias=True))
566
566
 
567
567
 
568
568
  alias = GroupAlias()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-maimaidx
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: maimaidx plugin for nonebot2
5
5
  Author-email: Yuri-YuzuChaN <806235364@qq.com>
6
6
  License-Expression: MIT
@@ -61,7 +61,7 @@ Dynamic: license-file
61
61
  ```
62
62
 
63
63
  2. 安装 `PhantomJS`,前往 https://phantomjs.org/download.html 下载对应平台支持
64
- 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染,例如 `ubuntu`:`apt install fonts-wqy-microhei`
64
+ 3. 安装 `微软雅黑` 字体,解决使用 `ginfo` 指令字体不渲染的问题,例如 `ubuntu`:`apt install fonts-wqy-microhei`
65
65
 
66
66
  > [!WARNING]
67
67
  > 未配置 `PhantomJS` 支持的Bot,在使用 `ginfo` 指令时会被强制关闭 Bot 进程
@@ -72,7 +72,7 @@ Dynamic: license-file
72
72
 
73
73
  - [私人云盘](https://cloud.yuzuchan.moe/f/1bUn/Resource.7z)
74
74
  - [AList网盘](https://share.yuzuchan.moe/p/Resource.7z?sign=EvCwaGwJrneyD1Olq00NG3HXNK7fQKpx_sa3Ck9Uzjs=:0)
75
- - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzuchan_yuzuai_onmicrosoft_com/EdGUKRSo-VpHjT2noa_9EroBVO27iYMSQO3oFnZjpYTbqA?e=FE4KXY)
75
+ - [onedrive](https://yuzuai-my.sharepoint.com/:u:/g/personal/yuzu_yuzuchan_moe/EdGUKRSo-VpHjT2noa_9EroBdFZci-tqWjVZzKZRTEeZkw?e=a1TM40)
76
76
 
77
77
  2. 在 `.env` 文件中配置静态文件绝对路径 `MAIMAIDXPATH`
78
78
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-maimaidx"
3
- version = "2.0.2"
3
+ version = "2.0.4"
4
4
  authors = [
5
5
  { name="Yuri-YuzuChaN", email="806235364@qq.com" },
6
6
  ]