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

MessageSegement.forward 函数的参数与 mirai-api-http 提供的参数不同 #47

Open
HelloGwkki opened this issue Dec 28, 2022 · 2 comments

Comments

@HelloGwkki
Copy link

HelloGwkki commented Dec 28, 2022

环境

nonebot-adapter-mirai2==0.0.19
nonebot2==2.0.0rc2

相关资料

nonebot-adapter-mirai2 的实现:

@classmethod
def forward(cls, node_list: str, senderld: int, time: int, sender_name: str, message_chain: "MessageChain", messageid: int):
"""
:说明:
转发消息
:参数:
* ``node_list: str``: 节点列表
* ``senderld: int``: 发送者的ld
* ``time: int``: 时间戳
* ``sender_name: str``: 发送者的名字
* ``message_chain: MessageChain``: 消息链
* ``messageid: int``: 消息id
"""
return cls(type=MessageType.FORWARD, nodeList=node_list, senderLd=senderld, time=time, senderName=sender_name, messageChain=message_chain, messageId=messageid)

mirai-api-http 文档中的描述:
mirai-api-http | ForwardMessage 消息类型

mah 中的 nodeListobject 类型,而项目中对 node_list 的类型标注为 str

@HelloGwkki
Copy link
Author

下面的代码可以构建一个能够发送的 ForwardMessage

from nonebot.adapters.mirai2.message import MessageSegment, MessageType

MessageSegment(
    type=MessageType.FORWARD,
    nodeList=[
        {
            "senderId": 10001,
            "time": 0,
            "senderName": "bot",
            "messageChain": [
                MessageSegment.plain("TEST")
            ]
        }
    ]
)

@ieew
Copy link
Owner

ieew commented Dec 31, 2022

@HelloGwkki 这个接口我并没有用过,所以没有留意应该是什么样子的。到时候有空我看看

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