Table of Contents

Class ApplicationCommandPermission

Namespace
Discord
Assembly
Discord.Net.Core.dll

Application command permissions allow you to enable or disable commands for specific users or roles within a guild.

public class ApplicationCommandPermission
Inheritance
ApplicationCommandPermission
Inherited Members

Constructors

ApplicationCommandPermission(IChannel, bool)

Creates a new ApplicationCommandPermission targeting Channel.

public ApplicationCommandPermission(IChannel channel, bool allow)

Parameters

channel IChannel

The channel you want to target this permission value for.

allow bool

The value of this permission.

ApplicationCommandPermission(IRole, bool)

Creates a new ApplicationCommandPermission targeting Role.

public ApplicationCommandPermission(IRole target, bool allow)

Parameters

target IRole

The role you want to target this permission value for.

allow bool

The value of this permission.

ApplicationCommandPermission(IUser, bool)

Creates a new ApplicationCommandPermission targeting User.

public ApplicationCommandPermission(IUser target, bool allow)

Parameters

target IUser

The user you want to target this permission value for.

allow bool

The value of this permission.

ApplicationCommandPermission(ulong, ApplicationCommandPermissionTarget, bool)

public ApplicationCommandPermission(ulong targetId, ApplicationCommandPermissionTarget targetType, bool allow)

Parameters

targetId ulong

The id you want to target this permission value for.

targetType ApplicationCommandPermissionTarget

The type of the targetId parameter.

allow bool

The value of this permission.

Properties

Permission

true to allow, otherwise false.

public bool Permission { get; }

Property Value

bool

TargetId

The id of the role or user.

public ulong TargetId { get; }

Property Value

ulong

TargetType

The target of this permission.

public ApplicationCommandPermissionTarget TargetType { get; }

Property Value

ApplicationCommandPermissionTarget

Methods

ForAllChannels(IGuild, bool)

Creates a new ApplicationCommandPermission targeting every channel in a guild.

public static ApplicationCommandPermission ForAllChannels(IGuild guild, bool allow)

Parameters

guild IGuild

Target guild.

allow bool

The value of this permission.

Returns

ApplicationCommandPermission

Instance of ApplicationCommandPermission targeting every channel in a guild.

ForAllChannels(ulong, bool)

Creates a new ApplicationCommandPermission targeting every channel in a guild.

public static ApplicationCommandPermission ForAllChannels(ulong guildId, bool allow)

Parameters

guildId ulong

Id of the target guild.

allow bool

The value of this permission.

Returns

ApplicationCommandPermission

Instance of ApplicationCommandPermission targeting every channel in a guild.

ForEveryone(IGuild, bool)

Creates a new ApplicationCommandPermission targeting @everyone in a guild.

public static ApplicationCommandPermission ForEveryone(IGuild guild, bool allow)

Parameters

guild IGuild

Target guild.

allow bool

The value of this permission.

Returns

ApplicationCommandPermission

Instance of ApplicationCommandPermission targeting @everyone in a guild.

ForEveryone(ulong, bool)

Creates a new ApplicationCommandPermission targeting @everyone in a guild.

public static ApplicationCommandPermission ForEveryone(ulong guildId, bool allow)

Parameters

guildId ulong

Id of the target guild.

allow bool

The value of this permission.

Returns

ApplicationCommandPermission

Instance of ApplicationCommandPermission targeting @everyone in a guild.