Some minor changes and fixes
This commit is contained in:
@@ -148,17 +148,22 @@ command_result ConnectedClient::handleCommandChannelGroupAdd(Command &cmd) {
|
||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_serverinstance_modify_templates, 1);
|
||||
log_group_type = log::GroupType::TEMPLATE;
|
||||
} else {
|
||||
if (!this->server)
|
||||
if (!this->server) {
|
||||
return command_result{error::parameter_invalid, "you cant create normal groups on the template server!"};
|
||||
}
|
||||
|
||||
log_group_type = log::GroupType::NORMAL;
|
||||
}
|
||||
|
||||
if (cmd["name"].string().empty())
|
||||
if (cmd["name"].string().empty()) {
|
||||
return command_result{error::parameter_invalid, "invalid group name"};
|
||||
}
|
||||
|
||||
for (const auto &gr : group_manager->availableServerGroups(true))
|
||||
if (gr->name() == cmd["name"].string() && gr->target() == GroupTarget::GROUPTARGET_CHANNEL)
|
||||
for (const auto &gr : group_manager->availableServerGroups(true)) {
|
||||
if (gr->name() == cmd["name"].string() && gr->target() == GroupTarget::GROUPTARGET_CHANNEL) {
|
||||
return command_result{error::parameter_invalid, "Group already exists"};
|
||||
}
|
||||
}
|
||||
|
||||
auto group = group_manager->createGroup(GroupTarget::GROUPTARGET_CHANNEL, cmd["type"].as<GroupType>(), cmd["name"].string());
|
||||
serverInstance->action_logger()->group_logger.log_group_create(this->getServerId(), this->ref(), log::GroupTarget::CHANNEL, log_group_type, group->groupId(), group->name(), 0, "");
|
||||
@@ -186,8 +191,9 @@ command_result ConnectedClient::handleCommandChannelGroupAdd(Command &cmd) {
|
||||
});
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
return command_result{error::group_invalid_id};
|
||||
}
|
||||
return command_result{error::ok};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user