Closed 2659170494 closed 6 months ago
Windows
3.8.10
2.2.1
0.11.2
Chronocat 0.2.6
使用MessageSegment消息段与其它消息段或文本组合时,特殊字符会消失? 我尝试过nonebot文档给出的其它组合方式,但是除了文本与文本之间的组合,其它的组合都没有识别出转义字符。
这是其中的部分代码: from nonebot import on_startswith from nonebot.adapters.satori import Message, MessageEvent, MessageSegment
menu_get = on_startswith({"菜单"})
@menu_get.handle() async def Mint_menu(bot: Bot,event:MessageEvent): test_message1 = MessageSegment(type="chronocat:face",data={"id":12}) + "\n" + "Hello Yoshi" test_message2 = [MessageSegment(type="chronocat:face",data={"id":12}),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message3 = [MessageSegment.text("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message4 = [MessageSegment("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message5 = ["[CQ:face,id=12]","\n",MessageSegment.text("Hello Yoshi")] print(test_message1) print(test_message2) print(test_message3) print(test_message4) print(test_message5) await menu_get.send(Message(test_message1)) await menu_get.send(Message(test_message2)) await menu_get.send(Message(test_message3)) await menu_get.send(Message(test_message4)) await menu_get.send(Message(test_message5)) await menu_get.finish()
转义的字符能够正常显示
print(test_message1)的情况: print(Message(test_message1))的情况:
No response
确认项
操作系统
Windows
Python 版本
3.8.10
NoneBot 版本
2.2.1
适配器
0.11.2
协议端
Chronocat 0.2.6
描述问题
使用MessageSegment消息段与其它消息段或文本组合时,特殊字符会消失? 我尝试过nonebot文档给出的其它组合方式,但是除了文本与文本之间的组合,其它的组合都没有识别出转义字符。
复现步骤
这是其中的部分代码: from nonebot import on_startswith from nonebot.adapters.satori import Message, MessageEvent, MessageSegment
menu_get = on_startswith({"菜单"})
@menu_get.handle() async def Mint_menu(bot: Bot,event:MessageEvent): test_message1 = MessageSegment(type="chronocat:face",data={"id":12}) + "\n" + "Hello Yoshi" test_message2 = [MessageSegment(type="chronocat:face",data={"id":12}),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message3 = [MessageSegment.text("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message4 = [MessageSegment("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")] test_message5 = ["[CQ:face,id=12]","\n",MessageSegment.text("Hello Yoshi")] print(test_message1) print(test_message2) print(test_message3) print(test_message4) print(test_message5) await menu_get.send(Message(test_message1)) await menu_get.send(Message(test_message2)) await menu_get.send(Message(test_message3)) await menu_get.send(Message(test_message4)) await menu_get.send(Message(test_message5)) await menu_get.finish()
期望的结果
转义的字符能够正常显示
截图或日志
print(test_message1)的情况: print(Message(test_message1))的情况:
Nonebot 配置项
No response