0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

modules/console: Add room send (non-state) cmd.

This commit is contained in:
Jason Volk 2018-04-28 00:18:30 -07:00
parent d3b1b0ff77
commit ec80e3ddef

View file

@ -2847,6 +2847,51 @@ console_cmd__room__set(opt &out, const string_view &line)
return true;
}
bool
console_cmd__room__send(opt &out, const string_view &line)
{
const params param
{
line, " ",
{
"room_id", "sender", "type", "content"
}
};
const auto &room_id
{
m::room_id(param.at(0))
};
const m::user::id &sender
{
param.at(1)
};
const string_view type
{
param.at(2)
};
const json::object &content
{
param.at(3, json::object{})
};
const m::room room
{
room_id
};
const auto event_id
{
send(room, sender, type, content)
};
out << event_id << std::endl;
return true;
}
bool
console_cmd__room__message(opt &out, const string_view &line)
{