Class RequireRoleAttribute
- Namespace
- HeyBox.Interactions
- Assembly
- HeyBox.Net.Interactions.dll
要求调用命令的用户拥有指定的角色。
public class RequireRoleAttribute : PreconditionAttribute
- Inheritance
-
RequireRoleAttribute
- Inherited Members
Constructors
RequireRoleAttribute(ulong)
要求调用命令的用户拥有特定角色。
public RequireRoleAttribute(ulong roleId)
Parameters
roleId
ulong需要用户拥有的角色 ID。
Properties
NotAGuildErrorMessage
获取或设置如果由于在非群组频道运行而导致先决条件失败时的错误消息。
public string? NotAGuildErrorMessage { get; set; }
Property Value
RoleId
获取此先决条件指定的角色 ID。
public ulong RoleId { get; }
Property Value
Methods
CheckRequirementsAsync(IInteractionContext, ICommandInfo, IServiceProvider?)
检查 commandInfo
所代表的命令是否满足先决条件。
public override Task<PreconditionResult> CheckRequirementsAsync(IInteractionContext context, ICommandInfo commandInfo, IServiceProvider? services)
Parameters
context
IInteractionContext命令的上下文。
commandInfo
ICommandInfo被执行的命令。
services
IServiceProvider用于依赖注入的服务集合。