Add logger bot cleanup support
This commit is contained in:
@@ -67,6 +67,7 @@ namespace PluralKit.Core {
|
||||
public ulong? LogChannel { get; set; }
|
||||
public ISet<ulong> LogBlacklist { get; set; }
|
||||
public ISet<ulong> Blacklist { get; set; }
|
||||
public bool LogCleanupEnabled { get; set; }
|
||||
}
|
||||
|
||||
public class SystemGuildSettings
|
||||
|
@@ -363,6 +363,8 @@ namespace PluralKit.Core {
|
||||
public ulong? LogChannel { get; set; }
|
||||
public long[] LogBlacklist { get; set; }
|
||||
public long[] Blacklist { get; set; }
|
||||
|
||||
public bool LogCleanupEnabled { get; set; }
|
||||
|
||||
public GuildConfig Into() =>
|
||||
new GuildConfig
|
||||
@@ -370,7 +372,8 @@ namespace PluralKit.Core {
|
||||
Id = Id,
|
||||
LogChannel = LogChannel,
|
||||
LogBlacklist = new HashSet<ulong>(LogBlacklist?.Select(c => (ulong) c) ?? new ulong[] {}),
|
||||
Blacklist = new HashSet<ulong>(Blacklist?.Select(c => (ulong) c) ?? new ulong[]{})
|
||||
Blacklist = new HashSet<ulong>(Blacklist?.Select(c => (ulong) c) ?? new ulong[]{}),
|
||||
LogCleanupEnabled = LogCleanupEnabled
|
||||
};
|
||||
}
|
||||
|
||||
@@ -388,10 +391,11 @@ namespace PluralKit.Core {
|
||||
public async Task SaveGuildConfig(GuildConfig cfg)
|
||||
{
|
||||
using (var conn = await _conn.Obtain())
|
||||
await conn.ExecuteAsync("insert into servers (id, log_channel, log_blacklist, blacklist) values (@Id, @LogChannel, @LogBlacklist, @Blacklist) on conflict (id) do update set log_channel = @LogChannel, log_blacklist = @LogBlacklist, blacklist = @Blacklist", new
|
||||
await conn.ExecuteAsync("insert into servers (id, log_channel, log_blacklist, blacklist, log_cleanup_enabled) values (@Id, @LogChannel, @LogBlacklist, @Blacklist, @LogCleanupEnabled) on conflict (id) do update set log_channel = @LogChannel, log_blacklist = @LogBlacklist, blacklist = @Blacklist, log_cleanup_enabled = @LogCleanupEnabled", new
|
||||
{
|
||||
cfg.Id,
|
||||
cfg.LogChannel,
|
||||
cfg.LogCleanupEnabled,
|
||||
LogBlacklist = cfg.LogBlacklist.Select(c => (long) c).ToList(),
|
||||
Blacklist = cfg.Blacklist.Select(c => (long) c).ToList()
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ using Serilog;
|
||||
namespace PluralKit.Core {
|
||||
public class SchemaService
|
||||
{
|
||||
private const int TargetSchemaVersion = 4;
|
||||
private const int TargetSchemaVersion = 5;
|
||||
|
||||
private DbConnectionFactory _conn;
|
||||
private ILogger _logger;
|
||||
|
Reference in New Issue
Block a user