nonebot-plugin-dialectlist 2.5.1__tar.gz → 2.6.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 (21) hide show
  1. {nonebot_plugin_dialectlist-2.5.1/nonebot_plugin_dialectlist.egg-info → nonebot_plugin_dialectlist-2.6.1}/PKG-INFO +19 -11
  2. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/README.md +17 -9
  3. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/__init__.py +18 -8
  4. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/config.py +1 -1
  5. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/utils.py +3 -1
  6. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1/nonebot_plugin_dialectlist.egg-info}/PKG-INFO +19 -11
  7. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/pyproject.toml +2 -2
  8. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/LICENSE +0 -0
  9. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/MANIFEST.in +0 -0
  10. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/model.py +0 -0
  11. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/storage.py +0 -0
  12. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  13. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
  14. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  15. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/time.py +0 -0
  16. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist/usage.py +0 -0
  17. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -0
  18. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  19. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist.egg-info/requires.txt +0 -0
  20. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  21. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.1}/setup.cfg +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.5.1
3
+ Version: 2.6.1
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
7
- Requires-Python: <3.13,>=3.9
7
+ Requires-Python: <4.0,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
@@ -82,15 +82,20 @@ nb plugin install nonebot-plugin-dialectlist
82
82
 
83
83
  在 .env 中,可以添加以下配置项
84
84
  ```python
85
- dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
86
- dialectlist__get_num = 10 #获取人数数量
87
- dialectlist__visualization = True #是否可视化
88
- # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
89
- dialectlist__font = "SimHei" #字体格式
90
- dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
91
- dialectlist__excluded_self = True #是否排除机器人自己 QQ
92
- dialectlist__suffix: bool = False # 是否显示后缀
93
- dialectlist__string_suffix: str = "统计花费时间{timecost}" # 消息格式后缀
85
+ dialectlist__get_num: int = 5 # 获取人数数量
86
+ dialectlist__font: str = "SimHei" # 字体格式
87
+ dialectlist__suffix: bool = True # 是否显示后缀
88
+ dialectlist__excluded_self: bool = True # 是否排除自己
89
+ dialectlist__visualization: bool = True # 是否可视化
90
+ dialectlist__show_text_rank: bool = True # 是否显示文本排名
91
+ dialectlist__counting_cache: bool = False # 计数缓存(能够提高回复速度)
92
+ dialectlist__excluded_people: List[str] = [] # 排除的人的QQ号
93
+ dialectlist__use_user_info_cache: bool = False # 是否使用用户信息缓存
94
+ dialectlist__aggregate_transmission: bool = False # 是否聚合转发消息
95
+ dialectlist__timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
96
+ dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
97
+ dialectlist__template_path: str = "./template/rank_template.j2" # 模板路径
98
+ dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
94
99
  ```
95
100
  💭也可以不进行配置,这将会使插件按照默认配置运行
96
101
 
@@ -154,6 +159,9 @@ __!!注意!!__
154
159
  `/kkb 114514 1919810 ♂`
155
160
  `/kkb @man -k ♂`
156
161
 
162
+ > [!IMPORTANT]
163
+ > 关键词支持正则表达式!
164
+
157
165
  ## 💪 目前支持的平台
158
166
 
159
167
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -54,15 +54,20 @@ nb plugin install nonebot-plugin-dialectlist
54
54
 
55
55
  在 .env 中,可以添加以下配置项
56
56
  ```python
57
- dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
58
- dialectlist__get_num = 10 #获取人数数量
59
- dialectlist__visualization = True #是否可视化
60
- # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
61
- dialectlist__font = "SimHei" #字体格式
62
- dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
63
- dialectlist__excluded_self = True #是否排除机器人自己 QQ
64
- dialectlist__suffix: bool = False # 是否显示后缀
65
- dialectlist__string_suffix: str = "统计花费时间{timecost}" # 消息格式后缀
57
+ dialectlist__get_num: int = 5 # 获取人数数量
58
+ dialectlist__font: str = "SimHei" # 字体格式
59
+ dialectlist__suffix: bool = True # 是否显示后缀
60
+ dialectlist__excluded_self: bool = True # 是否排除自己
61
+ dialectlist__visualization: bool = True # 是否可视化
62
+ dialectlist__show_text_rank: bool = True # 是否显示文本排名
63
+ dialectlist__counting_cache: bool = False # 计数缓存(能够提高回复速度)
64
+ dialectlist__excluded_people: List[str] = [] # 排除的人的QQ号
65
+ dialectlist__use_user_info_cache: bool = False # 是否使用用户信息缓存
66
+ dialectlist__aggregate_transmission: bool = False # 是否聚合转发消息
67
+ dialectlist__timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
68
+ dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
69
+ dialectlist__template_path: str = "./template/rank_template.j2" # 模板路径
70
+ dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
66
71
  ```
