Table of Contents

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

module ModuleBuilder

Parent module of this command.

name string

Name of this command.

callback ExecuteCallback

Execution callback of this command.

Properties

CommandType

Gets the type of this command.

public ApplicationCommandType CommandType { get; set; }

Property Value

ApplicationCommandType

ContextTypes

Gets the context types this command can be executed in.

public HashSet<InteractionContextType> ContextTypes { get; set; }

Property Value

HashSet<InteractionContextType>

DefaultMemberPermissions

Gets the default permissions needed for executing this command.

public GuildPermission? DefaultMemberPermissions { get; set; }

Property Value

GuildPermission?

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

bool

Instance

protected override ContextCommandBuilder Instance { get; }

Property Value

ContextCommandBuilder

IntegrationTypes

Gets the install method for this command.

public HashSet<ApplicationIntegrationType> IntegrationTypes { get; set; }

Property Value

HashSet<ApplicationIntegrationType>

IsEnabledInDm

Gets whether this command can be used in DMs.

public bool IsEnabledInDm { get; set; }

Property Value

bool

IsNsfw

Gets whether this command is age restricted.

public bool IsNsfw { get; set; }

Property Value

bool

Methods

AddParameter(Action<CommandParameterBuilder>)

Adds a command parameter to the parameters collection.

public override ContextCommandBuilder AddParameter(Action<CommandParameterBuilder> configure)

Parameters

configure Action<CommandParameterBuilder>

CommandParameterBuilder factory.

Returns

ContextCommandBuilder

The builder instance.

SetDefaultPermission(bool)

[Obsolete("To be deprecated soon, use SetEnabledInDm and WithDefaultMemberPermissions instead.")]
public ContextCommandBuilder SetDefaultPermission(bool defaultPermision)

Parameters

defaultPermision bool

New value of the DefaultPermission.

Returns

ContextCommandBuilder

The builder instance.

SetEnabledInDm(bool)

public ContextCommandBuilder SetEnabledInDm(bool isEnabled)

Parameters

isEnabled bool

New value of the IsEnabledInDm.

Returns

ContextCommandBuilder

The builder instance.

SetNsfw(bool)

Sets IsNsfw.

public ContextCommandBuilder SetNsfw(bool isNsfw)

Parameters

isNsfw bool

New value of the IsNsfw.

Returns

ContextCommandBuilder

The builder instance.

SetType(ApplicationCommandType)

public ContextCommandBuilder SetType(ApplicationCommandType commandType)

Parameters

commandType ApplicationCommandType

New value of the CommandType.

Returns

ContextCommandBuilder

The builder instance.

WithContextTypes(params InteractionContextType[])

public ContextCommandBuilder WithContextTypes(params InteractionContextType[] contextTypes)

Parameters

contextTypes InteractionContextType[]

Context types the command can be executed in.

Returns

ContextCommandBuilder

The builder instance.

WithDefaultMemberPermissions(GuildPermission)

public ContextCommandBuilder WithDefaultMemberPermissions(GuildPermission permissions)

Parameters

permissions GuildPermission

New value of the DefaultMemberPermissions.

Returns

ContextCommandBuilder

The builder instance.

WithIntegrationTypes(params ApplicationIntegrationType[])

public ContextCommandBuilder WithIntegrationTypes(params ApplicationIntegrationType[] integrationTypes)

Parameters

integrationTypes ApplicationIntegrationType[]

Install types for this command.

Returns

ContextCommandBuilder

The builder instance.