Ported to mastodon-cpp 0.105.0.
This commit is contained in:
parent
dbf5741fbf
commit
adead24ba2
|
@ -28,7 +28,8 @@
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
namespace pt = boost::property_tree;
|
namespace pt = boost::property_tree;
|
||||||
using Mastodon::API;
|
using namespace Mastodon;
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ string get_ingredient(std::vector<string> &vector)
|
||||||
return ingredient;
|
return ingredient;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main()
|
||||||
{
|
{
|
||||||
pt::ptree config;
|
pt::ptree config;
|
||||||
string instance = "";
|
string instance = "";
|
||||||
|
@ -167,27 +168,25 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
toot += ", \nand plenty oil. Salt to taste. \n\nHappy cooking! 🍲 \n\n#bot";
|
toot += ", \nand plenty oil. Salt to taste. \n\nHappy cooking! 🍲 \n\n#bot";
|
||||||
|
|
||||||
|
return_call ret;
|
||||||
string answer;
|
API masto(instance, access_token);
|
||||||
std::uint16_t ret;
|
|
||||||
Mastodon::API masto(instance, access_token);
|
|
||||||
masto.set_useragent("soupbot/" + (string)global::version);
|
masto.set_useragent("soupbot/" + (string)global::version);
|
||||||
|
|
||||||
API::parametermap parameters =
|
parameters params =
|
||||||
{
|
{
|
||||||
{ "status", { toot } },
|
{ "status", { toot } },
|
||||||
{ "visibility", { "public" } }
|
{ "visibility", { "public" } }
|
||||||
};
|
};
|
||||||
ret = masto.post(API::v1::statuses, parameters, answer);
|
ret = masto.post(API::v1::statuses, params);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret)
|
||||||
{
|
{
|
||||||
cout << answer << '\n';
|
cout << ret.answer << '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Error code: " << ret << '\n';
|
std::cerr << "Error code: " << ret.error_code << '\n';
|
||||||
return ret;
|
return ret.error_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue