nonebot-plugin-dialectlist 2.2.2__tar.gz → 2.2.3__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.2.2 → nonebot_plugin_dialectlist-2.2.3}/PKG-INFO +5 -4
  2. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/README.md +3 -3
  3. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/__init__.py +33 -20
  4. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/config.py +8 -7
  5. nonebot_plugin_dialectlist-2.2.3/nonebot_plugin_dialectlist/model.py +17 -0
  6. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/storage.py +1 -0
  7. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/template/css/style.css +1 -1
  8. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/time.py +3 -4
  9. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/utils.py +5 -11
  10. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist.egg-info/PKG-INFO +5 -4
  11. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist.egg-info/requires.txt +1 -0
  12. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/pyproject.toml +2 -1
  13. nonebot_plugin_dialectlist-2.2.2/nonebot_plugin_dialectlist/model.py +0 -11
  14. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/MANIFEST.in +0 -0
  15. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/template/avatar/default.jpg +0 -0
  16. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/template/avatar/master.jpg +0 -0
  17. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/template/rank_template.j2 +0 -0
  18. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist/usage.py +0 -0
  19. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist.egg-info/SOURCES.txt +0 -0
  20. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist.egg-info/dependency_links.txt +0 -0
  21. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/nonebot_plugin_dialectlist.egg-info/top_level.txt +0 -0
  22. {nonebot_plugin_dialectlist-2.2.2 → nonebot_plugin_dialectlist-2.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -8,6 +8,7 @@ Requires-Python: <4.0,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
10
10
  Requires-Dist: requests>=2.32.3
11
+ Requires-Dist: nonebot-plugin-orm[default]
11
12
  Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
12
13
  Requires-Dist: nonebot-plugin-alconna>=0.50.2
13
14
  Requires-Dist: nonebot-plugin-cesaa>=0.4.0
@@ -75,11 +76,11 @@ nonebot-plugin-dialectlist
75
76
 
76
77
  在 .env 中,可以添加以下配置项
77
78
  ```python
78
- dialectlist__string_format = '第{index}名:\n{nickname},{chatdatanum}条消息、n' #消息格式
79
+ dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
79
80
  dialectlist__get_num = 10 #获取人数数量
80
81
  dialectlist__visualization = True #是否可视化
81
- # dialectlist__visualization_type = '圆环图' #可视化方案 (不再支持)
82
- dialectlist__font = 'SimHei' #字体格式
82
+ # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
83
+ dialectlist__font = "SimHei" #字体格式
83
84
  dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
84
85
  dialectlist__excluded_self = True #是否排除机器人自己 QQ
85
86
  dialectlist__suffix: bool = False # 是否显示后缀
@@ -50,11 +50,11 @@ nonebot-plugin-dialectlist
50
50
 
51
51
  在 .env 中,可以添加以下配置项
52
52
  ```python
53
- dialectlist__string_format = '第{index}名:\n{nickname},{chatdatanum}条消息、n' #消息格式
53
+ dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
54
54
  dialectlist__get_num = 10 #获取人数数量
55
55
  dialectlist__visualization = True #是否可视化
56
- # dialectlist__visualization_type = '圆环图' #可视化方案 (不再支持)
57
- dialectlist__font = 'SimHei' #字体格式
56
+ # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
57
+ dialectlist__font = "SimHei" #字体格式
58
58
  dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
59
59
  dialectlist__excluded_self = True #是否排除机器人自己 QQ
60
60
  dialectlist__suffix: bool = False # 是否显示后缀
@@ -19,30 +19,22 @@ from arclet.alconna import ArparmaBehavior
19
19
  from arclet.alconna.arparma import Arparma
20
20
 
21
21
  from nonebot.log import logger
22
- from nonebot.params import Arg, Depends
23
22
  from nonebot.typing import T_State
24
23
  from nonebot.compat import model_dump
25
- from nonebot.adapters import Bot, Event, Message
26
24
  from nonebot.params import Arg, Depends
25
+ from nonebot.adapters import Bot, Event
27
26
  from nonebot.permission import SUPERUSER
28
27
  from nonebot.plugin import PluginMetadata, inherit_supported_adapters
29
- from nonebot.typing import T_State
30
28
  from nonebot_plugin_alconna import (
31
- Alconna,
32
- AlconnaMatch,
33
- AlconnaMatcher,
34
- AlconnaQuery,
35
- Option,
36
29
  Args,
37
- Match,
38
30
  Option,
39
- Query,
40
- image_fetch,
31
+ Alconna,
41
32
  on_alconna,
42
33
  )
43
34
 
44
- from nonebot_plugin_chatrecorder import get_message_records
35
+ from nonebot_plugin_apscheduler import scheduler
45
36
  from nonebot_plugin_userinfo import get_user_info
37
+ from nonebot_plugin_chatrecorder import get_message_records
46
38
  from nonebot_plugin_session import Session, SessionIdType, extract_session
47
39
 
48
40
  # from . import migrations #抄词云的部分代码,还不知道这有什么用
@@ -58,10 +50,9 @@ from .model import UserRankInfo
58
50
  from .utils import (
59
51
  got_rank,
60
52
  msg_counter,
61
- persist_id2user_id,
62
- user_id2persist_id,
63
- group_id2persist_id,
64
53
  get_rank_image,
54
+ persist_id2user_id,
55
+ # get_user_info2,
65
56
  )
66
57
 
67
58
  __plugin_meta__ = PluginMetadata(
@@ -202,6 +193,8 @@ async def _group_message(
202
193
  state["stop"] = state["start"] + timedelta(days=1)
203
194
  except ValueError:
204
195
  await rank_cmd.finish("请输入正确的日期,不然我没法理解呢!")
196
+
197
+ logger.debug(f"命令解析花费时间:{t.time() - t1}")
205
198
 
206
199
 
207
200
  @rank_cmd.got(
@@ -223,6 +216,7 @@ async def handle_rank(
223
216
  start: datetime = Arg(),
224
217
  stop: datetime = Arg(),
225
218
  ):
219
+ t1 = t.time()
226
220
  if id := state["group_id"]:
227
221
  id = str(id)
228
222
  logger.debug(f"group_id: {id}")
@@ -233,6 +227,9 @@ async def handle_rank(
233
227
  if not id:
234
228
  await saa.Text("没有指定群哦").finish()
235
229
 
230
+ logger.debug(f"所属群聊解析花费时间:{t.time() - t1}")
231
+ t1 = t.time()
232
+
236
233
  messages = await get_message_records(
237
234
  id2s=[id],
238
235
  id_type=SessionIdType.GROUP,
@@ -243,11 +240,16 @@ async def handle_rank(
243
240
  time_stop=stop,
244
241
  exclude_id1s=plugin_config.excluded_people,
245
242
  )
246
-
243
+
244
+ logger.debug(f"获取群聊消息花费时间:{t.time() - t1}")
245
+ t1 = t.time()
246
+
247
247
  if not messages:
248
248
  await saa.Text("明明这个时间段都没有人说话怎么会有话痨榜呢?").finish()
249
249
 
250
250
  rank = got_rank(msg_counter(messages))
251
+ logger.debug(f"群聊消息计数花费时间:{t.time() - t1}")
252
+ t1 = t.time()
251
253
  logger.debug(rank)
252
254
  rank2: List[UserRankInfo] = []
253
255
  ids = await persist_id2user_id([int(i[0]) for i in rank])
@@ -300,16 +302,27 @@ async def handle_rank(
300
302
  chatdatanum=rank2[i].user_bnum,
301
303
  )
302
304
  string += str_example
303
-
305
+
304
306
  msg = saa.Text(string)
305
-
307
+ logger.debug(f"群聊消息渲染文字花费时间:{t.time() - t1}")
308
+ t1 = t.time()
309
+
306
310
  if plugin_config.visualization:
307
311
  image = await get_rank_image(rank2)
308
312
  msg += saa.Image(image)
309
-
313
+
310
314
  if plugin_config.suffix:
311
315
  timecost = t.time() - state["t1"]
312
316
  suffix = saa.Text(plugin_config.string_suffix.format(timecost=timecost))
313
317
  msg += suffix
314
-
318
+
319
+ logger.debug(f"群聊消息渲染图片花费时间:{t.time() - t1}")
320
+
315
321
  await msg.finish(reply=True)
322
+
323
+
324
+ # @scheduler.scheduled_job(
325
+ # "dialectlist", day="*/2", id="xxx", args=[1], kwargs={"arg2": 2}
326
+ # )
327
+ # async def __():
328
+ # pass
@@ -1,19 +1,20 @@
1
- from typing import Optional, Literal, List
2
- from nonebot import get_driver, get_plugin_config
3
1
  from pydantic import BaseModel
2
+ from typing import Optional, List
3
+ from nonebot import get_driver, get_plugin_config
4
4
 
5
5
 
6
6
  class ScopedConfig(BaseModel):
7
- font: str = "SimHei" # 字体格式
8
7
  get_num: int = 5 # 获取人数数量
9
- timezone: Optional[str] = "Asia/Shanghai"
8
+ font: str = "SimHei" # 字体格式
9
+ suffix: bool = False # 是否显示后缀
10
10
  excluded_self: bool = True
11
- string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
12
- template_path: str = "./template/rank_template.j2" # 模板路径
13
11
  visualization: bool = True # 是否可视化
12
+ counting_cache: bool = True
14
13
  excluded_people: List[str] = [] # 排除的人的QQ号
15
- suffix: bool = False # 是否显示后缀
14
+ timezone: Optional[str] = "Asia/Shanghai"
16
15
  string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
16
+ template_path: str = "./template/rank_template.j2" # 模板路径
17
+ string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
17
18
 
18
19
 
19
20
  class Config(BaseModel):
@@ -0,0 +1,17 @@
1
+ from typing import Union
2
+ from pydantic import BaseModel
3
+ from nonebot_plugin_orm import Model
4
+ from nonebot_plugin_userinfo import UserInfo
5
+
6
+
7
+ class UserRankInfo(UserInfo):
8
+ user_bnum: int
9
+ user_proportion: float
10
+ user_nickname: str
11
+ user_index: Union[int, str]
12
+ user_avatar_bytes: bytes
13
+
14
+ class MsgCountDayData(BaseModel):
15
+ user_id:str
16
+ # class MsgCountData(Model):
17
+ # __tablename__ = 'dialectlist_msg_data'
@@ -1 +1,2 @@
1
1
  # TODO 使用计数缓存进行数据库查询优化,避免一次性查询过多消息导致内存爆炸。
2
+ from nonebot_plugin_orm import Model
@@ -1,5 +1,5 @@
1
1
  body {
2
- background-image: url('https://image.anosu.top/pixiv/direct?size=regular');
2
+ background-image: url('https://api.yimian.xyz/img');
3
3
  background-attachment: scroll;
4
4
  margin: 0;
5
5
  background-size: cover;
@@ -1,16 +1,15 @@
1
1
  # TODO 时间处理模块,用于处理时间相关操作。
2
- from datetime import datetime, time, tzinfo
3
- from typing import Optional, Union
4
2
  from zoneinfo import ZoneInfo
3
+ from typing import Optional, Union
4
+ from datetime import datetime, time, tzinfo
5
5
 
6
- from nonebot.typing import T_State
7
6
  from nonebot.params import Arg
7
+ from nonebot.typing import T_State
8
8
  from nonebot.adapters import Message
9
9
 
10
10
  from nonebot_plugin_apscheduler import scheduler
11
11
  from nonebot_plugin_alconna import AlconnaMatcher
12
12
 
13
-
14
13
  from .config import plugin_config
15
14
 
16
15
 
@@ -1,30 +1,24 @@
1
1
  import os
2
2
  import unicodedata
3
3
 
4
- from typing import Optional, Dict, List, Union
5
- from pathlib import Path
4
+ from typing import Dict, List
6
5
  from sqlalchemy import or_, select
7
6
  from sqlalchemy.sql import ColumnElement
8
7
 
9
8
  from nonebot.log import logger
10
- from nonebot.params import Arg, Depends
11
- from nonebot.typing import T_State
9
+ from nonebot.params import Depends
12
10
  from nonebot.matcher import Matcher
13
- from nonebot.adapters import Message
14
11
 
15
12
  from nonebot_plugin_orm import get_session
16
13
  from nonebot_plugin_session import Session, SessionLevel, extract_session
14
+ from nonebot_plugin_localstore import get_cache_dir
15
+ from nonebot_plugin_htmlrender import template_to_pic
17
16
  from nonebot_plugin_session_orm import SessionModel
18
- from nonebot_plugin_userinfo import EventUserInfo, UserInfo
19
- from nonebot_plugin_htmlrender import html_to_pic, template_to_pic
20
- from nonebot_plugin_apscheduler import scheduler
21
17
  from nonebot_plugin_chatrecorder import MessageRecord
22
- from nonebot_plugin_localstore import get_cache_dir
23
- from nonebot_plugin_alconna import AlconnaMatcher
24
18
 
25
19
 
26
- from .config import plugin_config
27
20
  from .model import UserRankInfo
21
+ from .config import plugin_config
28
22
 
29
23
  cache_path = get_cache_dir("nonebot_plugin_dialectlist")
30
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-dialectlist
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: 看看你群群友有多能说
5
5
  Author-email: Chen_Xu233 <woyerpa@outlook.com>
6
6
  License: MIT
@@ -8,6 +8,7 @@ Requires-Python: <4.0,>=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: nonebot-plugin-chatrecorder>=0.6.0
10
10
  Requires-Dist: requests>=2.32.3
11
+ Requires-Dist: nonebot-plugin-orm[default]
11
12
  Requires-Dist: nonebot-plugin-apscheduler>=0.4.0
12
13
  Requires-Dist: nonebot-plugin-alconna>=0.50.2
13
14
  Requires-Dist: nonebot-plugin-cesaa>=0.4.0
@@ -75,11 +76,11 @@ nonebot-plugin-dialectlist
75
76
 
76
77
  在 .env 中,可以添加以下配置项
77
78
  ```python
78
- dialectlist__string_format = '第{index}名:\n{nickname},{chatdatanum}条消息、n' #消息格式
79
+ dialectlist__string_format = "第{index}名:\n{nickname},{chatdatanum}条消息、\n" #消息格式
79
80
  dialectlist__get_num = 10 #获取人数数量
80
81
  dialectlist__visualization = True #是否可视化
81
- # dialectlist__visualization_type = '圆环图' #可视化方案 (不再支持)
82
- dialectlist__font = 'SimHei' #字体格式
82
+ # dialectlist__visualization_type = "圆环图" #可视化方案 (不再支持)
83
+ dialectlist__font = "SimHei" #字体格式
83
84
  dialectlist__excluded_people = [] #排除的人的 QQ 号(或频道号?(未经测试))
84
85
  dialectlist__excluded_self = True #是否排除机器人自己 QQ
85
86
  dialectlist__suffix: bool = False # 是否显示后缀
@@ -1,5 +1,6 @@
1
1
  nonebot-plugin-chatrecorder>=0.6.0
2
2
  requests>=2.32.3
3
+ nonebot-plugin-orm[default]
3
4
  nonebot-plugin-apscheduler>=0.4.0
4
5
  nonebot-plugin-alconna>=0.50.2
5
6
  nonebot-plugin-cesaa>=0.4.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-dialectlist"
3
- version = "2.2.2"
3
+ version = "2.2.3"
4
4
  description = "看看你群群友有多能说"
5
5
  authors = [
6
6
  {name = "Chen_Xu233", email = "woyerpa@outlook.com"},
@@ -8,6 +8,7 @@ authors = [
8
8
  dependencies = [
9
9
  "nonebot-plugin-chatrecorder>=0.6.0",
10
10
  "requests>=2.32.3",
11
+ "nonebot-plugin-orm[default]",
11
12
  "nonebot-plugin-apscheduler>=0.4.0",
12
13
  "nonebot-plugin-alconna>=0.50.2",
13
14
  "nonebot-plugin-cesaa>=0.4.0",
@@ -1,11 +0,0 @@
1
- from typing import Optional, Literal, List, Union
2
- from pydantic import BaseModel
3
- from nonebot_plugin_userinfo import get_user_info, 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