Пример #1
0
 /// <summary>Plays the passed <see cref="PlayResource"/></summary>
 /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
 /// <param name="play">The associated resource type string to a factory.</param>
 /// <param name="meta">Allows overriding certain settings for the resource.</param>
 /// <returns>Ok if successful, or an error message otherwise.</returns>
 public Task Play(InvokerData invoker, PlayResource play)
 {
     playlistManager.Clear();
     playlistManager.Queue(PlaylistItem.From(play));
     playlistManager.Index = 0;
     stats.TrackSongLoad(play.AudioResource.AudioType, true, true);
     return(StartResource(invoker, play));
 }
Пример #2
0
        public async Task Enqueue(InvokerData invoker, string message, string?audioType = null, PlayInfo?meta = null)
        {
            PlayResource playResource;

            try { playResource = await resourceResolver.Load(message, audioType); }
            catch
            {
                stats.TrackSongLoad(audioType, false, true);
                throw;
            }
            await Enqueue(invoker, PlaylistItem.From(playResource).MergeMeta(meta));
        }