Check if there are URLs in that message
This commit is contained in:
parent
8f083e127d
commit
e9e16f96d8
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (expandurl-mastodon
|
project (expandurl-mastodon
|
||||||
VERSION 0.1.0
|
VERSION 0.1.1
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ mention the bot account (@expandurl@botsin.space for example).
|
||||||
* C++ compiler (tested: gcc 6.4, clang 5.0)
|
* C++ compiler (tested: gcc 6.4, clang 5.0)
|
||||||
* [cmake](https://cmake.org/) (tested: 3.9.6)
|
* [cmake](https://cmake.org/) (tested: 3.9.6)
|
||||||
* [curlpp](http://www.curlpp.org/) (tested: 0.8.4)
|
* [curlpp](http://www.curlpp.org/) (tested: 0.8.4)
|
||||||
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.12.0)
|
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.12.1)
|
||||||
|
|
||||||
## Get sourcecode
|
## Get sourcecode
|
||||||
|
|
||||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -95,6 +95,10 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
message += url + " \n";
|
message += url + " \n";
|
||||||
}
|
}
|
||||||
|
if (!message.empty())
|
||||||
|
{
|
||||||
|
message = '@' + notif.status().account().acct() +
|
||||||
|
' ' + message;
|
||||||
if (listener.send_reply(notif.status(), message))
|
if (listener.send_reply(notif.status(), message))
|
||||||
{
|
{
|
||||||
cout << "Sent reply: " << message;
|
cout << "Sent reply: " << message;
|
||||||
|
@ -105,6 +109,12 @@ int main(int argc, char *argv[])
|
||||||
notif.status().id() << '\n';
|
notif.status().id() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listener.send_reply(notif.status(),
|
||||||
|
"I couldn't find an URL in the message you replied to. 😞");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listener.stop();
|
listener.stop();
|
||||||
|
|
|
@ -131,7 +131,7 @@ const bool Listener::send_reply(const Easy::Status &status,
|
||||||
{
|
{
|
||||||
{ "in_reply_to_id", { id } },
|
{ "in_reply_to_id", { id } },
|
||||||
{ "visibility", { strvisibility } },
|
{ "visibility", { strvisibility } },
|
||||||
{ "status", { '@' + status.account().acct() + ' ' + message } }
|
{ "status", { message } }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (status.sensitive())
|
if (status.sensitive())
|
||||||
|
|
Loading…
Reference in New Issue