nonebot-plugin-dialectlist 2.4.6__tar.gz → 2.5.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.4.6/nonebot_plugin_dialectlist.egg-info → nonebot_plugin_dialectlist-2.5.1}/PKG-INFO +19 -2
  2. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/README.md +18 -1
  3. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/__init__.py +59 -4
  4. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/config.py +2 -1
  5. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/usage.py +17 -0
  6. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/utils.py +1 -1
  7. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1/nonebot_plugin_dialectlist.egg-info}/PKG-INFO +19 -2
  8. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/pyproject.toml +1 -1
  9. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/LICENSE +0 -0
  10. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/MANIFEST.in +0 -0
  11. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/model.py +0 -0
  12. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/storage.py +0 -0
  13. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  14. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
  15. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  16. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist/time.py +0 -0
  17. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -0
  18. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  19. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist.egg-info/requires.txt +0 -0
  20. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  21. {nonebot_plugin_dialectlist-2.4.6 → nonebot_plugin_dialectlist-2.5.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.4.6
3
+ Version: 2.5.1
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -105,6 +105,8 @@ __!!注意!!__
105
105
 
106
106
  ### 🎨一般用法
107
107
 
108
+ #### B话榜
109
+
108
110
  -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
109
111
 
110
112
  -`/今日B话榜` ————看看今天的群友发了多少消息!
@@ -123,8 +125,14 @@ __!!注意!!__
123
125
 
124
126
  -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
125
127
 
128
+ #### 看看B话(kkb)
129
+
130
+ -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
131
+
126
132
  ### 🚀进阶用法
127
133
 
134
+ #### B话榜
135
+
128
136
  `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
129
137
 
130
138
  如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
@@ -137,6 +145,15 @@ __!!注意!!__
137
145
  `/昨日B话榜 -k 女装`
138
146
  `/本周B话榜 -g 12345678`
139
147
 
148
+ #### 看看B话
149
+
150
+ `/看看B话 {@|QQ号} {群号?} {关键词?}`
151
+
152
+ 以下调用方法均合法:
153
+
154
+ `/kkb 114514 1919810 ♂`
155
+ `/kkb @man -k ♂`
156
+
140
157
  ## 💪 目前支持的平台
141
158
 
142
159
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -202,7 +219,7 @@ __!!注意!!__
202
219
 
203
220
  - [x] 查询带某关键词的消息量
204
221
 
205
- - [ ] 合并转发
222
+ - [x] 合并转发
206
223
 
207
224
  待补充。.....
208
225
 
@@ -77,6 +77,8 @@ __!!注意!!__
77
77
 
78
78
  ### 🎨一般用法
79
79
 
80
+ #### B话榜
81
+
80
82
  -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
81
83
 
82
84
  -`/今日B话榜` ————看看今天的群友发了多少消息!
@@ -95,8 +97,14 @@ __!!注意!!__
95
97
 
96
98
  -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
97
99
 
100
+ #### 看看B话(kkb)
101
+
102
+ -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
103
+
98
104
  ### 🚀进阶用法
99
105
 
106
+ #### B话榜
107
+
100
108
  `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
101
109
 
102
110
  如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
@@ -109,6 +117,15 @@ __!!注意!!__
109
117
  `/昨日B话榜 -k 女装`
110
118
  `/本周B话榜 -g 12345678`
111
119
 
120
+ #### 看看B话
121
+
122
+ `/看看B话 {@|QQ号} {群号?} {关键词?}`
123
+
124
+ 以下调用方法均合法:
125
+
126
+ `/kkb 114514 1919810 ♂`
127
+ `/kkb @man -k ♂`
128
+
112
129
  ## 💪 目前支持的平台
113
130
 
114
131
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -174,7 +191,7 @@ __!!注意!!__
174
191
 
175
192
  - [x] 查询带某关键词的消息量
176
193
 
177
- - [ ] 合并转发
194
+ - [x] 合并转发
178
195
 
179
196
  待补充。.....
180
197
 
@@ -23,7 +23,10 @@ from nonebot.params import Arg, Depends
23
23
  from nonebot.adapters import Bot, Event
24
24
  from nonebot.plugin import PluginMetadata, inherit_supported_adapters
25
25
  from nonebot_plugin_alconna import (
26
+ At,
26
27
  Args,
28
+ Field,
29
+ Match,
27
30
  Option,
28
31
  Alconna,
29
32
  on_alconna,
@@ -85,6 +88,55 @@ async def _build_cache(bot: Bot, event: Event):
85
88
  await saa.Text("重建缓存完成。").send(reply=True)
86
89
 
87
90
 
91
+ b_cmd = on_alconna(
92
+ Alconna(
93
+ "看看B话",
94
+ Args["at", [str, At], Field(completion=lambda: "请想要查询的人的QQ号")],
95
+ Option("-g|--group_id", Args["group_id?", str]),
96
+ Option("-k|--keyword", Args["keyword?", str])
97
+ ),
98
+ aliases={"kkb"},
99
+ use_cmd_start=True,
100
+ )
101
+
102
+ @b_cmd.handle()
103
+ async def handle_b_cmd(
104
+ at:Match[str|At],
105
+ group_id: Match[str],
106
+ keyword: Match[str],
107
+ session: Session = Depends(extract_session),
108
+ ):
109
+ id = at.result
110
+ if isinstance(id, At):
111
+ id = id.target
112
+ if group_id.available:
113
+ gid = group_id.result
114
+ else:
115
+ gid = session.id2
116
+
117
+ if not gid:
118
+ await b_cmd.finish("请指定群号。")
119
+
120
+ if keyword.available:
121
+ keywords = keyword.result
122
+ else:
123
+ keywords = None
124
+
125
+ messages = await get_message_records(
126
+ id1s=[id],
127
+ id2s=[gid],
128
+ id_type=SessionIdType.GROUP,
129
+ include_bot_id=False,
130
+ include_bot_type=False,
131
+ types=["message"], # 排除机器人自己发的消息
132
+ exclude_id1s=plugin_config.excluded_people,
133
+ )
134
+ d = msg_counter(messages, keywords)
135
+ rank = got_rank(d)
136
+
137
+ await saa.Text(f"该用户在群{gid}的B话数量为{rank[0][1]}。").send(reply=True)
138
+
139
+
88
140
  rank_cmd = on_alconna(
89
141
  Alconna(
90
142
  "B话榜",
@@ -267,7 +319,7 @@ async def handle_rank(
267
319
  t1 = t.time()
268
320
  rank2 = await get_user_infos(bot, event, rank)
269
321
  logger.debug(f"获取用户信息花费时间:{t.time() - t1}")
270
-
322
+
271
323
  string: str = ""
272
324
  if plugin_config.show_text_rank:
273
325
 
@@ -275,7 +327,7 @@ async def handle_rank(
275
327
  string += f"关于{keyword}的话痨榜结果:\n"
276
328
  else:
277
329
  string += "话痨榜:\n"
278
-
330
+
279
331
  for i in rank2:
280
332
  logger.debug(i.user_name)
281
333
  for i in range(len(rank2)):
@@ -300,5 +352,8 @@ async def handle_rank(
300
352
  msg += suffix
301
353
  if not msg:
302
354
  await saa.Text("你把可视化都关了哪来的排行榜?").finish()
303
-
304
- await msg.finish(reply=True)
355
+
356
+ if plugin_config.aggregate_transmission:
357
+ await saa.AggregatedMessageFactory([msg]).finish(reply=True)
358
+ else:
359
+ await msg.finish(reply=True)
@@ -9,10 +9,11 @@ class ScopedConfig(BaseModel):
9
9
  suffix: bool = True # 是否显示后缀
10
10
  excluded_self: bool = True # 是否排除自己
11
11
  visualization: bool = True # 是否可视化
12
- show_text_rank:bool = True # 是否显示文本排名
12
+ show_text_rank: bool = True # 是否显示文本排名
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
17
  timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
17
18
  string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
18
19
  template_path: str = "./template/rank_template.j2" # 模板路径
@@ -7,6 +7,8 @@ __usage__ = cleandoc(
7
7
 
8
8
  ### 🎨一般用法
9
9
 
10
+ #### B话榜
11
+
10
12
  -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
11
13
 
12
14
  -`/今日B话榜` ————看看今天的群友发了多少消息!
@@ -25,8 +27,14 @@ __usage__ = cleandoc(
25
27
 
26
28
  -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
27
29
 
30
+ #### 看看B话(kkb)
31
+
32
+ -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
33
+
28
34
  ### 🚀进阶用法
29
35
 
36
+ #### B话榜
37
+
30
38
  `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
31
39
 
32
40
  如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
@@ -39,5 +47,14 @@ __usage__ = cleandoc(
39
47
  `/昨日B话榜 -k 女装`
40
48
  `/本周B话榜 -g 12345678`
41
49
 
50
+ #### 看看B话
51
+
52
+ `/看看B话 {@|QQ号} {群号?} {关键词?}`
53
+
54
+ 以下调用方法均合法:
55
+
56
+ `/kkb 114514 1919810 ♂`
57
+ `/kkb @man -k ♂`
58
+
42
59
  """
43
60
  )
@@ -94,7 +94,7 @@ def msg_counter(
94
94
  logger.info("wow , there are {} msgs to count !!!".format(msg_len))
95
95
 
96
96
  for i in msg_list:
97
- logger.debug(f"processing msg {i.plain_text}")
97
+ # logger.debug(f"processing msg {i.plain_text}")
98
98
  if keyword:
99
99
  if keyword not in i.plain_text:
100
100
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.4.6
3
+ Version: 2.5.1
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -105,6 +105,8 @@ __!!注意!!__
105
105
 
106
106
  ### 🎨一般用法
107
107
 
108
+ #### B话榜
109
+
108
110
  -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
109
111
 
110
112
  -`/今日B话榜` ————看看今天的群友发了多少消息!
@@ -123,8 +125,14 @@ __!!注意!!__
123
125
 
124
126
  -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
125
127
 
128
+ #### 看看B话(kkb)
129
+
130
+ -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
131
+
126
132
  ### 🚀进阶用法
127
133
 
134
+ #### B话榜
135
+
128
136
  `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
129
137
 
130
138
  如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
@@ -137,6 +145,15 @@ __!!注意!!__
137
145
  `/昨日B话榜 -k 女装`
138
146
  `/本周B话榜 -g 12345678`
139
147
 
148
+ #### 看看B话
149
+
150
+ `/看看B话 {@|QQ号} {群号?} {关键词?}`
151
+
152
+ 以下调用方法均合法:
153
+
154
+ `/kkb 114514 1919810 ♂`
155
+ `/kkb @man -k ♂`
156
+
140
157
  ## 💪 目前支持的平台
141
158
 
142
159
  | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
@@ -202,7 +219,7 @@ __!!注意!!__
202
219
 
203
220
  - [x] 查询带某关键词的消息量
204
221
 
205
- - [ ] 合并转发
222
+ - [x] 合并转发
206
223
 
207
224
  待补充。.....
208
225
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-dialectlist"
3
- version = "2.4.6"
3
+ version = "2.5.1"
4
4
  description = "看看你群群友有多能说"
5
5
  authors = [
6
6
  {name = "Chen_Xu233", email = "woyerpa@outlook.com"},