Updated beta1

This commit is contained in:
WolverinDEV
2020-02-01 22:40:23 +01:00
parent 73ed3a23c6
commit a42c0869bf
3 changed files with 19 additions and 18 deletions
+3 -4
View File
@@ -262,13 +262,12 @@ command_result ConnectedClient::handleCommandGetConnectionInfo(Command &cmd) {
ConnectedLockedClient client{this->server->find_client_by_id(cmd["clid"].as<ClientId>())};
if (!client) return command_result{error::client_invalid_id};
bool send_temp;
bool send_temp{false};
auto info = client->request_connection_info(_this.lock(), send_temp);
if (info) {
if (info || send_temp) {
this->notifyConnectionInfo(client.client, info);
} else if(send_temp) {
} else
return command_result{error::no_cached_connection_info};
}
return command_result{error::ok};
}
+13 -11
View File
@@ -236,14 +236,15 @@ command_result ConnectedClient::handleCommandMusicBotPlayerInfo(Command& cmd) {
result["bot_id"] = bot->getClientDatabaseId();
result["player_state"] =(int) bot->player_state();
if(bot->current_player()) {
result["player_buffered_index"] = bot->current_player()->bufferedUntil().count();
result["player_replay_index"] = bot->current_player()->currentIndex().count();
result["player_max_index"] = bot->current_player()->length().count();
result["player_seekable"] = bot->current_player()->seek_supported();
auto player = bot->current_player();
if(player) {
result["player_buffered_index"] = player->bufferedUntil().count();
result["player_replay_index"] = player->currentIndex().count();
result["player_max_index"] = player->length().count();
result["player_seekable"] = player->seek_supported();
result["player_title"] = bot->current_player()->songTitle();
result["player_description"] = bot->current_player()->songDescription();
result["player_title"] = player->songTitle();
result["player_description"] = player->songDescription();
} else {
result["player_buffered_index"] = 0;
result["player_replay_index"] = 0;
@@ -270,6 +271,7 @@ command_result ConnectedClient::handleCommandMusicBotPlayerAction(Command& cmd)
if(!bot) return command_result{error::music_invalid_id};
ACTION_REQUIRES_PERMISSION(permission::i_client_music_play_power, bot->calculate_permission(permission::i_client_music_needed_play_power, bot->getChannelId()), this->getChannelId());
auto player = bot->current_player();
if(cmd["action"] == 0) {
bot->stopMusic();
} else if(cmd["action"] == 1) {
@@ -281,11 +283,11 @@ command_result ConnectedClient::handleCommandMusicBotPlayerAction(Command& cmd)
} else if(cmd["action"] == 4) {
bot->rewindSong();
} else if(cmd["action"] == 5) {
if(!bot->current_player()) return command_result{error::music_no_player};
bot->current_player()->forward(::music::PlayerUnits(cmd["units"].as<int64_t>()));
if(!player) return command_result{error::music_no_player};
player->forward(::music::PlayerUnits(cmd["units"].as<int64_t>()));
} else if(cmd["action"] == 6) {
if(!bot->current_player()) return command_result{error::music_no_player};
bot->current_player()->rewind(::music::PlayerUnits(cmd["units"].as<int64_t>()));
if(!player) return command_result{error::music_no_player};
player->rewind(::music::PlayerUnits(cmd["units"].as<int64_t>()));
} else return command_result{error::music_invalid_action};
return command_result{error::ok};