RegexBot/Modules/ModLogs/ModuleConfig.cs
Noi 1149f2800d Reorganized project
Moved modules into the assembly itself to simplify development of
further features and reduce complexity in building this project.

Additionally, many small adjustments were made, including:
- Add documentation to most public methods that had it missing
- Minor style updates
- Updated readme to reflect near-completion of this rewrite
- Remove any last remaining references to old project name Kerobot
- Update dependencies
2022-07-20 18:55:08 -07:00

21 lines
No EOL
917 B
C#

using RegexBot.Common;
namespace RegexBot.Modules.ModLogs;
class ModuleConfig {
public EntityName ReportingChannel { get; }
public bool LogMessageDeletions { get; }
public bool LogMessageEdits { get; }
public ModuleConfig(JObject config) {
const string RptChError = $"'{nameof(ReportingChannel)}' must be set to a valid channel name.";
var rptch = config[nameof(ReportingChannel)]?.Value<string>();
if (string.IsNullOrWhiteSpace(rptch)) throw new ModuleLoadException(RptChError);
ReportingChannel = new EntityName(rptch);
if (ReportingChannel.Type != EntityType.Channel) throw new ModuleLoadException(RptChError);
// Individual logging settings - all default to false
LogMessageDeletions = config[nameof(LogMessageDeletions)]?.Value<bool>() ?? false;
LogMessageEdits = config[nameof(LogMessageEdits)]?.Value<bool>() ?? false;
}
}