mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-03 12:39:54 +03:00
The project structure has been changed because the previous one had everything in 1 folder. From this PR onwards, the following is true: - The source code is stored in `src/` - `*.resx` and `Messages.Designer.cs` is stored in `locale/` - Documentation is stored on the wiki and in `docs/` - Miscellaneous files, such as dotfiles, are stored in the root folder of the repository This PR additionally fixes an issue that would cause logs of edited messages to not be syntax highlighted. This happened because the responder of edited messages was changed to use the universal `InBlockCode` extension method which did not support syntax highlighting until this PR This PR additionally changes CODEOWNERS to be more reliable. Previously, it would be possible for some PRs to be unable to be approved because the only person who can approve them is the same person who opened the PR. --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
90 lines
3.5 KiB
C#
90 lines
3.5 KiB
C#
using System.Globalization;
|
|
using Remora.Discord.API.Abstractions.Objects;
|
|
|
|
namespace Boyfriend.Data;
|
|
|
|
/// <summary>
|
|
/// Stores per-guild settings that can be set by a member
|
|
/// with <see cref="DiscordPermission.ManageGuild" /> using the /settings command
|
|
/// </summary>
|
|
public class GuildConfiguration {
|
|
/// <summary>
|
|
/// Represents a scheduled event notification receiver.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Used to selectively mention guild members when a scheduled event has started or is about to start.
|
|
/// </remarks>
|
|
public enum NotificationReceiver {
|
|
Interested,
|
|
Role
|
|
}
|
|
|
|
public static readonly Dictionary<string, CultureInfo> CultureInfoCache = new() {
|
|
{ "en", new CultureInfo("en-US") },
|
|
{ "ru", new CultureInfo("ru-RU") },
|
|
{ "mctaylors-ru", new CultureInfo("tt-RU") }
|
|
};
|
|
|
|
public string Language { get; set; } = "en";
|
|
|
|
/// <summary>
|
|
/// Controls what message should be sent in <see cref="PublicFeedbackChannel" /> when a new member joins the server.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <list type="bullet">
|
|
/// <item>No message will be sent if set to "off", "disable" or "disabled".</item>
|
|
/// <item><see cref="Messages.DefaultWelcomeMessage" /> will be sent if set to "default" or "reset"</item>
|
|
/// </list>
|
|
/// </remarks>
|
|
/// <seealso cref="GuildMemberAddResponder" />
|
|
public string WelcomeMessage { get; set; } = "default";
|
|
|
|
/// <summary>
|
|
/// Controls whether or not the <see cref="Messages.Ready" /> message should be sent
|
|
/// in <see cref="PrivateFeedbackChannel" /> on startup.
|
|
/// </summary>
|
|
/// <seealso cref="GuildCreateResponder" />
|
|
public bool ReceiveStartupMessages { get; set; }
|
|
|
|
public bool RemoveRolesOnMute { get; set; }
|
|
|
|
/// <summary>
|
|
/// Controls whether or not a guild member's roles are returned if he/she leaves and then joins back.
|
|
/// </summary>
|
|
/// <remarks>Roles will not be returned if the member left the guild because of /ban or /kick.</remarks>
|
|
public bool ReturnRolesOnRejoin { get; set; }
|
|
|
|
public bool AutoStartEvents { get; set; }
|
|
|
|
/// <summary>
|
|
/// Controls what channel should all public messages be sent to.
|
|
/// </summary>
|
|
public ulong PublicFeedbackChannel { get; set; }
|
|
|
|
/// <summary>
|
|
/// Controls what channel should all private, moderator-only messages be sent to.
|
|
/// </summary>
|
|
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; }
|
|
|
|
/// <summary>
|
|
/// Controls what guild members should be mentioned when a scheduled event has started or is about to start.
|
|
/// </summary>
|
|
/// <seealso cref="NotificationReceiver" />
|
|
public List<NotificationReceiver> EventStartedReceivers { get; set; }
|
|
= new() { NotificationReceiver.Interested, NotificationReceiver.Role };
|
|
|
|
/// <summary>
|
|
/// Controls the amount of time before a scheduled event to send a reminder in <see cref="EventNotificationChannel" />.
|
|
/// </summary>
|
|
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];
|
|
}
|
|
}
|