mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(bot): add system guild icon & guild name (#554)
This commit is contained in:
parent
d12cd481f6
commit
3045c5e307
22 changed files with 337 additions and 28 deletions
|
|
@ -26,6 +26,7 @@ public class MessageContext
|
|||
public string? SystemGuildTag { get; }
|
||||
public bool TagEnabled { get; }
|
||||
public string? SystemAvatar { get; }
|
||||
public string? SystemGuildAvatar { get; }
|
||||
public bool AllowAutoproxy { get; }
|
||||
public int? LatchTimeout { get; }
|
||||
public bool CaseSensitiveProxyTags { get; }
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@ public class ProxyMember
|
|||
return memberName;
|
||||
}
|
||||
|
||||
public string? ProxyAvatar(MessageContext ctx) => ServerAvatar ?? WebhookAvatar ?? Avatar ?? ctx.SystemAvatar;
|
||||
public string? ProxyAvatar(MessageContext ctx) => ServerAvatar ?? WebhookAvatar ?? Avatar ?? ctx.SystemGuildAvatar ?? ctx.SystemAvatar;
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ create function message_context(account_id bigint, guild_id bigint, channel_id b
|
|||
system_guild_tag text,
|
||||
tag_enabled bool,
|
||||
system_avatar text,
|
||||
system_guild_avatar text,
|
||||
allow_autoproxy bool,
|
||||
latch_timeout integer,
|
||||
case_sensitive_proxy_tags bool,
|
||||
|
|
@ -22,6 +23,7 @@ as $$
|
|||
-- CTEs to query "static" (accessible only through args) data
|
||||
with
|
||||
system as (select systems.*, system_config.latch_timeout, system_guild.tag as guild_tag, system_guild.tag_enabled as tag_enabled,
|
||||
system_guild.avatar_url as guild_avatar,
|
||||
allow_autoproxy as account_autoproxy, system_config.case_sensitive_proxy_tags, system_config.proxy_error_message_enabled from accounts
|
||||
left join systems on systems.id = accounts.system
|
||||
left join system_config on system_config.system = accounts.system
|
||||
|
|
@ -44,6 +46,7 @@ as $$
|
|||
system.guild_tag as system_guild_tag,
|
||||
coalesce(system.tag_enabled, true) as tag_enabled,
|
||||
system.avatar_url as system_avatar,
|
||||
system.guild_avatar as system_guild_avatar,
|
||||
system.account_autoproxy as allow_autoproxy,
|
||||
system.latch_timeout as latch_timeout,
|
||||
system.case_sensitive_proxy_tags as case_sensitive_proxy_tags,
|
||||
|
|
|
|||
7
PluralKit.Core/Database/Migrations/35.sql
Normal file
7
PluralKit.Core/Database/Migrations/35.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- database version 35
|
||||
-- add guild avatar and guild name to system guild settings
|
||||
|
||||
alter table system_guild add column avatar_url text;
|
||||
alter table system_guild add column display_name text;
|
||||
|
||||
update info set schema_version = 35;
|
||||
7
PluralKit.Core/Database/Migrations/36.sql
Normal file
7
PluralKit.Core/Database/Migrations/36.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- database version 36
|
||||
-- add system avatar privacy and system name privacy
|
||||
|
||||
alter table systems add column name_privacy integer not null default 1;
|
||||
alter table systems add column avatar_privacy integer not null default 1;
|
||||
|
||||
update info set schema_version = 36;
|
||||
|
|
@ -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 = 34;
|
||||
private const int TargetSchemaVersion = 36;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DatabaseMigrator(ILogger logger)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue