nonebot-plugin-dialectlist 2.7.1__tar.gz → 3.0.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 (24) hide show
  1. {nonebot_plugin_dialectlist-2.7.1/nonebot_plugin_dialectlist.egg-info → nonebot_plugin_dialectlist-3.0.1}/PKG-INFO +72 -67
  2. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/README.md +67 -62
  3. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/__init__.py +16 -38
  4. nonebot_plugin_dialectlist-3.0.1/nonebot_plugin_dialectlist/config.py +30 -0
  5. nonebot_plugin_dialectlist-3.0.1/nonebot_plugin_dialectlist/schema.py +11 -0
  6. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/usage.py +2 -2
  7. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/utils.py +59 -53
  8. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1/nonebot_plugin_dialectlist.egg-info}/PKG-INFO +72 -67
  9. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +1 -3
  10. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist.egg-info/requires.txt +4 -4
  11. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/pyproject.toml +5 -5
  12. nonebot_plugin_dialectlist-2.7.1/nonebot_plugin_dialectlist/config.py +0 -29
  13. nonebot_plugin_dialectlist-2.7.1/nonebot_plugin_dialectlist/migrations/fb88e4d27eb8_update_dialectlist.py +0 -47
  14. nonebot_plugin_dialectlist-2.7.1/nonebot_plugin_dialectlist/model.py +0 -23
  15. nonebot_plugin_dialectlist-2.7.1/nonebot_plugin_dialectlist/storage.py +0 -136
  16. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/LICENSE +0 -0
  17. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/MANIFEST.in +0 -0
  18. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  19. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
  20. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  21. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist/time.py +0 -0
  22. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  23. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  24. {nonebot_plugin_dialectlist-2.7.1 → nonebot_plugin_dialectlist-3.0.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.7.1
3
+ Version: 3.0.1
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -15,13 +15,13 @@ Requires-Dist: nonebot-plugin-cesaa>=0.4.0
15
15
  Requires-Dist: nonebot-plugin-userinfo>=0.2.6
16
16
  Requires-Dist: nonebot-plugin-htmlrender>=0.3.3
17
17
  Requires-Dist: nonebot2>=2.3.2
18
- Requires-Dist: pillow>=10.4.0
18
+ Requires-Dist: pillow>=11.3.0
19
19
  Requires-Dist: nonebot-plugin-uninfo>=0.1.1
20
20
  Provides-Extra: dev
21
21
  Requires-Dist: ruff>=0.5.5; extra == "dev"
22
- Requires-Dist: setuptools>=71.1.0; extra == "dev"
23
- Requires-Dist: twine>=5.1.0; extra == "dev"
24
- Requires-Dist: nb-cli>=0.7.6; extra == "dev"
22
+ Requires-Dist: setuptools>=80.9.0; extra == "dev"
23
+ Requires-Dist: twine>=6.2.0; extra == "dev"
24
+ Requires-Dist: nb-cli>=1.4.2; extra == "dev"
25
25
  Requires-Dist: py-spy>=0.3.14; extra == "dev"
26
26
  Provides-Extra: test
27
27
  Requires-Dist: nonebot-adapter-onebot>=2.4.4; extra == "test"
@@ -35,7 +35,8 @@ Dynamic: license-file
35
35
 
36
36
  <div align="center">
37
37
 
38
- # 📃话痨排行榜
38
+ # 📃 话痨排行榜
39
+
39
40
  nonebot-plugin-dialectlist
40
41
 
41
42
  <p align="center">
@@ -53,21 +54,25 @@ nonebot-plugin-dialectlist
53
54
  [![wakatime](https://wakatime.com/badge/user/114aee90-a5f9-49aa-b441-9eca7eebfda3/project/68aaa2a1-fb8a-4b00-bb66-ee67e8a3f3b0.svg)](https://wakatime.com/badge/user/114aee90-a5f9-49aa-b441-9eca7eebfda3/project/68aaa2a1-fb8a-4b00-bb66-ee67e8a3f3b0)
54
55
 
55
56
  \>💬**看看群友们这些天在群里水了多少话**💬<
57
+
56
58
  </div>
57
59
 
58
60
  ## 💿 安装
59
61
 
60
62
  通过`pip`或`nb`安装:
63
+
61
64
  - 通过 pip 安装
65
+
62
66
  ```bash
63
67
  pip install nonebot-plugin-dialectlist
64
68
  ```
69
+
65
70
  - 通过 nb-cli 安装
71
+
66
72
  ```bash
67
73
  nb plugin install nonebot-plugin-dialectlist
68
74
  ```
69
75
 
70
-
71
76
  ### ✅ 插件依赖于
72
77
 
73
78
  1. [nonebot-plugin-datastore](https://github.com/he0119/nonebot-plugin-datastore) ————本地化储存
@@ -77,13 +82,14 @@ nb plugin install nonebot-plugin-dialectlist
77
82
  5. [nonebot-plugin-chatrecorder](https://github.com/noneplugin/nonebot-plugin-chatrecorder) ————实现消息储存
78
83
  6. [nonebot-plugin-cesaa](https://github.com/MountainDash/nonebot-plugin-send-anything-anywhere) ————实现多平台
79
84
 
80
- **⚠注意** 若先前没有安装过```nonebot-plugin-chatrecorder```或者```nonebot-plugin-orm```,则会在启动时报错,请按报错的提示安装数据库!
81
-
85
+ **⚠ 注意** 若先前没有安装过`nonebot-plugin-chatrecorder`或者`nonebot-plugin-orm`,则会在启动时报错,请按报错的提示安装数据库!
86
+
82
87
  ## ⚙ 配置
83
88
 
84
89
  需要**提前配置**本插件所**依赖的插件**!
85
90
 
86
91
  在 .env 中,可以添加以下配置项
92
+
87
93
  ```python
88
94
  dialectlist__get_num: int = 5 # 获取人数数量
89
95
  dialectlist__font: str = "SimHei" # 字体格式
@@ -91,73 +97,74 @@ dialectlist__suffix: bool = True # 是否显示后缀
91
97
  dialectlist__excluded_self: bool = True # 是否排除自己
92
98
  dialectlist__visualization: bool = True # 是否可视化
93
99
  dialectlist__show_text_rank: bool = True # 是否显示文本排名
94
- dialectlist__counting_cache: bool = False # 计数缓存(能够提高回复速度)
95
- dialectlist__excluded_people: List[str] = [] # 排除的人的QQ号
100
+ dialectlist__excluded_people: List[str] = [] # 排除的人的 QQ 号
96
101
  dialectlist__use_user_info_cache: bool = False # 是否使用用户信息缓存
97
102
  dialectlist__aggregate_transmission: bool = False # 是否聚合转发消息
98
103
  dialectlist__timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
99
- dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
104
+ dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
100
105
  dialectlist__template_path: str = "./template/rank_template.j2" # 模板路径
101
- dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
106
+ dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息、n" # 消息格式
102
107
  ```
103
- 💭也可以不进行配置,这将会使插件按照默认配置运行
104
108
 
105
- ### ⚠ 注意!!
109
+ 💭 也可以不进行配置,这将会使插件按照默认配置运行
110
+
111
+ ### ⚠ 注意!!
106
112
 
107
113
  > 在旧版插件(2.0.0 以下)中,dialectlist 与后面的配置项只隔了一个下划线,若更新到新版本以后需要俩个下划线。
108
114
 
109
- > 由于插件依赖chatrecord多次引入爆炸性修改,建议在遇到问题后优先尝试降级chatrecord插件
115
+ > 由于插件依赖 chatrecord 多次引入爆炸性修改,建议在遇到问题后优先尝试降级 chatrecord 插件
110
116
 
111
- ## 🗨命令
112
- __!!注意!!__
117
+ ## 🗨 命令
118
+
119
+ **!!注意!!**
113
120
  新版本指令调用方式改变,改为更易理解也更好打的 B 话榜。
114
121
  同时也可以用类似 `/今日废话榜` 的方式(只要改前面的就好了)(算是给 [盘古之白](https://github.com/vinta/pangu.js) 风格爱好者的福利吧?)
115
122
 
116
- ### 🎨一般用法
123
+ ### 🎨 一般用法
117
124
 
118
- #### B话榜
125
+ #### B 话榜
119
126
 
120
- -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
127
+ -`/B 话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
121
128
 
122
- -`/今日B话榜` ————看看今天的群友发了多少消息!
129
+ -`/今日 B 话榜` ————看看今天的群友发了多少消息!
123
130
 
124
- -`/昨日B话榜` ————看看昨天的群友发了多少消息!
131
+ -`/昨日 B 话榜` ————看看昨天的群友发了多少消息!
125
132
 
126
- -`/前日B话榜` ————看看前天的群友发了多少消息!
133
+ -`/前日 B 话榜` ————看看前天的群友发了多少消息!
127
134
 
128
- -`/本周B话榜` ————看看本周的群友发了多少消息!
129
-
130
- -`/上周B话榜` ————看看上周的群友发了多少消息!
135
+ -`/本周 B 话榜` ————看看本周的群友发了多少消息!
131
136
 
132
- -`/本月B话榜` ————看看这个月的群友发了多少消息!
137
+ -`/上周 B 话榜` ————看看上周的群友发了多少消息!
133
138
 
134
- -`/年度B话榜` ————看看今年的群友发了多少消息!
139
+ -`/本月 B 话榜` ————看看这个月的群友发了多少消息!
135
140
 
136
- -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
141
+ -`/年度 B 话榜` ————看看今年的群友发了多少消息!
137
142
 
138
- #### 看看B话(kkb)
143
+ -`/历史 B 话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
139
144
 
140
- -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
145
+ #### 看看 B 话(kkb)
141
146
 
142
- ### 🚀进阶用法
147
+ -`/看看 B 话 [@某人|QQ 号]` ————看看这个 b 人在这个 b 群发了多少 b 话!
143
148
 
144
- #### B话榜
149
+ ### 🚀 进阶用法
145
150
 
146
- `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
151
+ #### B 话榜
147
152
 
148
- 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
153
+ `/{时间类型(今日|年度)?}{B 话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
149
154
 
150
- 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
155
+ 如:`/B 话榜 历史 2024-01-01~2024-01-02 12345678 女装`
156
+
157
+ 也可以 `/{时间类型(今日|年度)?}{B 话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
151
158
 
152
159
  以下调用方法均合法:
153
160
 
154
- `/今日B话榜 -g 12345678 -k 女装`
155
- `/昨日B话榜 -k 女装`
156
- `/本周B话榜 -g 12345678`
161
+ `/今日 B 话榜 -g 12345678 -k 女装`
162
+ `/昨日 B 话榜 -k 女装`
163
+ `/本周 B 话榜 -g 12345678`
157
164
 
158
- #### 看看B话
165
+ #### 看看 B 话
159
166
 
160
- `/看看B话 {@|QQ号} {群号?} {关键词?}`
167
+ `/看看 B 话 {@|QQ 号} {群号?} {关键词?}`
161
168
 
162
169
  以下调用方法均合法:
163
170
 
@@ -169,28 +176,28 @@ __!!注意!!__
169
176
 
170
177
  ## 💪 目前支持的平台
171
178
 
172
- | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
173
- |:-----:|:----:|:----:| :----: |
174
- | Onebot | ✅ | ✅ | NapCat + Window11|
175
- | 飞书 | ❌ | ❓ | 🤔 |
176
- | Red | ❌ | ❓ | 🤔 |
177
- | DoDo | ❌ | ❓ | 🤔 |
178
- | Mirai | ❌ | ❓ | 🤔 |
179
- | 开黑啦 | ❌ | ❓ | 🤔 |
180
- | Kritor | ❌ | ❓ | 🤔 |
181
- | Ntchat | ❌ | ❓ | 🤔 |
182
- | Satori | ❌ | ❓ | 🤔 |
183
- | Telegram | ❌ | ❓ | 🤔 |
184
- | Discord | ❌ | ❓ | 🤔 |
185
- | Tailchat | ❌ | ❓ | 🤔 |
186
- | QQ 官方接口 | ❌ | ❓ | 🤔 |
187
- | Rocket.Chat | ❌ | ❓ | 🤔 |
179
+ | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
180
+ | :---------: | :----------: | :--------------: | :---------------: |
181
+ | Onebot | ✅ | ✅ | NapCat + Window11 |
182
+ | 飞书 | ❌ | ❓ | 🤔 |
183
+ | Red | ❌ | ❓ | 🤔 |
184
+ | DoDo | ❌ | ❓ | 🤔 |
185
+ | Mirai | ❌ | ❓ | 🤔 |
186
+ | 开黑啦 | ❌ | ❓ | 🤔 |
187
+ | Kritor | ❌ | ❓ | 🤔 |
188
+ | Ntchat | ❌ | ❓ | 🤔 |
189
+ | Satori | ❌ | ❓ | 🤔 |
190
+ | Telegram | ❌ | ❓ | 🤔 |
191
+ | Discord | ❌ | ❓ | 🤔 |
192
+ | Tailchat | ❌ | ❓ | 🤔 |
193
+ | QQ 官方接口 | ❌ | ❓ | 🤔 |
194
+ | Rocket.Chat | ❌ | ❓ | 🤔 |
188
195
 
189
196
  - 如果你测试过能够使用,请在 Issue 中指出
190
197
 
191
- ## 📦另外
198
+ ## 📦 另外
192
199
 
193
- ### 😳加入作者的 BUG 反馈群 ~~(🥵女装粉丝群)~~
200
+ ### 😳 加入作者的 BUG 反馈群 ~~(🥵 女装粉丝群)~~
194
201
 
195
202
  [群连接](https://qm.qq.com/q/Yty2yc9Bee)
196
203
 
@@ -203,10 +210,9 @@ __!!注意!!__
203
210
 
204
211
  ![9c149e99ca747c13892be3f9fbeedf31](https://github.com/user-attachments/assets/d02d108c-1ab3-4ad1-9123-c1a98862e627)
205
212
 
213
+ ### 💕 感谢
206
214
 
207
- ### 💕感谢
208
-
209
- 本插件的__init__.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
215
+ 本插件的**init**.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
210
216
 
211
217
  [nonebot-plugin-wordcloud](https://github.com/he0119/nonebot-plugin-wordcloud)
212
218
 
@@ -223,7 +229,6 @@ __!!注意!!__
223
229
  - [x] 更好看的图片渲染
224
230
 
225
231
  - [x] 添加一些全新的可配置项
226
-
227
232
  - [x] 尝试利用 jinja2 模板引擎制作可视化图片
228
233
 
229
234
  - [x] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
@@ -233,9 +238,9 @@ __!!注意!!__
233
238
  - [x] 查询带某关键词的消息量
234
239
 
235
240
  - [x] 合并转发
236
-
237
- 待补充。.....
238
241
 
242
+ 待补充。.....
243
+
244
+ ### 👾 题外话
239
245
 
240
- ### 👾题外话
241
246
  ~~整个项目快被我写成屎山了~~
@@ -6,7 +6,8 @@
6
6
 
7
7
  <div align="center">
8
8
 
9
- # 📃话痨排行榜
9
+ # 📃 话痨排行榜
10
+
10
11
  nonebot-plugin-dialectlist
11
12
 
12
13
  <p align="center">
@@ -24,21 +25,25 @@ nonebot-plugin-dialectlist
24
25
  [![wakatime](https://wakatime.com/badge/user/114aee90-a5f9-49aa-b441-9eca7eebfda3/project/68aaa2a1-fb8a-4b00-bb66-ee67e8a3f3b0.svg)](https://wakatime.com/badge/user/114aee90-a5f9-49aa-b441-9eca7eebfda3/project/68aaa2a1-fb8a-4b00-bb66-ee67e8a3f3b0)
25
26
 
26
27
  \>💬**看看群友们这些天在群里水了多少话**💬<
28
+
27
29
  </div>
28
30
 
29
31
  ## 💿 安装
30
32
 
31
33
  通过`pip`或`nb`安装:
34
+
32
35
  - 通过 pip 安装
36
+
33
37
  ```bash
34
38
  pip install nonebot-plugin-dialectlist
35
39
  ```
40
+
36
41
  - 通过 nb-cli 安装
42
+
37
43
  ```bash
38
44
  nb plugin install nonebot-plugin-dialectlist
39
45
  ```
40
46
 
41
-
42
47
  ### ✅ 插件依赖于
43
48
 
44
49
  1. [nonebot-plugin-datastore](https://github.com/he0119/nonebot-plugin-datastore) ————本地化储存
@@ -48,13 +53,14 @@ nb plugin install nonebot-plugin-dialectlist
48
53
  5. [nonebot-plugin-chatrecorder](https://github.com/noneplugin/nonebot-plugin-chatrecorder) ————实现消息储存
49
54
  6. [nonebot-plugin-cesaa](https://github.com/MountainDash/nonebot-plugin-send-anything-anywhere) ————实现多平台
50
55
 
51
- **⚠注意** 若先前没有安装过```nonebot-plugin-chatrecorder```或者```nonebot-plugin-orm```,则会在启动时报错,请按报错的提示安装数据库!
52
-
56
+ **⚠ 注意** 若先前没有安装过`nonebot-plugin-chatrecorder`或者`nonebot-plugin-orm`,则会在启动时报错,请按报错的提示安装数据库!
57
+
53
58
  ## ⚙ 配置
54
59
 
55
60
  需要**提前配置**本插件所**依赖的插件**!
56
61
 
57
62
  在 .env 中,可以添加以下配置项
63
+
58
64
  ```python
59
65
  dialectlist__get_num: int = 5 # 获取人数数量
60
66
  dialectlist__font: str = "SimHei" # 字体格式
@@ -62,73 +68,74 @@ dialectlist__suffix: bool = True # 是否显示后缀
62
68
  dialectlist__excluded_self: bool = True # 是否排除自己
63
69
  dialectlist__visualization: bool = True # 是否可视化
64
70
  dialectlist__show_text_rank: bool = True # 是否显示文本排名
65
- dialectlist__counting_cache: bool = False # 计数缓存(能够提高回复速度)
66
- dialectlist__excluded_people: List[str] = [] # 排除的人的QQ号
71
+ dialectlist__excluded_people: List[str] = [] # 排除的人的 QQ 号
67
72
  dialectlist__use_user_info_cache: bool = False # 是否使用用户信息缓存
68
73
  dialectlist__aggregate_transmission: bool = False # 是否聚合转发消息
69
74
  dialectlist__timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
70
- dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
75
+ dialectlist__string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
71
76
  dialectlist__template_path: str = "./template/rank_template.j2" # 模板路径
72
- dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
77
+ dialectlist__string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息、n" # 消息格式
73
78
  ```
74
- 💭也可以不进行配置,这将会使插件按照默认配置运行
75
79
 
76
- ### ⚠ 注意!!
80
+ 💭 也可以不进行配置,这将会使插件按照默认配置运行
81
+
82
+ ### ⚠ 注意!!
77
83
 
78
84
  > 在旧版插件(2.0.0 以下)中,dialectlist 与后面的配置项只隔了一个下划线,若更新到新版本以后需要俩个下划线。
79
85
 
80
- > 由于插件依赖chatrecord多次引入爆炸性修改,建议在遇到问题后优先尝试降级chatrecord插件
86
+ > 由于插件依赖 chatrecord 多次引入爆炸性修改,建议在遇到问题后优先尝试降级 chatrecord 插件
81
87
 
82
- ## 🗨命令
83
- __!!注意!!__
88
+ ## 🗨 命令
89
+
90
+ **!!注意!!**
84
91
  新版本指令调用方式改变,改为更易理解也更好打的 B 话榜。
85
92
  同时也可以用类似 `/今日废话榜` 的方式(只要改前面的就好了)(算是给 [盘古之白](https://github.com/vinta/pangu.js) 风格爱好者的福利吧?)
86
93
 
87
- ### 🎨一般用法
94
+ ### 🎨 一般用法
88
95
 
89
- #### B话榜
96
+ #### B 话榜
90
97
 
91
- -`/B话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
98
+ -`/B 话榜` ————看看有史以来(机器人存在以来)群友们发了多少消息! (好像没写)
92
99
 
93
- -`/今日B话榜` ————看看今天的群友发了多少消息!
100
+ -`/今日 B 话榜` ————看看今天的群友发了多少消息!
94
101
 
95
- -`/昨日B话榜` ————看看昨天的群友发了多少消息!
102
+ -`/昨日 B 话榜` ————看看昨天的群友发了多少消息!
96
103
 
97
- -`/前日B话榜` ————看看前天的群友发了多少消息!
104
+ -`/前日 B 话榜` ————看看前天的群友发了多少消息!
98
105
 
99
- -`/本周B话榜` ————看看本周的群友发了多少消息!
100
-
101
- -`/上周B话榜` ————看看上周的群友发了多少消息!
106
+ -`/本周 B 话榜` ————看看本周的群友发了多少消息!
102
107
 
103
- -`/本月B话榜` ————看看这个月的群友发了多少消息!
108
+ -`/上周 B 话榜` ————看看上周的群友发了多少消息!
104
109
 
105
- -`/年度B话榜` ————看看今年的群友发了多少消息!
110
+ -`/本月 B 话榜` ————看看这个月的群友发了多少消息!
106
111
 
107
- -`/历史B话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
112
+ -`/年度 B 话榜` ————看看今年的群友发了多少消息!
108
113
 
109
- #### 看看B话(kkb)
114
+ -`/历史 B 话榜` ————看看历史上(机器人存在以来)的群友发了多少消息!
110
115
 
111
- -`/看看B话 [@某人|QQ号]` ————看看这个b人在这个b群发了多少b话!
116
+ #### 看看 B 话(kkb)
112
117
 
113
- ### 🚀进阶用法
118
+ -`/看看 B 话 [@某人|QQ 号]` ————看看这个 b 人在这个 b 群发了多少 b 话!
114
119
 
115
- #### B话榜
120
+ ### 🚀 进阶用法
116
121
 
117
- `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
122
+ #### B 话榜
118
123
 
119
- 如:`/B话榜 历史 2024-01-01~2024-01-02 12345678 女装`
124
+ `/{时间类型(今日|年度)?}{B 话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} {群号} {关键词}`
120
125
 
121
- 也可以 `/{时间类型(今日|年度)?}{B话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
126
+ 如:`/B 话榜 历史 2024-01-01~2024-01-02 12345678 女装`
127
+
128
+ 也可以 `/{时间类型(今日|年度)?}{B 话榜|废话榜} {时间类型?} {ISO8601 格式时间 ?} -g {群号} -k {关键词}`
122
129
 
123
130
  以下调用方法均合法:
124
131
 
125
- `/今日B话榜 -g 12345678 -k 女装`
126
- `/昨日B话榜 -k 女装`
127
- `/本周B话榜 -g 12345678`
132
+ `/今日 B 话榜 -g 12345678 -k 女装`
133
+ `/昨日 B 话榜 -k 女装`
134
+ `/本周 B 话榜 -g 12345678`
128
135
 
129
- #### 看看B话
136
+ #### 看看 B 话
130
137
 
131
- `/看看B话 {@|QQ号} {群号?} {关键词?}`
138
+ `/看看 B 话 {@|QQ 号} {群号?} {关键词?}`
132
139
 
133
140
  以下调用方法均合法:
134
141
 
@@ -140,28 +147,28 @@ __!!注意!!__
140
147
 
141
148
  ## 💪 目前支持的平台
142
149
 
143
- | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
144
- |:-----:|:----:|:----:| :----: |
145
- | Onebot | ✅ | ✅ | NapCat + Window11|
146
- | 飞书 | ❌ | ❓ | 🤔 |
147
- | Red | ❌ | ❓ | 🤔 |
148
- | DoDo | ❌ | ❓ | 🤔 |
149
- | Mirai | ❌ | ❓ | 🤔 |
150
- | 开黑啦 | ❌ | ❓ | 🤔 |
151
- | Kritor | ❌ | ❓ | 🤔 |
152
- | Ntchat | ❌ | ❓ | 🤔 |
153
- | Satori | ❌ | ❓ | 🤔 |
154
- | Telegram | ❌ | ❓ | 🤔 |
155
- | Discord | ❌ | ❓ | 🤔 |
156
- | Tailchat | ❌ | ❓ | 🤔 |
157
- | QQ 官方接口 | ❌ | ❓ | 🤔 |
158
- | Rocket.Chat | ❌ | ❓ | 🤔 |
150
+ | 平台 | 是否经过测试 | 是否能够正常工作 | 测试环境 |
151
+ | :---------: | :----------: | :--------------: | :---------------: |
152
+ | Onebot | ✅ | ✅ | NapCat + Window11 |
153
+ | 飞书 | ❌ | ❓ | 🤔 |
154
+ | Red | ❌ | ❓ | 🤔 |
155
+ | DoDo | ❌ | ❓ | 🤔 |
156
+ | Mirai | ❌ | ❓ | 🤔 |
157
+ | 开黑啦 | ❌ | ❓ | 🤔 |
158
+ | Kritor | ❌ | ❓ | 🤔 |
159
+ | Ntchat | ❌ | ❓ | 🤔 |
160
+ | Satori | ❌ | ❓ | 🤔 |
161
+ | Telegram | ❌ | ❓ | 🤔 |
162
+ | Discord | ❌ | ❓ | 🤔 |
163
+ | Tailchat | ❌ | ❓ | 🤔 |
164
+ | QQ 官方接口 | ❌ | ❓ | 🤔 |
165
+ | Rocket.Chat | ❌ | ❓ | 🤔 |
159
166
 
160
167
  - 如果你测试过能够使用,请在 Issue 中指出
161
168
 
162
- ## 📦另外
169
+ ## 📦 另外
163
170
 
164
- ### 😳加入作者的 BUG 反馈群 ~~(🥵女装粉丝群)~~
171
+ ### 😳 加入作者的 BUG 反馈群 ~~(🥵 女装粉丝群)~~
165
172
 
166
173
  [群连接](https://qm.qq.com/q/Yty2yc9Bee)
167
174
 
@@ -174,10 +181,9 @@ __!!注意!!__
174
181
 
175
182
  ![9c149e99ca747c13892be3f9fbeedf31](https://github.com/user-attachments/assets/d02d108c-1ab3-4ad1-9123-c1a98862e627)
176
183
 
184
+ ### 💕 感谢
177
185
 
178
- ### 💕感谢
179
-
180
- 本插件的__init__.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
186
+ 本插件的**init**.py 中的处理函数参考了词云中的方法 ~~(其实大部分都是 Ctrl+C Ctr+V)~~
181
187
 
182
188
  [nonebot-plugin-wordcloud](https://github.com/he0119/nonebot-plugin-wordcloud)
183
189
 
@@ -194,7 +200,6 @@ __!!注意!!__
194
200
  - [x] 更好看的图片渲染
195
201
 
196
202
  - [x] 添加一些全新的可配置项
197
-
198
203
  - [x] 尝试利用 jinja2 模板引擎制作可视化图片
199
204
 
200
205
  - [x] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
@@ -204,9 +209,9 @@ __!!注意!!__
204
209
  - [x] 查询带某关键词的消息量
205
210
 
206
211
  - [x] 合并转发
207
-
208
- 待补充。.....
209
212
 
213
+ 待补充。.....
214
+
215
+ ### 👾 题外话
210
216
 
211
- ### 👾题外话
212
217
  ~~整个项目快被我写成屎山了~~
@@ -16,7 +16,6 @@ from typing import Optional, Union
16
16
  import nonebot_plugin_saa as saa
17
17
  from arclet.alconna import ArparmaBehavior
18
18
  from arclet.alconna.arparma import Arparma
19
- from nonebot import on_command
20
19
  from nonebot.adapters import Bot, Event
21
20
  from nonebot.log import logger
22
21
  from nonebot.params import Arg, Depends
@@ -31,10 +30,10 @@ from nonebot_plugin_alconna import (
31
30
  Option,
32
31
  on_alconna,
33
32
  )
34
- from nonebot_plugin_chatrecorder import get_message_records
35
33
  from nonebot_plugin_uninfo import Session, Uninfo, get_session
36
34
 
37
35
  from .config import Config, plugin_config
36
+
38
37
  # from .storage import build_cache, get_cache
39
38
  from .time import (
40
39
  get_datetime_fromisoformat_with_timezone,
@@ -46,8 +45,8 @@ from .utils import (
46
45
  get_rank_image,
47
46
  get_user_infos,
48
47
  got_rank,
49
- msg_counter,
50
48
  persist_id2user_id,
49
+ get_user_message_counts,
51
50
  )
52
51
 
53
52
  __plugin_meta__ = PluginMetadata(
@@ -80,17 +79,6 @@ def wrapper(slot: Union[int, str], content: Optional[str], context) -> str:
80
79
  return '' # pragma: no cover
81
80
 
82
81
 
83
- build_cache_cmd = on_command('build_cache', aliases={'重建缓存'}, block=True)
84
-
85
-
86
- @build_cache_cmd.handle()
87
- async def _build_cache(bot: Bot, event: Event):
88
- return
89
- await saa.Text('正在重建缓存,请稍等。').send(reply=True) # type: ignore
90
- await build_cache()
91
- await saa.Text('重建缓存完成。').send(reply=True)
92
-
93
-
94
82
  b_cmd = on_alconna(
95
83
  Alconna(
96
84
  '看看B话',
@@ -122,18 +110,16 @@ async def handle_b_cmd(
122
110
  if not gid:
123
111
  await b_cmd.finish('请指定群号。')
124
112
 
125
- if keyword.available:
126
- keywords = keyword.result
127
- else:
128
- keywords = None
113
+ _keyword = keyword.result
129
114
 
130
- messages = await get_message_records(
115
+ d = await get_user_message_counts(
116
+ keyword=_keyword,
131
117
  scene_ids=[gid],
132
118
  user_ids=[id],
133
119
  types=['message'], # 排除机器人自己发的消息
134
120
  exclude_user_ids=plugin_config.excluded_people,
135
121
  )
136
- d = msg_counter(messages, keywords)
122
+
137
123
  rank = got_rank(d)
138
124
  if not rank:
139
125
  await b_cmd.finish(
@@ -302,24 +288,16 @@ async def handle_rank(
302
288
 
303
289
  keyword = state['keyword']
304
290
 
305
- if plugin_config.counting_cache:
306
- await saa.Text("缓存暂不支持").finish()
307
- # if keyword:
308
- # await saa.Text('已开启缓存~缓存不支持关键词查询哦').finish()
309
- # t1 = t.time()
310
- # raw_rank = await get_cache(start, stop, id)
311
- # logger.debug(f'获取计数消息花费时间:{t.time() - t1}')
312
- else:
313
- t1 = t.time()
314
- messages = await get_message_records(
315
- scene_ids=[id],
316
- types=['message'], # 排除机器人自己发的消息
317
- time_start=start,
318
- time_stop=stop,
319
- exclude_user_ids=plugin_config.excluded_people,
320
- )
321
- raw_rank = msg_counter(messages, keyword)
322
- logger.debug(f'获取计数消息花费时间:{t.time() - t1}')
291
+ t1 = t.time()
292
+ raw_rank = await get_user_message_counts(
293
+ keyword=keyword,
294
+ scene_ids=[id],
295
+ types=['message'], # 排除机器人自己发的消息
296
+ time_start=start,
297
+ time_stop=stop,
298
+ exclude_user_ids=plugin_config.excluded_people,
299
+ )
300
+ logger.debug(f'获取计数消息花费时间:{t.time() - t1}')
323
301
 
324
302
  if not raw_rank:
325
303
  await saa.Text(
@@ -0,0 +1,30 @@
1
+ from typing import List, Optional
2
+
3
+ from nonebot import get_driver, get_plugin_config
4
+ from pydantic import BaseModel
5
+
6
+
7
+ class ScopedConfig(BaseModel):
8
+ get_num: int = 5 # 获取人数数量
9
+ font: str = 'SimHei' # 字体格式
10
+ suffix: bool = True # 是否显示后缀
11
+ excluded_self: bool = True # 是否排除自己
12
+ visualization: bool = True # 是否可视化
13
+ show_text_rank: bool = True # 是否显示文本排名
14
+ excluded_people: List[str] = [] # 排除的人的QQ号
15
+ use_user_info_cache: bool = False # 是否使用用户信息缓存
16
+ aggregate_transmission: bool = False # 是否聚合转发消息
17
+ timezone: Optional[str] = 'Asia/Shanghai' # 时区,影响统计时间
18
+ string_suffix: str = '统计花费时间:{timecost}秒' # 消息格式后缀
19
+ template_path: str = './template/rank_template.j2' # 模板路径
20
+ string_format: str = (
21
+ '第{index}名:\n{nickname},{chatdatanum}条消息\n' # 消息格式
22
+ )
23
+
24
+
25
+ class Config(BaseModel):
26
+ dialectlist: ScopedConfig = ScopedConfig()
27
+
28
+
29
+ global_config = get_driver().config
30
+ plugin_config = get_plugin_config(Config).dialectlist
@@ -0,0 +1,11 @@
1
+ from typing import Union
2
+
3
+ from nonebot_plugin_userinfo import UserInfo
4
+
5
+
6
+ class UserRankInfo(UserInfo):
7
+ user_bnum: int
8
+ user_proportion: float
9
+ user_nickname: str
10
+ user_index: Union[int, str]
11
+ user_avatar_bytes: bytes