mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add text-to-speech option to members (#570)
Merges PluralKit/PluralKit#570
This commit is contained in:
parent
68cd21fb2f
commit
e58b3c7274
16 changed files with 90 additions and 6 deletions
|
|
@ -17,6 +17,7 @@ public class ProxyMember
|
|||
public MemberId Id { get; }
|
||||
public IReadOnlyCollection<ProxyTag> ProxyTags { get; } = new ProxyTag[0];
|
||||
public bool KeepProxy { get; }
|
||||
public bool Tts { get; }
|
||||
|
||||
public string? ServerName { get; }
|
||||
public string? DisplayName { get; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
create function message_context(account_id bigint, guild_id bigint, channel_id bigint, thread_id bigint)
|
||||
create function message_context(account_id bigint, guild_id bigint, channel_id bigint, thread_id bigint)
|
||||
returns table (
|
||||
system_id int,
|
||||
log_channel bigint,
|
||||
|
|
@ -68,6 +68,7 @@ create function proxy_members(account_id bigint, guild_id bigint)
|
|||
id int,
|
||||
proxy_tags proxy_tag[],
|
||||
keep_proxy bool,
|
||||
tts bool,
|
||||
|
||||
server_name text,
|
||||
display_name text,
|
||||
|
|
@ -87,6 +88,7 @@ as $$
|
|||
members.id as id,
|
||||
members.proxy_tags as proxy_tags,
|
||||
members.keep_proxy as keep_proxy,
|
||||
members.tts as tts,
|
||||
|
||||
-- Name info
|
||||
member_guild.display_name as server_name,
|
||||
|
|
|
|||
6
PluralKit.Core/Database/Migrations/38.sql
Normal file
6
PluralKit.Core/Database/Migrations/38.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-- database version 38
|
||||
-- add proxy tag privacy
|
||||
|
||||
alter table members add column tts boolean not null default false;
|
||||
|
||||
update info set schema_version = 38;
|
||||
|
|
@ -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 = 37;
|
||||
private const int TargetSchemaVersion = 38;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DatabaseMigrator(ILogger logger)
|
||||
|
|
@ -78,4 +78,4 @@ internal class DatabaseMigrator
|
|||
// Then, migration 1 gets executed, which creates the info table and sets version to 1
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public class PKMember
|
|||
public string Description { get; private set; }
|
||||
public ICollection<ProxyTag> ProxyTags { get; private set; }
|
||||
public bool KeepProxy { get; private set; }
|
||||
public bool Tts { get; private set; }
|
||||
public Instant Created { get; private set; }
|
||||
public int MessageCount { get; private set; }
|
||||
public Instant? LastMessageTimestamp { get; private set; }
|
||||
|
|
@ -137,6 +138,7 @@ public static class PKMemberExt
|
|||
o.Add("description", member.DescriptionFor(ctx));
|
||||
o.Add("created", member.CreatedFor(ctx)?.FormatExport());
|
||||
o.Add("keep_proxy", member.KeepProxy);
|
||||
o.Add("tts", member.Tts);
|
||||
|
||||
o.Add("autoproxy_enabled", ctx == LookupContext.ByOwner ? member.AllowAutoproxy : null);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class MemberPatch: PatchObject
|
|||
public Partial<string?> Description { get; set; }
|
||||
public Partial<ProxyTag[]> ProxyTags { get; set; }
|
||||
public Partial<bool> KeepProxy { get; set; }
|
||||
public Partial<bool> Tts { get; set; }
|
||||
public Partial<int> MessageCount { get; set; }
|
||||
public Partial<bool> AllowAutoproxy { get; set; }
|
||||
public Partial<PrivacyLevel> Visibility { get; set; }
|
||||
|
|
@ -46,6 +47,7 @@ public class MemberPatch: PatchObject
|
|||
.With("description", Description)
|
||||
.With("proxy_tags", ProxyTags)
|
||||
.With("keep_proxy", KeepProxy)
|
||||
.With("tts", Tts)
|
||||
.With("message_count", MessageCount)
|
||||
.With("allow_autoproxy", AllowAutoproxy)
|
||||
.With("member_visibility", Visibility)
|
||||
|
|
@ -126,6 +128,7 @@ public class MemberPatch: PatchObject
|
|||
if (o.ContainsKey("pronouns")) patch.Pronouns = o.Value<string>("pronouns").NullIfEmpty();
|
||||
if (o.ContainsKey("description")) patch.Description = o.Value<string>("description").NullIfEmpty();
|
||||
if (o.ContainsKey("keep_proxy")) patch.KeepProxy = o.Value<bool>("keep_proxy");
|
||||
if (o.ContainsKey("tts")) patch.Tts = o.Value<bool>("tts");
|
||||
|
||||
if (isImport)
|
||||
{
|
||||
|
|
@ -223,6 +226,9 @@ public class MemberPatch: PatchObject
|
|||
if (KeepProxy.IsPresent)
|
||||
o.Add("keep_proxy", KeepProxy.Value);
|
||||
|
||||
if (Tts.IsPresent)
|
||||
o.Add("tts", Tts.Value);
|
||||
|
||||
if (
|
||||
Visibility.IsPresent
|
||||
|| NamePrivacy.IsPresent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue