nonebot / nonebot/adapter-onebot
Bug: `\`参数输出转义
Open
Nobody has claimed this yet.
question
- Dominant language
- Python
- Stars
- 120
- Forks
- 37
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 1
Description
操作系统
Windows/Linux/MacOS均出现
Python 版本
3.10.12
NoneBot 版本
2.1.0
适配器
Onebot v11
协议端
go-cqhttp
描述问题
日志输出错误:
09-18 22:28:54 [INFO] nonebot | Event will be handled by Matcher(type='message', module=dicergirl, lineno=80)
09-18 22:28:54 [INFO] nonebot | Matcher(type='message', module=dicergirl, lineno=80) running complete
Task exception was never retrieved
future: <Task finished name='Task-8213' coro=<Bot.handle_event() done, defined at /root/oracle-dicer/.venv/lib/python3.10/site-packages/nonebot/adapters/onebot/v11/bot.py:186> exception=ValueError('Closing tag "</le>" has no corresponding opening tag')>
Traceback (most recent call last):
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/nonebot/adapters/onebot/v11/bot.py", line 194, in handle_event
await handle_event(self, event)
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/nonebot/message.py", line 497, in handle_event
logger.opt(colors=True).success(log_msg)
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/loguru/_logger.py", line 2018, in success
__self._log("SUCCESS", False, __self._options, __message, args, kwargs)
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/loguru/_logger.py", line 1987, in _log
colored_message = Colorizer.prepare_simple_message(str(message))
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/loguru/_colorizer.py", line 368, in prepare_simple_message
parser.feed(string)
File "/root/oracle-dicer/.venv/lib/python3.10/site-packages/loguru/_colorizer.py", line 244, in feed
raise ValueError('Closing tag "%s" has no corresponding opening tag' % markup)
ValueError: Closing tag "</le>" has no corresponding opening tag
复现步骤
监听一个消息事件,例如on_startswith("xxx"),然后发送消息:\+图片(一个反斜杠+图片)
怀疑是\转义了CQ码的[而导致输出错误。
期望的结果
No response
截图或日志
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue through nonebot/message.py:497, where handle_event calls logger.opt(colors=True).success(log_msg), using a message beginning with a backslash and an image. Check the related call from nonebot/adapters/onebot/v11/bot.py:194. Done means this event is logged without the Loguru markup ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100