Embeds + Seperate the { } thingies

This commit is contained in:
01Private 2016-12-13 21:21:19 -08:00
parent 18715a6a83
commit 99e3c76953
2 changed files with 19 additions and 9 deletions

View File

@ -12,7 +12,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using VideoLibrary; using VideoLibrary;
namespace NadekoBot.Modules.Music.Classes namespace NadekoBot.Modules.Music.Classes//{(SongInfo.Provider ?? "-")}
{ {
public class SongInfo public class SongInfo
{ {
@ -27,24 +27,29 @@ namespace NadekoBot.Modules.Music.Classes
} }
public class Song public class Song
{ {
public StreamState State { get; set; }
public string PrettyName => public string PrettyName =>
$"**【 {SongInfo.Title.TrimTo(55)} 】**`{(SongInfo.Provider ?? "-")}` `by {QueuerName}`"; $"{SongInfo.Title.TrimTo(70)}";
public SongInfo SongInfo { get; } public SongInfo SongInfo { get; }
public string QueuerName { get; set; }
public MusicPlayer MusicPlayer { get; set; } public MusicPlayer MusicPlayer { get; set; }
public string PrettyUser =>
$"{QueuerName}";
public string QueuerName { get; set; }
public string PrettyProvider =>
$"{(SongInfo.Provider ?? "No Provider")}";
public StreamState State { get; set; }
public string PrettyCurrentTime() public string PrettyCurrentTime()
{ {
var time = TimeSpan.FromSeconds(bytesSent / 3840 / 50); var time = TimeSpan.FromSeconds(bytesSent / 3840 / 50);
var str = $"【{(int)time.TotalMinutes}m {time.Seconds}s】**/** "; var str = $"{(int)time.TotalMinutes}m {time.Seconds}s / ";
if (TotalLength == TimeSpan.Zero) if (TotalLength == TimeSpan.Zero)
str += "**?**"; str += "**?**";
else if (TotalLength == TimeSpan.MaxValue) else if (TotalLength == TimeSpan.MaxValue)
str += "**∞**"; str += "**∞**";
else else
str += $"{(int)TotalLength.TotalMinutes}m {TotalLength.Seconds}s"; str += $"{(int)TotalLength.TotalMinutes}m {TotalLength.Seconds}s";
return str; return str;
} }

View File

@ -184,8 +184,13 @@ namespace NadekoBot.Modules.Music
{ {
await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false);
} }
await channel.SendMessageAsync($"🎵`Now Playing` {currentSong.PrettyName} " + var embed = new EmbedBuilder()
$"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false); .WithAuthor(eab => eab.WithName("🎵 Now Playing"))
.WithTitle($"{currentSong.PrettyName}")
.WithDescription($"{currentSong.PrettyUser}")
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.PrettyCurrentTime()}"))
.WithColor(NadekoBot.OkColor);
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]