Class RequireChannelAttribute
This attribute requires a interaction to be executed in a specific channel.
Inherited Members
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Color_Chan.Discord.Commands.Attributes.ProvidedRequirements
Assembly: Color-Chan.Discord.Commands.dll
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class RequireChannelAttribute : InteractionRequirementAttribute
Examples
[RequireChannel(0123456789)]
public class PongCommands : SlashCommandModule
{
[SlashCommand("ping", "Ping Pong!")]
public Task<IDiscordInteractionResponse> PongAsync()
{
// Command code...
}
}
Constructors
| Improve this Doc View SourceRequireChannelAttribute(UInt64)
Initializes a new instance of RequireChannelAttribute.
Declaration
public RequireChannelAttribute(ulong channelId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | channelId | The ID of the channel. |
Methods
| Improve this Doc View SourceCheckRequirementAsync(IInteractionContext, IServiceProvider)
Checks if a specific requirement for a interaction request has met.
Declaration
public override Task<Result> CheckRequirementAsync(IInteractionContext context, IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | The IInteractionContext of the interaction request. |
System.IServiceProvider | services | The System.IServiceProvider containing all the necessary dependencies for the interaction request. |
Returns
Type | Description |
---|---|
Task<Result> | The result of the interaction request requirement. |