commit
950862d9bc
@ -514,6 +514,9 @@ namespace NadekoBot.Modules.Administration
|
||||
if (channel == null)
|
||||
return Task.CompletedTask;
|
||||
|
||||
if (before.Content == after.Content)
|
||||
return Task.CompletedTask;
|
||||
|
||||
LogSetting logSetting;
|
||||
if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out logSetting)
|
||||
|| !logSetting.IsLogging
|
||||
|
@ -50,8 +50,6 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
|
||||
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
|
||||
|
||||
public string PTT => $"{PrettyTotalTime}";
|
||||
|
||||
public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
|
||||
|
||||
public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss");
|
||||
@ -67,6 +65,24 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
}
|
||||
}
|
||||
|
||||
public string Thumbnail {
|
||||
get {
|
||||
switch (SongInfo.ProviderType)
|
||||
{
|
||||
case MusicType.Normal:
|
||||
//todo have videoid in songinfo from the start
|
||||
var videoId = Regex.Match(SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+");
|
||||
return $"https://img.youtube.com/vi/{ videoId }/0.jpg";
|
||||
case MusicType.Soundcloud:
|
||||
return SongInfo.AlbumArt;
|
||||
case MusicType.Local:
|
||||
case MusicType.Radio:
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int skipTo = 0;
|
||||
public int SkipTo {
|
||||
get { return skipTo; }
|
||||
|
@ -217,26 +217,16 @@ namespace NadekoBot.Modules.Music
|
||||
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())
|
||||
.WithTitle($"{currentSong.SongInfo.Title}")
|
||||
.WithDescription(currentSong.PrettyCurrentTime + "/" + currentSong.PTT)
|
||||
.WithDescription(currentSong.PrettyFullTime)
|
||||
.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}");
|
||||
}
|
||||
|
||||
.WithOkColor()
|
||||
.WithThumbnail(tn => tn.Url = currentSong.Thumbnail)
|
||||
.WithUrl(currentSong.SongInfo.Query);
|
||||
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@ -342,16 +332,6 @@ 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user