feat(bot): server config toggle for @silent proxied messages

This commit is contained in:
Iris System 2024-12-30 04:33:17 +00:00
parent 2d36b8a7cc
commit b88c1b7712
12 changed files with 50 additions and 3 deletions

View file

@ -36,6 +36,6 @@ public class MessageContext
public bool InLogBlacklist { get; }
public bool LogCleanupEnabled { get; }
public bool RequireSystemTag { get; }
public bool DenyBotUsage { get; }
public bool SuppressNotifications { get; }
}

View file

@ -27,6 +27,7 @@ create function message_context(account_id bigint, guild_id bigint, channel_id b
in_log_blacklist bool,
log_cleanup_enabled bool,
require_system_tag bool,
suppress_notifications bool,
deny_bot_usage bool
)
@ -67,6 +68,7 @@ as $$
or (thread_id = any (servers.log_blacklist))) as in_log_blacklist,
coalesce(servers.log_cleanup_enabled, false) as log_cleanup_enabled,
coalesce(servers.require_system_tag, false) as require_system_tag,
coalesce(servers.suppress_notifications, false) as suppress_notifications,
-- abuse_logs table
coalesce(abuse_logs.deny_bot_usage, false) as deny_bot_usage

View file

@ -0,0 +1,7 @@
-- database version 51
--
-- add guild setting for SUPPRESS_NOTIFICATIONS message flag on proxied messages
alter table servers add column suppress_notifications bool not null default false;
update info set schema_version = 51;

View file

@ -9,7 +9,7 @@ namespace PluralKit.Core;
internal class DatabaseMigrator
{
private const string RootPath = "PluralKit.Core.Database"; // "resource path" root for SQL files
private const int TargetSchemaVersion = 50;
private const int TargetSchemaVersion = 51;
private readonly ILogger _logger;
public DatabaseMigrator(ILogger logger)

View file

@ -9,4 +9,5 @@ public class GuildConfig
public bool LogCleanupEnabled { get; }
public bool InvalidCommandResponseEnabled { get; }
public bool RequireSystemTag { get; }
public bool SuppressNotifications { get; }
}

View file

@ -10,6 +10,7 @@ public class GuildPatch: PatchObject
public Partial<bool> LogCleanupEnabled { get; set; }
public Partial<bool> InvalidCommandResponseEnabled { get; set; }
public Partial<bool> RequireSystemTag { get; set; }
public Partial<bool> SuppressNotifications { get; set; }
public override Query Apply(Query q) => q.ApplyPatch(wrapper => wrapper
.With("log_channel", LogChannel)
@ -18,5 +19,6 @@ public class GuildPatch: PatchObject
.With("log_cleanup_enabled", LogCleanupEnabled)
.With("invalid_command_response_enabled", InvalidCommandResponseEnabled)
.With("require_system_tag", RequireSystemTag)
.With("suppress_notifications", SuppressNotifications)
);
}