nonebot-plugin-parser 2.6.6__tar.gz → 2.6.7__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_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/PKG-INFO +5 -1
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/README.md +4 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/pyproject.toml +2 -2
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/config.py +7 -0
- nonebot_plugin_parser-2.6.7/src/nonebot_plugin_parser/matchers/filter.py +82 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/xiaohongshu/__init__.py +1 -1
- nonebot_plugin_parser-2.6.6/src/nonebot_plugin_parser/matchers/filter.py +0 -72
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/constants.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/download/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/download/task.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/download/ytdlp.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/exception.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/helper.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/matchers/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/matchers/rule.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/acfun/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/acfun/video.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/base.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/article.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/common.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/dynamic.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/favlist.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/live.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/opus.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/bilibili/video.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/cookie.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/data.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/douyin/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/douyin/slides.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/douyin/video.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/kuaishou/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/kuaishou/states.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/nga.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/task.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/tiktok.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/twitter.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/utils.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/weibo/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/weibo/article.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/weibo/common.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/weibo/show.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/xiaohongshu/common.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/xiaohongshu/discovery.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/xiaohongshu/explore.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/youtube/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/youtube/meta.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/base.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/common/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/common/assets.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/common/font.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/common/renderer.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/default.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/htmlrender.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/HYSongYunLangHeiW.ttf +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/__init__.py +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/avatar.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/bilibili.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/douyin.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/1.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/2.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/3.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/4.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/5.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/6.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/7.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/8.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/fallback_pic/9.jpg +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/kuaishou.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/play.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/tiktok.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/twitter.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/weibo.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/xiaohongshu.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/resources/youtube.png +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/renders/templates/card.html.jinja2 +0 -0
- {nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nonebot-plugin-parser
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.7
|
|
4
4
|
Summary: NoneBot2 链接分享解析 Alconna 版, 现支持B站|抖音|快手|微博|小红书|YouTube|TikTok|Twitter|AcFun|NGA
|
|
5
5
|
Keywords: acfun,bilibili,douyin,kuaishou,nga,nonebot,nonebot2,tiktok,twitter,video,weibo,xiaohongshu,youtube
|
|
6
6
|
Author: fllesser
|
|
@@ -315,6 +315,10 @@ parser_emoji_cdn="https://emojicdn.elk.sh"
|
|
|
315
315
|
|
|
316
316
|
# [可选] emoji 渲染样式 "apple", "google", "twitter", "facebook"(默认)
|
|
317
317
|
parser_emoji_style="facebook"
|
|
318
|
+
|
|
319
|
+
# [可选] 是否启用群组黑名单模式(默认启用,即所有群聊的解析都是开启的)
|
|
320
|
+
parser_group_blacklist_enabled=True
|
|
321
|
+
|
|
318
322
|
```
|
|
319
323
|
|
|
320
324
|
</details>
|
|
@@ -262,6 +262,10 @@ parser_emoji_cdn="https://emojicdn.elk.sh"
|
|
|
262
262
|
|
|
263
263
|
# [可选] emoji 渲染样式 "apple", "google", "twitter", "facebook"(默认)
|
|
264
264
|
parser_emoji_style="facebook"
|
|
265
|
+
|
|
266
|
+
# [可选] 是否启用群组黑名单模式(默认启用,即所有群聊的解析都是开启的)
|
|
267
|
+
parser_group_blacklist_enabled=True
|
|
268
|
+
|
|
265
269
|
```
|
|
266
270
|
|
|
267
271
|
</details>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nonebot-plugin-parser"
|
|
3
|
-
version = "2.6.
|
|
3
|
+
version = "2.6.7"
|
|
4
4
|
description = "NoneBot2 链接分享解析 Alconna 版, 现支持B站|抖音|快手|微博|小红书|YouTube|TikTok|Twitter|AcFun|NGA"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -115,7 +115,7 @@ conflicts = [
|
|
|
115
115
|
[tool.bumpversion]
|
|
116
116
|
tag = true
|
|
117
117
|
commit = true
|
|
118
|
-
current_version = "2.6.
|
|
118
|
+
current_version = "2.6.7"
|
|
119
119
|
message = "release: bump vesion from {current_version} to {new_version}"
|
|
120
120
|
|
|
121
121
|
[[tool.bumpversion.files]]
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/config.py
RENAMED
|
@@ -56,6 +56,8 @@ class Config(BaseModel):
|
|
|
56
56
|
"""Pilmoji 表情 CDN"""
|
|
57
57
|
parser_emoji_style: EmojiStyle = EmojiStyle.FACEBOOK
|
|
58
58
|
"""Pilmoji 表情样式"""
|
|
59
|
+
parser_group_blacklist_enabled: bool = True
|
|
60
|
+
"""是否启用群组黑名单模式(默认启用,即所有群聊的解析都是开启的)"""
|
|
59
61
|
|
|
60
62
|
@property
|
|
61
63
|
def nickname(self) -> str:
|
|
@@ -182,6 +184,11 @@ class Config(BaseModel):
|
|
|
182
184
|
"""Pilmoji 表情样式"""
|
|
183
185
|
return self.parser_emoji_style
|
|
184
186
|
|
|
187
|
+
@property
|
|
188
|
+
def group_blacklist_enabled(self) -> bool:
|
|
189
|
+
"""是否启用群组黑名单模式"""
|
|
190
|
+
return self.parser_group_blacklist_enabled
|
|
191
|
+
|
|
185
192
|
|
|
186
193
|
pconfig: Config = get_plugin_config(Config)
|
|
187
194
|
"""插件配置"""
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from nonebot import on_command
|
|
5
|
+
from nonebot.rule import to_me
|
|
6
|
+
from nonebot.matcher import Matcher
|
|
7
|
+
from nonebot.permission import SUPERUSER
|
|
8
|
+
from nonebot_plugin_uninfo import ADMIN, Session, UniSession
|
|
9
|
+
|
|
10
|
+
from ..config import pconfig
|
|
11
|
+
|
|
12
|
+
_DISABLED_GROUPS_PATH: Path = pconfig.data_dir / "disabled_groups.json"
|
|
13
|
+
_GROUP_SET_PATH: Path = pconfig.data_dir / "group_set.json"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _load_or_initialize_set() -> set[str]:
|
|
17
|
+
"""加载群配置"""
|
|
18
|
+
# 判断是否存在
|
|
19
|
+
if not _GROUP_SET_PATH.exists():
|
|
20
|
+
if _DISABLED_GROUPS_PATH.exists():
|
|
21
|
+
# 迁移旧的关闭解析名单
|
|
22
|
+
_DISABLED_GROUPS_PATH.rename(_GROUP_SET_PATH)
|
|
23
|
+
else:
|
|
24
|
+
_GROUP_SET_PATH.write_text(json.dumps([]))
|
|
25
|
+
|
|
26
|
+
return set(json.loads(_GROUP_SET_PATH.read_text()))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_GROUP_SET: set[str] = _load_or_initialize_set()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _save_group_set():
|
|
33
|
+
_GROUP_SET_PATH.write_text(json.dumps(list(_GROUP_SET)))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _add_group(group_key: str):
|
|
37
|
+
_GROUP_SET.add(group_key)
|
|
38
|
+
_save_group_set()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _remove_group(group_key: str):
|
|
42
|
+
_GROUP_SET.discard(group_key)
|
|
43
|
+
_save_group_set()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _get_group_key(session: Session) -> str:
|
|
47
|
+
"""获取群组的唯一标识符 由平台名称和会话场景 ID 组成,例如 `QQClient_123456789`"""
|
|
48
|
+
return f"{session.scope}_{session.scene_path}"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def is_enabled(session: Session = UniSession()) -> bool:
|
|
52
|
+
"""判断当前会话是否在关闭解析的名单中"""
|
|
53
|
+
if session.scene.is_private:
|
|
54
|
+
return True
|
|
55
|
+
|
|
56
|
+
group_key = _get_group_key(session)
|
|
57
|
+
if pconfig.group_blacklist_enabled:
|
|
58
|
+
return group_key not in _GROUP_SET
|
|
59
|
+
else:
|
|
60
|
+
return group_key in _GROUP_SET
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@on_command("开启解析", rule=to_me(), permission=SUPERUSER | ADMIN(), block=True).handle()
|
|
64
|
+
async def _(matcher: Matcher, session: Session = UniSession()):
|
|
65
|
+
"""开启解析"""
|
|
66
|
+
group_key = _get_group_key(session)
|
|
67
|
+
if pconfig.group_blacklist_enabled:
|
|
68
|
+
_remove_group(group_key)
|
|
69
|
+
else:
|
|
70
|
+
_add_group(group_key)
|
|
71
|
+
await matcher.finish("解析已开启")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@on_command("关闭解析", rule=to_me(), permission=SUPERUSER | ADMIN(), block=True).handle()
|
|
75
|
+
async def _(matcher: Matcher, session: Session = UniSession()):
|
|
76
|
+
"""关闭解析"""
|
|
77
|
+
group_key = _get_group_key(session)
|
|
78
|
+
if pconfig.group_blacklist_enabled:
|
|
79
|
+
_add_group(group_key)
|
|
80
|
+
else:
|
|
81
|
+
_remove_group(group_key)
|
|
82
|
+
await matcher.finish("解析已关闭")
|
|
@@ -33,7 +33,7 @@ class XiaoHongShuParser(BaseParser):
|
|
|
33
33
|
self.headers["cookie"] = pconfig.xhs_ck
|
|
34
34
|
self.ios_headers["cookie"] = pconfig.xhs_ck
|
|
35
35
|
|
|
36
|
-
@handle("xhslink
|
|
36
|
+
@handle("xhslink", r"xhslink\.(com|cn)/[A-Za-z0-9._?%&+=/#@-]+")
|
|
37
37
|
async def _parse_short_link(self, searched: re.Match[str]):
|
|
38
38
|
url = f"https://{searched.group(0)}"
|
|
39
39
|
return await self.parse_with_redirect(url, self.ios_headers)
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
from nonebot import on_command
|
|
5
|
-
from nonebot.rule import to_me
|
|
6
|
-
from nonebot.matcher import Matcher
|
|
7
|
-
from nonebot.permission import SUPERUSER
|
|
8
|
-
from nonebot_plugin_uninfo import ADMIN, Session, UniSession
|
|
9
|
-
|
|
10
|
-
from ..config import pconfig
|
|
11
|
-
|
|
12
|
-
_DISABLED_GROUPS_PATH: Path = pconfig.data_dir / "disabled_groups.json"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def load_or_initialize_set() -> set[str]:
|
|
16
|
-
"""加载或初始化关闭解析的名单"""
|
|
17
|
-
# 判断是否存在
|
|
18
|
-
if not _DISABLED_GROUPS_PATH.exists():
|
|
19
|
-
_DISABLED_GROUPS_PATH.write_text(json.dumps([]))
|
|
20
|
-
return set(json.loads(_DISABLED_GROUPS_PATH.read_text()))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def save_disabled_groups():
|
|
24
|
-
"""保存关闭解析的名单"""
|
|
25
|
-
_DISABLED_GROUPS_PATH.write_text(json.dumps(list(_DISABLED_GROUPS_SET)))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# 内存中关闭解析的名单,第一次先进行初始化
|
|
29
|
-
_DISABLED_GROUPS_SET: set[str] = load_or_initialize_set()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def get_group_key(session: Session) -> str:
|
|
33
|
-
"""获取群组的唯一标识符
|
|
34
|
-
|
|
35
|
-
由平台名称和会话场景 ID 组成,例如 `QQClient_123456789`。
|
|
36
|
-
"""
|
|
37
|
-
return f"{session.scope}_{session.scene_path}"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def is_enabled(session: Session = UniSession()) -> bool:
|
|
41
|
-
"""判断当前会话是否在关闭解析的名单中"""
|
|
42
|
-
if session.scene.is_private:
|
|
43
|
-
return True
|
|
44
|
-
|
|
45
|
-
group_key = get_group_key(session)
|
|
46
|
-
if group_key in _DISABLED_GROUPS_SET:
|
|
47
|
-
return False
|
|
48
|
-
return True
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@on_command("开启解析", rule=to_me(), permission=SUPERUSER | ADMIN(), block=True).handle()
|
|
52
|
-
async def _(matcher: Matcher, session: Session = UniSession()):
|
|
53
|
-
"""开启解析"""
|
|
54
|
-
group_key = get_group_key(session)
|
|
55
|
-
if group_key in _DISABLED_GROUPS_SET:
|
|
56
|
-
_DISABLED_GROUPS_SET.remove(group_key)
|
|
57
|
-
save_disabled_groups()
|
|
58
|
-
await matcher.finish("解析已开启")
|
|
59
|
-
else:
|
|
60
|
-
await matcher.finish("解析已开启,无需重复开启")
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@on_command("关闭解析", rule=to_me(), permission=SUPERUSER | ADMIN(), block=True).handle()
|
|
64
|
-
async def _(matcher: Matcher, session: Session = UniSession()):
|
|
65
|
-
"""关闭解析"""
|
|
66
|
-
group_key = get_group_key(session)
|
|
67
|
-
if group_key not in _DISABLED_GROUPS_SET:
|
|
68
|
-
_DISABLED_GROUPS_SET.add(group_key)
|
|
69
|
-
save_disabled_groups()
|
|
70
|
-
await matcher.finish("解析已关闭")
|
|
71
|
-
else:
|
|
72
|
-
await matcher.finish("解析已关闭,无需重复关闭")
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/__init__.py
RENAMED
|
File without changes
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/exception.py
RENAMED
|
File without changes
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/parsers/nga.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_parser-2.6.6 → nonebot_plugin_parser-2.6.7}/src/nonebot_plugin_parser/utils.py
RENAMED
|
File without changes
|