.whoplays command added

This commit is contained in:
Master Kwoth 2016-05-14 20:20:49 +02:00
parent c51d41d40f
commit b7c8bf504c
2 changed files with 25 additions and 4 deletions

View File

@ -946,6 +946,25 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage(":ok:");
});
cgb.CreateCommand(Prefix + "whoplays")
.Description("Shows a list of users who are playing the specified game")
.Parameter("game")
.Do(async e =>
{
var game = e.GetArg("game").Trim().ToUpperInvariant();
var en = e.Server.Users
.Where(u => u.CurrentGame?.ToUpperInvariant() == game)
.Select(u => $"{u.Name}");
var arr = en as string[] ?? en.ToArray();
if (arr.Length == 0)
await e.Channel.SendMessage("Nobody. (not 100% sure)");
else
await e.Channel.SendMessage("• " + string.Join("\n• ", arr));
});
});
}

View File

@ -95,10 +95,12 @@ namespace NadekoBot.Modules.Music.Classes
Console.WriteLine($"Exception in PlaySong: {ex}");
}
OnCompleted(this, curSong);
if (RepeatSong)
playlist.Insert(0, curSong);
else if (RepeatPlaylist)
playlist.Insert(playlist.Count, curSong);
curSong = CurrentSong; //to check if its null now
if (curSong != null)
if (RepeatSong)
playlist.Insert(0, curSong);
else if (RepeatPlaylist)
playlist.Insert(playlist.Count, curSong);
SongCancelSource = new CancellationTokenSource();
cancelToken = SongCancelSource.Token;
}