Fixed bug where playlist would not be loaded fully if atleast one song failed to load
This commit is contained in:
parent
a38078a09c
commit
6e3c5cb6bd
@ -9,4 +9,12 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
}
|
}
|
||||||
public PlaylistFullException() : base("Queue is full.") { }
|
public PlaylistFullException() : base("Queue is full.") { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SongNotFoundException : Exception
|
||||||
|
{
|
||||||
|
public SongNotFoundException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public SongNotFoundException() : base("Song is not found.") { }
|
||||||
|
}
|
||||||
}
|
}
|
@ -282,9 +282,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false);
|
await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (PlaylistFullException)
|
catch (SongNotFoundException) { }
|
||||||
{ break; }
|
catch { break; }
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
await msg.ModifyAsync(m => m.Content = "🎵 `Playlist queue complete.`").ConfigureAwait(false);
|
await msg.ModifyAsync(m => m.Content = "🎵 `Playlist queue complete.`").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -579,6 +578,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
await QueueSong(usr, channel, usr.VoiceChannel, item.Query, true, item.ProviderType).ConfigureAwait(false);
|
await QueueSong(usr, channel, usr.VoiceChannel, item.Query, true, item.ProviderType).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
catch (SongNotFoundException) { }
|
||||||
catch { break; }
|
catch { break; }
|
||||||
}
|
}
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
@ -794,6 +794,9 @@ namespace NadekoBot.Modules.Music
|
|||||||
musicPlayer.ThrowIfQueueFull();
|
musicPlayer.ThrowIfQueueFull();
|
||||||
resolvedSong = await Song.ResolveSong(query, musicType).ConfigureAwait(false);
|
resolvedSong = await Song.ResolveSong(query, musicType).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (resolvedSong == null)
|
||||||
|
throw new SongNotFoundException();
|
||||||
|
|
||||||
musicPlayer.AddSong(resolvedSong, queuer.Username);
|
musicPlayer.AddSong(resolvedSong, queuer.Username);
|
||||||
}
|
}
|
||||||
catch (PlaylistFullException)
|
catch (PlaylistFullException)
|
||||||
|
Loading…
Reference in New Issue
Block a user