CommandRepositoryTrait
Replaces all of an application's commands in one request. Shared by the global and guild command repositories.
Tags
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
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.