67
72
  💭也可以不进行配置,这将会使插件按照默认配置运行
68
73
 
@@ -126,6 +131,9 @@ __!!注意!!__
126
131
  `/kkb 114514 1919810 ♂`
127
132
  `/kkb @man -k ♂`
128
133
 
134
+ > [!IMPORTANT]
135
+ > 关键词支持正则表达式!
136
+
129
137
  ## 💪 目前支持的平台
130
138
 
131
139
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -5,6 +5,7 @@ require("nonebot_plugin_apscheduler")
5
5
  require("nonebot_plugin_htmlrender")
6
6
  require("nonebot_plugin_userinfo")
7
7
  require("nonebot_plugin_alconna")
8
+ require("nonebot_plugin_uninfo")
8
9
  require("nonebot_plugin_cesaa")
9
10
 
10
11
  import re
@@ -33,6 +34,7 @@ from nonebot_plugin_alconna import (
33
34
  )
34
35
  from nonebot_plugin_chatrecorder import get_message_records
35
36
  from nonebot_plugin_session import Session, SessionIdType, extract_session
37
+ from nonebot_plugin_uninfo import Uninfo
36
38
 
37
39
  from .storage import get_cache, build_cache
38
40
  from .config import Config, plugin_config
@@ -93,17 +95,19 @@ b_cmd = on_alconna(
93
95
  "看看B话",
94
96
  Args["at", [str, At], Field(completion=lambda: "请想要查询的人的QQ号")],
95
97
  Option("-g|--group_id", Args["group_id?", str]),
96
- Option("-k|--keyword", Args["keyword?", str])
98
+ Option("-k|--keyword", Args["keyword?", str]),
97
99
  ),
98
100
  aliases={"kkb"},
99
101
  use_cmd_start=True,
100
102
  )
101
103
 
104
+
102
105
  @b_cmd.handle()
103
106
  async def handle_b_cmd(
104
- at:Match[str|At],
107
+ at: Match[str | At],
105
108
  group_id: Match[str],
106
109
  keyword: Match[str],
110
+ uninfo: Uninfo,
107
111
  session: Session = Depends(extract_session),
108
112
  ):
109
113
  id = at.result
