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

MessageSegment.reply消息无效 #41

Open
ProblemFactory opened this issue Mar 22, 2023 · 6 comments
Open

MessageSegment.reply消息无效 #41

ProblemFactory opened this issue Mar 22, 2023 · 6 comments

Comments

@ProblemFactory
Copy link

ProblemFactory commented Mar 22, 2023

from nonebot import Bot
from nonebot.params import CommandArg, EventMessage
from nonebot.matcher import Matcher
from nonebot.adapters.onebot.v11 import (
    Message,
    MessageSegment,
    MessageEvent,
    GroupMessageEvent,
    PrivateMessageEvent,
)


async def test(
    bot: Bot,
    event: MessageEvent,
    matcher: Matcher,
    arg: Message = CommandArg(),
    user_data: Optional[UserData] = None,
):
    await matcher.finish(MessageSegment.reply(event.message_id) + MessageSegment.at(event.sender.user_id) + MessageSegment.text('test'))

这样产生的消息没有引用效果,只有at和'test‘文本。

@ProblemFactory
Copy link
Author

懂了,这个和我前面提的message_id类型的issue #40 本质上是一个问题,这里把message_id编码转成str就好了。

@ProblemFactory
Copy link
Author

现在message_id都是int了,那这个咋办?

@realhuhu
Copy link
Owner

没事,发给云崽的时候会统一转回oicq的str

@ProblemFactory
Copy link
Author

那之前为啥有问题的?

@realhuhu
Copy link
Owner

有的api调用途径不一样,遗漏了类型转换

@ProblemFactory
Copy link
Author

我试了下 刚pull的新版本,MessageSegment.reply不行,后台log有

ApiRejection {
�
  code: -60,
  message: 'The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received 6.5_869_781_750_548_59e_+49'
}

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