Skip to content

Commit

Permalink
Update cluster.h
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis authored Oct 8, 2024
1 parent 2a36704 commit 08b3841
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,8 @@ class DPP_EXPORT cluster {
std::enable_if_t<std::is_same_v<std::invoke_result_t<F, const slashcommand_handler_t&>, dpp::task<void>>, bool>
register_command(const std::string& name, F&& handler){
std::unique_lock lk(named_commands_mutex);
if (named_commands.count(name) != 0) {
return false;
}
named_commands.emplace(name, handler);
return true;
auto [_, inserted] = named_commands.try_emplace(name, handler);
return inserted;
};
#endif

Expand Down

0 comments on commit 08b3841

Please sign in to comment.