From 761a82740fb44f7c3881559d1ce0e1df2f955f26 Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 12 Jun 2020 23:55:25 +0200 Subject: [PATCH] Remove unused functions and classes --- PluralKit.Core/Services/IDataStore.cs | 21 +------------------- PluralKit.Core/Services/PostgresDataStore.cs | 20 ------------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/PluralKit.Core/Services/IDataStore.cs b/PluralKit.Core/Services/IDataStore.cs index f47c8af5..21a8714b 100644 --- a/PluralKit.Core/Services/IDataStore.cs +++ b/PluralKit.Core/Services/IDataStore.cs @@ -28,12 +28,6 @@ namespace PluralKit.Core { public ulong? OriginalMid; } - public struct ImportedSwitch - { - public Instant Timestamp; - public IReadOnlyCollection Members; - } - public struct SwitchListEntry { public ICollection Members; @@ -265,13 +259,7 @@ namespace PluralKit.Core { /// /// The IDs of the webhook messages to delete. Task DeleteMessagesBulk(IReadOnlyCollection postedMessageIds); - - /// - /// Gets the most recent message sent by a given account in a given guild. - /// - /// The full message object, or null if none was found. - Task GetLastMessageInGuild(ulong account, ulong guild); - + /// /// Gets switches from a system. /// @@ -283,7 +271,6 @@ namespace PluralKit.Core { /// Task GetSwitchCount(PKSystem system); - /// /// Gets the latest (temporally; closest to now) switch of a given system. /// @@ -321,12 +308,6 @@ namespace PluralKit.Core { /// Task GetFrontBreakdown(PKSystem system, Instant periodStart, Instant periodEnd); - /// - /// Gets the first listed fronter in a system. - /// - /// The first fronter, or null if none are registered. - Task GetFirstFronter(PKSystem system); - /// /// Registers a switch with the given members in the given system. /// diff --git a/PluralKit.Core/Services/PostgresDataStore.cs b/PluralKit.Core/Services/PostgresDataStore.cs index c81d3fb5..0c1b976e 100644 --- a/PluralKit.Core/Services/PostgresDataStore.cs +++ b/PluralKit.Core/Services/PostgresDataStore.cs @@ -277,17 +277,6 @@ namespace PluralKit.Core { } } - public async Task GetLastMessageInGuild(ulong account, ulong guild) - { - using var conn = await _conn.Obtain(); - return (await conn.QueryAsync("select messages.*, members.*, systems.* from messages left join members on members.id = messages.member left join systems on systems.id = members.system where messages.guild = @Guild and messages.sender = @Uid order by mid desc limit 1", (msg, member, system) => new FullMessage - { - Message = msg, - System = system, - Member = member - }, new { Uid = account, Guild = guild })).FirstOrDefault(); - } - public async Task GetTotalMessages() { using (var conn = await _conn.Obtain()) @@ -340,15 +329,6 @@ namespace PluralKit.Core { _logger.Information("Updated guild configuration {@GuildCfg}", cfg); } - public async Task GetFirstFronter(PKSystem system) - { - // TODO: move to extension method since it doesn't rely on internals - var lastSwitch = await GetLatestSwitch(system); - if (lastSwitch == null) return null; - - return await GetSwitchMembers(lastSwitch).FirstOrDefaultAsync(); - } - public async Task AddSwitch(PKSystem system, IEnumerable members) { // Use a transaction here since we're doing multiple executed commands in one