nonebot-plugin-randpic 1.2.0__tar.gz → 1.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-randpic
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: 一个通过指令随机发送你存储的图片的nonebot2插件
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -22,6 +22,7 @@ Requires-Dist: httpx (>=0.20.0,<1.0.0)
22
22
  Requires-Dist: nonebot-adapter-onebot (>=2.1.5,<3.0.0)
23
23
  Requires-Dist: nonebot-plugin-localstore (>=0.6.0,<0.7.0)
24
24
  Requires-Dist: nonebot2[fastapi] (>=2.0.0,<3.0.0)
25
+ Requires-Dist: pillow (>=11.0.0)
25
26
  Project-URL: Homepage, https://github.com/HuParry/nonebot-plugin-randpic
26
27
  Project-URL: Repository, https://github.com/HuParry/nonebot-plugin-randpic
27
28
  Description-Content-Type: text/markdown
@@ -14,6 +14,7 @@ import aiosqlite
14
14
  from nonebot.params import Fullmatch
15
15
  from urllib import parse
16
16
  from urllib.parse import urlparse
17
+ import importlib
17
18
 
18
19
  from .config import *
19
20
  from .ali_oss import *
@@ -132,15 +133,17 @@ async def create_dir():
132
133
 
133
134
  def web_app_init(web_driver: Driver):
134
135
  try:
135
- from .drivers.fastapi import register_route
136
- except ImportError as e:
137
- logger.warning(f"Driver {web_driver.type} not supported")
136
+ _module = importlib.import_module(
137
+ f"nonebot_plugin_randpic.drivers.{driver.type.split('+')[0]}"
138
+ )
139
+ except ImportError:
140
+ logger.warning(f"Driver {driver.type} not supported")
138
141
  return
139
142
 
140
143
  StaticImageGalleryGenerator(randpic_img_path, randpic_path / 'public').generate_static_site(randpic_oss_no_upload_list)
141
144
  if not os.path.exists(randpic_path / 'public'):
142
145
  return
143
-
146
+ register_route = getattr(_module, "register_route")
144
147
  register_route(web_driver, randpic_path / 'public')
145
148
  host = str(web_driver.config.host)
146
149
  port = web_driver.config.port
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "nonebot-plugin-randpic"
3
- version = "1.2.0"
3
+ version = "1.2.2"
4
4
  description = "一个通过指令随机发送你存储的图片的nonebot2插件"
5
5
  authors = ["HuParry <hu_parry@qq.com>"]
6
6
  license = "MIT"
@@ -18,6 +18,7 @@ nonebot-plugin-localstore = "^0.6.0"
18
18
  aiosqlite = "^0.13.0"
19
19
  httpx = ">=0.20.0,<1.0.0"
20
20
  alibabacloud_oss_v2 = ">=1.1.0"
21
+ pillow = ">=11.0.0"
21
22
 
22
23
  [build-system]
23
24
  requires = ["poetry-core"]