rename the new precondition + remove obsolete from the old one (#2988)

This commit is contained in:
Mihail Gribkov
2024-08-29 00:04:54 +03:00
committed by GitHub
parent 57eb906552
commit 5ca5aa51c4
2 changed files with 4 additions and 5 deletions

View File

@@ -7,7 +7,6 @@ namespace Discord.Interactions
/// Requires the bot to have a specific permission in the channel a command is invoked in. /// Requires the bot to have a specific permission in the channel a command is invoked in.
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
[Obsolete("This attribute does not support user app interactions. Consider switching to 'RequireAppPermissionAttribute'", false)]
public class RequireBotPermissionAttribute : PreconditionAttribute public class RequireBotPermissionAttribute : PreconditionAttribute
{ {
/// <summary> /// <summary>

View File

@@ -4,10 +4,10 @@ using System;
namespace Discord.Interactions; namespace Discord.Interactions;
/// <summary> /// <summary>
/// Requires the bot to have a specific permission in the channel a command is invoked in. /// Requires the bot to have a specific permission in the context a command is invoked in.
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireAppPermissionAttribute : PreconditionAttribute public class RequireContextPermissionAttribute : PreconditionAttribute
{ {
/// <summary> /// <summary>
/// Gets the specified <see cref="Discord.GuildPermission" /> of the precondition. /// Gets the specified <see cref="Discord.GuildPermission" /> of the precondition.
@@ -35,7 +35,7 @@ public class RequireAppPermissionAttribute : PreconditionAttribute
/// The <see cref="Discord.GuildPermission"/> that the bot must have. Multiple permissions can be specified /// The <see cref="Discord.GuildPermission"/> that the bot must have. Multiple permissions can be specified
/// by ORing the permissions together. /// by ORing the permissions together.
/// </param> /// </param>
public RequireAppPermissionAttribute(GuildPermission permission) public RequireContextPermissionAttribute(GuildPermission permission)
{ {
GuildPermission = permission; GuildPermission = permission;
ChannelPermission = null; ChannelPermission = null;
@@ -47,7 +47,7 @@ public class RequireAppPermissionAttribute : PreconditionAttribute
/// The <see cref="Discord.ChannelPermission"/> that the bot must have. Multiple permissions can be /// The <see cref="Discord.ChannelPermission"/> that the bot must have. Multiple permissions can be
/// specified by ORing the permissions together. /// specified by ORing the permissions together.
/// </param> /// </param>
public RequireAppPermissionAttribute(ChannelPermission permission) public RequireContextPermissionAttribute(ChannelPermission permission)
{ {
ChannelPermission = permission; ChannelPermission = permission;
GuildPermission = null; GuildPermission = null;