stats better, timeout increased

This commit is contained in:
Master Kwoth 2016-02-14 18:43:44 +01:00
parent a100afe7d2
commit f62d9d0d79
3 changed files with 16 additions and 13 deletions

View File

@ -48,21 +48,23 @@ namespace NadekoBot
}
public void LoadStats() {
_statsCache =
"`Author: Kwoth`" +
var sb = new System.Text.StringBuilder();
sb.AppendLine("`Author: Kwoth`");
//$"\nDiscord.Net version: {DiscordConfig.LibVersion}" +
//$"\nRuntime: {_client.GetRuntime()}" +
$"\n`Bot Version: {BotVersion}`" +
sb.AppendLine($"`Bot Version: {BotVersion}`");
//$"\nLogged in as: {_client.CurrentUser.Name}" +
$"\n`Bot id: {_client.CurrentUser.Id}`" +
$"\n`Uptime: {GetUptimeString()}`" +
$"\n`Servers: {_client.Servers.Count()}`" +
$"\n`Channels: {_client.Servers.Sum(s => s.AllChannels.Count())}`" +
sb.AppendLine($"`Bot id: {_client.CurrentUser.Id}`");
sb.AppendLine($"`Owner id: {NadekoBot.OwnerID}`");
sb.AppendLine($"`Uptime: {GetUptimeString()}`");
sb.Append($"`Servers: {_client.Servers.Count()}");
sb.AppendLine($" | Channels: {_client.Servers.Sum(s => s.AllChannels.Count())}`");
//$"\nUsers: {_client.Servers.SelectMany(x => x.Users.Select(y => y.Id)).Count()} (non-unique)" +
$"\n`Heap: {Math.Round((double)GC.GetTotalMemory(true) / 1.MiB(), 2).ToString()} MB`" +
$"\n`Commands Ran this session: {_commandsRan}`" +
$"\n`Message queue size:{_client.MessageQueue.Count}`" +
$"\n`Greeted/Byed {Commands.ServerGreetCommand.Greeted} times.`";
sb.AppendLine($"`Heap: {Math.Round((double)GC.GetTotalMemory(true) / 1.MiB(), 2).ToString()} MB`");
sb.AppendLine($"`Commands Ran this session: {_commandsRan}`");
sb.AppendLine($"`Message queue size:{_client.MessageQueue.Count}`");
sb.AppendLine($"`Greeted {Commands.ServerGreetCommand.Greeted} times.`");
_statsCache = sb.ToString();
}
public string GetStats() {

View File

@ -385,7 +385,7 @@ namespace NadekoBot.Modules {
.Description("Shows some basic stats for nadeko")
.Do(async e => {
var t = Task.Run(() => {
return NadekoStats.Instance.GetStats() + "\n`" + Music.GetMusicStats() + "`";
return NadekoStats.Instance.GetStats() + "`" + Music.GetMusicStats() + "`";
});
await e.Send(await t);

View File

@ -62,7 +62,8 @@ namespace NadekoBot {
//create new discord client
client = new DiscordClient(new DiscordConfigBuilder() {
MessageCacheSize = 0
MessageCacheSize = 0,
ConnectionTimeout = 60000,
});
//create a command service