Mark remaining preconditions as obsolete

This commit is contained in:
Noi 2023-01-16 21:52:11 -08:00
parent e4f5c90aab
commit bbb640df56
4 changed files with 5 additions and 9 deletions

View file

@ -6,6 +6,7 @@ namespace BirthdayBot.ApplicationCommands;
/// Precondition requiring the executing user be recognized as a bot moderator.<br/>
/// A bot moderator has either the Manage Server permission or is a member of the designated bot moderator role.
/// </summary>
[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.";

View file

@ -5,6 +5,7 @@ namespace BirthdayBot.ApplicationCommands;
/// Implements the included precondition from Discord.Net, requiring a guild context while using our custom error message.<br/><br/>
/// Combining this with <see cref="RequireBotModeratorAttribute"/> is redundant. If possible, only use the latter instead.
/// </summary>
[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.";

View file

@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>3.4.6</Version>
<Version>3.4.7</Version>
<Authors>NoiTheCat</Authors>
</PropertyGroup>

View file

@ -4,11 +4,6 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace BirthdayBot.Data;
[Table("settings")]
public class GuildConfig {
public GuildConfig() {
BlockedUsers = new HashSet<BlocklistEntry>();
UserEntries = new HashSet<UserEntry>();
}
[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<BlocklistEntry> BlockedUsers { get; set; }
[InverseProperty(nameof(UserEntry.Guild))]
public ICollection<UserEntry> UserEntries { get; set; }
public ICollection<UserEntry> UserEntries { get; set; } = null!;
/// <summary>
/// Gets if this instance is new and does not (yet) exist in the database.