Adding by default a music bot to each newly created server
This commit is contained in:
parent
035f23ef23
commit
64b4a7118b
@ -45,6 +45,7 @@ bool config::server::enable_teamspeak_weblist;
|
||||
bool config::server::strict_ut8_mode;
|
||||
bool config::server::show_invisible_clients_as_online;
|
||||
bool config::server::disable_ip_saving;
|
||||
bool config::server::default_music_bot;
|
||||
ssize_t config::server::max_virtual_server;
|
||||
bool config::server::badges::allow_badges;
|
||||
bool config::server::badges::allow_overwolf;
|
||||
@ -1233,7 +1234,12 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
|
||||
{
|
||||
CREATE_BINDING("disable_ip_saving", 0);
|
||||
BIND_BOOL(config::server::disable_ip_saving, false);
|
||||
ADD_DESCRIPTION("Disable the saving of IP addresses within the database");
|
||||
ADD_DESCRIPTION("Disable the saving of IP addresses within the database.");
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("default_music_bot", 0);
|
||||
BIND_BOOL(config::server::default_music_bot, true);
|
||||
ADD_DESCRIPTION("Add by default a new music bot to each created virtual server.");
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("max_virtual_servers", FLAG_RELOADABLE);
|
||||
|
@ -73,6 +73,7 @@ namespace ts::config {
|
||||
extern bool enable_teamspeak_weblist;
|
||||
extern bool show_invisible_clients_as_online;
|
||||
extern bool disable_ip_saving;
|
||||
extern bool default_music_bot;
|
||||
|
||||
namespace badges {
|
||||
extern bool allow_overwolf;
|
||||
|
@ -388,7 +388,8 @@ FwIDAQAB
|
||||
|
||||
if (voiceServerManager->serverInstances().empty()) {
|
||||
logMessage(LOG_INSTANCE, "§aCreating new TeaSpeak server...");
|
||||
auto server = voiceServerManager->createServer(config::binding::DefaultVoiceHost, config::voice::default_voice_port);
|
||||
auto server = voiceServerManager->create_server(config::binding::DefaultVoiceHost,
|
||||
config::voice::default_voice_port);
|
||||
if (!server)
|
||||
logCritical(LOG_INSTANCE, "§cCould not create a new server!");
|
||||
else {
|
||||
|
@ -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);
|
||||
|
@ -32,7 +32,7 @@ namespace ts {
|
||||
|
||||
bool initialize(bool execute_autostart = true);
|
||||
|
||||
std::shared_ptr<VirtualServer> createServer(std::string, uint16_t);
|
||||
std::shared_ptr<VirtualServer> create_server(std::string hosts, uint16_t port);
|
||||
bool deleteServer(std::shared_ptr<VirtualServer>);
|
||||
|
||||
std::shared_ptr<VirtualServer> findServerById(ServerId);
|
||||
|
@ -603,7 +603,7 @@ command_result QueryClient::handleCommandServerCreate(Command& cmd) {
|
||||
uint16_t port = cmd[0].has("virtualserver_port") ? cmd["virtualserver_port"].as<uint16_t>() : freePort;
|
||||
{
|
||||
auto _start = system_clock::now();
|
||||
server = serverInstance->getVoiceServerManager()->createServer(host, port);
|
||||
server = serverInstance->getVoiceServerManager()->create_server(host, port);
|
||||
auto _end = system_clock::now();
|
||||
time_create = duration_cast<milliseconds>(_end - _start);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user