Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

查询服务器时报错:IndexError: string index out of range #22

Closed
Midnight-2004 opened this issue Nov 10, 2024 · 0 comments
Closed

Comments

@Midnight-2004
Copy link

日志如下:

11-10 14:28:53 [SUCCESS] nonebot | OneBot V11 2567438430 | [message.group.normal]: Message 1964757241 from 13******37@[ :42******1] '/motd sakuraaction.top:23197'
11-10 14:28:53 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=35)
11-10 14:28:53 [ERROR] nonebot_plugin_picmcstat | 获取服务器状态/画服务器状态图出错
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "D:\bot\mybot\.venv\Lib\site-packages\uvicorn\main.py", line 579, in run
    server.run()
  File "D:\bot\mybot\.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 641, in run_until_complete
    self.run_forever()
  File "C:\Program Files\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 608, in run_forever
    self._run_once()
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 1936, in _run_once
    handle._run()
  File "C:\Program Files\Python311\Lib\asyncio\events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\__main__.py", line 48, in _
    await finish_with_query(arg, svr_type)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\__main__.py", line 21, in finish_with_query
    ret = await draw(ip, svr_type)
> File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\draw.py", line 414, in draw
    return draw_resp(resp, ip)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\draw.py", line 397, in draw_resp
    return draw_java(resp, addr)
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\draw.py", line 278, in draw_java
    motd = transformer.transform(trim_motd(res.motd.parsed))
  File "D:\bot\mybot\.venv\Lib\site-packages\nonebot_plugin_picmcstat\util.py", line 161, in trim_motd
    if it[-1] in WHITESPACE_EXCLUDE_NEWLINE:
IndexError: string index out of range
11-10 14:28:54 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_picmcstat.__main__, lineno=35) running complete

服务器motd如下:
image

@lgc2333 lgc2333 closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants