maybe this was causing stutters?

This commit is contained in:
Master Kwoth 2016-01-28 12:04:25 +01:00
parent f8ea322317
commit 9ccc01c4a6

View File

@ -18,7 +18,7 @@ namespace NadekoBot.Modules {
.Where(kvp => kvp.Value.CurrentSong == null .Where(kvp => kvp.Value.CurrentSong == null
&& kvp.Value.SongQueue.Count == 0)) { && kvp.Value.SongQueue.Count == 0)) {
var val = mp.Value; var val = mp.Value;
musicPlayers.TryRemove(mp.Key, out val); (musicPlayers as System.Collections.IDictionary).Remove(mp.Key);
} }
} }
@ -37,9 +37,10 @@ namespace NadekoBot.Modules {
public Music() : base() { public Music() : base() {
Timer cleaner = new Timer(); Timer cleaner = new Timer();
cleaner.Elapsed += (s, e) => CleanMusicPlayers(); cleaner.Elapsed += (s, e) => System.Threading.Tasks.Task.Run(() => CleanMusicPlayers());
cleaner.Interval = 10000; cleaner.Interval = 10000;
cleaner.Start(); cleaner.Start();
/*
Timer statPrinter = new Timer(); Timer statPrinter = new Timer();
NadekoBot.client.Connected += (s, e) => { NadekoBot.client.Connected += (s, e) => {
if (statPrinter.Enabled) return; if (statPrinter.Enabled) return;
@ -47,7 +48,7 @@ namespace NadekoBot.Modules {
statPrinter.Interval = 5000; statPrinter.Interval = 5000;
statPrinter.Start(); statPrinter.Start();
}; };
*/
} }
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
@ -82,7 +83,7 @@ namespace NadekoBot.Modules {
.Description("Pauses the song") .Description("Pauses the song")
.Do(async e => { .Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return; if (musicPlayers.ContainsKey(e.Server) == false) return;
await e.Send("This feature is coming VERY soon."); await e.Send("This feature is coming tomorrow.");
/* /*
if (musicPlayers[e.Server].Pause()) if (musicPlayers[e.Server].Pause())
if (musicPlayers[e.Server].IsPaused) if (musicPlayers[e.Server].IsPaused)