added !m rm all, changes to music

This commit is contained in:
Master Kwoth
2016-02-20 17:38:02 +01:00
parent a0ec4db004
commit 5da3492b12
2 changed files with 15 additions and 8 deletions

View File

@ -225,13 +225,21 @@ namespace NadekoBot.Modules {
});
cgb.CreateCommand("rm")
.Description("Removes a song by a # from the queue")
.Description("Removes a song by a # from the queue or 'all' to remove whole queue.")
.Parameter("num",ParameterType.Required)
.Do(async e => {
var arg = e.GetArg("num");
int num;
MusicControls mc;
if (!musicPlayers.TryGetValue(e.Server, out mc) || !int.TryParse(arg, out num)) {
if (!musicPlayers.TryGetValue(e.Server, out mc)) {
return;
}
if (arg?.ToLower() == "all") {
mc.SongQueue?.Clear();
await e.Send($"🎵Queue cleared!");
return;
}
int num;
if (!int.TryParse(arg, out num)) {
return;
}
if (num <= 0 || num > mc.SongQueue.Count)