mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
modules/m_command: Simplify command string preserved in input property.
This commit is contained in:
parent
b447b9dd42
commit
2dc5c852cf
1 changed files with 10 additions and 5 deletions
|
@ -77,23 +77,28 @@ try
|
||||||
unquote(content.at("room_id"))
|
unquote(content.at("room_id"))
|
||||||
};
|
};
|
||||||
|
|
||||||
const json::string &input
|
const json::string &input_
|
||||||
{
|
{
|
||||||
content.at("body")
|
content.at("body")
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!startswith(input, "\\\\"))
|
if(!startswith(input_, "\\\\"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// View of the command string without prefix
|
// View of the command string without prefix
|
||||||
string_view cmd{input};
|
string_view input{input_};
|
||||||
cmd = lstrip(cmd, "\\\\");
|
input = lstrip(input, "\\\\");
|
||||||
|
|
||||||
// Determine if there's a bang after the prefix; if so the response's
|
// Determine if there's a bang after the prefix; if so the response's
|
||||||
// sender will be the user, and will be broadcast publicly to the room.
|
// sender will be the user, and will be broadcast publicly to the room.
|
||||||
// Otherwise the response comes from the server and is only visible in
|
// Otherwise the response comes from the server and is only visible in
|
||||||
// the user's timeline.
|
// the user's timeline.
|
||||||
const bool public_response(startswith(cmd, '!'));
|
const bool public_response
|
||||||
|
{
|
||||||
|
startswith(input, '!')
|
||||||
|
};
|
||||||
|
|
||||||
|
string_view cmd{input};
|
||||||
cmd = lstrip(cmd, '!');
|
cmd = lstrip(cmd, '!');
|
||||||
|
|
||||||
log::debug
|
log::debug
|
||||||
|
|
Loading…
Reference in a new issue