nonebot-plugin-picmenu-next 0.1.0__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 (91) hide show
  1. nonebot_plugin_picmenu_next-0.1.0/LICENSE +21 -0
  2. nonebot_plugin_picmenu_next-0.1.0/PKG-INFO +225 -0
  3. nonebot_plugin_picmenu_next-0.1.0/README.md +207 -0
  4. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/__init__.py +33 -0
  5. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/__main__.py +203 -0
  6. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/config.py +20 -0
  7. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/data_source/__init__.py +16 -0
  8. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/data_source/collect.py +126 -0
  9. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/data_source/mixin.py +225 -0
  10. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/data_source/models.py +93 -0
  11. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/data_source/pinyin.py +51 -0
  12. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/ft_parser.py +222 -0
  13. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/res/gan_shen_me.jpg +0 -0
  14. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/__init__.py +87 -0
  15. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/__init__.py +126 -0
  16. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/base.html.jinja +35 -0
  17. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/css/base.css +230 -0
  18. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/css/dark.css +11 -0
  19. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/css/detail.css +16 -0
  20. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/css/index.css +8 -0
  21. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/detail.html.jinja +70 -0
  22. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/index.html.jinja +25 -0
  23. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/js/base.js +7 -0
  24. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/js/tsconfig.json +8 -0
  25. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/code-colorful.css +69 -0
  26. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/code-github-dark.css +81 -0
  27. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.ttf +0 -0
  28. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.woff +0 -0
  29. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  30. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  31. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  32. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  33. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  34. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  35. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  36. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  37. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  38. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  39. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  40. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  41. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  42. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.ttf +0 -0
  43. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.woff +0 -0
  44. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.woff2 +0 -0
  45. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  46. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  47. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  48. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.ttf +0 -0
  49. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.woff +0 -0
  50. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.woff2 +0 -0
  51. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.ttf +0 -0
  52. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.woff +0 -0
  53. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.woff2 +0 -0
  54. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  55. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  56. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  57. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.ttf +0 -0
  58. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.woff +0 -0
  59. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.woff2 +0 -0
  60. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  61. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  62. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  63. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  64. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  65. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  66. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  67. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  68. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  69. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.ttf +0 -0
  70. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.woff +0 -0
  71. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.woff2 +0 -0
  72. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.ttf +0 -0
  73. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.woff +0 -0
  74. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  75. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.ttf +0 -0
  76. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.woff +0 -0
  77. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  78. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.ttf +0 -0
  79. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.woff +0 -0
  80. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  81. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.ttf +0 -0
  82. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.woff +0 -0
  83. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  84. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  85. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  86. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  87. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/katex.min.css +1 -0
  88. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/default/res/third-party/katex.min.js +1 -0
  89. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/templates/pw_utils.py +82 -0
  90. nonebot_plugin_picmenu_next-0.1.0/nonebot_plugin_picmenu_next/utils.py +18 -0
  91. nonebot_plugin_picmenu_next-0.1.0/pyproject.toml +42 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 LgCookie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.1
