nonebot-plugin-dialectlist 2.5.1__tar.gz → 2.6.0__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.0}/PKG-INFO +1 -1
  2. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/__init__.py +18 -8
  3. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/config.py +1 -1
  4. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/utils.py +3 -1
  5. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0/nonebot_plugin_dialectlist.egg-info}/PKG-INFO +1 -1
  6. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/pyproject.toml +1 -1
  7. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/LICENSE +0 -0
  8. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/MANIFEST.in +0 -0
  9. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/README.md +0 -0
  10. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/model.py +0 -0
  11. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/storage.py +0 -0
  12. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  13. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
  14. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  15. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/time.py +0 -0
  16. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist/usage.py +0 -0
  17. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -0
  18. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  19. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist.egg-info/requires.txt +0 -0
  20. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  21. {nonebot_plugin_dialectlist-2.5.1 → nonebot_plugin_dialectlist-2.6.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.5.1
3
+ Version: 2.6.0
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.5.1
3
+ Version: 2.6.0
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-dialectlist"
3
- version = "2.5.1"
3
+ version = "2.6.0"
4
4
  description = "看看你群群友有多能说"
5
5
  authors = [
6
6
  {name = "Chen_Xu233", email = "woyerpa@outlook.com"},