gotta know if its enabled or disabled

This commit is contained in:
Master Kwoth 2016-01-31 09:38:16 +01:00
parent e71e390cca
commit 40b64407f2

View File

@ -16,7 +16,7 @@ namespace NadekoBot.Modules {
internal static string GetMusicStats() { internal static string GetMusicStats() {
var stats = musicPlayers.Where(kvp => kvp.Value?.SongQueue.Count > 0 || kvp.Value?.CurrentSong != null); var stats = musicPlayers.Where(kvp => kvp.Value?.SongQueue.Count > 0 || kvp.Value?.CurrentSong != null);
int cnt; int cnt;
return $"Playing {cnt = stats.Count()} songs".SnPl(cnt)+$", {stats.Sum(kvp => kvp.Value?.SongQueue?.Count ?? 0)} queued."; return $"Playing {cnt = stats.Count()} songs".SnPl(cnt) + $", {stats.Sum(kvp => kvp.Value?.SongQueue?.Count ?? 0)} queued.";
} }
public Music() : base() { public Music() : base() {
@ -162,7 +162,7 @@ namespace NadekoBot.Modules {
player.SongQueue.Shuffle(); player.SongQueue.Shuffle();
await e.Send(":musical_note: Songs shuffled!"); await e.Send(":musical_note: Songs shuffled!");
}); });
bool setgameEnabled = false; bool setgameEnabled = true;
Timer setgameTimer = new Timer(); Timer setgameTimer = new Timer();
setgameTimer.Interval = 20000; setgameTimer.Interval = 20000;
setgameTimer.Elapsed += (s, e) => { setgameTimer.Elapsed += (s, e) => {
@ -172,7 +172,7 @@ namespace NadekoBot.Modules {
setgameTimer.Start(); setgameTimer.Start();
cgb.CreateCommand("setgame") cgb.CreateCommand("setgame")
.Description("Sets the game of the bot to the number of songs playing.**Owner only**") .Description("Sets the game of the bot to the number of songs playing.**Owner only**")
.Do(e => { .Do(async e => {
if (NadekoBot.OwnerID != e.User.Id) if (NadekoBot.OwnerID != e.User.Id)
return; return;
setgameEnabled = !setgameEnabled; setgameEnabled = !setgameEnabled;
@ -180,6 +180,8 @@ namespace NadekoBot.Modules {
setgameTimer.Start(); setgameTimer.Start();
else else
setgameTimer.Stop(); setgameTimer.Stop();
await e.Send("Music status " + (setgameEnabled ? "enabled" : "disabled"));
}); });
}); });
} }