Fixed some bugs

This commit is contained in:
WolverinDEV
2020-03-01 10:28:29 +01:00
parent 0d456eea5d
commit e81e21f00e
7 changed files with 201 additions and 157 deletions
+23 -3
View File
@@ -956,8 +956,29 @@ command_result ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
if(!bulked)
notify = Command(this->notify_response_command("notifymusicqueueentry"));
//TODO!
//apply_song(notify, *it, command_index);
auto song = *it;
notify[command_index]["song_id"] = song->id;
notify[command_index]["song_url"] = song->url;
notify[command_index]["song_invoker"] = song->invoker;
notify[command_index]["song_loaded"] = song->loaded;
auto entry = song->load_future ? song->load_future->getValue({}) : nullptr;
if(entry) {
notify[command_index]["song_loaded"] = true;
if(entry->type != ::music::TYPE_STREAM && entry->type != ::music::TYPE_VIDEO)
continue;
auto info = reinterpret_pointer_cast<::music::UrlSongInfo>(entry);
if(info) {
notify[command_index]["song_title"] = info->title;
notify[command_index]["song_description"] = info->description;
if(auto thumbnail = reinterpret_pointer_cast<::music::ThumbnailUrl>(info->thumbnail); thumbnail && thumbnail->type() == ::music::THUMBNAIL_URL)
notify[command_index]["song_thumbnail"] = thumbnail->url();
else
notify[command_index]["song_thumbnail"] = "";
notify[command_index]["song_length"] = info->length.count();
}
}
notify[command_index]["queue_index"] = begin_index++;
if(!bulked)
@@ -966,7 +987,6 @@ command_result ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
command_index++;
}
debugMessage(this->getServerId(),"Send: {}",notify.build());
if(bulked) {
if(command_index > 0) {
this->sendCommand(notify);