nonebot-plugin-picmenu-next 0.1.0.dev2__tar.gz → 0.1.1__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 (96) hide show
  1. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/PKG-INFO +72 -21
  2. nonebot_plugin_picmenu_next-0.1.1/README.md +209 -0
  3. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/__init__.py +1 -1
  4. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/__main__.py +36 -14
  5. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/config.py +1 -0
  6. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/data_source/__init__.py +16 -0
  7. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/data_source/collect.py +55 -35
  8. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/data_source/mixin.py +225 -0
  9. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/data_source/models.py +109 -0
  10. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/data_source/pinyin.py +51 -0
  11. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/ft_parser.py +23 -16
  12. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/res/gan_shen_me.jpg +0 -0
  13. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/__init__.py +12 -2
  14. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/__init__.py +13 -2
  15. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/detail.html.jinja +5 -1
  16. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/index.html.jinja +5 -1
  17. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/pw_utils.py +2 -2
  18. nonebot_plugin_picmenu_next-0.1.1/nonebot_plugin_picmenu_next/utils.py +18 -0
  19. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/pyproject.toml +3 -2
  20. nonebot_plugin_picmenu_next-0.1.0.dev2/README.md +0 -159
  21. nonebot_plugin_picmenu_next-0.1.0.dev2/nonebot_plugin_picmenu_next/data_source/__init__.py +0 -31
  22. nonebot_plugin_picmenu_next-0.1.0.dev2/nonebot_plugin_picmenu_next/data_source/models.py +0 -191
  23. nonebot_plugin_picmenu_next-0.1.0.dev2/nonebot_plugin_picmenu_next/data_source/pinyin.py +0 -86
  24. nonebot_plugin_picmenu_next-0.1.0.dev2/nonebot_plugin_picmenu_next/utils.py +0 -34
  25. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/LICENSE +0 -0
  26. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/base.html.jinja +0 -0
  27. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/css/base.css +0 -0
  28. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/css/dark.css +0 -0
  29. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/css/detail.css +0 -0
  30. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/css/index.css +0 -0
  31. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/js/base.js +0 -0
  32. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/js/tsconfig.json +0 -0
  33. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/code-colorful.css +0 -0
  34. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/code-github-dark.css +0 -0
  35. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.ttf +0 -0
  36. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.woff +0 -0
  37. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  38. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  39. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  40. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  41. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  42. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  43. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  44. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  45. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  46. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  47. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  48. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  49. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  50. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.ttf +0 -0
  51. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.woff +0 -0
  52. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Bold.woff2 +0 -0
  53. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  54. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  55. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  56. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.ttf +0 -0
  57. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.woff +0 -0
  58. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Italic.woff2 +0 -0
  59. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.ttf +0 -0
  60. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.woff +0 -0
  61. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Main-Regular.woff2 +0 -0
  62. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  63. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  64. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  65. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.ttf +0 -0
  66. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.woff +0 -0
  67. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Math-Italic.woff2 +0 -0
  68. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  69. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  70. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  71. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  72. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  73. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  74. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  75. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  76. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  77. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.ttf +0 -0
  78. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.woff +0 -0
  79. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Script-Regular.woff2 +0 -0
  80. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.ttf +0 -0
  81. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.woff +0 -0
  82. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  83. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.ttf +0 -0
  84. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.woff +0 -0
  85. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  86. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.ttf +0 -0
  87. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.woff +0 -0
  88. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  89. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.ttf +0 -0
  90. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.woff +0 -0
  91. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  92. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  93. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  94. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  95. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/katex.min.css +0 -0
  96. {nonebot_plugin_picmenu_next-0.1.0.dev2 → nonebot_plugin_picmenu_next-0.1.1}/nonebot_plugin_picmenu_next/templates/default/res/third-party/katex.min.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-picmenu-next
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.1
4
4
  Summary: Template plugin project
