Adding by default a music bot to each newly created server

This commit is contained in:
WolverinDEV
2020-02-15 15:37:19 +01:00
parent 035f23ef23
commit 64b4a7118b
6 changed files with 18 additions and 7 deletions
+6 -3
View File
@@ -308,7 +308,7 @@ size_t VirtualServerManager::usedSlots() {
return res;
}
shared_ptr<VirtualServer> VirtualServerManager::createServer(std::string hosts, uint16_t port) {
shared_ptr<VirtualServer> VirtualServerManager::create_server(std::string hosts, uint16_t port) {
bool sid_success = false;
ServerId serverId = this->next_available_server_id(sid_success);
@@ -321,7 +321,7 @@ shared_ptr<VirtualServer> VirtualServerManager::createServer(std::string hosts,
variable{":target_sid", serverId},
variable{":type", property::PROP_TYPE_SERVER}).execute();
if(!prop_copy.success)
logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr());
logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr());
auto server = make_shared<VirtualServer>(serverId, this->handle->getSql());
server->self = server;
@@ -330,7 +330,10 @@ shared_ptr<VirtualServer> VirtualServerManager::createServer(std::string hosts,
}
server->properties()[property::VIRTUALSERVER_HOST] = hosts;
server->properties()[property::VIRTUALSERVER_PORT] = port;
auto bot = server->musicManager->createBot(0);
if(!bot) {
logCritical(server->getServerId(), "Failed to create default music bot!");
}
{
threads::MutexLock l(this->instanceLock);
this->instances.push_back(server);