summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-05-06 00:47:00 +0500
committerilotterytea <iltsu@alright.party>2024-05-06 00:47:00 +0500
commit9069514f8425932ef998fc8a80b514eb81c88025 (patch)
tree36b711f6be7a2a063b6a3059d1582b97c25453b0 /src
parent58df60b6e3ccda724a81dd9f0721b1c6e84686c1 (diff)
fix?: i dont remember what i tried to fix there
Diffstat (limited to 'src')
-rw-r--r--src/commands/request_util.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/commands/request_util.cpp b/src/commands/request_util.cpp
index b51abee..fe1d1d4 100644
--- a/src/commands/request_util.cpp
+++ b/src/commands/request_util.cpp
@@ -174,16 +174,14 @@ namespace bot::command {
}
std::optional<std::string> subcommand_id = parts[0];
- if (subcommand_id->empty()) {
- subcommand_id = std::nullopt;
- }
-
auto subcommand_ids = (*cmd)->get_subcommand_ids();
- if (subcommand_id != std::nullopt &&
- std::any_of(subcommand_ids.begin(), subcommand_ids.end(),
- [&](const auto &x) { return x == subcommand_id; })) {
+ if (std::any_of(
+ subcommand_ids.begin(), subcommand_ids.end(),
+ [&](const auto &x) { return x == subcommand_id.value(); })) {
parts.erase(parts.begin());
+ } else {
+ subcommand_id = std::nullopt;
}
std::optional<std::string> message = utils::string::join_vector(parts, ' ');