5
5
  Author-Email: LgCookie <lgc2333@126.com>
6
6
  License: MIT
@@ -8,12 +8,13 @@ Project-URL: homepage, https://github.com/lgc-NB2Dev/nonebot-plugin-picmenu-next
8
8
  Requires-Python: <4.0,>=3.9
9
9
  Requires-Dist: nonebot2>=2.4.1
10
10
  Requires-Dist: nonebot-plugin-alconna>=0.54.2
11
- Requires-Dist: cookit[jinja,loguru,nonebot-alconna,nonebot-localstore,pw,pyd]>=0.11.5
11
+ Requires-Dist: cookit[jinja,loguru,nonebot-alconna,pw,pyd]>=0.11.6
12
12
  Requires-Dist: pypinyin>=0.54.0
13
13
  Requires-Dist: jieba>=0.42.1
14
14
  Requires-Dist: thefuzz>=0.22.1
15
15
  Requires-Dist: markdown-it-py[plugins]>=3.0.0
16
16
  Requires-Dist: pygments>=2.19.1
17
+ Requires-Dist: nonebot-plugin-htmlrender>=0.6.5
17
18
  Description-Content-Type: text/markdown
18
19
 
19
20
  <!-- markdownlint-disable MD031 MD033 MD036 MD041 -->
@@ -30,14 +31,14 @@ Description-Content-Type: text/markdown
30
31
 
31
32
  # NoneBot-Plugin-PicMenu-Next
32
33
 
33
- _✨ NoneBot 插件简单描述 ✨_
34
+ _✨ 新一代的图片帮助插件 ✨_
34
35
 
35
36
  <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
36
37
  <a href="https://pdm.fming.dev">
37
38
  <img src="https://img.shields.io/badge/pdm-managed-blueviolet" alt="pdm-managed">
38
39
  </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">
40
+ <a href="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/08822e56-b8a3-4a4e-a8dd-7d95757e3803">
41
+ <img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/08822e56-b8a3-4a4e-a8dd-7d95757e3803.svg" alt="wakatime">
41
42
  </a>
42
43
 
43
44
  <br />
@@ -68,7 +69,56 @@ _✨ NoneBot 插件简单描述 ✨_
68
69
 
69
70
  ## 📖 介绍
70
71
 
71
- 这里是插件的详细介绍部分
72
+ - ✨ **美观的图片界面**:直观友好的图片界面
73
+ - 🛠️ **PicMenu 兼容**:本插件使用 PicMenu 插件格式的三级菜单(功能详情),兼容 PicMenu 的 `<ft>` 富文本标签(但不太推荐使用)
74
+ - 🔍 **支持模糊搜索**:支持通过序号或名称查找插件及功能,并提供插件名称的模糊匹配
75
+ - 🔤 **拼音支持**:插件排序与模糊搜索时考虑拼音,提高中文环境下的使用体验
76
+ - 📜 **Markdown 支持**:支持 Markdown 格式的帮助信息展示(需要插件开发者主动适配)
77
+ - 🔒 **隐藏控制**:默认状态下类型为 `library` 的插件会对普通用户隐藏
78
+ - 🎨 **自定义模板**:提供模板开发者注册模板的接口,提供插件开发者自定义某插件使用的详细信息模板的方式,提供配置供用户自定义想要使用的模板
79
+ - 🔌 **插件扩展机制**:提供强大的 mixin 支持,允许插件通过中间件方式自定义帮助菜单展示和行为
80
+
81
+ ### 展示图
82
+
83
+ <details>
84
+ <summary>主页面</summary>
85
+
86
+ ![亮色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_main.jpg)
87
+ ![暗色主页](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_main.jpg)
88
+
89
+ </details>
90
+
91
+ <details>
92
+ <summary>插件详情</summary>
93
+
94
+ ![亮色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_detail.jpg)
95
+ ![暗色插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_detail.jpg)
96
+
97
+ </details>
98
+
99
+ <details>
100
+ <summary>插件详情(带功能详情三级菜单)</summary>
101
+
102
+ ![亮色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_with_func.jpg)
103
+ ![暗色带三级菜单插件详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_with_func.jpg)
104
+
105
+ </details>
106
+
107
+ <details>
108
+ <summary>功能详情</summary>
109
+
110
+ ![亮色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_func_detail.jpg)
111
+ ![暗色功能详情](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_func_detail.jpg)
112
+
113
+ </details>
114
+
115
+ <details>
116
+ <summary>Markdown 测试</summary>
117
+
118
+ ![亮色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/light_markdown.jpg)
119
+ ![暗色 Markdown 测试](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/picmenu-next/dark_markdown.jpg)
120
+
121
+ </details>
72
122
 
