Fixed !!rm spam?

This commit is contained in:
Kwoth 2017-01-05 21:54:49 +01:00
parent 517bfc2294
commit 871089bf26
2 changed files with 19 additions and 18 deletions

View File

@ -77,7 +77,7 @@ namespace NadekoBot.Modules.Music.Classes
public string PrettyVolume => $"🔉 {(int)(Volume * 100)}%";
public event Action<Song> SongRemoved = delegate { };
public event Action<Song, int> SongRemoved = delegate { };
public MusicPlayer(IVoiceChannel startingVoiceChannel, float? defaultVolume)
{
@ -282,7 +282,7 @@ namespace NadekoBot.Modules.Music.Classes
var song = playlist.ElementAtOrDefault(index);
if (playlist.Remove(song) && !silent)
{
SongRemoved(song);
SongRemoved(song, index);
}
});

View File

@ -466,22 +466,6 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
if (((IGuildUser)Context.User).VoiceChannel != musicPlayer.PlaybackVoiceChannel)
return;
musicPlayer.SongRemoved += async (song) =>
{
try
{
var embed = new EmbedBuilder()
.WithAuthor(eab => eab.WithName("Removed song #" + num).WithMusicIcon())
.WithDescription(song.PrettyName)
.WithFooter(ef => ef.WithText(song.PrettyInfo))
.WithErrorColor();
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
catch { }
};
musicPlayer.RemoveSongAt(num - 1);
}
@ -868,6 +852,23 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
}
catch { }
};
mp.SongRemoved += async (song, index) =>
{
try
{
var embed = new EmbedBuilder()
.WithAuthor(eab => eab.WithName("Removed song #" + (index + 1)).WithMusicIcon())
.WithDescription(song.PrettyName)
.WithFooter(ef => ef.WithText(song.PrettyInfo))
.WithErrorColor();
await textCh.EmbedAsync(embed).ConfigureAwait(false);
}
catch { }
};
return mp;
});
Song resolvedSong;