commit
8b48d1e9be
@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = 0;
|
//var i = 0;
|
||||||
if (submissions.Count == 0)
|
if (submissions.Count == 0)
|
||||||
{
|
{
|
||||||
await channel.SendErrorAsync("Acrophobia", "Game ended with no submissions.");
|
await channel.SendErrorAsync("Acrophobia", "Game ended with no submissions.");
|
||||||
|
@ -50,6 +50,8 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
|
|
||||||
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
|
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
|
||||||
|
|
||||||
|
public string PTT => $"{PrettyTotalTime}";
|
||||||
|
|
||||||
public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
|
public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
|
||||||
|
|
||||||
public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss");
|
public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss");
|
||||||
@ -59,7 +61,7 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
if (TotalTime == TimeSpan.Zero)
|
if (TotalTime == TimeSpan.Zero)
|
||||||
return "(?)";
|
return "(?)";
|
||||||
else if (TotalTime == TimeSpan.MaxValue)
|
else if (TotalTime == TimeSpan.MaxValue)
|
||||||
return "**∞**";
|
return "∞";
|
||||||
else
|
else
|
||||||
return TotalTime.ToString(@"mm\:ss");
|
return TotalTime.ToString(@"mm\:ss");
|
||||||
}
|
}
|
||||||
|
@ -216,14 +216,26 @@ namespace NadekoBot.Modules.Music
|
|||||||
var currentSong = musicPlayer.CurrentSong;
|
var currentSong = musicPlayer.CurrentSong;
|
||||||
if (currentSong == null)
|
if (currentSong == null)
|
||||||
return;
|
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 videoid = Regex.Match(currentSong.SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+");
|
||||||
|
|
||||||
var embed = new EmbedBuilder()
|
var embed = new EmbedBuilder()
|
||||||
.WithAuthor(eab => eab.WithName("Now Playing")
|
.WithAuthor(eab => eab.WithName("Now Playing")
|
||||||
.WithMusicIcon())
|
.WithMusicIcon())
|
||||||
.WithDescription(currentSong.PrettyName)
|
.WithTitle($"{currentSong.SongInfo.Title}")
|
||||||
.WithFooter(ef => ef.WithText(currentSong.PrettyCurrentTime + "/" + currentSong.PrettyInfo))
|
.WithDescription(currentSong.PrettyCurrentTime + "/" + currentSong.PTT)
|
||||||
|
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}"))
|
||||||
.WithOkColor();
|
.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);
|
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -313,6 +325,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
|
|
||||||
var msg =
|
var msg =
|
||||||
await channel.SendMessageAsync($"🎵 Attempting to queue **{count}** songs".SnPl(count) + "...").ConfigureAwait(false);
|
await channel.SendMessageAsync($"🎵 Attempting to queue **{count}** songs".SnPl(count) + "...").ConfigureAwait(false);
|
||||||
|
|
||||||
var cancelSource = new CancellationTokenSource();
|
var cancelSource = new CancellationTokenSource();
|
||||||
|
|
||||||
var tasks = Task.WhenAll(idArray.Select(async id =>
|
var tasks = Task.WhenAll(idArray.Select(async id =>
|
||||||
@ -329,6 +342,16 @@ namespace NadekoBot.Modules.Music
|
|||||||
|
|
||||||
await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token));
|
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);
|
await msg.ModifyAsync(m => m.Content = "✅ Playlist queue complete.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,6 +847,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
if (finishedMessage != null)
|
if (finishedMessage != null)
|
||||||
finishedMessage.DeleteAfter(0);
|
finishedMessage.DeleteAfter(0);
|
||||||
|
|
||||||
finishedMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor()
|
finishedMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||||
.WithAuthor(eab => eab.WithName("Finished Song").WithMusicIcon())
|
.WithAuthor(eab => eab.WithName("Finished Song").WithMusicIcon())
|
||||||
.WithDescription(song.PrettyName)
|
.WithDescription(song.PrettyName)
|
||||||
@ -839,8 +863,13 @@ namespace NadekoBot.Modules.Music
|
|||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
IUserMessage playingMessage = null;
|
IUserMessage playingMessage = null;
|
||||||
|
|
||||||
mp.OnStarted += async (player, song) =>
|
mp.OnStarted += async (player, song) =>
|
||||||
{
|
{
|
||||||
|
try { await mp.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
||||||
|
var sender = player as MusicPlayer;
|
||||||
|
if (sender == null)
|
||||||
|
return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (playingMessage != null)
|
if (playingMessage != null)
|
||||||
@ -848,8 +877,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
|
|
||||||
playingMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor()
|
playingMessage = await textCh.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||||
.WithAuthor(eab => eab.WithName("Playing Song").WithMusicIcon())
|
.WithAuthor(eab => eab.WithName("Playing Song").WithMusicIcon())
|
||||||
.WithDescription(song.PrettyName)
|
.WithDescription($"{song.PrettyName}")
|
||||||
.WithFooter(ef => ef.WithText(song.PrettyInfo))
|
.WithFooter(ef => ef.WithText($"🔉 {(int)(sender.Volume * 100)}% | {song.PrettyInfo}"))
|
||||||
.Build())
|
.Build())
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -870,7 +899,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
pauseMessage = await textCh.SendConfirmAsync("🎵 Music playback **resumed**.").ConfigureAwait(false);
|
pauseMessage = await textCh.SendConfirmAsync("🎵 Music playback **resumed**.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
if (pauseMessage != null)
|
if (pauseMessage != null)
|
||||||
pauseMessage.DeleteAfter(15);
|
pauseMessage.DeleteAfter(5);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user