lgc-NB2Dev / nonebot-plugin-picmcstat

A NoneBot2 plugin generates a pic from a Minecraft server's MOTD
MIT License
16 stars 3 forks source link

上游库更新后插件出现问题 #15

Closed lgc2333 closed 8 months ago

lgc2333 commented 9 months ago

我也有类似的报错

ERROR nonebot_plugin_picmcstat >> 获取服务器状态/画服务器状态图出错
Traceback (most recent call last):

  File "/bot/atri/main.py", line 9, in <module>
    ATRI.run()
    │    └ <function run at 0x7f9e5a2385e0>
    └ <module 'ATRI' from '/bot/atri/ATRI/__init__.py'>

  File "/bot/atri/ATRI/__init__.py", line 36, in run
    nonebot.run(log_level=log_level)
    │       │             └ 'warning'
    │       └ <function run at 0x7f9e5af8f760>
    └ <module 'nonebot' from '/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/__init__....

  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
    │                 │       └ {'log_level': 'warning'}
    │                 └ ()
    └ <function get_driver at 0x7f9e5af8f5b0>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 201, in run
    uvicorn.run(
    │       └ <function run at 0x7f9e5a184670>
    └ <module 'uvicorn' from '/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/uvicorn/__init__....
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 578, in run
    server.run()
    │      └ <function Server.run at 0x7f9e5a184820>
    └ <uvicorn.server.Server object at 0x7f9e35181ff0>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7f9e5a1848b0>
           │       │   └ <uvicorn.server.Server object at 0x7f9e35181ff0>
           │       └ <function run at 0x7f9e5c118550>
           └ <module 'asyncio' from '/usr/lib/python3.10/asyncio/__init__.py'>
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7f9e382e9ee0>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
    await _run_matcher(
          └ <function _run_matcher at 0x7f9e5aeaf010>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
          │       │   │    │      │      │      └ {<function _command at 0x7f9e5adb7d00>: <Task finished name='Task-1743' coro=<_command() done, defined at /root/.cache/pypoet...
          │       │   │    │      │      └ <contextlib.AsyncExitStack object at 0x7f9dea3ecc40>
          │       │   │    │      └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None, 'command_whitespace': None}, '...
          │       │   │    └ GroupMessageEvent(time=1701623220, self_id=3218305779, post_type='message', sub_type='normal', user_id=1445352985, message_ty...
          │       │   └ Bot(type='OneBot V11', self_id='3218305779')
          │       └ <function Matcher.run at 0x7f9e5adb7a30>
          └ Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=59)
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 846, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
          │    │          │    │      │      │      └ {<function _command at 0x7f9e5adb7d00>: <Task finished name='Task-1743' coro=<_command() done, defined at /root/.cache/pypoet...
          │    │          │    │      │      └ <contextlib.AsyncExitStack object at 0x7f9dea3ecc40>
          │    │          │    │      └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None, 'command_whitespace': None}, '...
          │    │          │    └ GroupMessageEvent(time=1701623220, self_id=3218305779, post_type='message', sub_type='normal', user_id=1445352985, message_ty...
          │    │          └ Bot(type='OneBot V11', self_id='3218305779')
          │    └ <function simple_run at 0x7f9e4af3b130>
          └ Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=59)

  File "/bot/atri/ATRI/patch.py", line 41, in simple_run
    await handler(
          └ Dependent(call=shortcut_handler)

  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
                 │    │             │         │    │    │       └ {'matcher': Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=59)}
                 │    │             │         │    │    └ <function get_shortcut_handler.<locals>.shortcut_handler at 0x7f9e143cd1b0>
                 │    │             │         │    └ Dependent(call=shortcut_handler)
                 │    │             │         └ ~R
                 │    │             └ typing.Awaitable
                 │    └ typing.Callable
                 └ <function cast at 0x7f9e5c1a0280>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot_plugin_picmcstat/__main__.py", line 48, in shortcut_handler
    img = await draw(host, svr_type)
          │    │          │    │      └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None, 'command_whitespace': None}, '...
          │    │          │    └ GroupMessageEvent(time=1701623220, self_id=3218305779, post_type='message', sub_type='normal', user_id=1445352985, message_ty...
          │    │          └ Bot(type='OneBot V11', self_id='3218305779')
       │    └ <function simple_run at 0x7f9e4af3b130>
     └ Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=59)

  File "/bot/atri/ATRI/patch.py", line 41, in simple_run
    await handler(
          └ Dependent(call=shortcut_handler)

  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
                 │    │             │         │    │    │       └ {'matcher': Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=59)}
          │    │             │         │    │    └ <function get_shortcut_handler.<locals>.shortcut_handler at 0x7f9e143cd1b0>
    │    │             │         │    └ Dependent(call=shortcut_handler)
│    │             │         └ ~R
│    │             └ typing.Awaitable
│    └ typing.Callable
  <function cast at 0x7f9e5c1a0280>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot_plugin_picmcstat/__main__.py", line 48, in shortcut_handler
    img = await draw(host, svr_type)
                │    │     └ 'be'
             │    └ 'qymc.sytes.net:19132'
           └ <function draw at 0x7f9e14337d00>
> File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot_plugin_picmcstat/draw.py", line 329, in draw
    return draw_bedrock(status, original_ip)
           │            │       └ 'qymc.sytes.net:19132'
        │            └ BedrockStatusResponse(players=BedrockStatusPlayers(online=0, max=202312), version=BedrockStatusVersion(name='1.20.41', protoc...
      └ <function draw_bedrock at 0x7f9e14337be0>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot_plugin_picmcstat/draw.py", line 276, in draw_bedrock
    motd = strip_lines(res.motd)
           │           │   └ Motd(parsed=['齐悦幻想'], raw='齐悦幻想', bedrock=True)
        │           └ BedrockStatusResponse(players=BedrockStatusPlayers(online=0, max=202312), version=BedrockStatusVersion(name='1.20.41', protoc...
      └ <function strip_lines at 0x7f9e14337400>
  File "/root/.cache/pypoetry/virtualenvs/atri-TKW06R_y-py3.10/lib/python3.10/site-packages/nonebot_plugin_picmcstat/util.py", line 44, in strip_lines
    txt = "\n".join([x.strip() for x in txt.splitlines()])
                                        └ Motd(parsed=['齐悦幻想'], raw='齐悦幻想', bedrock=True)

AttributeError: 'Motd' object has no attribute 'splitlines'

Originally posted by @qingtian-crazy in https://github.com/lgc-NB2Dev/nonebot-plugin-picmcstat/issues/9#issuecomment-1837541203

qingtian-crazy commented 9 months ago

呜呜呜┭┮﹏┭┮,能修复吗这个Bug

qingtian-crazy commented 9 months ago

12.10不知道为什么突然能正常渲染了

lgc2333 commented 8 months ago

已修复