Fixed some bugs
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user