fixed customreactions always loading default reactions, even when they are deleted #370

This commit is contained in:
Master Kwoth 2016-07-07 04:46:33 +02:00
parent 9d88627e19
commit f0c85eaafc
2 changed files with 34 additions and 14 deletions

View File

@ -196,7 +196,7 @@ namespace NadekoBot
return; return;
} }
#if NADEKO_RELEASE #if NADEKO_RELEASE
await Task.Delay(100000).ConfigureAwait(false); await Task.Delay(120000).ConfigureAwait(false);
#else #else
await Task.Delay(1000).ConfigureAwait(false); await Task.Delay(1000).ConfigureAwait(false);
#endif #endif

View File

@ -3,25 +3,14 @@ using NadekoBot.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.Serialization;
namespace NadekoBot.Classes.JSONModels namespace NadekoBot.Classes.JSONModels
{ {
public class Configuration public class Configuration
{ {
public bool DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true;
public bool IsRotatingStatus { get; set; } = false;
public int BufferSize { get; set; } = 4.MiB();
[JsonIgnore] [JsonIgnore]
public List<Quote> Quotes { get; set; } = new List<Quote>(); public static readonly Dictionary<string, List<string>> DefaultCustomReactions = new Dictionary<string, List<string>>
[JsonIgnore]
public List<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
public string RemindMessageFormat { get; set; } = "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗";
public Dictionary<string, List<string>> CustomReactions { get; set; } = new Dictionary<string, List<string>>()
{ {
{@"\o\", new List<string>() {@"\o\", new List<string>()
{ "/o/" } }, { "/o/" } },
@ -93,6 +82,21 @@ namespace NadekoBot.Classes.JSONModels
} } } }
}; };
public bool DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true;
public bool IsRotatingStatus { get; set; } = false;
public int BufferSize { get; set; } = 4.MiB();
public List<Quote> Quotes { get; set; } = new List<Quote>();
[JsonIgnore]
public List<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
public string RemindMessageFormat { get; set; } = "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗";
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public Dictionary<string, List<string>> CustomReactions { get; set; }
public List<string> RotatingStatuses { get; set; } = new List<string>(); public List<string> RotatingStatuses { get; set; } = new List<string>();
public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel();
public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>(); public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>();
@ -104,6 +108,22 @@ namespace NadekoBot.Classes.JSONModels
143515953525817344 143515953525817344
}; };
[OnDeserialized]
internal void OnDeserialized(StreamingContext context)
{
if (CustomReactions == null)
{
CustomReactions = DefaultCustomReactions;
}
}
[OnSerializing]
internal void OnSerializing(StreamingContext context)
{
if (CustomReactions == null)
{
CustomReactions = DefaultCustomReactions;
}
}
public string[] _8BallResponses { get; set; } = public string[] _8BallResponses { get; set; } =
{ {