diff --git a/modules/m_command.cc b/modules/m_command.cc index 820b44be2..2c1395089 100644 --- a/modules/m_command.cc +++ b/modules/m_command.cc @@ -196,6 +196,12 @@ catch(const std::exception &e) }; } +static command_result +command__caption(const mutable_buffer &buf, + const m::user &user, + const m::room &room, + const string_view &cmd); + static command_result command__ping(const mutable_buffer &buf, const m::user &user, @@ -241,6 +247,9 @@ try case "ping"_: return command__ping(buf, user, room, cmd); + case "caption"_: + return command__caption(buf, user, room, cmd); + default: break; } @@ -814,3 +823,43 @@ command__dash(const mutable_buffer &buf, return { view(out, buf), alt }; } + +command_result +command__caption(const mutable_buffer &buf, + const m::user &user, + const m::room &room, + const string_view &cmd) +{ + const params param{tokens_after(cmd, ' ', 0), " ", + { + "url", + }}; + + const string_view caption + { + tokens_after(cmd, ' ', 1) + }; + + std::ostringstream out; + pubsetbuf(out, buf); + out + << "" + << "