diff options
| -rw-r--r-- | bot/src/commands/command.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bot/src/commands/command.cpp b/bot/src/commands/command.cpp index 4544810..6d3010e 100644 --- a/bot/src/commands/command.cpp +++ b/bot/src/commands/command.cpp @@ -84,6 +84,13 @@ namespace bot { } void CommandLoader::add_command(std::unique_ptr<Command> command) { + auto it = std::find_if(this->commands.begin(), this->commands.end(), + [&command](const auto &x) { + return command->get_name() == x->get_name(); + }); + if (it != this->commands.end()) { + this->commands.erase(it); + } this->commands.push_back(std::move(command)); } |