73
123
  ## 💿 安装
74
124
 
@@ -135,25 +185,22 @@ plugins = [
135
185
 
136
186
  ## ⚙️ 配置
137
187
 
138
- nonebot2 项目的 `.env` 文件中添加下表中的必填配置
188
+ NoneBot2 项目的 `.env` 文件中添加下表中的配置
139
189
 
140
- | 配置项 | 必填 | 默认值 | 说明 |
141
- | :------: | :--: | :----: | :------: |
142
- | 配置项 1 | | 无 | 配置说明 |
143
- | 配置项 2 | 否 | 无 | 配置说明 |
190
+ | 配置项 | 必填 | 默认值 | 说明 |
191
+ | :-----------------------------: | :--: | :-------: | :----------------------------: |
192
+ | `PMN_INDEX_TEMPLATE` | | `default` | 首页展示模板的名称 |
193
+ | `PMN_DETAIL_TEMPLATE` | 否 | `default` | 插件详情模板的名称 |
194
+ | `PMN_FUNC_DETAIL_TEMPLATE` | 否 | `default` | 插件功能详情模板的名称 |
195
+ | `PMN_ONLY_SUPERUSER_SEE_HIDDEN` | 否 | `False` | 是否仅超级用户可以查看隐藏内容 |
144
196
 
145
197
  ## 🎉 使用
146
198
 
147
- ### 指令表
199
+ 发送 `帮助` 指令试试吧!
148
200
 
149
- | 指令 | 权限 | 需要@ | 范围 | 说明 |
150
- | :----: | :--: | :---: | :--: | :------: |
151
- | 指令 1 | 主人 | 否 | 私聊 | 指令说明 |
152
- | 指令 2 | 群员 | 是 | 群聊 | 指令说明 |
201
+ ## 🔧 开发
153
202
 
154
- ### 效果图
155
-
156
- 如果有效果图的话
203
+ 文档待补充
157
204
 
158
205
  ## 📞 联系
159
206
 
@@ -164,7 +211,9 @@ Telegram:[@lgc2333](https://t.me/lgc2333)
164
211
 
165
212
  ## 💡 鸣谢
166
213
 
167
- 如果有要鸣谢的人的话
214
+ ### [hamo-reid/nonebot_plugin_PicMenu](https://github.com/hamo-reid/nonebot_plugin_PicMenu)
215
+
216
+ - 灵感来源(?)
168
217
 
169
218
  ## 💰 赞助
170
219
 
@@ -174,4 +223,6 @@ Telegram:[@lgc2333](https://t.me/lgc2333)
174
223
 
175
224
  ## 📝 更新日志
176
225
 
177
- 芝士刚刚发布的插件,还没有更新日志的说 qwq~
226
+ ### 0.1.1
227
+
228
+ - 尝试兼容 Pydantic V1
@@ -0,0 +1,209 @@
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/08822e56-b8a3-4a4e-a8dd-7d95757e3803">
22
+ <img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/08822e56-b8a3-4a4e-a8dd-7d95757e3803.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
+ ### 0.1.1
208
+
209
+ - 尝试兼容 Pydantic V1
@@ -11,7 +11,7 @@ from .config import ConfigModel
11
11
  from .data_source import refresh_infos
12
12
  from .templates import load_builtin_templates
13
13
 
14
- __version__ = "0.1.0.dev2"
14
+ __version__ = "0.1.1"
15
15
  __plugin_meta__ = PluginMetadata(
16
16
  name="PicMenu Next",
17
17
  description="新一代的图片帮助插件",
@@ -1,16 +1,24 @@
1
1
  from collections.abc import Sequence
2
+ from pathlib import Path
2
3
  from typing import Optional, TypeVar
3
4
 
4
5
  from arclet.alconna import Alconna, Arg, Args, CommandMeta, Option, store_true
5
6
  from loguru import logger
7
+ from nonebot.adapters import Bot as BaseBot, Event as BaseEvent
8
+ from nonebot.permission import SUPERUSER
6
9
  from nonebot_plugin_alconna import Query, on_alconna
7
10
  from nonebot_plugin_alconna.uniseg import UniMessage
8
11
  from thefuzz import process
9
12
 
10
- from .data_source import get_resolved_infos
13
+ from .config import config
14
+ from .data_source import get_infos
15
+ from .data_source.mixin import resolve_detail_mixin, resolve_main_mixin
11
16
  from .data_source.models import PinyinChunkSequence, PMDataItem, PMNPluginInfo
12
17
  from .templates import detail_templates, func_detail_templates, index_templates
13
18
 
19
+ RES_DIR = Path(__file__).parent / "res"
20
+ TIP_IMG_PATH = RES_DIR / "gan_shen_me.jpg"
21
+
14
22
  alc = Alconna(
15
23
  "help",
16
24
  Args(
@@ -137,16 +145,30 @@ async def query_func_detail(
137
145
 
138
146
  @m_cls.handle()
139
147
  async def _(
148
+ bot: BaseBot,
149
+ ev: BaseEvent,
140
150
  q_plugin: Query[Optional[str]] = Query("~plugin", None),
141
151
  q_function: Query[Optional[str]] = Query("~function", None),
142
152
  q_show_hidden: Query[bool] = Query("~show-hidden.value", default=False),
143
153
  ):
144
- infos = await get_resolved_infos()
145
- if not q_show_hidden.result:
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:
146
168
  infos = [x for x in infos if not x.pmn.hidden]
147
169
 
148
170
  if not q_plugin.result:
149
- m = await index_templates.get()(infos)
171
+ m = await index_templates.get()(infos, show_hidden)
150
172
  await m.finish()
151
173
 
152
174
  r = await query_plugin(infos, q_plugin.result)
@@ -154,21 +176,21 @@ async def _(
154
176
  await UniMessage.text("好像没有找到对应插件呢……").finish(reply_to=True)
155
177
  info_index, info = r
156
178
  if not q_function.result:
157
- m = await detail_templates.get(info.pmn.template)(info, info_index)
179
+ m = await detail_templates.get(
180
+ info.pmn.template,
181
+ )(info, info_index, show_hidden)
158
182
  await m.finish()
159
183
 
160
- if not info.pm_data:
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:
161
190
  await UniMessage.text(
162
191
  f"插件 `{info.name}` 没有详细功能介绍哦",
163
192
  ).finish(reply_to=True)
164
193
 
165
- if (not (plugin := info.plugin)) or (
166
- not (pm_data := await info.resolve_pm_data(plugin))
167
- ):
168
- await UniMessage.text("啊哦,遇到了意外情况……").finish(reply_to=True)
169
-
170
- if not q_show_hidden.result:
171
- pm_data = [x for x in pm_data if not x.hidden]
172
194
  r = await query_func_detail(pm_data, q_function.result)
173
195
  if not r:
174
196
  await UniMessage.text(
@@ -177,5 +199,5 @@ async def _(
177
199
  func_index, func = r
178
200
  m = await func_detail_templates.get(
179
201
  func.template,
180
- )(info, info_index, func, func_index)
202
+ )(info, info_index, func, func_index, show_hidden)
181
203
  await m.finish()
@@ -8,6 +8,7 @@ class ConfigModel(BaseModel):
8
8
  index_template: str = "default"
9
9
  detail_template: str = "default"
10
10
  func_detail_template: str = "default"
11
+ only_superuser_see_hidden: bool = False
11
12
 
12
13
 
13
14
  config: ConfigModel = get_plugin_config(ConfigModel)
@@ -0,0 +1,16 @@
1
+ from nonebot import get_loaded_plugins as _get_loaded_plugins
2
+
3
+ from .collect import collect_plugin_infos as _collect_plugin_infos
4
+ from .models import PMNPluginInfo as _PMNPluginInfoRaw
5
+
6
+ _infos: list[_PMNPluginInfoRaw] = []
7
+
8
+
9
+ def get_infos() -> list[_PMNPluginInfoRaw]:
10
+ return _infos
11
+
12
+
13
+ async def refresh_infos() -> list[_PMNPluginInfoRaw]:
14
+ global _infos
15
+ _infos = await _collect_plugin_infos(_get_loaded_plugins())
16
+ return _infos
@@ -1,7 +1,10 @@
1
1
  import asyncio
2
+ import importlib
2
3
  from collections.abc import Iterable
3
- from importlib.metadata import Distribution, distribution
4
- from typing import Literal, Optional, Union
4
+ from contextlib import suppress
5
+ from functools import lru_cache
6
+ from importlib.metadata import Distribution, PackageNotFoundError, distribution
7
+ from typing import Optional
5
8
 
6
9
  from cookit.loguru import warning_suppress
7
10
  from cookit.pyd import type_validate_python
@@ -9,7 +12,8 @@ from nonebot import logger
9
12
  from nonebot.plugin import Plugin
10
13
 
11
14
  from ..utils import normalize_plugin_name
12
- from .models import PMNDataRaw, PMNPluginExtra, PMNPluginInfoRaw
15
+ from .mixin import chain_mixins, plugin_collect_mixins
16
+ from .models import PMNData, PMNPluginExtra, PMNPluginInfo
13
17
 
14
18
 
15
19
  def normalize_metadata_user(info: str, allow_multi: bool = False) -> str:
@@ -19,7 +23,31 @@ def normalize_metadata_user(info: str, allow_multi: bool = False) -> str:
19
23
  return " & ".join(x.split("<")[0].strip().strip("'\"") for x in infos)
20
24
 
21
25
 
22
- async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfoRaw:
26
+ @lru_cache
27
+ def get_dist(module_name: str) -> Optional[Distribution]:
28
+ with warning_suppress(f"Unexpected error happened when getting info of package {module_name}"),\
29
+ suppress(PackageNotFoundError): # fmt: skip
30
+ return distribution(module_name)
31
+ if "." not in module_name:
32
+ return None
33
+ module_name = module_name.rsplit(".", 1)[0]
34
+ return get_dist(module_name)
35
+
36
+
37
+ @lru_cache
38
+ def get_version_attr(module_name: str) -> Optional[str]:
39
+ with warning_suppress(f"Unexpected error happened when importing {module_name}"),\
40
+ suppress(ImportError): # fmt: skip
41
+ m = importlib.import_module(module_name)
42
+ if ver := getattr(m, "__version__", None):
43
+ return ver
44
+ if "." not in module_name:
45
+ return None
46
+ module_name = module_name.rsplit(".", 1)[0]
47
+ return get_version_attr(module_name)
48
+
49
+
50
+ async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfo:
23
51
  meta = plugin.metadata
24
52
  extra: Optional[PMNPluginExtra] = None
25
53
  if meta:
@@ -28,31 +56,10 @@ async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfoRaw:
28
56
 
29
57
  name = normalize_plugin_name(meta.name if meta else plugin.id_)
30
58
 
31
- _dist: Union[Distribution, None, Literal[False]] = False
32
-
33
- def get_dist() -> Optional[Distribution]:
34
- nonlocal _dist
35
- if _dist is not False:
36
- return _dist
37
-
38
- _dist = None
39
- module = plugin.module_name
40
- while True:
41
- with warning_suppress(
42
- f"Failed to get info of package {module}",
43
- level="DEBUG",
44
- debug_stack=False,
45
- ):
46
- _dist = distribution(module)
47
- return _dist
48
- if "." not in module:
49
- return None
50
- module = module.rsplit(".", 1)[0]
51
-
52
59
  ver = extra.version if extra else None
53
60
  if not ver:
54
- ver = getattr(plugin, "__version__", None)
55
- if not ver and (dist := get_dist()):
61
+ ver = get_version_attr(plugin.module_name)
62
+ if not ver and (dist := get_dist(plugin.module_name)):
56
63
  ver = dist.version
57
64
 
58
65
  author = (
@@ -60,7 +67,7 @@ async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfoRaw:
60
67
  if extra
61
68
  else None
62
69
  )
63
- if not author and (dist := get_dist()):
70
+ if not author and (dist := get_dist(plugin.module_name)):
64
71
  if author := dist.metadata.get("Author") or dist.metadata.get("Maintainer"):
65
72
  author = normalize_metadata_user(author)
66
73
  elif author := dist.metadata.get("Author-Email") or dist.metadata.get(
@@ -71,15 +78,20 @@ async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfoRaw:
71
78
  description = (
72
79
  meta.description
73
80
  if meta
74
- else (dist.metadata.get("Summary") if (dist := get_dist()) else None)
81
+ else (
82
+ dist.metadata.get("Summary")
83
+ if (dist := get_dist(plugin.module_name))
84
+ else None
85
+ )
75
86
  )
76
87
 
77
- pmn = (extra.pmn if extra else None) or PMNDataRaw()
88
+ pmn = (extra.pmn if extra else None) or PMNData()
78
89
  if ("hidden" not in pmn.model_fields_set) and meta and meta.type == "library":
79
- pmn = PMNDataRaw(hidden=True)
90
+ pmn = PMNData(hidden=True)
80
91
 
81
92
  logger.debug(f"Completed to get info of plugin {plugin.id_}")
82
- obj = PMNPluginInfoRaw(
93
+ return PMNPluginInfo(
94
+ plugin_id=plugin.id_,
83
95
  name=name,
84
96
  author=author,
85
97
  version=ver,
@@ -88,8 +100,6 @@ async def get_info_from_plugin(plugin: Plugin) -> PMNPluginInfoRaw:
88
100
  pm_data=extra.menu_data if extra else None,
89
101
  pmn=pmn,
90
102
  )
91
- obj.plugin = plugin
92
- return obj
93
103
 
94
104
 
95
105
  async def collect_plugin_infos(plugins: Iterable[Plugin]):
@@ -101,6 +111,16 @@ async def collect_plugin_infos(plugins: Iterable[Plugin]):
101
111
  *(_get(plugin) for plugin in plugins),
102
112
  )
103
113
  infos = [x for x in infos if x]
104
- logger.success(f"Collected {len(infos)} plugin infos")
114
+
115
+ async def final_mixin(infos: list[PMNPluginInfo]):
116
+ return infos
117
+
118
+ mixin_chain = chain_mixins(plugin_collect_mixins.data, final_mixin)
119
+ infos = await mixin_chain(infos)
120
+
105
121
  infos.sort(key=lambda x: x.name_pinyin)
122
+ logger.success(f"Collected {len(infos)} plugin infos")
123
+
124
+ get_dist.cache_clear()
125
+ get_version_attr.cache_clear()
106
126
  return infos