使用 Python: /home/su226/代码/test/.venv/bin/python
08-06 13:01:01 [SUCCESS] nonebot | NoneBot is initializing...
08-06 13:01:01 [INFO] nonebot | Current Env: dev
08-06 13:01:01 [DEBUG] nonebot | Loaded Config: {'driver': '~aiohttp', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'environment': 'dev', 'telegram_bots': [{'token': 'xxxxxx', 'api_server': 'http://127.0.0.1:19343/'}]}
08-06 13:01:01 [DEBUG] nonebot | Succeeded to load adapter "Telegram"
08-06 13:01:01 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna:uniseg" from "nonebot_plugin_alconna.uniseg"
08-06 13:01:01 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_waiter"
08-06 13:01:01 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna"
08-06 13:01:01 [SUCCESS] nonebot | Succeeded to load plugin "test" from "test.plugins.test"
08-06 13:01:01 [SUCCESS] nonebot | Running NoneBot...
08-06 13:01:01 [SUCCESS] nonebot | Loaded adapters: Telegram
08-06 13:01:01 [INFO] nonebot | Application startup completed.
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API getMe
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API {}
08-06 13:01:01 [INFO] nonebot | Telegram | Delete old webhook
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API deleteWebhook
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API {}
08-06 13:01:01 [INFO] nonebot | Telegram | Start poll
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API getUpdates
08-06 13:01:01 [DEBUG] nonebot | Telegram | Calling API {'timeout': '30'}
08-06 13:01:03 [DEBUG] nonebot | Telegram | Calling API getUpdates
08-06 13:01:03 [DEBUG] nonebot | Telegram | Calling API {'offset': '515466275', 'timeout': '30'}
08-06 13:01:03 [DEBUG] nonebot | Telegram | Calling API getUpdates
08-06 13:01:03 [DEBUG] nonebot | Telegram | Calling API {'offset': '515466276', 'timeout': '30'}
08-06 13:01:03 [DEBUG] nonebot | Telegram | {'message_id': 392, 'date': 1754456463, 'chat': {'id': 5699987045, 'type': 'private', 'username': 'thesu226', 'first_name': 'su226'}, 'message': [{'type': 'bot_command', 'data': {'text': '/test'}}, {'type': 'text', 'data': {'text': ''}}], 'original_message': [{'type': 'bot_command', 'data': {'text': '/test'}}, {'type': 'text', 'data': {'text': ''}}], 'from_': {'id': 5699987045, 'is_bot': False, 'first_name': 'su226', 'username': 'thesu226', 'language_code': 'zh-hans'}}
08-06 13:01:03 [SUCCESS] nonebot | Telegram 6612117548 | [message.private]: Message 392 from 5699987045: /test
08-06 13:01:03 [DEBUG] nonebot | Checking for matchers in priority 1...
08-06 13:01:03 [INFO] nonebot | Event will be handled by Matcher(type='message', module=test.plugins.test, lineno=6)
08-06 13:01:03 [DEBUG] nonebot | Running Matcher(type='message', module=test.plugins.test, lineno=6)
08-06 13:01:03 [DEBUG] nonebot | Running handler Dependent(call=_)
08-06 13:01:03 [INFO] nonebot | Matcher(type='message', module=test.plugins.test, lineno=6) running complete
08-06 13:01:03 [ERROR] nonebot | Running Matcher(type='message', module=test.plugins.test, lineno=6) failed.
Traceback (most recent call last):
File "<string>", line 15, in <module>
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/__init__.py", line 337, in run
get_driver().run(*args, **kwargs)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/drivers/none.py", line 61, in run
anyio.run(self._serve)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 74, in run
return async_backend.run(func, args, {}, backend_options)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 2316, in run
return runner.run(wrapper())
File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "/usr/lib/python3.13/asyncio/base_events.py", line 712, in run_until_complete
self.run_forever()
File "/usr/lib/python3.13/asyncio/base_events.py", line 683, in run_forever
self._run_once()
File "/usr/lib/python3.13/asyncio/base_events.py", line 2042, in _run_once
handle._run()
File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/utils.py", line 254, in run_coro_with_shield
return await coro
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/message.py", line 506, in check_and_run_matcher
await _run_matcher(
> File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/message.py", line 458, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/internal/matcher/matcher.py", line 926, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/internal/matcher/matcher.py", line 863, in simple_run
await handler(
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/home/su226/代码/test/test/plugins/test.py", line 11, in _
await UniMessage([Text("a"), Text.br(), Text("b")]).send()
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot_plugin_alconna/uniseg/message.py", line 1406, in send
res = await fn.send_to(target, bot, msg, **kwargs)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot_plugin_alconna/uniseg/adapters/telegram/exporter.py", line 176, in send_to
return await bot.send(event=target, message=message, reply_markup=reply_markup, **kwargs)
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/adapters/telegram/bot.py", line 296, in send
return await self.send_to(
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/adapters/telegram/bot.py", line 219, in send_to
entities=Entity.build_telegram_entities(entities),
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/nonebot/adapters/telegram/message.py", line 334, in build_telegram_entities
MessageEntity(
File "/home/su226/代码/test/.venv/lib/python3.13/site-packages/pydantic/main.py", line 253, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for MessageEntity
type
Input should be 'mention', 'hashtag', 'cashtag', 'bot_command', 'url', 'email', 'phone_number', 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', 'expandable_blockquote', 'blockquote', 'code', 'pre', 'text_link', 'text_mention' or 'custom_emoji' [type=literal_error, input_value='', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/literal_error
08-06 13:01:03 [DEBUG] nonebot | Checking for matchers completed
^C08-06 13:01:05 [INFO] nonebot | Shutting down
08-06 13:01:05 [INFO] nonebot | Waiting for application shutdown. (CTRL+C to force quit)
请确认:
Bug
问题
发送带有 Text.br 的消息时报错
如何复现
预期行为
正常发送消息
使用环境:
日志/截图