Skip to content

CommandPermission

Implementation of the Application Command Permission Structure as a Luau builder.

https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure

CommandPermission.id  :: string?

The ID of the role, user, or channel this permission applies to.

CommandPermission.type  :: CommandPermissionType?

Whether this permission targets a role, user, or channel.

CommandPermission.permission  :: boolean

Whether the target is allowed (true) or denied (false) access to the command.

CommandPermission : setId ( id )  -> CommandPermission

Sets the ID of the role, user, or channel this permission applies to.

Parameters

id: Snowflake

Returns

CommandPermission
CommandPermission : setType ( permissionType )  -> CommandPermission

Sets the type of entity this permission targets.

Parameters

permissionType: CommandPermissionType

Returns

CommandPermission
CommandPermission : allow ( )  -> CommandPermission

Allows the targeted role, user, or channel to use the command.

Returns

CommandPermission
CommandPermission : deny ( )  -> CommandPermission

Denies the targeted role, user, or channel from using the command.

Returns

CommandPermission
CommandPermission : build ( )  -> JSON

Responsible for building the GuildApplicationCommandPermissionObject JSON that can be parsed by the Discord API.

Returns

JSON
CommandPermission . new ( resource )  -> CommandPermission

Responsible for creating a new CommandPermission.

Parameters

resource: {
id: apiTypes.Snowflake?,
permissionType: CommandPermissionType?,
permission: boolean?,
}

Returns

CommandPermission