cyanray / mirai-cpp

本项目为 mirai-api-http 的 C++ 封装,方便使用 C++ 开发基于 mirai-api-http 插件。
GNU Affero General Public License v3.0
148 stars 38 forks source link

关于MessageChain().Add<VoiceMessage>(); #154

Closed misaka-20002 closed 1 year ago

misaka-20002 commented 1 year ago

MessageChain mc; VoiceMessage vc; string url = "http://music.163.com/song/media/outer/url?id=" + commands[1] + ".mp3"; vc.Url(url); cout << vc.ToJson() << endl; mc.Add<VoiceMessage>(vc); cout << mc.ToJson() << endl;

输出两行 {"base64":null,"length":12685285295766200576,"path":null,"type":"Voice","url":"http://music.163.com/song/media/outer/url?id=478654417.mp3","voiceId":null}

[{"base64":null,"length":12685285295766200576,"path":null,"type":"Voice","url":null,"voiceId":null}] url参数神秘消失了

Numendacil commented 1 year ago

VoiceMessage的copy constructor写错了,我去提个PR

cyanray commented 1 year ago

试试 #155 有没有效果?

misaka-20002 commented 1 year ago

git submodule update似乎没有什么用 我自己手动在本地同步更改了 现在在测试

misaka-20002 commented 1 year ago

似乎还是不行

misaka-20002 commented 1 year ago

image 现在copy constructor是这样 还是无效参数

misaka-20002 commented 1 year ago

result那里也改了

Numendacil commented 1 year ago

image 现在copy constructor是这样 还是无效参数

你最开始给出的那一段示例代码的输出现在是什么呢

Cyan::MessageChain mc;
Cyan::VoiceMessage vc;
std::string url = "www.examples.com"; 
vc.Url(url); 
std::cout << vc.ToJson() << std::endl; 
mc.Add<Cyan::VoiceMessage>(vc); 
std::cout << mc.ToJson() << std::endl;
misaka-20002 commented 1 year ago

可能要明天才能给了() 调试机关了

misaka-20002 commented 1 year ago

好了解决了() 确实是复制构造函数和length_没有赋初始0的问题