mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
modules/console: Add room create cmd.
This commit is contained in:
parent
e6b06a4522
commit
63e662606a
1 changed files with 42 additions and 0 deletions
|
@ -2872,6 +2872,48 @@ console_cmd__room__join(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__room__create(opt &out, const string_view &line)
|
||||
{
|
||||
const params param
|
||||
{
|
||||
line, " ",
|
||||
{
|
||||
"room_id", "[creator]", "[type]", "[parent]"
|
||||
}
|
||||
};
|
||||
|
||||
const m::room::id room_id
|
||||
{
|
||||
param.at(0)
|
||||
};
|
||||
|
||||
const m::user::id creator
|
||||
{
|
||||
param.at(1, m::me.user_id)
|
||||
};
|
||||
|
||||
const string_view type
|
||||
{
|
||||
param[2]
|
||||
};
|
||||
|
||||
const string_view &parent
|
||||
{
|
||||
param[3]
|
||||
};
|
||||
|
||||
const m::room room
|
||||
{
|
||||
parent?
|
||||
m::create(room_id, creator, parent, type):
|
||||
m::create(room_id, creator, type)
|
||||
};
|
||||
|
||||
out << room.room_id << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__room__id(opt &out, const string_view &id)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue