small improvements

This commit is contained in:
Master Kwoth 2016-02-19 03:19:41 +01:00
parent 6dcc8dfc01
commit c08498af54
2 changed files with 11 additions and 8 deletions

View File

@ -11,7 +11,7 @@ namespace NadekoBot
{
public class NadekoStats
{
public string BotVersion = "0.8-beta13";
public string BotVersion = "NadekoBot 0.8-beta13";
private static readonly NadekoStats _instance = new NadekoStats();
public static NadekoStats Instance => _instance;
@ -49,7 +49,7 @@ namespace NadekoBot
public void LoadStats() {
var sb = new System.Text.StringBuilder();
sb.AppendLine("`Author: Kwoth`");
sb.AppendLine("`Author: Kwoth` `Library: Discord.Net`");
//$"\nDiscord.Net version: {DiscordConfig.LibVersion}" +
//$"\nRuntime: {_client.GetRuntime()}" +
sb.AppendLine($"`Bot Version: {BotVersion}`");

View File

@ -667,13 +667,16 @@ namespace NadekoBot.Modules {
}
public void SaveParseToDb<T>(string where) where T : IDataModel {
var data = File.ReadAllText(where);
var arr = JObject.Parse(data)["results"] as JArray;
var objects = new List<T>();
foreach (JObject obj in arr) {
objects.Add(obj.ToObject<T>());
try {
var data = File.ReadAllText(where);
var arr = JObject.Parse(data)["results"] as JArray;
var objects = new List<T>();
foreach (JObject obj in arr) {
objects.Add(obj.ToObject<T>());
}
Classes.DBHandler.Instance.InsertMany(objects);
}
Classes.DBHandler.Instance.InsertMany(objects);
catch { }
}
}
}