using System.Globalization; using Remora.Discord.API.Abstractions.Objects; namespace Boyfriend.Data; /// /// Stores per-guild settings that can be set by a member /// with using the /settings command /// public class GuildConfiguration { /// /// Represents a scheduled event notification receiver. /// /// /// Used to selectively mention guild members when a scheduled event has started or is about to start. /// public enum NotificationReceiver { Interested, Role } public static readonly Dictionary CultureInfoCache = new() { { "en", new CultureInfo("en-US") }, { "ru", new CultureInfo("ru-RU") }, { "mctaylors-ru", new CultureInfo("tt-RU") } }; public string Language { get; set; } = "en"; /// /// Controls what message should be sent in when a new member joins the server. /// /// /// /// No message will be sent if set to "off", "disable" or "disabled". /// will be sent if set to "default" or "reset" /// /// /// public string WelcomeMessage { get; set; } = "default"; /// /// Controls whether or not the message should be sent /// in on startup. /// /// public bool ReceiveStartupMessages { get; set; } public bool RemoveRolesOnMute { get; set; } /// /// Controls whether or not a guild member's roles are returned if he/she leaves and then joins back. /// /// Roles will not be returned if the member left the guild because of /ban or /kick. public bool ReturnRolesOnRejoin { get; set; } public bool AutoStartEvents { get; set; } /// /// Controls what channel should all public messages be sent to. /// public ulong PublicFeedbackChannel { get; set; } /// /// Controls what channel should all private, moderator-only messages be sent to. /// public ulong PrivateFeedbackChannel { get; set; } public ulong EventNotificationChannel { get; set; } public ulong DefaultRole { get; set; } public ulong MuteRole { get; set; } public ulong EventNotificationRole { get; set; } /// /// Controls what guild members should be mentioned when a scheduled event has started or is about to start. /// /// public List EventStartedReceivers { get; set; } = new() { NotificationReceiver.Interested, NotificationReceiver.Role }; /// /// Controls the amount of time before a scheduled event to send a reminder in . /// public TimeSpan EventEarlyNotificationOffset { get; set; } = TimeSpan.Zero; // Do not convert this to a property, else serialization will be attempted public CultureInfo GetCulture() { return CultureInfoCache[Language]; } }