cyanray / mirai-cpp

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

无法上传文件 #156

Closed senjiou closed 1 year ago

senjiou commented 1 year ago

报错信息: [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal

cyanray commented 1 year ago

你的代码贴一下,光靠错误信息看不出什么。

senjiou commented 1 year ago

抱歉 直接在 main() 中 `

while (true)
{
    try
    {
        cout << "尝试与 mirai-api-http 建立连接..." << endl;
        bot.Connect(opts);
        break;
    }
    catch (const std::exception &ex)
    {
        cout << ex.what() << endl;
    }
    MiraiBot::SleepSeconds(1);
}
cout << "Bot Working..." << endl;
try
{
    bot.UploadFileAndSend(群号_gid, "E:/code/mirai-cpp-template/src/main.cpp");
}
catch (const std::exception &ex)
{
    cout << ex.what() << endl;
}}

`

Numendacil commented 1 year ago

群文件上传路径错误 MiraiBot.cpp,正确的路径为 [POST] /file/upload Http Adapter