LiteyukiStudio / LiteyukiBot

一个综合,All in One,轻量的机器人应用程式
https://bot.liteyuki.icu/
Other
144 stars 22 forks source link

哦~我亲爱的liteyuki_statistics,它无法正常的统计! #72

Closed ElapsingDreams closed 3 months ago

ElapsingDreams commented 3 months ago

问题反馈

请确保

描述问题

commit: [0c942d98065655f6d3242f1cda7ab02ec9ff6348]

如何复现

git clone Setup venv run 发送 'stat m -d 30d -p 1d'

预期

发送统计图

实际

无结果返回

日志或截图

2024-09-01 02:09:26 [✅成功] <nonebot.message.handle_event:506> OneBot V11 **| [message.private.friend]: Message **-from **'stat m -d 30d -p 1d'
2024-09-01 02:09:26 [🐛调试] <nonebot.message._apply_event_preprocessors:151> Running PreProcessors...
2024-09-01 02:09:26 [🐛调试] <nonebot.message.handle_event:537> Checking for matchers in priority 1...
2024-09-01 02:09:26 [ℹ️信息] <nonebot.message._run_matcher:406> Event will be handled by Matcher(type='message', module=src.nonebot_plugins.to_liteyuki, lineno=31)
2024-09-01 02:09:27 [🐛调试] <src.data.where_all:87> Selecting global_plugin WHERE module_name = to_liteyuki
2024-09-01 02:09:27 [🐛调试] <src.data.where_all:87> Selecting user WHERE user_id = **
2024-09-01 02:09:27 [🐛调试] <nonebot.utils.log:310> Plugin-Alconna | Alconna::statistic 对 "stat m -d 30d -p 1d" 的解析结果是 (matched=True, header_match=(origin='stat' result='statistic' matched=True groups={}), subcommands={'message': (value=Ellipsis args={} options={'duration': (value=None args={'duration': '30d'}), 'period': (value=None args={'period': '1d'})} subcommands={})}, other_args={'duration': '30d', 'period': '1d'})
2024-09-01 02:09:27 [🐛调试] <nonebot.message._run_matcher:427> Running Matcher(type='message', module=src.nonebot_plugins.to_liteyuki, lineno=31)
2024-09-01 02:09:27 [🐛调试] <nonebot.matcher.simple_run:823> Running handler Dependent(call=_)
2024-09-01 02:09:27 [ℹ️信息] <nonebot.message._run_matcher:406> Event will be handled by AlconnaMatcher(type='', module=src.nonebot_plugins.liteyuki_statistics.stat_matchers, lineno=21)
2024-09-01 02:09:27 [ℹ️信息] <nonebot.matcher.simple_run:838> Matcher(type='message', module=src.nonebot_plugins.to_liteyuki, lineno=31) running complete
2024-09-01 02:09:27 [🐛调试] <src.data.where_all:87> Selecting global_plugin WHERE module_name = liteyuki_statistics
2024-09-01 02:09:27 [🐛调试] <nonebot.message._run_matcher:427> Running AlconnaMatcher(type='', module=src.nonebot_plugins.liteyuki_statistics.stat_matchers, lineno=21)
2024-09-01 02:09:27 [🐛调试] <nonebot.matcher.simple_run:823> Running handler Dependent(call=_, parameterless=(Depends(Dependent(call=_arparma_check), use_cache=False),))
2024-09-01 02:09:27 [🐛调试] <src.data.where_all:87> Selecting message_event WHERE time > 1722535767 AND group_id = all
2024-09-01 02:09:27 [ℹ️信息] <nonebot.matcher.simple_run:838> AlconnaMatcher(type='', module=src.nonebot_plugins.liteyuki_statistics.stat_matchers, lineno=21) running complete
2024-09-01 02:09:27 [⭕错误] <nonebot.message._run_matcher:430> Running AlconnaMatcher(type='', module=src.nonebot_plugins.liteyuki_statistics.stat_matchers, lineno=21) failed.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "e:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\liteyuki\core\manager.py", line 78, in _delivery_channel_wrapper
    func(*args, **kwargs)
  File "e:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\src\liteyuki_plugins\liteyukibot_plugin_nonebot\__init__.py", line 46, in nb_run
    nonebot.run()
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\uvicorn\main.py", line 577, in run
    server.run()
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1906, in _run_once
    handle._run()
  File "C:\Users\$$\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "E:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "e:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\src\nonebot_plugins\liteyuki_statistics\stat_matchers.py", line 115, in _
    img = await get_stat_msg_image(duration=duration, period=period, group_id=group_id, bot_id=bot_id, user_id=user_id, ulang=ulang)
  File "e:\Work2024\LiteyukiDEV\Lastest\LiteyukiBot\LiteyukiBot\src\nonebot_plugins\liteyuki_statistics\data_source.py", line 78, in get_stat_msg_image
    start_time = max(msg_rows[0].time, start_time)
IndexError: list index out of range
2024-09-01 02:09:27 [🐛调试] <nonebot.message.handle_event:551> Stop event propagation
2024-09-01 02:09:27 [🐛调试] <nonebot.message.handle_event:558> Checking for matchers completed
2024-09-01 02:09:27 [🐛调试] <nonebot.message._apply_event_postprocessors:206> Running PostProcessors...
2024-09-01 02:09:27 [🐛调试] <src.data.save:115> Upserting TABLE_NAME='message_event' id=None time=1725127767 bot_id='3968764954' adapter='onebot.v11' user_id='**' group_id='' message_id='-1073384993' message=[{'type': 'text', 'data': {'text': 'stat m -d 30d -p 1d'}}] message_text='stat m -d 30d -p 1d' message_type='private'

设备信息

补充内容 将src\nonebot_plugins\liteyuki_statistics\stat_matchers.py第101-104

    if group_id in ["current", "c"] and hasattr(event, "group_id"):
        group_id = str(event_utils.get_group_id(event))
    else:
        group_id = "all"

更改为 commit: [0c942d98065655f6d3242f1cda7ab02ec9ff6348] 之前

    if group_id in ["current", "c"]:
        group_id = str(event_utils.get_group_id(event))

即可解决,但我不清楚提交用意,仅于issue中提出见解

snowykami commented 3 months ago

https://github.com/LiteyukiStudio/LiteyukiBot/pull/71