1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-30 02:59:54 +03:00

Add support for temporary bans

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-06-11 16:57:19 +05:00
parent e883e143eb
commit 9c080d9691
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
10 changed files with 144 additions and 31 deletions

View file

@ -1,4 +1,5 @@
using System.Globalization;
using Remora.Rest.Core;
namespace Boyfriend.Data;
@ -10,17 +11,31 @@ public class GuildData {
public readonly GuildConfiguration Configuration;
public readonly string ConfigurationPath;
public readonly Dictionary<ulong, MemberData> MemberData;
public readonly string MemberDataPath;
public readonly Dictionary<ulong, ScheduledEventData> ScheduledEvents;
public readonly string ScheduledEventsPath;
public GuildData(
GuildConfiguration configuration, string configurationPath,
Dictionary<ulong, ScheduledEventData> scheduledEvents, string scheduledEventsPath) {
Dictionary<ulong, ScheduledEventData> scheduledEvents, string scheduledEventsPath,
Dictionary<ulong, MemberData> memberData, string memberDataPath) {
Configuration = configuration;
ConfigurationPath = configurationPath;
ScheduledEvents = scheduledEvents;
ScheduledEventsPath = scheduledEventsPath;
MemberData = memberData;
MemberDataPath = memberDataPath;
}
public CultureInfo Culture => Configuration.Culture;
public CultureInfo Culture => Configuration.GetCulture();
public MemberData GetMemberData(Snowflake userId) {
if (MemberData.TryGetValue(userId.Value, out var existing)) return existing;
var newData = new MemberData(userId.Value, null);
MemberData.Add(userId.Value, newData);
return newData;
}
}