2024-10-14 14:56:40 +02:00
|
|
|
// Copyright (C) 2021-present sam (starshines.gay)
|
|
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Affero General Public License as published
|
|
|
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
2024-10-09 22:31:58 +02:00
|
|
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
2024-08-19 16:12:28 +02:00
|
|
|
using Remora.Discord.API.Abstractions.Objects;
|
|
|
|
|
using Remora.Rest.Core;
|
|
|
|
|
|
|
|
|
|
namespace Catalogger.Backend.Cache;
|
|
|
|
|
|
|
|
|
|
public interface IMemberCache
|
|
|
|
|
{
|
|
|
|
|
public Task<IGuildMember?> TryGetAsync(Snowflake guildId, Snowflake userId);
|
|
|
|
|
public Task SetAsync(Snowflake guildId, IGuildMember member);
|
|
|
|
|
public Task SetManyAsync(Snowflake guildId, IReadOnlyList<IGuildMember> members);
|
2024-09-02 17:00:33 +02:00
|
|
|
public Task RemoveAsync(Snowflake guildId, Snowflake userId);
|
2024-08-19 16:12:28 +02:00
|
|
|
public Task<bool> IsGuildCachedAsync(Snowflake guildId);
|
|
|
|
|
public Task MarkAsCachedAsync(Snowflake guildId);
|
|
|
|
|
public Task MarkAsUncachedAsync(Snowflake guildId);
|
2024-10-09 22:31:58 +02:00
|
|
|
public Task UpdateAsync(IGuildMemberUpdate newMember);
|
2024-10-20 15:20:22 +02:00
|
|
|
|
|
|
|
|
// These methods can be stubbed out for any implementation that isn't intended for use with the dashboard.
|
|
|
|
|
public Task SetMemberNamesAsync(Snowflake guildId, IEnumerable<IGuildMember> members);
|
|
|
|
|
|
|
|
|
|
public Task UpdateMemberNameAsync(
|
|
|
|
|
Snowflake guildId,
|
|
|
|
|
Snowflake userId,
|
|
|
|
|
string prevName,
|
|
|
|
|
string newName
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<(string Name, string Id)>> GetMemberNamesAsync(
|
|
|
|
|
Snowflake guildId,
|
|
|
|
|
string prefix
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
public Task TryRemoveMemberNameAsync(Snowflake guildId, string username);
|
2024-10-09 17:35:11 +02:00
|
|
|
}
|