@@ -113,10 +117,10 @@ async def handle_b_cmd(
113
117
  gid = group_id.result
114
118
  else:
115
119
  gid = session.id2
116
-
120
+
117
121
  if not gid:
118
122
  await b_cmd.finish("请指定群号。")
119
-
123
+
120
124
  if keyword.available:
121
125
  keywords = keyword.result
122
126
  else:
@@ -133,8 +137,14 @@ async def handle_b_cmd(
133
137
  )
134
138
  d = msg_counter(messages, keywords)
135
139
  rank = got_rank(d)
136
-
137
- await saa.Text(f"该用户在群{gid}的B话数量为{rank[0][1]}。").send(reply=True)
140
+ if not rank:
141
+ await b_cmd.finish(
142
+ f"该用户在群“{uninfo.scene.name}”关于“{keyword}”的B话数量为0。"
143
+ )
144
+
145
+ await saa.Text(
146
+ f"该用户在群“{uninfo.scene.name}”关于“{keyword}”的B话数量为{rank[0][1]}。"
147
+ ).send(reply=True)
138
148
 
139
149
 
140
150
  rank_cmd = on_alconna(
@@ -352,8 +362,8 @@ async def handle_rank(
352
362
  msg += suffix
353
363
  if not msg:
354
364
  await saa.Text("你把可视化都关了哪来的排行榜?").finish()
355
-
365
+
356
366
  if plugin_config.aggregate_transmission:
357
- await saa.AggregatedMessageFactory([msg]).finish(reply=True)
367
+ await saa.AggregatedMessageFactory([msg]).finish()
358
368
  else:
359
369
  await msg.finish(reply=True)
@@ -13,7 +13,7 @@ class ScopedConfig(BaseModel):
13
13
  counting_cache: bool = False # 计数缓存(能够提高回复速度)
14
14
  excluded_people: List[str] = [] # 排除的人的QQ号
15
15
  use_user_info_cache: bool = False # 是否使用用户信息缓存
16
- aggregate_transmission:bool = False # 是否聚合转发消息
16
+ aggregate_transmission: bool = False # 是否聚合转发消息
17
17
  timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
18
18
  string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
19
19
  template_path: str = "./template/rank_template.j2" # 模板路径
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import re
2
3
  import httpx
3
4
  import asyncio
4
5
  import unicodedata
@@ -96,7 +97,8 @@ def msg_counter(
96
97
  for i in msg_list:
97
98
  # logger.debug(f"processing msg {i.plain_text}")
98
99
  if keyword:
99
- if keyword not in i.plain_text:
100
+ match = re.search(keyword, i.plain_text)
101
+ if not match:
100
102
  continue
101
103
  try:
102
104
  lst[str(i.session_persist_id)] += 1
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.5.1
3
+ Version: 2.6.1
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
7
- Requires-Python: <3.13,>=3.9
7
+ Requires-Python: <4.0,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
@@ -82,15 +82,20 @@ nb plugin install nonebot-plugin-dialectlist
82
82
 
83
83
  在 .env 中,可以添加以下配置项
84
84
  ```python
85
- dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
86
- dialectlist__get_num = 10 #获取人数数量
87
- dialectlist__visualization = True #是否可视化
88
- # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
89
- dialectlist__font = "SimHei" #字体格式
90
- dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
91
- dialectlist__excluded_self = True #是否排除机器人自己 QQ
92
- dialectlist__suffix: bool = False # 是否显示后缀
93
- dialectlist__string_suffix: str = "统计花费时间{timecost}" # 消息格式后缀
85
+ dialectlist__get_num: int = 5 # 获取人数数量
86
+ dialectlist__font: str = "SimHei" # 字体格式
87
+ dialectlist__suffix: bool = True # 是否显示后缀
88
+ dialectlist__excluded_self: bool = True # 是否排除自己
89
+ dialectlist__visualization: bool = True # 是否可视化
90
+ dialectlist__show_text_rank: bool = True # 是否显示文本排名
91
+ dialectlist__counting_cache: bool = False # 计数缓存(能够提高回复速度)
92
+ dialectlist__excluded_people: List[str] = [] # 排除的人的QQ号
93
+ dialectlist__use_user_info_cache: bool = False # 是否使用用户信息缓存
94
+ dialectlist__aggregate_transmission: bool = False # 是否聚合转发消息
95
+ dialectlist__timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
96
+ dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
97
+ dialectlist__template_path: str = "./template/rank_template.j2" # 模板路径
98
+ dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
94
99
  ```
95
100
  💭也可以不进行配置,这将会使插件按照默认配置运行
96
101
 
@@ -154,6 +159,9 @@ __!!注意!!__
154
159
  `/kkb 114514 1919810 ♂`
155
160
  `/kkb @man -k ♂`
156
161
 
162
+ > [!IMPORTANT]
163
+ > 关键词支持正则表达式!
164
+
157
165
  ## 💪 目前支持的平台
158
166
 
159
167
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-dialectlist"
3
- version = "2.5.1"
3
+ version = "2.6.1"
4
4
  description = "看看你群群友有多能说"
5
5
  authors = [
6
6
  {name = "Chen_Xu233", email = "woyerpa@outlook.com"},
@@ -17,7 +17,7 @@ dependencies = [
17
17
  "pillow>=10.4.0",
18
18
  "nonebot-plugin-uninfo>=0.1.1",
19
19
  ]
20
- requires-python = ">=3.9,<3.13"
20
+ requires-python = ">=3.9,<4.0"
21
21
  readme = "README.md"
22
22
  license = {text = "MIT"}
23
23