nonebot-plugin-efthelper 0.1.0__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.
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/PKG-INFO +1 -1
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/__init__.py +30 -12
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/config.py +3 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper.egg-info/PKG-INFO +1 -1
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/pyproject.toml +1 -1
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/LICENSE +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/README.md +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/api.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/assets/README.md +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/assets/bear.png +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/assets/usec.png +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/card.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/circle.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/eftforge.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/endings.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/format.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/image.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/index.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/registry.py +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper.egg-info/SOURCES.txt +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper.egg-info/requires.txt +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper.egg-info/top_level.txt +0 -0
- {nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/setup.cfg +0 -0
|
@@ -15,7 +15,7 @@ import logging
|
|
|
15
15
|
import time
|
|
16
16
|
from typing import Dict, List, Optional, Tuple
|
|
17
17
|
|
|
18
|
-
from nonebot import get_driver, get_plugin_config, on_command
|
|
18
|
+
from nonebot import get_driver, get_plugin_config, on_command, require
|
|
19
19
|
from nonebot.adapters import Message
|
|
20
20
|
from nonebot.matcher import Matcher
|
|
21
21
|
from nonebot.params import CommandArg
|
|
@@ -38,14 +38,36 @@ from .image import dim_image, make_image_segment, sniff_format, webp_to_png
|
|
|
38
38
|
from .index import NicknameIndex
|
|
39
39
|
from .registry import ProfileRegistry
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
logger = logging.getLogger("nonebot_plugin_efthelper")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _require_plugin(name: str) -> bool:
|
|
45
|
+
"""先 require 再 import 依赖插件。
|
|
46
|
+
|
|
47
|
+
NoneBot 的硬性规定:依赖其他插件提供的功能时必须先 require(),否则模块会被
|
|
48
|
+
普通 import 进来却没「作为插件加载」,之后任何人再 require 它都会报
|
|
49
|
+
「Module ... is not loaded as a plugin」。插件商店的自动化测试恰好会 require
|
|
50
|
+
一次 apscheduler,踩的就是这个坑。
|
|
51
|
+
"""
|
|
52
|
+
try:
|
|
53
|
+
require(name)
|
|
54
|
+
return True
|
|
55
|
+
except Exception: # noqa: BLE001 - 依赖缺失时允许降级
|
|
56
|
+
logger.debug("依赖插件 %s 不可用,相关功能降级", name)
|
|
57
|
+
return False
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# 多候选时的序号选择依赖 nonebot-plugin-waiter,缺失则退化成「列出 ID 让用户自己填」
|
|
61
|
+
_HAS_WAITER = _require_plugin("nonebot_plugin_waiter")
|
|
62
|
+
if _HAS_WAITER:
|
|
44
63
|
from nonebot_plugin_waiter import prompt as _waiter_prompt
|
|
45
|
-
|
|
64
|
+
else:
|
|
46
65
|
_waiter_prompt = None
|
|
47
66
|
|
|
48
|
-
|
|
67
|
+
# 定时任务依赖 nonebot-plugin-apscheduler
|
|
68
|
+
_HAS_SCHEDULER = _require_plugin("nonebot_plugin_apscheduler")
|
|
69
|
+
if _HAS_SCHEDULER:
|
|
70
|
+
from nonebot_plugin_apscheduler import scheduler
|
|
49
71
|
|
|
50
72
|
__plugin_meta__ = PluginMetadata(
|
|
51
73
|
name="逃离塔科夫查询",
|
|
@@ -906,9 +928,7 @@ def _setup_refresh_job() -> None:
|
|
|
906
928
|
logger.info("档案预热已关闭(EFT_PROFILE_REFRESH_ENABLED=false)")
|
|
907
929
|
return
|
|
908
930
|
|
|
909
|
-
|
|
910
|
-
from nonebot_plugin_apscheduler import scheduler
|
|
911
|
-
except Exception: # noqa: BLE001 - 可选依赖
|
|
931
|
+
if not _HAS_SCHEDULER:
|
|
912
932
|
logger.info(
|
|
913
933
|
"未安装 nonebot-plugin-apscheduler,跳过档案预热。"
|
|
914
934
|
"装上即可启用:pip install nonebot-plugin-apscheduler"
|
|
@@ -1164,9 +1184,7 @@ def _setup_circle_warm_job() -> None:
|
|
|
1164
1184
|
except Exception as exc: # noqa: BLE001
|
|
1165
1185
|
logger.debug("注册启动预热失败:%s", exc)
|
|
1166
1186
|
|
|
1167
|
-
|
|
1168
|
-
from nonebot_plugin_apscheduler import scheduler
|
|
1169
|
-
except Exception: # noqa: BLE001 - 可选依赖
|
|
1187
|
+
if not _HAS_SCHEDULER:
|
|
1170
1188
|
logger.info(
|
|
1171
1189
|
"未安装 nonebot-plugin-apscheduler,跳过邪教圈定时预热。"
|
|
1172
1190
|
"装上即可启用:pip install nonebot-plugin-apscheduler"
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/config.py
RENAMED
|
@@ -15,6 +15,9 @@ from pydantic import BaseModel, Field
|
|
|
15
15
|
def _default_cache_dir() -> Path:
|
|
16
16
|
"""优先用 nonebot-plugin-localstore;没装就退回到 ./cache/eft。"""
|
|
17
17
|
try:
|
|
18
|
+
from nonebot import require
|
|
19
|
+
|
|
20
|
+
require("nonebot_plugin_localstore")
|
|
18
21
|
import nonebot_plugin_localstore as store # type: ignore
|
|
19
22
|
|
|
20
23
|
return Path(store.get_plugin_cache_dir("nonebot_plugin_efthelper"))
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/card.py
RENAMED
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/circle.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/format.py
RENAMED
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/image.py
RENAMED
|
File without changes
|
{nonebot_plugin_efthelper-0.1.0 → nonebot_plugin_efthelper-0.1.1}/nonebot_plugin_efthelper/index.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|