2
+ Name: nonebot-plugin-picmenu-next
3
+ Version: 0.1.0
4
+ Summary: Template plugin project
5
+ Author-Email: LgCookie <lgc2333@126.com>
6
+ License: MIT
7
+ Project-URL: homepage, https://github.com/lgc-NB2Dev/nonebot-plugin-picmenu-next
8
+ Requires-Python: <4.0,>=3.9
9
+ Requires-Dist: nonebot2>=2.4.1
10
+ Requires-Dist: nonebot-plugin-alconna>=0.54.2
11
+ Requires-Dist: cookit[jinja,loguru,nonebot-alconna,nonebot-localstore,pw,pyd]>=0.11.6
12
+ Requires-Dist: pypinyin>=0.54.0
13
+ Requires-Dist: jieba>=0.42.1
14
+ Requires-Dist: thefuzz>=0.22.1
15
+ Requires-Dist: markdown-it-py[plugins]>=3.0.0
16
+ Requires-Dist: pygments>=2.19.1
17
+ Description-Content-Type: text/markdown
18
+
19
+ <!-- markdownlint-disable MD031 MD033 MD036 MD041 -->
20
+
21
+ <div align="center">
22
+
23
+ <a href="https://v2.nonebot.dev/store">
24
+ <img src="https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo">
25
+ </a>
26
+
27
+ <p>
28
+ <img src="https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/template/plugin.svg" alt="NoneBotPluginText">
29
+ </p>
30
+
31
+ # NoneBot-Plugin-PicMenu-Next
32
+
33
+ _✨ 新一代的图片帮助插件 ✨_
34
+
35
+ <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
36
+ <a href="https://pdm.fming.dev">
37
+ <img src="https://img.shields.io/badge/pdm-managed-blueviolet" alt="pdm-managed">
38
+ </a>
39
+ <a href="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb">
40
+ <img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb.svg" alt="wakatime">
41
+ </a>
42
+
43
+ <br />
44
+
45
+ <a href="https://pydantic.dev">
46
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/template/pyd-v1-or-v2.json" alt="Pydantic Version 1 Or 2" >
47
+ </a>
48
+ <a href="./LICENSE">
49
+ <img src="https://img.shields.io/github/license/lgc-NB2Dev/nonebot-plugin-picmenu-next.svg" alt="license">
50
+ </a>
51
+ <a href="https://pypi.python.org/pypi/nonebot-plugin-picmenu-next">
52
+ <img src="https://img.shields.io/pypi/v/nonebot-plugin-picmenu-next.svg" alt="pypi">
53
+ </a>
54
+ <a href="https://pypi.python.org/pypi/nonebot-plugin-picmenu-next">
55
+ <img src="https://img.shields.io/pypi/dm/nonebot-plugin-picmenu-next" alt="pypi download">
56
+ </a>
57
+
58
+ <br />
59
+
60
+ <a href="https://registry.nonebot.dev/plugin/nonebot-plugin-picmenu-next:nonebot_plugin_picmenu_next">
61
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin%2Fnonebot-plugin-picmenu-next" alt="NoneBot Registry">
62
+ </a>
63
+ <a href="https://registry.nonebot.dev/plugin/nonebot-plugin-picmenu-next:nonebot_plugin_picmenu_next">
64
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin-adapters%2Fnonebot-plugin-picmenu-next" alt="Supported Adapters">
65
+ </a>
66
+
67
+ </div>
68
+
69
+ ## 📖 介绍
70
+
71
+ - ✨ **美观的图片界面**:直观友好的图片界面
72
+ - 🛠️ **PicMenu 兼容**:本插件使用 PicMenu 插件格式的三级菜单(功能详情),兼容 PicMenu 的 `<ft>` 富文本标签(但不太推荐使用)
73
+ - 🔍 **支持模糊搜索**:支持通过序号或名称查找插件及功能,并提供插件名称的模糊匹配
74
+ - 🔤 **拼音支持**:插件排序与模糊搜索时考虑拼音,提高中文环境下的使用体验
75
+ - 📜 **Markdown 支持**:支持 Markdown 格式的帮助信息展示(需要插件开发者主动适配)
76
+ - 🔒 **隐藏控制**:默认状态下类型为 `library` 的插件会对普通用户隐藏
77
+ - 🎨 **自定义模板**:提供模板开发者注册模板的接口,提供插件开发者自定义某插件使用的详细信息模板的方式,提供配置供用户自定义想要使用的模板
78
+ - 🔌 **插件扩展机制**:提供强大的 mixin 支持,允许插件通过中间件方式自定义帮助菜单展示和行为
79
+
80
+ ### 展示图
81
+
82
+ <details>
83
+ <summary>主页面</summary>
84
+
85
+ ![亮色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_main.jpg)
86
+ ![暗色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_main.jpg)
87
+
88
+ </details>
89
+
90
+ <details>
91
+ <summary>插件详情</summary>
92
+
93
+ ![亮色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_detail.jpg)
94
+ ![暗色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_detail.jpg)
95
+
96
+ </details>
97
+
98
+ <details>
99
+ <summary>插件详情(带功能详情三级菜单)</summary>
100
+
101
+ ![亮色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_with_func.jpg)
102
+ ![暗色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_with_func.jpg)
103
+
104
+ </details>
105
+
106
+ <details>
107
+ <summary>功能详情</summary>
108
+
109
+ ![亮色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_func_detail.jpg)
110
+ ![暗色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_func_detail.jpg)
111
+
112
+ </details>
113
+
114
+ <details>
115
+ <summary>Markdown 测试</summary>
116
+
117
+ ![亮色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_markdown.jpg)
118
+ ![暗色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_markdown.jpg)
119
+
120
+ </details>
121
+
122
+ ## 💿 安装
123
+
124
+ 以下提到的方法 任选**其一** 即可
125
+
126
+ <details open>
127
+ <summary>[推荐] 使用 nb-cli 安装</summary>
128
+ 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
129
+
130
+ ```bash
131
+ nb plugin install nonebot-plugin-picmenu-next
132
+ ```
133
+
134
+ </details>
135
+
136
+ <details>
137
+ <summary>使用包管理器安装</summary>
138
+ 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
139
+
140
+ <details>
141
+ <summary>pip</summary>
142
+
143
+ ```bash
144
+ pip install nonebot-plugin-picmenu-next
145
+ ```
146
+
147
+ </details>
148
+ <details>
149
+ <summary>pdm</summary>
150
+
151
+ ```bash
152
+ pdm add nonebot-plugin-picmenu-next
153
+ ```
154
+
155
+ </details>
156
+ <details>
157
+ <summary>poetry</summary>
158
+
159
+ ```bash
160
+ poetry add nonebot-plugin-picmenu-next
161
+ ```
162
+
163
+ </details>
164
+ <details>
165
+ <summary>conda</summary>
166
+
167
+ ```bash
168
+ conda install nonebot-plugin-picmenu-next
169
+ ```
170
+
171
+ </details>
172
+
173
+ 打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分的 `plugins` 项里追加写入
174
+
175
+ ```toml
176
+ [tool.nonebot]
177
+ plugins = [
178
+ # ...
179
+ "nonebot_plugin_picmenu_next"
180
+ ]
181
+ ```
182
+
183
+ </details>
184
+
185
+ ## ⚙️ 配置
186
+
187
+ 在 NoneBot2 项目的 `.env` 文件中添加下表中的配置
188
+
189
+ | 配置项 | 必填 | 默认值 | 说明 |
190
+ | :-----------------------------: | :--: | :-------: | :----------------------------: |
191
+ | `PMN_INDEX_TEMPLATE` | 否 | `default` | 首页展示模板的名称 |
192
+ | `PMN_DETAIL_TEMPLATE` | 否 | `default` | 插件详情模板的名称 |
193
+ | `PMN_FUNC_DETAIL_TEMPLATE` | 否 | `default` | 插件功能详情模板的名称 |
194
+ | `PMN_ONLY_SUPERUSER_SEE_HIDDEN` | 否 | `False` | 是否仅超级用户可以查看隐藏内容 |
195
+
196
+ ## 🎉 使用
197
+
198
+ 发送 `帮助` 指令试试吧!
199
+
200
+ ## 🔧 开发
201
+
202
+ 文档待补充
203
+
204
+ ## 📞 联系
205
+
206
+ QQ:3076823485
207
+ Telegram:[@lgc2333](https://t.me/lgc2333)
208
+ 吹水群:[1105946125](https://jq.qq.com/?_wv=1027&k=Z3n1MpEp)
209
+ 邮箱:<lgc2333@126.com>
210
+
211
+ ## 💡 鸣谢
212
+
213
+ ### [hamo-reid/nonebot_plugin_PicMenu](https://github.com/hamo-reid/nonebot_plugin_PicMenu)
214
+
215
+ - 灵感来源(?)
216
+
217
+ ## 💰 赞助
218
+
219
+ **[赞助我](https://blog.lgc2333.top/donate)**
220
+
221
+ 感谢大家的赞助!你们的赞助将是我继续创作的动力!
222
+
223
+ ## 📝 更新日志
224
+
225
+ 芝士刚刚发布的插件,还没有更新日志的说 qwq~
@@ -0,0 +1,207 @@
1
+ <!-- markdownlint-disable MD031 MD033 MD036 MD041 -->
2
+
3
+ <div align="center">
4
+
5
+ <a href="https://v2.nonebot.dev/store">
6
+ <img src="https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo">
7
+ </a>
8
+
9
+ <p>
10
+ <img src="https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/template/plugin.svg" alt="NoneBotPluginText">
11
+ </p>
12
+
13
+ # NoneBot-Plugin-PicMenu-Next
14
+
15
+ _✨ 新一代的图片帮助插件 ✨_
16
+
17
+ <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
18
+ <a href="https://pdm.fming.dev">
19
+ <img src="https://img.shields.io/badge/pdm-managed-blueviolet" alt="pdm-managed">
20
+ </a>
21
+ <a href="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb">
22
+ <img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb.svg" alt="wakatime">
23
+ </a>
24
+
25
+ <br />
26
+
27
+ <a href="https://pydantic.dev">
28
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/template/pyd-v1-or-v2.json" alt="Pydantic Version 1 Or 2" >
29
+ </a>
30
+ <a href="./LICENSE">
31
+ <img src="https://img.shields.io/github/license/lgc-NB2Dev/nonebot-plugin-picmenu-next.svg" alt="license">
32
+ </a>
33
+ <a href="https://pypi.python.org/pypi/nonebot-plugin-picmenu-next">
34
+ <img src="https://img.shields.io/pypi/v/nonebot-plugin-picmenu-next.svg" alt="pypi">
35
+ </a>
36
+ <a href="https://pypi.python.org/pypi/nonebot-plugin-picmenu-next">
37
+ <img src="https://img.shields.io/pypi/dm/nonebot-plugin-picmenu-next" alt="pypi download">
38
+ </a>
39
+
40
+ <br />
41
+
42
+ <a href="https://registry.nonebot.dev/plugin/nonebot-plugin-picmenu-next:nonebot_plugin_picmenu_next">
43
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin%2Fnonebot-plugin-picmenu-next" alt="NoneBot Registry">
44
+ </a>
45
+ <a href="https://registry.nonebot.dev/plugin/nonebot-plugin-picmenu-next:nonebot_plugin_picmenu_next">
46
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin-adapters%2Fnonebot-plugin-picmenu-next" alt="Supported Adapters">
47
+ </a>
48
+
49
+ </div>
50
+
51
+ ## 📖 介绍
52
+
53
+ - ✨ **美观的图片界面**:直观友好的图片界面
54
+ - 🛠️ **PicMenu 兼容**:本插件使用 PicMenu 插件格式的三级菜单(功能详情),兼容 PicMenu 的 `<ft>` 富文本标签(但不太推荐使用)
55
+ - 🔍 **支持模糊搜索**:支持通过序号或名称查找插件及功能,并提供插件名称的模糊匹配
56
+ - 🔤 **拼音支持**:插件排序与模糊搜索时考虑拼音,提高中文环境下的使用体验
57
+ - 📜 **Markdown 支持**:支持 Markdown 格式的帮助信息展示(需要插件开发者主动适配)
58
+ - 🔒 **隐藏控制**:默认状态下类型为 `library` 的插件会对普通用户隐藏
59
+ - 🎨 **自定义模板**:提供模板开发者注册模板的接口,提供插件开发者自定义某插件使用的详细信息模板的方式,提供配置供用户自定义想要使用的模板
60
+ - 🔌 **插件扩展机制**:提供强大的 mixin 支持,允许插件通过中间件方式自定义帮助菜单展示和行为
61
+
62
+ ### 展示图
63
+
64
+ <details>
65
+ <summary>主页面</summary>
66
+
67
+ ![亮色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_main.jpg)
68
+ ![暗色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_main.jpg)
69
+
70
+ </details>
71
+
72
+ <details>
73
+ <summary>插件详情</summary>
74
+
75
+ ![亮色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_detail.jpg)
76
+ ![暗色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_detail.jpg)
77
+
78
+ </details>
79
+
80
+ <details>
81
+ <summary>插件详情(带功能详情三级菜单)</summary>
82
+
83
+ ![亮色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_with_func.jpg)
84
+ ![暗色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_with_func.jpg)
85
+
86
+ </details>
87
+
88
+ <details>
89
+ <summary>功能详情</summary>
90
+
91
+ ![亮色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_func_detail.jpg)
92
+ ![暗色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_func_detail.jpg)
93
+
94
+ </details>
95
+
96
+ <details>
97
+ <summary>Markdown 测试</summary>
98
+
99
+ ![亮色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_markdown.jpg)
100
+ ![暗色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_markdown.jpg)
101
+
102
+ </details>
103
+
104
+ ## 💿 安装
105
+
106
+ 以下提到的方法 任选**其一** 即可
107
+
108
+ <details open>
109
+ <summary>[推荐] 使用 nb-cli 安装</summary>
110
+ 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
111
+
112
+ ```bash
113
+ nb plugin install nonebot-plugin-picmenu-next
114
+ ```
115
+
116
+ </details>
117
+
118
+ <details>
119
+ <summary>使用包管理器安装</summary>
120
+ 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
121
+
122
+ <details>
123
+ <summary>pip</summary>
124
+
125
+ ```bash
126
+ pip install nonebot-plugin-picmenu-next
127
+ ```
128
+
129
+ </details>
130
+ <details>
131
+ <summary>pdm</summary>
132
+
133
+ ```bash
134
+ pdm add nonebot-plugin-picmenu-next
135
+ ```
136
+
137
+ </details>
138
+ <details>
139
+ <summary>poetry</summary>
140
+
141
+ ```bash
142
+ poetry add nonebot-plugin-picmenu-next
143
+ ```
144
+
145
+ </details>
146
+ <details>
147
+ <summary>conda</summary>
148
+
149
+ ```bash
150
+ conda install nonebot-plugin-picmenu-next
151
+ ```
152
+
153
+ </details>
154
+
155
+ 打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分的 `plugins` 项里追加写入
156
+
157
+ ```toml
158
+ [tool.nonebot]
159
+ plugins = [
160
+ # ...
161
+ "nonebot_plugin_picmenu_next"
162
+ ]
163
+ ```
164
+
165
+ </details>
166
+
167
+ ## ⚙️ 配置
168
+
169
+ 在 NoneBot2 项目的 `.env` 文件中添加下表中的配置
170
+
171
+ | 配置项 | 必填 | 默认值 | 说明 |
172
+ | :-----------------------------: | :--: | :-------: | :----------------------------: |
173
+ | `PMN_INDEX_TEMPLATE` | 否 | `default` | 首页展示模板的名称 |
174
+ | `PMN_DETAIL_TEMPLATE` | 否 | `default` | 插件详情模板的名称 |
175
+ | `PMN_FUNC_DETAIL_TEMPLATE` | 否 | `default` | 插件功能详情模板的名称 |
176
+ | `PMN_ONLY_SUPERUSER_SEE_HIDDEN` | 否 | `False` | 是否仅超级用户可以查看隐藏内容 |
177
+
178
+ ## 🎉 使用
179
+
180
+ 发送 `帮助` 指令试试吧!
181
+
182
+ ## 🔧 开发
183
+
184
+ 文档待补充
185
+
186
+ ## 📞 联系
187
+
188
+ QQ:3076823485
189
+ Telegram:[@lgc2333](https://t.me/lgc2333)
190
+ 吹水群:[1105946125](https://jq.qq.com/?_wv=1027&k=Z3n1MpEp)
191
+ 邮箱:<lgc2333@126.com>
192
+
193
+ ## 💡 鸣谢
194
+
195
+ ### [hamo-reid/nonebot_plugin_PicMenu](https://github.com/hamo-reid/nonebot_plugin_PicMenu)
196
+
197
+ - 灵感来源(?)
198
+
199
+ ## 💰 赞助
200
+
201
+ **[赞助我](https://blog.lgc2333.top/donate)**
202
+
203
+ 感谢大家的赞助!你们的赞助将是我继续创作的动力!
204
+
205
+ ## 📝 更新日志
206
+
207
+ 芝士刚刚发布的插件,还没有更新日志的说 qwq~
@@ -0,0 +1,33 @@
1
+ # ruff: noqa: E402
2
+
3
+ from nonebot import get_driver
4
+ from nonebot.plugin import PluginMetadata, inherit_supported_adapters, require
5
+
6
+ require("nonebot_plugin_alconna")
7
+ require("nonebot_plugin_htmlrender")
8
+
9
+ from . import __main__ as __main__
10
+ from .config import ConfigModel
11
+ from .data_source import refresh_infos
12
+ from .templates import load_builtin_templates
13
+
14
+ __version__ = "0.1.0"
15
+ __plugin_meta__ = PluginMetadata(
16
+ name="PicMenu Next",
17
+ description="新一代的图片帮助插件",
18
+ usage="发送“帮助”查看所有所有插件功能",
19
+ type="application",
20
+ homepage="https://github.com/lgc-NB2Dev/nonebot-plugin-picmenu-next",
21
+ config=ConfigModel,
22
+ supported_adapters=inherit_supported_adapters("nonebot_plugin_alconna"),
23
+ extra={"License": "MIT", "Author": "LgCookie"},
24
+ )
25
+
26
+ load_builtin_templates()
27
+
28
+ driver = get_driver()
29
+
30
+
31
+ @driver.on_startup
32
+ async def _():
33
+ await refresh_infos()
@@ -0,0 +1,203 @@
1
+ from collections.abc import Sequence
2
+ from pathlib import Path
3
+ from typing import Optional, TypeVar
4
+
5
+ from arclet.alconna import Alconna, Arg, Args, CommandMeta, Option, store_true
6
+ from loguru import logger
7
+ from nonebot.adapters import Bot as BaseBot, Event as BaseEvent
8
+ from nonebot.permission import SUPERUSER
9
+ from nonebot_plugin_alconna import Query, on_alconna
10
+ from nonebot_plugin_alconna.uniseg import UniMessage
11
+ from thefuzz import process
12
+
13
+ from .config import config
14
+ from .data_source import get_infos
15
+ from .data_source.mixin import resolve_detail_mixin, resolve_main_mixin
16
+ from .data_source.models import PinyinChunkSequence, PMDataItem, PMNPluginInfo
17
+ from .templates import detail_templates, func_detail_templates, index_templates
18
+
19
+ RES_DIR = Path(__file__).parent / "res"
20
+ TIP_IMG_PATH = RES_DIR / "gan_shen_me.jpg"
21
+
22
+ alc = Alconna(
23
+ "help",
24
+ Args(
25
+ Arg("plugin?", str, notice="插件序号或名称"),
26
+ Arg("function?", str, notice="插件功能序号或名称"),
27
+ ),
28
+ Option(
29
+ "-H|--show-hidden",
30
+ action=store_true,
31
+ help_text="显示隐藏的插件",
32
+ ),
33
+ meta=CommandMeta(
34
+ description="新一代的图片帮助插件",
35
+ author="LgCookie",
36
+ ),
37
+ )
38
+ m_cls = on_alconna(
39
+ alc,
40
+ aliases={"帮助", "菜单"},
41
+ skip_for_unmatch=False,
42
+ auto_send_output=True,
43
+ use_cmd_start=True,
44
+ )
45
+
46
+
47
+ def get_name_similarities(
48
+ query: str,
49
+ query_pinyin: str,
50
+ choices: list[str],
51
+ choices_pinyin: list[str],
52
+ raw_weight: float = 0.6,
53
+ pinyin_weight: float = 0.4,
54
+ ) -> list[float]:
55
+ raw_scores = [x[1] for x in process.extractWithoutOrder(query, choices)]
56
+ pinyin_scores = [
57
+ x[1] for x in process.extractWithoutOrder(query_pinyin, choices_pinyin)
58
+ ]
59
+ similarities = [
60
+ raw_weight * raw + pinyin_weight * pinyin
61
+ for raw, pinyin in zip(raw_scores, pinyin_scores)
62
+ ]
63
+ logger.opt(lazy=True).debug(
64
+ "Query: {}, similarities:\n{}",
65
+ lambda: f"{query} ({query_pinyin})",
66
+ lambda: ";\n".join(
67
+ (
68
+ f"{choices[i]} ({choices_pinyin[i]})"
69
+ f": ({raw} * {raw_weight}) + ({pin} * {pinyin_weight}) = {sim}"
70
+ )
71
+ for i, (raw, pin, sim) in sorted(
72
+ enumerate(zip(raw_scores, pinyin_scores, similarities)),
73
+ key=lambda x: x[1],
74
+ reverse=True,
75
+ )
76
+ ),
77
+ )
78
+ return similarities
79
+
80
+
81
+ T = TypeVar("T")
82
+
83
+
84
+ def handle_query_index(query: str, infos: Sequence[T]) -> Optional[tuple[int, T]]:
85
+ if query.isdigit() and query.strip("0"):
86
+ return (
87
+ ((i := qn - 1), infos[i])
88
+ if (1 <= (qn := int(query)) <= len(infos))
89
+ else None
90
+ )
91
+ return None
92
+
93
+
94
+ async def query_plugin(
95
+ infos: list[PMNPluginInfo],
96
+ query: str,
97
+ score_cutoff: float = 60,
98
+ ) -> Optional[tuple[int, PMNPluginInfo]]:
99
+ if r := handle_query_index(query, infos):
100
+ return r
101
+
102
+ choices: list[str] = []
103
+ choices_pinyin: list[str] = []
104
+ for info in infos:
105
+ choices.append(info.casefold_name)
106
+ choices_pinyin.append(info.name_pinyin.casefold_str)
107
+
108
+ similarities = get_name_similarities(
109
+ query.casefold(),
110
+ PinyinChunkSequence.from_raw(query).casefold_str,
111
+ choices,
112
+ choices_pinyin,
113
+ )
114
+ i, s = max(enumerate(similarities), key=lambda x: x[1])
115
+ if s >= score_cutoff:
116
+ return i, infos[i]
117
+ return None
118
+
119
+
120
+ async def query_func_detail(
121
+ pm_data: list[PMDataItem],
122
+ query: str,
123
+ score_cutoff: float = 60,
124
+ ) -> Optional[tuple[int, PMDataItem]]:
125
+ if r := handle_query_index(query, pm_data):
126
+ return r
127
+
128
+ choices: list[str] = []
129
+ choices_pinyin: list[str] = []
130
+ for data in pm_data:
131
+ choices.append(data.casefold_func)
132
+ choices_pinyin.append(data.func_pinyin.casefold_str)
133
+
134
+ similarities = get_name_similarities(
135
+ query.casefold(),
136
+ PinyinChunkSequence.from_raw(query).casefold_str,
137
+ choices,
138
+ choices_pinyin,
139
+ )
140
+ i, s = max(enumerate(similarities), key=lambda x: x[1])
141
+ if s >= score_cutoff:
142
+ return i, pm_data[i]
143
+ return None
144
+
145
+
146
+ @m_cls.handle()
147
+ async def _(
148
+ bot: BaseBot,
149
+ ev: BaseEvent,
150
+ q_plugin: Query[Optional[str]] = Query("~plugin", None),
151
+ q_function: Query[Optional[str]] = Query("~function", None),
152
+ q_show_hidden: Query[bool] = Query("~show-hidden.value", default=False),
153
+ ):
154
+ show_hidden = q_show_hidden.result
155
+ if (
156
+ show_hidden
157
+ and config.only_superuser_see_hidden
158
+ and (not await SUPERUSER(bot, ev))
159
+ ):
160
+ await (
161
+ UniMessage.image(raw=TIP_IMG_PATH.read_bytes())
162
+ .text("别想看咱藏起来的东西!")
163
+ .finish(reply_to=True)
164
+ )
165
+
166
+ infos = await resolve_main_mixin(get_infos())
167
+ if not show_hidden:
168
+ infos = [x for x in infos if not x.pmn.hidden]
169
+
170
+ if not q_plugin.result:
171
+ m = await index_templates.get()(infos, show_hidden)
172
+ await m.finish()
173
+
174
+ r = await query_plugin(infos, q_plugin.result)
175
+ if not r:
176
+ await UniMessage.text("好像没有找到对应插件呢……").finish(reply_to=True)
177
+ info_index, info = r
178
+ if not q_function.result:
179
+ m = await detail_templates.get(
180
+ info.pmn.template,
181
+ )(info, info_index, show_hidden)
182
+ await m.finish()
183
+
184
+ info = await resolve_detail_mixin(info)
185
+ pm_data = info.pm_data
186
+ if pm_data and (not show_hidden):
187
+ pm_data = [x for x in pm_data if not x.hidden]
188
+
189
+ if not pm_data:
190
+ await UniMessage.text(
191
+ f"插件 `{info.name}` 没有详细功能介绍哦",
192
+ ).finish(reply_to=True)
193
+
194
+ r = await query_func_detail(pm_data, q_function.result)
195
+ if not r:
196
+ await UniMessage.text(
197
+ f"好像没有找到插件 `{info.name}` 的对应功能呢……",
198
+ ).finish(reply_to=True)
199
+ func_index, func = r
200
+ m = await func_detail_templates.get(
201
+ func.template,
202
+ )(info, info_index, func, func_index, show_hidden)
203
+ await m.finish()