Log autoresponse configuration load

This commit is contained in:
Noikoio 2017-08-29 22:39:59 -07:00
parent 019a5bdd96
commit 2e9036b26a
2 changed files with 8 additions and 4 deletions

View file

@ -42,13 +42,15 @@ namespace Noikoio.RegexBot.Feature.AutoRespond
} }
[ConfigSection("autoresponses")] [ConfigSection("autoresponses")]
public override Task<object> ProcessConfiguration(JToken configSection) public override async Task<object> ProcessConfiguration(JToken configSection)
{ {
var responses = new List<ResponseDefinition>(); var responses = new List<ResponseDefinition>();
foreach (var def in configSection.Children<JProperty>()) foreach (var def in configSection.Children<JProperty>())
{ {
// Everything is left to the constructor // All validation is left to the constructor
responses.Add(new ResponseDefinition(def)); var resp = new ResponseDefinition(def);
responses.Add(resp);
await Log($"Added definition '{resp.Label}'");
} }
return Task.FromResult<object>(responses.AsReadOnly()); return Task.FromResult<object>(responses.AsReadOnly());

View file

@ -8,7 +8,7 @@ namespace Noikoio.RegexBot.Feature.AutoRespond
/// <summary> /// <summary>
/// Represents a single autoresponse definition. /// Represents a single autoresponse definition.
/// </summary> /// </summary>
struct ResponseDefinition class ResponseDefinition
{ {
public enum ResponseType { None, Exec, Reply } public enum ResponseType { None, Exec, Reply }
@ -96,5 +96,7 @@ namespace Noikoio.RegexBot.Feature.AutoRespond
} }
} }
} }
public override string ToString() => $"Autoresponse definition '{Label}'";
} }
} }