Fixes to .stats
This commit is contained in:
parent
21c6c5fc9a
commit
37d462712c
@ -23,10 +23,10 @@ namespace NadekoBot.Services.Impl
|
||||
public string Heap =>
|
||||
Math.Round((double)GC.GetTotalMemory(false) / 1.MiB(), 2).ToString();
|
||||
public double MessagesPerSecond => MessageCounter / (double)GetUptime().TotalSeconds;
|
||||
private uint _textChannels = 0;
|
||||
public uint TextChannels => _textChannels;
|
||||
private uint _voiceChannels = 0;
|
||||
public uint VoiceChannels => _voiceChannels;
|
||||
private int _textChannels = 0;
|
||||
public int TextChannels => _textChannels;
|
||||
private int _voiceChannels = 0;
|
||||
public int VoiceChannels => _voiceChannels;
|
||||
public string OwnerIds => string.Join(", ", NadekoBot.Credentials.OwnerIds);
|
||||
|
||||
Timer carbonitexTimer { get; }
|
||||
@ -42,9 +42,12 @@ namespace NadekoBot.Services.Impl
|
||||
|
||||
this.client.Disconnected += _ => Reset();
|
||||
|
||||
var guilds = this.client.GetGuilds();
|
||||
var _textChannels = guilds.Sum(g => g.Channels.Where(cx => cx is ITextChannel).Count());
|
||||
var _voiceChannels = guilds.Sum(g => g.Channels.Count) - _textChannels;
|
||||
this.client.Connected += () =>
|
||||
{
|
||||
var guilds = this.client.GetGuilds();
|
||||
_textChannels = guilds.Sum(g => g.Channels.Where(cx => cx is ITextChannel).Count());
|
||||
_voiceChannels = guilds.Sum(g => g.Channels.Count) - _textChannels;
|
||||
};
|
||||
|
||||
this.client.ChannelCreated += (c) =>
|
||||
{
|
||||
@ -70,6 +73,14 @@ namespace NadekoBot.Services.Impl
|
||||
_voiceChannels += vc;
|
||||
};
|
||||
|
||||
this.client.LeftGuild += (g) =>
|
||||
{
|
||||
var tc = g.Channels.Where(cx => cx is ITextChannel).Count();
|
||||
var vc = g.Channels.Count - tc;
|
||||
_textChannels -= tc;
|
||||
_voiceChannels -= vc;
|
||||
};
|
||||
|
||||
this.carbonitexTimer = new Timer(async (state) =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.CarbonKey))
|
||||
|
@ -33,6 +33,7 @@ namespace NadekoBot
|
||||
public event Action<SocketGuild> LeftGuild = delegate { };
|
||||
|
||||
public event Action<Exception> Disconnected = delegate { };
|
||||
public event Action Connected = delegate { };
|
||||
|
||||
private uint _connectedCount = 0;
|
||||
private uint _downloadedCount = 0;
|
||||
@ -145,6 +146,7 @@ namespace NadekoBot
|
||||
}
|
||||
}
|
||||
}
|
||||
Connected();
|
||||
}
|
||||
|
||||
internal Task DownloadAllUsersAsync() =>
|
||||
|
Loading…
Reference in New Issue
Block a user