nonebot-plugin-dialectlist 2.4.4__tar.gz → 2.4.6__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 (22) hide show
  1. {nonebot_plugin_dialectlist-2.4.4/nonebot_plugin_dialectlist.egg-info → nonebot_plugin_dialectlist-2.4.6}/PKG-INFO +38 -16
  2. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/README.md +37 -14
  3. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/__init__.py +18 -3
  4. nonebot_plugin_dialectlist-2.4.6/nonebot_plugin_dialectlist/usage.py +43 -0
  5. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/utils.py +8 -2
  6. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6/nonebot_plugin_dialectlist.egg-info}/PKG-INFO +38 -16
  7. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist.egg-info/requires.txt +0 -1
  8. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/pyproject.toml +1 -2
  9. nonebot_plugin_dialectlist-2.4.4/nonebot_plugin_dialectlist/usage.py +0 -9
  10. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/LICENSE +0 -0
  11. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/MANIFEST.in +0 -0
  12. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/config.py +0 -0
  13. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/model.py +0 -0
  14. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/storage.py +0 -0
  15. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  16. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
  17. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  18. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist/time.py +0 -0
  19. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -0
  20. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  21. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  22. {nonebot_plugin_dialectlist-2.4.4 → nonebot_plugin_dialectlist-2.4.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.4.4
3
+ Version: 2.4.6
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -8,7 +8,6 @@ Requires-Python: <3.13,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
11
- Requires-Dist: requests>=2.32.3
12
11
  Requires-Dist: nonebot-plugin-orm[default]
13
12
  Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
14
13
  Requires-Dist: nonebot-plugin-alconna>=0.50.2
@@ -55,15 +54,16 @@ nonebot-plugin-dialectlist
55
54
 
56
55
  ## 💿 安装
57
56
 
58
- 通过`pip`或`nb`安装;
59
-
60
- >**通过 pip **安装
61
-
62
- `pip install nonebot-plugin-dialectlist`
63
-
64
- >**通过 nb **安装
57
+ 通过`pip`或`nb`安装:
58
+ - 通过 pip 安装
59
+ ```bash
60
+ pip install nonebot-plugin-dialectlist
61
+ ```
62
+ - 通过 nb-cli 安装
63
+ ```bash
64
+ nb plugin install nonebot-plugin-dialectlist
65
+ ```
65
66
 
66
- `nb plugin install nonebot-plugin-dialectlist`
67
67
 
68
68
  ### ✅ 插件依赖于
69
69
 
@@ -125,9 +125,17 @@ __!!注意!!__
125
125
 
126
126
  ### 🚀进阶用法
127
127
 
128
- `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间} {群号}`
128
+ `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
129
129
 
130
- 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678`
130
+ 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
131
+
132
+ 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
133
+
134
+ 以下调用方法均合法:
135
+
136
+ `/今日B话榜 -g 12345678 -k 女装`
137
+ `/昨日B话榜 -k 女装`
138
+ `/本周B话榜 -g 12345678`
131
139
 
132
140
  ## 💪 目前支持的平台
133
141
 
@@ -163,6 +171,9 @@ __!!注意!!__
163
171
 
164
172
  </details>
165
173
 
174
+ ![9c149e99ca747c13892be3f9fbeedf31](https://github.com/user-attachments/assets/d02d108c-1ab3-4ad1-9123-c1a98862e627)
175
+
176
+
166
177
  ### 💕感谢
167
178
 
168
179
  本插件的__init__.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
@@ -187,14 +198,19 @@ __!!注意!!__
187
198
 
188
199
  - [x] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
189
200
 
190
- - [ ] 特殊的储存方案优化消息统计
201
+ - [x] 特殊的储存方案优化消息统计
191
202
 
192
- - [ ] 查询带某关键词的消息量
203
+ - [x] 查询带某关键词的消息量
204
+
205
+ - [ ] 合并转发
193
206
 
194
207
  待补充。.....
195
208
 
196
- ## 📖版本
197
-
209
+ ## 📖版本日志
210
+
211
+ <details>
212
+ <summary>点我展开</summary>
213
+
198
214
  ### V1.0
199
215
 
200
216
  - 看看群里群友能有多话痨
@@ -228,5 +244,11 @@ __!!注意!!__
228
244
 
229
245
  - 优化代码,添加一些新的可配置项。
230
246
 
247
+ ### V2.4
248
+
249
+ - 添加一些新的可配置项。
250
+
251
+ </details>
252
+
231
253
  ### 👾题外话
232
254
  ~~整个项目快被我写成屎山了~~
@@ -26,15 +26,16 @@ nonebot-plugin-dialectlist
26
26
 
27
27
  ## 💿 安装
28
28
 
29
- 通过`pip`或`nb`安装;
30
-
31
- >**通过 pip **安装
32
-
33
- `pip install nonebot-plugin-dialectlist`
34
-
35
- >**通过 nb **安装
29
+ 通过`pip`或`nb`安装:
30
+ - 通过 pip 安装
31
+ ```bash
32
+ pip install nonebot-plugin-dialectlist
33
+ ```
34
+ - 通过 nb-cli 安装
35
+ ```bash
36
+ nb plugin install nonebot-plugin-dialectlist
37
+ ```
36
38
 
37
- `nb plugin install nonebot-plugin-dialectlist`
38
39
 
39
40
  ### ✅ 插件依赖于
40
41
 
@@ -96,9 +97,17 @@ __!!注意!!__
96
97
 
97
98
  ### 🚀进阶用法
98
99
 
99
- `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间} {群号}`
100
+ `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
100
101
 
101
- 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678`
102
+ 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
103
+
104
+ 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
105
+
106
+ 以下调用方法均合法:
107
+
108
+ `/今日B话榜 -g 12345678 -k 女装`
109
+ `/昨日B话榜 -k 女装`
110
+ `/本周B话榜 -g 12345678`
102
111
 
103
112
  ## 💪 目前支持的平台
104
113
 
@@ -134,6 +143,9 @@ __!!注意!!__
134
143
 
135
144
  </details>
136
145
 
146
+ ![9c149e99ca747c13892be3f9fbeedf31](https://github.com/user-attachments/assets/d02d108c-1ab3-4ad1-9123-c1a98862e627)
147
+
148
+
137
149
  ### 💕感谢
138
150
 
139
151
  本插件的__init__.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
@@ -158,14 +170,19 @@ __!!注意!!__
158
170
 
159
171
  - [x] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
160
172
 
161
- - [ ] 特殊的储存方案优化消息统计
173
+ - [x] 特殊的储存方案优化消息统计
162
174
 
163
- - [ ] 查询带某关键词的消息量
175
+ - [x] 查询带某关键词的消息量
176
+
177
+ - [ ] 合并转发
164
178
 
165
179
  待补充。.....
166
180
 
167
- ## 📖版本
168
-
181
+ ## 📖版本日志
182
+
183
+ <details>
184
+ <summary>点我展开</summary>
185
+
169
186
  ### V1.0
170
187
 
171
188
  - 看看群里群友能有多话痨
@@ -199,5 +216,11 @@ __!!注意!!__
199
216
 
200
217
  - 优化代码,添加一些新的可配置项。
201
218
 
219
+ ### V2.4
220
+
221
+ - 添加一些新的可配置项。
222
+
223
+ </details>
224
+
202
225
  ### 👾题外话
203
226
  ~~整个项目快被我写成屎山了~~
@@ -93,6 +93,7 @@ rank_cmd = on_alconna(
93
93
  str,
94
94
  ],
95
95
  Option("-g|--group_id", Args["group_id?", str]),
96
+ Option("-k|--keyword", Args["keyword?", str]),
96
97
  behaviors=[SameTime()],
97
98
  ),
98
99
  aliases={"废话榜"},
@@ -129,6 +130,7 @@ async def _group_message(
129
130
  type: Optional[str] = None,
130
131
  time: Optional[str] = None,
131
132
  group_id: Optional[str] = None,
133
+ keyword: Optional[str] = None,
132
134
  ):
133
135
  t1 = t.time()
134
136
  state["t1"] = t1
@@ -140,6 +142,8 @@ async def _group_message(
140
142
  if group_id:
141
143
  state["group_id"] = group_id
142
144
 
145
+ state["keyword"] = keyword
146
+
143
147
  if not type:
144
148
  await rank_cmd.finish(__plugin_meta__.usage)
145
149
 
@@ -226,7 +230,11 @@ async def handle_rank(
226
230
  if not id:
227
231
  await saa.Text("没有指定群哦").finish()
228
232
 
233
+ keyword = state["keyword"]
234
+
229
235
  if plugin_config.counting_cache:
236
+ if keyword:
237
+ await saa.Text("已开启缓存~缓存不支持关键词查询哦").finish()
230
238
  t1 = t.time()
231
239
  raw_rank = await get_cache(start, stop, id)
232
240
  logger.debug(f"获取计数消息花费时间:{t.time() - t1}")
@@ -242,11 +250,13 @@ async def handle_rank(
242
250
  time_stop=stop,
243
251
  exclude_id1s=plugin_config.excluded_people,
244
252
  )
245
- raw_rank = msg_counter(messages)
253
+ raw_rank = msg_counter(messages, keyword)
246
254
  logger.debug(f"获取计数消息花费时间:{t.time() - t1}")
247
255
 
248
256
  if not raw_rank:
249
- await saa.Text("明明这个时间段都没有人说话怎么会有话痨榜呢?").finish()
257
+ await saa.Text(
258
+ "没有获取到排行榜数据哦,请确认时间范围和群号是否正确或者关键词是否存在~"
259
+ ).finish()
250
260
 
251
261
  rank = got_rank(raw_rank)
252
262
  ids = await persist_id2user_id([int(i[0]) for i in rank])
@@ -259,8 +269,13 @@ async def handle_rank(
259
269
  logger.debug(f"获取用户信息花费时间:{t.time() - t1}")
260
270
 
261
271
  string: str = ""
262
-
263
272
  if plugin_config.show_text_rank:
273
+
274
+ if keyword:
275
+ string += f"关于{keyword}的话痨榜结果:\n"
276
+ else:
277
+ string += "话痨榜:\n"
278
+
264
279
  for i in rank2:
265
280
  logger.debug(i.user_name)
266
281
  for i in range(len(rank2)):
@@ -0,0 +1,43 @@
1
+ from inspect import cleandoc
2
+
3
+ __usage__ = cleandoc(
4
+ """
5
+ 快速调用:
6
+ /今日B话榜 ————看看今天群友发了多少消息。
7
+
8
+ ### 🎨一般用法
9
+
10
+ -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
11
+
12
+ -`/今日B话榜` ————看看今天的群友发了多少消息!
13
+
14
+ -`/昨日B话榜` ————看看昨天的群友发了多少消息!
15
+
16
+ -`/前日B话榜` ————看看前天的群友发了多少消息!
17
+
18
+ -`/本周B话榜` ————看看本周的群友发了多少消息!
19
+
20
+ -`/上周B话榜` ————看看上周的群友发了多少消息!
21
+
22
+ -`/本月B话榜` ————看看这个月的群友发了多少消息!
23
+
24
+ -`/年度B话榜` ————看看今年的群友发了多少消息!
25
+
26
+ -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
27
+
28
+ ### 🚀进阶用法
29
+
30
+ `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
31
+
32
+ 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
33
+
34
+ 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
35
+
36
+ 以下调用方法均合法:
37
+
38
+ `/今日B话榜 -g 12345678 -k 女装`
39
+ `/昨日B话榜 -k 女装`
40
+ `/本周B话榜 -g 12345678`
41
+
42
+ """
43
+ )
@@ -3,7 +3,7 @@ import httpx
3
3
  import asyncio
4
4
  import unicodedata
5
5
 
6
- from typing import Dict, List
6
+ from typing import Dict, List, Optional
7
7
  from sqlalchemy import or_, select
8
8
  from sqlalchemy.sql import ColumnElement
9
9
 
@@ -77,7 +77,9 @@ async def persist_id2group_id(ids: List[str]) -> List[str]:
77
77
  return [i.id2 for i in records]
78
78
 
79
79
 
80
- def msg_counter(msg_list: List[MessageRecord]) -> Dict[str, int]:
80
+ def msg_counter(
81
+ msg_list: List[MessageRecord], keyword: Optional[str]
82
+ ) -> Dict[str, int]:
81
83
  """### 计算每个人的消息量
82
84
 
83
85
  Args:
@@ -92,6 +94,10 @@ def msg_counter(msg_list: List[MessageRecord]) -> Dict[str, int]:
92
94
  logger.info("wow , there are {} msgs to count !!!".format(msg_len))
93
95
 
94
96
  for i in msg_list:
97
+ logger.debug(f"processing msg {i.plain_text}")
98
+ if keyword:
99
+ if keyword not in i.plain_text:
100
+ continue
95
101
  try:
96
102
  lst[str(i.session_persist_id)] += 1
97
103
  except KeyError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.4.4
3
+ Version: 2.4.6
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -8,7 +8,6 @@ Requires-Python: <3.13,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
11
- Requires-Dist: requests>=2.32.3
12
11
  Requires-Dist: nonebot-plugin-orm[default]
13
12
  Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
14
13
  Requires-Dist: nonebot-plugin-alconna>=0.50.2
@@ -55,15 +54,16 @@ nonebot-plugin-dialectlist
55
54
 
56
55
  ## 💿 安装
57
56
 
58
- 通过`pip`或`nb`安装;
59
-
60
- >**通过 pip **安装
61
-
62
- `pip install nonebot-plugin-dialectlist`
63
-
64
- >**通过 nb **安装
57
+ 通过`pip`或`nb`安装:
58
+ - 通过 pip 安装
59
+ ```bash
60
+ pip install nonebot-plugin-dialectlist
61
+ ```
62
+ - 通过 nb-cli 安装
63
+ ```bash
64
+ nb plugin install nonebot-plugin-dialectlist
65
+ ```
65
66
 
66
- `nb plugin install nonebot-plugin-dialectlist`
67
67
 
68
68
  ### ✅ 插件依赖于
69
69
 
@@ -125,9 +125,17 @@ __!!注意!!__
125
125
 
126
126
  ### 🚀进阶用法
127
127
 
128
- `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间} {群号}`
128
+ `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
129
129
 
130
- 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678`
130
+ 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
131
+
132
+ 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
133
+
134
+ 以下调用方法均合法:
135
+
136
+ `/今日B话榜 -g 12345678 -k 女装`
137
+ `/昨日B话榜 -k 女装`
138
+ `/本周B话榜 -g 12345678`
131
139
 
132
140
  ## 💪 目前支持的平台
133
141
 
@@ -163,6 +171,9 @@ __!!注意!!__
163
171
 
164
172
  </details>
165
173
 
174
+ ![9c149e99ca747c13892be3f9fbeedf31](https://github.com/user-attachments/assets/d02d108c-1ab3-4ad1-9123-c1a98862e627)
175
+
176
+
166
177
  ### 💕感谢
167
178
 
168
179
  本插件的__init__.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
@@ -187,14 +198,19 @@ __!!注意!!__
187
198
 
188
199
  - [x] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
189
200
 
190
- - [ ] 特殊的储存方案优化消息统计
201
+ - [x] 特殊的储存方案优化消息统计
191
202
 
192
- - [ ] 查询带某关键词的消息量
203
+ - [x] 查询带某关键词的消息量
204
+
205
+ - [ ] 合并转发
193
206
 
194
207
  待补充。.....
195
208
 
196
- ## 📖版本
197
-
209
+ ## 📖版本日志
210
+
211
+ <details>
212
+ <summary>点我展开</summary>
213
+
198
214
  ### V1.0
199
215
 
200
216
  - 看看群里群友能有多话痨
@@ -228,5 +244,11 @@ __!!注意!!__
228
244
 
229
245
  - 优化代码,添加一些新的可配置项。
230
246
 
247
+ ### V2.4
248
+
249
+ - 添加一些新的可配置项。
250
+
251
+ </details>
252
+
231
253
  ### 👾题外话
232
254
  ~~整个项目快被我写成屎山了~~
@@ -1,5 +1,4 @@
1
1
  nonebot-plugin-chatrecorder>=0.6.0
2
- requests>=2.32.3
3
2
  nonebot-plugin-orm[default]
4
3
  nonebot-plugin-apscheduler>=0.4.0
5
4
  nonebot-plugin-alconna>=0.50.2
@@ -1,13 +1,12 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-dialectlist"
3
- version = "2.4.4"
3
+ version = "2.4.6"
4
4
  description = "看看你群群友有多能说"
5
5
  authors = [
6
6
  {name = "Chen_Xu233", email = "woyerpa@outlook.com"},
7
7
  ]
8
8
  dependencies = [
9
9
  "nonebot-plugin-chatrecorder>=0.6.0",
10
- "requests>=2.32.3",
11
10
  "nonebot-plugin-orm[default]",
12
11
  "nonebot-plugin-apscheduler>=0.4.0",
13
12
  "nonebot-plugin-alconna>=0.50.2",
@@ -1,9 +0,0 @@
1
- from inspect import cleandoc
2
-
3
- __usage__ = cleandoc(
4
- """
5
- /今日B话榜 查看今天群里谁B话最多。
6
- /昨日B话榜 顾名思义。
7
- 以此类推,有本周,本月,上周,上月,年度排行榜。
8
- """
9
- )