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")]
public override Task<object> ProcessConfiguration(JToken configSection)
public override async Task<object> ProcessConfiguration(JToken configSection)
{
var responses = new List<ResponseDefinition>();
foreach (var def in configSection.Children<JProperty>())
{
// Everything is left to the constructor
responses.Add(new ResponseDefinition(def));
// All validation is left to the constructor
var resp = new ResponseDefinition(def);
responses.Add(resp);
await Log($"Added definition '{resp.Label}'");
}
return Task.FromResult<object>(responses.AsReadOnly());

View file

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