nonebot-plugin-dialectlist 2.1.6__tar.gz → 2.1.9__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.
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/PKG-INFO +29 -16
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/README.md +19 -7
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/__init__.py +46 -18
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/template/rank_template.j2 +1 -1
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/utils.py +24 -6
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist.egg-info/PKG-INFO +29 -16
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -1
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist.egg-info/requires.txt +9 -7
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/pyproject.toml +11 -9
- nonebot_plugin_dialectlist-2.1.6/setup.py +0 -3
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/MANIFEST.in +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/config.py +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/model.py +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/storage.py +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/template/avatar/master.jpg +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/template/css/style.css +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/time.py +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist/usage.py +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
- {nonebot_plugin_dialectlist-2.1.6 → nonebot_plugin_dialectlist-2.1.9}/setup.cfg +0 -0
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nonebot-plugin-dialectlist
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.9
|
|
4
4
|
Summary: 看看你群群友有多能说
|
|
5
5
|
Author-email: Chen_Xu233 <woyerpa@outlook.com>
|
|
6
6
|
License: MIT
|
|
7
|
-
Requires-Python: <4.0,>=3.
|
|
7
|
+
Requires-Python: <4.0,>=3.9
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: nonebot2>=2.3.1
|
|
10
9
|
Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
|
|
11
|
-
Requires-Dist: pygal>=3.0.4
|
|
12
10
|
Requires-Dist: requests>=2.32.3
|
|
13
11
|
Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
|
|
14
|
-
Requires-Dist: nonebot-plugin-alconna>=0.
|
|
12
|
+
Requires-Dist: nonebot-plugin-alconna>=0.50.2
|
|
15
13
|
Requires-Dist: nonebot-plugin-cesaa>=0.4.0
|
|
16
14
|
Requires-Dist: nonebot-plugin-userinfo>=0.2.4
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
15
|
+
Requires-Dist: nonebot-plugin-htmlrender>=0.3.3
|
|
16
|
+
Requires-Dist: nonebot2>=2.3.2
|
|
17
|
+
Requires-Dist: cn2an>=0.5.22
|
|
19
18
|
Provides-Extra: dev
|
|
20
|
-
Requires-Dist: ruff>=0.
|
|
21
|
-
Requires-Dist: setuptools>=
|
|
19
|
+
Requires-Dist: ruff>=0.5.5; extra == "dev"
|
|
20
|
+
Requires-Dist: setuptools>=71.1.0; extra == "dev"
|
|
22
21
|
Requires-Dist: twine>=5.1.0; extra == "dev"
|
|
23
22
|
Requires-Dist: nb-cli>=0.7.6; extra == "dev"
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: nonebot-adapter-onebot>=2.4.4; extra == "test"
|
|
24
25
|
|
|
25
26
|
<div align="center">
|
|
26
27
|
<a href="https://v2.nonebot.dev/store"><img src="./docs/NoneBotPlugin.svg" width="400" alt="NoneBotPluginLogo"></a>
|
|
@@ -34,8 +35,8 @@ Requires-Dist: nb-cli>=0.7.6; extra == "dev"
|
|
|
34
35
|
nonebot-plugin-dialectlist
|
|
35
36
|
|
|
36
37
|
<p align="center">
|
|
37
|
-
<a href="https://pypi.python.org/pypi/nonebot-plugin-
|
|
38
|
-
<img src="https://img.shields.io/pypi/v/nonebot-plugin-
|
|
38
|
+
<a href="https://pypi.python.org/pypi/nonebot-plugin-dialectlist">
|
|
39
|
+
<img src="https://img.shields.io/pypi/v/nonebot-plugin-dialectlist.svg" alt="pypi">
|
|
39
40
|
</a>
|
|
40
41
|
|
|
41
42
|
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
|
|
@@ -79,8 +80,8 @@ dialectlist__string_suffix_format = '你们的职业是水群吗?————M
|
|
|
79
80
|
dialectlist__get_num = 10 #获取人数数量
|
|
80
81
|
dialectlist__visualization = True #是否可视化
|
|
81
82
|
dialectlist__visualization_type = '圆环图' #可视化方案
|
|
82
|
-
dialectlist__font = 'SimHei'#字体格式
|
|
83
|
-
dialectlist__excluded_people = []#排除的人的 QQ 号(或频道号?(未经测试))
|
|
83
|
+
dialectlist__font = 'SimHei' #字体格式
|
|
84
|
+
dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
|
|
84
85
|
dialectlist__excluded_self = True #是否排除机器人自己 QQ
|
|
85
86
|
```
|
|
86
87
|
💭也可以不进行配置,这将会使插件按照默认配置运行
|
|
@@ -191,11 +192,23 @@ __!!注意!!__
|
|
|
191
192
|
|
|
192
193
|
- [x] 适配全平台
|
|
193
194
|
|
|
194
|
-
- [
|
|
195
|
+
- [x] 尝试利用 jinja2 模板引擎制作可视化图片
|
|
195
196
|
|
|
196
|
-
- [ ]
|
|
197
|
+
- [ ] 更好看的图片渲染
|
|
198
|
+
|
|
199
|
+
- [ ] 提供多样化的渲染器配置(html渲染,pillow渲染,统计绘图软件渲染)
|
|
200
|
+
- [ ] 为pillow渲染方式提供插件的加载方式(什么?插件里的插件???)
|
|
201
|
+
|
|
202
|
+
- [ ] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
|
|
203
|
+
|
|
204
|
+
- [ ] 查询带某关键词的消息量
|
|
205
|
+
|
|
206
|
+
- [ ] 使用管理员权限直接获取QQ官方统计的今日消息量以优化代码运行速度
|
|
207
|
+
|
|
208
|
+
- [ ] 特殊的储存方案优化消息统计
|
|
209
|
+
|
|
210
|
+
- [ ] 添加一些全新的可配置项
|
|
197
211
|
|
|
198
|
-
- [ ] 尝试利用 jinja2 模板引擎制作可视化图片 (((真的可以吗?))
|
|
199
212
|
|
|
200
213
|
待补充。.....
|
|
201
214
|
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
nonebot-plugin-dialectlist
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://pypi.python.org/pypi/nonebot-plugin-
|
|
14
|
-
<img src="https://img.shields.io/pypi/v/nonebot-plugin-
|
|
13
|
+
<a href="https://pypi.python.org/pypi/nonebot-plugin-dialectlist">
|
|
14
|
+
<img src="https://img.shields.io/pypi/v/nonebot-plugin-dialectlist.svg" alt="pypi">
|
|
15
15
|
</a>
|
|
16
16
|
|
|
17
17
|
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
|
|
@@ -55,8 +55,8 @@ dialectlist__string_suffix_format = '你们的职业是水群吗?————M
|
|
|
55
55
|
dialectlist__get_num = 10 #获取人数数量
|
|
56
56
|
dialectlist__visualization = True #是否可视化
|
|
57
57
|
dialectlist__visualization_type = '圆环图' #可视化方案
|
|
58
|
-
dialectlist__font = 'SimHei'#字体格式
|
|
59
|
-
dialectlist__excluded_people = []#排除的人的 QQ 号(或频道号?(未经测试))
|
|
58
|
+
dialectlist__font = 'SimHei' #字体格式
|
|
59
|
+
dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
|
|
60
60
|
dialectlist__excluded_self = True #是否排除机器人自己 QQ
|
|
61
61
|
```
|
|
62
62
|
💭也可以不进行配置,这将会使插件按照默认配置运行
|
|
@@ -167,11 +167,23 @@ __!!注意!!__
|
|
|
167
167
|
|
|
168
168
|
- [x] 适配全平台
|
|
169
169
|
|
|
170
|
-
- [
|
|
170
|
+
- [x] 尝试利用 jinja2 模板引擎制作可视化图片
|
|
171
171
|
|
|
172
|
-
- [ ]
|
|
172
|
+
- [ ] 更好看的图片渲染
|
|
173
|
+
|
|
174
|
+
- [ ] 提供多样化的渲染器配置(html渲染,pillow渲染,统计绘图软件渲染)
|
|
175
|
+
- [ ] 为pillow渲染方式提供插件的加载方式(什么?插件里的插件???)
|
|
176
|
+
|
|
177
|
+
- [ ] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
|
|
178
|
+
|
|
179
|
+
- [ ] 查询带某关键词的消息量
|
|
180
|
+
|
|
181
|
+
- [ ] 使用管理员权限直接获取QQ官方统计的今日消息量以优化代码运行速度
|
|
182
|
+
|
|
183
|
+
- [ ] 特殊的储存方案优化消息统计
|
|
184
|
+
|
|
185
|
+
- [ ] 添加一些全新的可配置项
|
|
173
186
|
|
|
174
|
-
- [ ] 尝试利用 jinja2 模板引擎制作可视化图片 (((真的可以吗?))
|
|
175
187
|
|
|
176
188
|
待补充。.....
|
|
177
189
|
|
|
@@ -9,6 +9,7 @@ require("nonebot_plugin_cesaa")
|
|
|
9
9
|
|
|
10
10
|
import re
|
|
11
11
|
import os
|
|
12
|
+
import cn2an
|
|
12
13
|
import nonebot_plugin_saa as saa
|
|
13
14
|
|
|
14
15
|
from typing import Union, Optional, List
|
|
@@ -19,6 +20,7 @@ from arclet.alconna.arparma import Arparma
|
|
|
19
20
|
from nonebot.log import logger
|
|
20
21
|
from nonebot.params import Arg, Depends
|
|
21
22
|
from nonebot.typing import T_State
|
|
23
|
+
from nonebot.compat import model_dump
|
|
22
24
|
from nonebot.adapters import Bot, Event, Message
|
|
23
25
|
from nonebot.params import Arg, Depends
|
|
24
26
|
from nonebot.permission import SUPERUSER
|
|
@@ -29,6 +31,7 @@ from nonebot_plugin_alconna import (
|
|
|
29
31
|
AlconnaMatch,
|
|
30
32
|
AlconnaMatcher,
|
|
31
33
|
AlconnaQuery,
|
|
34
|
+
Option,
|
|
32
35
|
Args,
|
|
33
36
|
Match,
|
|
34
37
|
Option,
|
|
@@ -53,6 +56,7 @@ from .utils import (
|
|
|
53
56
|
got_rank,
|
|
54
57
|
msg_counter,
|
|
55
58
|
persist_id2user_id,
|
|
59
|
+
user_id2persist_id,
|
|
56
60
|
get_rank_image
|
|
57
61
|
)
|
|
58
62
|
|
|
@@ -79,23 +83,22 @@ class SameTime(ArparmaBehavior):
|
|
|
79
83
|
interface.behave_fail()
|
|
80
84
|
|
|
81
85
|
|
|
82
|
-
def wrapper(slot: Union[int, str], content: Optional[str]) -> str:
|
|
86
|
+
def wrapper(slot: Union[int, str], content: Optional[str],context) -> str:
|
|
83
87
|
if slot == "type" and content:
|
|
84
88
|
return content
|
|
85
89
|
return "" # pragma: no cover
|
|
86
90
|
|
|
87
|
-
|
|
88
91
|
rank_cmd = on_alconna(
|
|
89
92
|
Alconna(
|
|
90
93
|
"B话榜",
|
|
91
94
|
Args["type?", ["今日", "昨日", "本周", "上周", "本月", "上月", "年度", "历史"]][
|
|
92
|
-
"time?",str,]
|
|
93
|
-
|
|
94
|
-
],
|
|
95
|
+
"time?",str,],
|
|
96
|
+
Option("-g|--group_id",Args["group_id?", str]),
|
|
95
97
|
behaviors=[SameTime()],
|
|
96
98
|
),
|
|
97
99
|
aliases={"废话榜"},
|
|
98
100
|
use_cmd_start=True,
|
|
101
|
+
block=True,
|
|
99
102
|
)
|
|
100
103
|
|
|
101
104
|
|
|
@@ -103,7 +106,16 @@ rank_cmd.shortcut(
|
|
|
103
106
|
r"(?P<type>今日|昨日|本周|上周|本月|上月|年度|历史)B话榜",
|
|
104
107
|
{
|
|
105
108
|
"prefix": True,
|
|
106
|
-
"command": "B话榜
|
|
109
|
+
"command": "B话榜",
|
|
110
|
+
"wrapper": wrapper,
|
|
111
|
+
"args": ["{type}"],
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
rank_cmd.shortcut(
|
|
115
|
+
r"(?P<type>今日|昨日|本周|上周|本月|上月|年度|历史)废话榜",
|
|
116
|
+
{
|
|
117
|
+
"prefix": True,
|
|
118
|
+
"command": "废话榜",
|
|
107
119
|
"wrapper": wrapper,
|
|
108
120
|
"args": ["{type}"],
|
|
109
121
|
},
|
|
@@ -122,10 +134,11 @@ async def _group_message(
|
|
|
122
134
|
|
|
123
135
|
dt = get_datetime_now_with_timezone()
|
|
124
136
|
|
|
125
|
-
if group_id
|
|
137
|
+
if not group_id:
|
|
126
138
|
group_id = session.id2
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
logger.debug(f"session id2: {group_id}")
|
|
140
|
+
if group_id:
|
|
141
|
+
state["group_id"] = group_id
|
|
129
142
|
|
|
130
143
|
if not type:
|
|
131
144
|
await rank_cmd.finish(__plugin_meta__.usage)
|
|
@@ -193,19 +206,25 @@ async def _group_message(
|
|
|
193
206
|
prompt="请输入你要查询的结束日期(如 2022-02-22)",
|
|
194
207
|
parameterless=[Depends(parse_datetime("stop"))],
|
|
195
208
|
)
|
|
196
|
-
@rank_cmd.got(
|
|
209
|
+
@rank_cmd.got(
|
|
210
|
+
"group_id",
|
|
211
|
+
prompt="请输入你要查询的群号。"
|
|
212
|
+
)
|
|
197
213
|
async def handle_rank(
|
|
214
|
+
state: T_State,
|
|
198
215
|
bot: Bot,
|
|
199
216
|
event: Event,
|
|
200
217
|
session: Session = Depends(extract_session),
|
|
201
218
|
start: datetime = Arg(),
|
|
202
219
|
stop: datetime = Arg(),
|
|
203
|
-
group_id: str = Arg(),
|
|
220
|
+
# group_id: str = Arg(),
|
|
204
221
|
):
|
|
205
|
-
if group_id:
|
|
206
|
-
id =
|
|
222
|
+
if id := state["group_id"]:
|
|
223
|
+
# id = await user_id2persist_id(id)
|
|
224
|
+
logger.debug(f"group_id: {id}")
|
|
207
225
|
else:
|
|
208
226
|
id = session.id2
|
|
227
|
+
logger.debug(f"group_id: {id}")
|
|
209
228
|
|
|
210
229
|
if not id:
|
|
211
230
|
await saa.Text("没有指定群哦").finish()
|
|
@@ -220,7 +239,12 @@ async def handle_rank(
|
|
|
220
239
|
time_stop=stop,
|
|
221
240
|
exclude_id1s=plugin_config.excluded_people,
|
|
222
241
|
)
|
|
242
|
+
|
|
243
|
+
if not messages:
|
|
244
|
+
await saa.Text("明明这个时间段都没有人说话怎么会有话痨榜呢?").finish()
|
|
245
|
+
|
|
223
246
|
rank = got_rank(msg_counter(messages))
|
|
247
|
+
logger.debug(rank)
|
|
224
248
|
rank2: List[UserRankInfo] = []
|
|
225
249
|
ids = await persist_id2user_id([int(i[0]) for i in rank])
|
|
226
250
|
for i in range(len(rank)):
|
|
@@ -228,9 +252,10 @@ async def handle_rank(
|
|
|
228
252
|
logger.debug(rank[i])
|
|
229
253
|
|
|
230
254
|
total = sum([i[1] for i in rank])
|
|
231
|
-
|
|
255
|
+
index = 1
|
|
232
256
|
for i in rank:
|
|
233
257
|
if user_info := await get_user_info(bot, event, user_id=str(i[0])):
|
|
258
|
+
logger.debug(user_info)
|
|
234
259
|
user_nickname = user_info.user_displayname\
|
|
235
260
|
if user_info.user_displayname\
|
|
236
261
|
else user_info.user_name\
|
|
@@ -240,18 +265,21 @@ async def handle_rank(
|
|
|
240
265
|
user_avatar = await user_info.user_avatar.get_image()\
|
|
241
266
|
if user_info.user_avatar\
|
|
242
267
|
else open(os.path.dirname(os.path.abspath(__file__))+"/template/avatar/default.jpg", "rb").read()
|
|
243
|
-
user = UserRankInfo(**
|
|
268
|
+
user = UserRankInfo(**model_dump(user_info),
|
|
244
269
|
user_bnum=i[1],
|
|
245
270
|
user_proportion= round(i[1] / total * 100, 2),
|
|
246
|
-
user_index=
|
|
247
|
-
user_nickname=user_nickname,
|
|
271
|
+
user_index= cn2an.an2cn(index),
|
|
272
|
+
user_nickname= user_nickname,
|
|
248
273
|
user_avatar_bytes= user_avatar,
|
|
249
274
|
)
|
|
250
275
|
user.user_gender="她" if user_info.user_gender == "female" else "他" if user_info.user_gender == "male" else "ta"
|
|
251
276
|
rank2.append(user)
|
|
277
|
+
index += 1
|
|
252
278
|
|
|
253
279
|
string: str = ""
|
|
254
|
-
for i in
|
|
280
|
+
for i in rank2:
|
|
281
|
+
logger.debug(i.user_name)
|
|
282
|
+
for i in range(len(rank2)):
|
|
255
283
|
str_example = plugin_config.string_format.format(
|
|
256
284
|
index=rank2[i].user_index,
|
|
257
285
|
nickname=rank2[i].user_nickname,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<div class="rank_card">
|
|
20
20
|
<img class="profile" src="{{ cache_path }}/{{ i.user_id }}.jpg"/>
|
|
21
21
|
<div class="rank_card_info">
|
|
22
|
-
<h1>第{{ i.user_index }}名:{{ i.
|
|
22
|
+
<h1>第{{ i.user_index }}名:{{ i.user_nickname }}</h1>
|
|
23
23
|
<div class="g-container">
|
|
24
24
|
<div class="g-progress" style="width: {{ i.user_proportion }}%"></div>
|
|
25
25
|
</div>
|
|
@@ -46,28 +46,46 @@ async def ensure_group(matcher: Matcher, session: Session = Depends(extract_sess
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
async def persist_id2user_id(ids: List) -> List[str]:
|
|
49
|
+
user_ids = []
|
|
50
|
+
async with get_session() as db_session:
|
|
51
|
+
for i in ids:
|
|
52
|
+
user_id = (await db_session.scalar(select(SessionModel).where(or_(*[SessionModel.id == i])))).id1 # type: ignore
|
|
53
|
+
user_ids.append(user_id)
|
|
54
|
+
return user_ids
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def user_id2persist_id(ids: List[str]) -> List[int]:
|
|
49
58
|
whereclause: List[ColumnElement[bool]] = []
|
|
50
|
-
whereclause.append(or_(*[SessionModel.
|
|
59
|
+
whereclause.append(or_(*[SessionModel.id1 == id for id in ids]))
|
|
51
60
|
statement = (
|
|
52
61
|
select(SessionModel).where(*whereclause)
|
|
53
62
|
# .join(SessionModel, SessionModel.id == MessageRecord.session_persist_id)
|
|
54
63
|
)
|
|
55
64
|
async with get_session() as db_session:
|
|
56
65
|
records = (await db_session.scalars(statement)).all()
|
|
57
|
-
return [i.
|
|
66
|
+
return [i.id for i in records]
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
async def user_id2persist_id(id: str) -> int:
|
|
68
|
+
async def group_id2persist_id(ids: List[str]) -> List[int]:
|
|
61
69
|
whereclause: List[ColumnElement[bool]] = []
|
|
62
|
-
whereclause.append(or_(*[SessionModel.id2 == id]))
|
|
70
|
+
whereclause.append(or_(*[SessionModel.id2 == id for id in ids]))
|
|
63
71
|
statement = (
|
|
64
72
|
select(SessionModel).where(*whereclause)
|
|
65
73
|
# .join(SessionModel, SessionModel.id == MessageRecord.session_persist_id)
|
|
66
74
|
)
|
|
67
75
|
async with get_session() as db_session:
|
|
68
76
|
records = (await db_session.scalars(statement)).all()
|
|
69
|
-
return
|
|
77
|
+
return [i.id for i in records]
|
|
70
78
|
|
|
79
|
+
async def persist_id2group_id(ids: List[str]) -> List[str]:
|
|
80
|
+
whereclause: List[ColumnElement[bool]] = []
|
|
81
|
+
whereclause.append(or_(*[SessionModel.id == id for id in ids]))
|
|
82
|
+
statement = (
|
|
83
|
+
select(SessionModel).where(*whereclause)
|
|
84
|
+
# .join(SessionModel, SessionModel.id == MessageRecord.session_persist_id)
|
|
85
|
+
)
|
|
86
|
+
async with get_session() as db_session:
|
|
87
|
+
records = (await db_session.scalars(statement)).all()
|
|
88
|
+
return [i.id2 for i in records]
|
|
71
89
|
|
|
72
90
|
def msg_counter(msg_list: List[MessageRecord]) -> Dict[str, int]:
|
|
73
91
|
"""### 计算每个人的消息量
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nonebot-plugin-dialectlist
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.9
|
|
4
4
|
Summary: 看看你群群友有多能说
|
|
5
5
|
Author-email: Chen_Xu233 <woyerpa@outlook.com>
|
|
6
6
|
License: MIT
|
|
7
|
-
Requires-Python: <4.0,>=3.
|
|
7
|
+
Requires-Python: <4.0,>=3.9
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: nonebot2>=2.3.1
|
|
10
9
|
Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
|
|
11
|
-
Requires-Dist: pygal>=3.0.4
|
|
12
10
|
Requires-Dist: requests>=2.32.3
|
|
13
11
|
Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
|
|
14
|
-
Requires-Dist: nonebot-plugin-alconna>=0.
|
|
12
|
+
Requires-Dist: nonebot-plugin-alconna>=0.50.2
|
|
15
13
|
Requires-Dist: nonebot-plugin-cesaa>=0.4.0
|
|
16
14
|
Requires-Dist: nonebot-plugin-userinfo>=0.2.4
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
15
|
+
Requires-Dist: nonebot-plugin-htmlrender>=0.3.3
|
|
16
|
+
Requires-Dist: nonebot2>=2.3.2
|
|
17
|
+
Requires-Dist: cn2an>=0.5.22
|
|
19
18
|
Provides-Extra: dev
|
|
20
|
-
Requires-Dist: ruff>=0.
|
|
21
|
-
Requires-Dist: setuptools>=
|
|
19
|
+
Requires-Dist: ruff>=0.5.5; extra == "dev"
|
|
20
|
+
Requires-Dist: setuptools>=71.1.0; extra == "dev"
|
|
22
21
|
Requires-Dist: twine>=5.1.0; extra == "dev"
|
|
23
22
|
Requires-Dist: nb-cli>=0.7.6; extra == "dev"
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: nonebot-adapter-onebot>=2.4.4; extra == "test"
|
|
24
25
|
|
|
25
26
|
<div align="center">
|
|
26
27
|
<a href="https://v2.nonebot.dev/store"><img src="./docs/NoneBotPlugin.svg" width="400" alt="NoneBotPluginLogo"></a>
|
|
@@ -34,8 +35,8 @@ Requires-Dist: nb-cli>=0.7.6; extra == "dev"
|
|
|
34
35
|
nonebot-plugin-dialectlist
|
|
35
36
|
|
|
36
37
|
<p align="center">
|
|
37
|
-
<a href="https://pypi.python.org/pypi/nonebot-plugin-
|
|
38
|
-
<img src="https://img.shields.io/pypi/v/nonebot-plugin-
|
|
38
|
+
<a href="https://pypi.python.org/pypi/nonebot-plugin-dialectlist">
|
|
39
|
+
<img src="https://img.shields.io/pypi/v/nonebot-plugin-dialectlist.svg" alt="pypi">
|
|
39
40
|
</a>
|
|
40
41
|
|
|
41
42
|
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
|
|
@@ -79,8 +80,8 @@ dialectlist__string_suffix_format = '你们的职业是水群吗?————M
|
|
|
79
80
|
dialectlist__get_num = 10 #获取人数数量
|
|
80
81
|
dialectlist__visualization = True #是否可视化
|
|
81
82
|
dialectlist__visualization_type = '圆环图' #可视化方案
|
|
82
|
-
dialectlist__font = 'SimHei'#字体格式
|
|
83
|
-
dialectlist__excluded_people = []#排除的人的 QQ 号(或频道号?(未经测试))
|
|
83
|
+
dialectlist__font = 'SimHei' #字体格式
|
|
84
|
+
dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
|
|
84
85
|
dialectlist__excluded_self = True #是否排除机器人自己 QQ
|
|
85
86
|
```
|
|
86
87
|
💭也可以不进行配置,这将会使插件按照默认配置运行
|
|
@@ -191,11 +192,23 @@ __!!注意!!__
|
|
|
191
192
|
|
|
192
193
|
- [x] 适配全平台
|
|
193
194
|
|
|
194
|
-
- [
|
|
195
|
+
- [x] 尝试利用 jinja2 模板引擎制作可视化图片
|
|
195
196
|
|
|
196
|
-
- [ ]
|
|
197
|
+
- [ ] 更好看的图片渲染
|
|
198
|
+
|
|
199
|
+
- [ ] 提供多样化的渲染器配置(html渲染,pillow渲染,统计绘图软件渲染)
|
|
200
|
+
- [ ] 为pillow渲染方式提供插件的加载方式(什么?插件里的插件???)
|
|
201
|
+
|
|
202
|
+
- [ ] 私聊的查询(超级用户可以任意查询群聊的信息)一半完成
|
|
203
|
+
|
|
204
|
+
- [ ] 查询带某关键词的消息量
|
|
205
|
+
|
|
206
|
+
- [ ] 使用管理员权限直接获取QQ官方统计的今日消息量以优化代码运行速度
|
|
207
|
+
|
|
208
|
+
- [ ] 特殊的储存方案优化消息统计
|
|
209
|
+
|
|
210
|
+
- [ ] 添加一些全新的可配置项
|
|
197
211
|
|
|
198
|
-
- [ ] 尝试利用 jinja2 模板引擎制作可视化图片 (((真的可以吗?))
|
|
199
212
|
|
|
200
213
|
待补充。.....
|
|
201
214
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
nonebot2>=2.3.1
|
|
2
1
|
nonebot-plugin-chatrecorder>=0.6.0
|
|
3
|
-
pygal>=3.0.4
|
|
4
2
|
requests>=2.32.3
|
|
5
3
|
nonebot-plugin-apscheduler>=0.4.0
|
|
6
|
-
nonebot-plugin-alconna>=0.
|
|
4
|
+
nonebot-plugin-alconna>=0.50.2
|
|
7
5
|
nonebot-plugin-cesaa>=0.4.0
|
|
8
6
|
nonebot-plugin-userinfo>=0.2.4
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
nonebot-plugin-htmlrender>=0.3.3
|
|
8
|
+
nonebot2>=2.3.2
|
|
9
|
+
cn2an>=0.5.22
|
|
10
|
+
|
|
11
|
+
[Test]
|
|
12
|
+
nonebot-adapter-onebot>=2.4.4
|
|
11
13
|
|
|
12
14
|
[dev]
|
|
13
|
-
ruff>=0.
|
|
14
|
-
setuptools>=
|
|
15
|
+
ruff>=0.5.5
|
|
16
|
+
setuptools>=71.1.0
|
|
15
17
|
twine>=5.1.0
|
|
16
18
|
nb-cli>=0.7.6
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nonebot-plugin-dialectlist"
|
|
3
|
-
version = "2.1.
|
|
3
|
+
version = "2.1.9"
|
|
4
4
|
description = "看看你群群友有多能说"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Chen_Xu233", email = "woyerpa@outlook.com"},
|
|
7
7
|
]
|
|
8
8
|
dependencies = [
|
|
9
|
-
"nonebot2>=2.3.1",
|
|
10
9
|
"nonebot-plugin-chatrecorder>=0.6.0",
|
|
11
|
-
"pygal>=3.0.4",
|
|
12
10
|
"requests>=2.32.3",
|
|
13
11
|
"nonebot-plugin-apscheduler>=0.4.0",
|
|
14
|
-
"nonebot-plugin-alconna>=0.
|
|
12
|
+
"nonebot-plugin-alconna>=0.50.2",
|
|
15
13
|
"nonebot-plugin-cesaa>=0.4.0",
|
|
16
14
|
"nonebot-plugin-userinfo>=0.2.4",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
15
|
+
"nonebot-plugin-htmlrender>=0.3.3",
|
|
16
|
+
"nonebot2>=2.3.2",
|
|
17
|
+
"cn2an>=0.5.22"
|
|
19
18
|
]
|
|
20
|
-
requires-python = ">=3.
|
|
19
|
+
requires-python = ">=3.9,<4.0"
|
|
21
20
|
readme = "README.md"
|
|
22
21
|
license = {text = "MIT"}
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
[project.optional-dependencies]
|
|
26
25
|
dev = [
|
|
27
|
-
"ruff>=0.
|
|
28
|
-
"setuptools>=
|
|
26
|
+
"ruff>=0.5.5",
|
|
27
|
+
"setuptools>=71.1.0",
|
|
29
28
|
"twine>=5.1.0",
|
|
30
29
|
"nb-cli>=0.7.6"
|
|
31
30
|
]
|
|
31
|
+
Test = [
|
|
32
|
+
"nonebot-adapter-onebot>=2.4.4",
|
|
33
|
+
]
|
|
32
34
|
|
|
33
35
|
[tool.pdm]
|
|
34
36
|
distribution = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|