2022-07-08 19:03:15 +00:00
|
|
|
using RegexBot.Common;
|
|
|
|
|
|
|
|
namespace RegexBot.Modules.ModLogs;
|
|
|
|
class ModuleConfig {
|
|
|
|
public EntityName ReportingChannel { get; }
|
|
|
|
|
|
|
|
public bool LogMessageDeletions { get; }
|
|
|
|
public bool LogMessageEdits { get; }
|
2022-08-24 03:39:44 +00:00
|
|
|
public bool LogModLogs { get; }
|
2022-07-08 19:03:15 +00:00
|
|
|
|
|
|
|
public ModuleConfig(JObject config) {
|
|
|
|
const string RptChError = $"'{nameof(ReportingChannel)}' must be set to a valid channel name.";
|
2022-08-23 02:25:48 +00:00
|
|
|
try {
|
|
|
|
ReportingChannel = new EntityName(config[nameof(ReportingChannel)]?.Value<string>()!, EntityType.Channel);
|
|
|
|
} catch (Exception) {
|
|
|
|
throw new ModuleLoadException(RptChError);
|
|
|
|
}
|
2022-07-08 19:03:15 +00:00
|
|
|
|
|
|
|
// Individual logging settings - all default to false
|
|
|
|
LogMessageDeletions = config[nameof(LogMessageDeletions)]?.Value<bool>() ?? false;
|
|
|
|
LogMessageEdits = config[nameof(LogMessageEdits)]?.Value<bool>() ?? false;
|
2022-08-24 03:39:44 +00:00
|
|
|
LogModLogs = config[nameof(LogModLogs)]?.Value<bool>() ?? false;
|
2022-07-08 19:03:15 +00:00
|
|
|
}
|
|
|
|
}
|