DiscordPHP Documentation

CommandRepositoryTrait

Replaces all of an application's commands in one request. Shared by the global and guild command repositories.

Tags
since
10.60.0

Table of Contents

Methods

bulkOverwrite()  : PromiseInterface<string|int, static>
Overwrites the application's commands with the ones given, in a single request.
putCommands()  : PromiseInterface<string|int, array<string|int, mixed>>
Sends the complete list of commands, to the route for global commands or for a guild's.

Methods

bulkOverwrite()

Overwrites the application's commands with the ones given, in a single request.

public bulkOverwrite(array<string|int, CommandBuilder|Command|array<string|int, mixed>> $commands) : PromiseInterface<string|int, static>

Commands missing from the list are deleted, those whose name and type match an existing command update it, and the rest are created. Commands that do not change do not count toward the daily limit on creating them. Afterwards the repository holds exactly the commands Discord returns.

Parameters
$commands : array<string|int, CommandBuilder|Command|array<string|int, mixed>>

Every command the application should have here.

Tags
link
https://docs.discord.com/developers/interactions/application-commands#bulk-overwrite-global-application-commands
https://docs.discord.com/developers/interactions/application-commands#bulk-overwrite-guild-application-commands
since
10.60.0
Return values
PromiseInterface<string|int, static>

putCommands()

Sends the complete list of commands, to the route for global commands or for a guild's.

protected abstract putCommands(array<string|int, array<string|int, mixed>> $commands) : PromiseInterface<string|int, array<string|int, mixed>>

Each repository names its own route here, so the request is visible where its endpoint is.

Parameters
$commands : array<string|int, array<string|int, mixed>>

The commands, ready to send.

Return values
PromiseInterface<string|int, array<string|int, mixed>> —

The commands as Discord now has them.

On this page

Search results