Esempio n. 1
0
        public async Task Play(string url)
        {
            if (!IsBound)
            {
                await Join();
            }

            await Context.Channel.SendMessageAsync($"**:musical_note: Searching :mag_right: `{url}`**");

            if (!Enqueue(url, out string err))
            {
                await Context.Channel.SendEmbedAsync($"An error has occured", err);

                return;
            }

            Song song = GetSongs.Last();

            EmbedBuilder embed = new EmbedBuilder
            {
                Color  = Color.Purple,
                Author = new EmbedAuthorBuilder
                {
                    IconUrl = Context.User.GetAvatarUrl(),
                    Name    = "Added to queue"
                },
                ThumbnailUrl = song.Thumbnail,
                Title        = song.Title,
                Url          = song.Url
            };

            embed.AddField("Channel", song.Artist, true);
            embed.AddField("Song Duration", $"{song.Duration / 60}:{song.Duration % 60}", true);
            embed.AddField("Estimated Time Until Playing", $"TBI", true);
            embed.AddField("Position in queue", IsPlaying ? (GetSongs.Count() - 1).ToString() : "Now");

            await Context.Channel.SendMessageAsync("", false, embed.Build());

            if (!IsPlaying)
            {
                await PlayAsync();
            }
        }