Class ContextCommandBuilder
- Namespace
 - Discord.Interactions.Builders
 
- Assembly
 - Discord.Net.Interactions.dll
 
Represents a builder for creating ContextCommandInfo.
public sealed class ContextCommandBuilder : CommandBuilder<ContextCommandInfo, ContextCommandBuilder, CommandParameterBuilder>, ICommandBuilder
  - Inheritance
 - 
      
      
      ContextCommandBuilder
 
- Implements
 
- Inherited Members
 
Constructors
ContextCommandBuilder(ModuleBuilder, string, ExecuteCallback)
Initializes a new ContextCommandBuilder.
public ContextCommandBuilder(ModuleBuilder module, string name, ExecuteCallback callback)
  Parameters
moduleModuleBuilderParent module of this command.
namestringName of this command.
callbackExecuteCallbackExecution callback of this command.
Properties
CommandType
Gets the type of this command.
public ApplicationCommandType CommandType { get; set; }
  Property Value
ContextTypes
Gets the context types this command can be executed in.
public HashSet<InteractionContextType> ContextTypes { get; set; }
  Property Value
DefaultMemberPermissions
Gets the default permissions needed for executing this command.
public GuildPermission? DefaultMemberPermissions { get; set; }
  Property Value
DefaultPermission
Gets the default permission of this command.
[Obsolete("To be deprecated soon, use IsEnabledInDm and DefaultMemberPermissions instead.")]
public bool DefaultPermission { get; set; }
  Property Value
Instance
protected override ContextCommandBuilder Instance { get; }
  Property Value
IntegrationTypes
Gets the install method for this command.
public HashSet<ApplicationIntegrationType> IntegrationTypes { get; set; }
  Property Value
IsEnabledInDm
Gets whether this command can be used in DMs.
public bool IsEnabledInDm { get; set; }
  Property Value
IsNsfw
Gets whether this command is age restricted.
public bool IsNsfw { get; set; }
  Property Value
Methods
AddParameter(Action<CommandParameterBuilder>)
Adds a command parameter to the parameters collection.
public override ContextCommandBuilder AddParameter(Action<CommandParameterBuilder> configure)
  Parameters
configureAction<CommandParameterBuilder>CommandParameterBuilder factory.
Returns
- ContextCommandBuilder
 The builder instance.
SetDefaultPermission(bool)
Sets DefaultPermission.
[Obsolete("To be deprecated soon, use SetEnabledInDm and WithDefaultMemberPermissions instead.")]
public ContextCommandBuilder SetDefaultPermission(bool defaultPermision)
  Parameters
defaultPermisionboolNew value of the DefaultPermission.
Returns
- ContextCommandBuilder
 The builder instance.
SetEnabledInDm(bool)
Sets IsEnabledInDm.
public ContextCommandBuilder SetEnabledInDm(bool isEnabled)
  Parameters
isEnabledboolNew value of the IsEnabledInDm.
Returns
- ContextCommandBuilder
 The builder instance.
SetNsfw(bool)
Sets IsNsfw.
public ContextCommandBuilder SetNsfw(bool isNsfw)
  Parameters
Returns
- ContextCommandBuilder
 The builder instance.
SetType(ApplicationCommandType)
Sets CommandType.
public ContextCommandBuilder SetType(ApplicationCommandType commandType)
  Parameters
commandTypeApplicationCommandTypeNew value of the CommandType.
Returns
- ContextCommandBuilder
 The builder instance.
WithContextTypes(params InteractionContextType[])
Sets the ContextTypes of this ContextCommandBuilder.
public ContextCommandBuilder WithContextTypes(params InteractionContextType[] contextTypes)
  Parameters
contextTypesInteractionContextType[]Context types the command can be executed in.
Returns
- ContextCommandBuilder
 The builder instance.
WithDefaultMemberPermissions(GuildPermission)
Sets DefaultMemberPermissions.
public ContextCommandBuilder WithDefaultMemberPermissions(GuildPermission permissions)
  Parameters
permissionsGuildPermissionNew value of the DefaultMemberPermissions.
Returns
- ContextCommandBuilder
 The builder instance.
WithIntegrationTypes(params ApplicationIntegrationType[])
Sets the IntegrationTypes of this ContextCommandBuilder.
public ContextCommandBuilder WithIntegrationTypes(params ApplicationIntegrationType[] integrationTypes)
  Parameters
integrationTypesApplicationIntegrationType[]Install types for this command.
Returns
- ContextCommandBuilder
 The builder instance.