From bbb640df5626ce467ce58f2e84163418df0ed150 Mon Sep 17 00:00:00 2001 From: Noi Date: Mon, 16 Jan 2023 21:52:11 -0800 Subject: [PATCH] Mark remaining preconditions as obsolete --- .../Preconditions/RequireBotModerator.cs | 1 + .../Preconditions/RequireGuildContext.cs | 1 + BirthdayBot.csproj | 2 +- Data/GuildConfig.cs | 10 ++-------- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ApplicationCommands/Preconditions/RequireBotModerator.cs b/ApplicationCommands/Preconditions/RequireBotModerator.cs index 74aaf3b..a6a6589 100644 --- a/ApplicationCommands/Preconditions/RequireBotModerator.cs +++ b/ApplicationCommands/Preconditions/RequireBotModerator.cs @@ -6,6 +6,7 @@ namespace BirthdayBot.ApplicationCommands; /// Precondition requiring the executing user be recognized as a bot moderator.
/// A bot moderator has either the Manage Server permission or is a member of the designated bot moderator role. /// +[Obsolete("Replace with appropriate DefaultMemberPermissionsAttribute")] class RequireBotModeratorAttribute : PreconditionAttribute { public const string Error = "User did not pass the mod check."; public const string Reply = ":x: You must be a moderator to use this command."; diff --git a/ApplicationCommands/Preconditions/RequireGuildContext.cs b/ApplicationCommands/Preconditions/RequireGuildContext.cs index f196bd4..d4c8ab0 100644 --- a/ApplicationCommands/Preconditions/RequireGuildContext.cs +++ b/ApplicationCommands/Preconditions/RequireGuildContext.cs @@ -5,6 +5,7 @@ namespace BirthdayBot.ApplicationCommands; /// Implements the included precondition from Discord.Net, requiring a guild context while using our custom error message.

/// Combining this with is redundant. If possible, only use the latter instead. /// +[Obsolete("Replace with EnableInDmAttribute")] class RequireGuildContextAttribute : RequireContextAttribute { public const string Error = "Command not received within a guild context."; public const string Reply = ":x: This command is only available within a server."; diff --git a/BirthdayBot.csproj b/BirthdayBot.csproj index d8150f9..3c00934 100644 --- a/BirthdayBot.csproj +++ b/BirthdayBot.csproj @@ -5,7 +5,7 @@ net6.0 enable enable - 3.4.6 + 3.4.7 NoiTheCat diff --git a/Data/GuildConfig.cs b/Data/GuildConfig.cs index 2b3c009..e3d747d 100644 --- a/Data/GuildConfig.cs +++ b/Data/GuildConfig.cs @@ -4,11 +4,6 @@ using System.ComponentModel.DataAnnotations.Schema; namespace BirthdayBot.Data; [Table("settings")] public class GuildConfig { - public GuildConfig() { - BlockedUsers = new HashSet(); - UserEntries = new HashSet(); - } - [Key] public ulong GuildId { get; set; } @@ -23,6 +18,7 @@ public class GuildConfig { public bool Moderated { get; set; } + [Obsolete("To be removed when RequireBotModeratorAttribute is also removed")] public ulong? ModeratorRole { get; set; } public string? AnnounceMessage { get; set; } @@ -33,10 +29,8 @@ public class GuildConfig { public DateTimeOffset LastSeen { get; set; } - [InverseProperty(nameof(BlocklistEntry.Guild))] - public ICollection BlockedUsers { get; set; } [InverseProperty(nameof(UserEntry.Guild))] - public ICollection UserEntries { get; set; } + public ICollection UserEntries { get; set; } = null!; /// /// Gets if this instance is new and does not (yet) exist in the database.