diff --git a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs index 795c0f63..730a3d27 100644 --- a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs +++ b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs @@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Games return; } - var i = 0; + //var i = 0; if (submissions.Count == 0) { await channel.SendErrorAsync("Acrophobia", "Game ended with no submissions."); diff --git a/src/NadekoBot/Modules/Music/Classes/Song.cs b/src/NadekoBot/Modules/Music/Classes/Song.cs index 4ed163fa..723c8466 100644 --- a/src/NadekoBot/Modules/Music/Classes/Song.cs +++ b/src/NadekoBot/Modules/Music/Classes/Song.cs @@ -49,6 +49,8 @@ namespace NadekoBot.Modules.Music.Classes public string PrettyName => $"**[{SongInfo.Title.TrimTo(70)}]({SongInfo.Query})**"; public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}"; + + public string PTT => $"{PrettyTotalTime}"; public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*"; @@ -59,7 +61,7 @@ namespace NadekoBot.Modules.Music.Classes if (TotalTime == TimeSpan.Zero) return "(?)"; else if (TotalTime == TimeSpan.MaxValue) - return "**∞**"; + return "∞"; else return TotalTime.ToString(@"mm\:ss"); } diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index afc42496..3a005a71 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -216,14 +216,26 @@ namespace NadekoBot.Modules.Music var currentSong = musicPlayer.CurrentSong; if (currentSong == null) return; + try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { } var videoid = Regex.Match(currentSong.SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+"); var embed = new EmbedBuilder() .WithAuthor(eab => eab.WithName("Now Playing") .WithMusicIcon()) - .WithDescription(currentSong.PrettyName) - .WithFooter(ef => ef.WithText(currentSong.PrettyCurrentTime + "/" + currentSong.PrettyInfo)) + .WithTitle($"{currentSong.SongInfo.Title}") + .WithDescription(currentSong.PrettyCurrentTime + "/" + currentSong.PTT) + .WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}")) .WithOkColor(); + if (currentSong.SongInfo.Provider.Equals("YouTube", StringComparison.OrdinalIgnoreCase)) + { + embed.WithThumbnail(tn => tn.Url = $"https://img.youtube.com/vi/{videoid}/0.jpg"); + embed.WithUrl($"{currentSong.SongInfo.Query}"); + } + else if (currentSong.SongInfo.Provider.Equals("SoundCloud", StringComparison.OrdinalIgnoreCase)) + { + embed.WithThumbnail(tn => tn.Url = $"{currentSong.SongInfo.AlbumArt}"); + embed.WithUrl($"{currentSong.SongInfo.Query}"); + } await channel.EmbedAsync(embed.Build()).ConfigureAwait(false); } @@ -313,6 +325,7 @@ namespace NadekoBot.Modules.Music var msg = await channel.SendMessageAsync($"🎵 Attempting to queue **{count}** songs".SnPl(count) + "...").ConfigureAwait(false); + var cancelSource = new CancellationTokenSource(); var tasks = Task.WhenAll(idArray.Select(async id => @@ -328,6 +341,16 @@ namespace NadekoBot.Modules.Music })); await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token)); + + /*foreach (var id in idArray) + { + try + { + await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false); + } + catch (SongNotFoundException) { } + catch { break; } + }*/ await msg.ModifyAsync(m => m.Content = "✅ Playlist queue complete.").ConfigureAwait(false); } @@ -824,6 +847,7 @@ namespace NadekoBot.Modules.Music { if (finishedMessage != null) finishedMessage.DeleteAfter(0); + finishedMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor() .WithAuthor(eab => eab.WithName("Finished Song").WithMusicIcon()) .WithDescription(song.PrettyName) @@ -839,8 +863,13 @@ namespace NadekoBot.Modules.Music catch { } }; IUserMessage playingMessage = null; + mp.OnStarted += async (player, song) => { + try { await mp.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { } + var sender = player as MusicPlayer; + if (sender == null) + return; try { if (playingMessage != null) @@ -848,8 +877,8 @@ namespace NadekoBot.Modules.Music playingMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor() .WithAuthor(eab => eab.WithName("Playing Song").WithMusicIcon()) - .WithDescription(song.PrettyName) - .WithFooter(ef => ef.WithText(song.PrettyInfo)) + .WithDescription($"{song.PrettyName}") + .WithFooter(ef => ef.WithText($"🔉 {(int)(sender.Volume * 100)}% | {song.PrettyInfo}")) .Build()) .ConfigureAwait(false); } @@ -870,7 +899,7 @@ namespace NadekoBot.Modules.Music pauseMessage = await textCh.SendConfirmAsync("🎵 Music playback **resumed**.").ConfigureAwait(false); } if (pauseMessage != null) - pauseMessage.DeleteAfter(15); + pauseMessage.DeleteAfter(5); } catch { } };