Moved carbon stats on server join and leave
This commit is contained in:
parent
d79514305b
commit
3af13550c2
@ -29,7 +29,7 @@ namespace NadekoBot
|
|||||||
public int VoiceChannelsCount { get; private set; } = 0;
|
public int VoiceChannelsCount { get; private set; } = 0;
|
||||||
|
|
||||||
private readonly Timer commandLogTimer = new Timer() { Interval = 10000 };
|
private readonly Timer commandLogTimer = new Timer() { Interval = 10000 };
|
||||||
private readonly Timer carbonStatusTimer = new Timer() { Interval = 3600000 };
|
//private readonly Timer carbonStatusTimer = new Timer() { Interval = 3600000 };
|
||||||
|
|
||||||
static NadekoStats() { }
|
static NadekoStats() { }
|
||||||
|
|
||||||
@ -57,6 +57,7 @@ namespace NadekoBot
|
|||||||
ServerCount++;
|
ServerCount++;
|
||||||
TextChannelsCount += e.Server.TextChannels.Count();
|
TextChannelsCount += e.Server.TextChannels.Count();
|
||||||
VoiceChannelsCount += e.Server.VoiceChannels.Count();
|
VoiceChannelsCount += e.Server.VoiceChannels.Count();
|
||||||
|
SendUpdateToCarbon();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
@ -67,6 +68,7 @@ namespace NadekoBot
|
|||||||
ServerCount--;
|
ServerCount--;
|
||||||
TextChannelsCount -= e.Server.TextChannels.Count();
|
TextChannelsCount -= e.Server.TextChannels.Count();
|
||||||
VoiceChannelsCount -= e.Server.VoiceChannels.Count();
|
VoiceChannelsCount -= e.Server.VoiceChannels.Count();
|
||||||
|
SendUpdateToCarbon();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
@ -96,10 +98,9 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(NadekoBot.Creds.CarbonKey))
|
private void SendUpdateToCarbon()
|
||||||
{
|
|
||||||
carbonStatusTimer.Elapsed += (s, e) =>
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -117,10 +118,8 @@ namespace NadekoBot
|
|||||||
Console.WriteLine("Failed sending status update to carbon.");
|
Console.WriteLine("Failed sending status update to carbon.");
|
||||||
Console.WriteLine(ex);
|
Console.WriteLine(ex);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
carbonStatusTimer.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSpan GetUptime() =>
|
public TimeSpan GetUptime() =>
|
||||||
DateTime.Now - Process.GetCurrentProcess().StartTime;
|
DateTime.Now - Process.GetCurrentProcess().StartTime;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user