The publish command is a way to publish slash commands to Discord. It uses the PUT route to overwrite existing commands.
Wherever your commands directory is located, publish will override the existing application commands on Discord. Existing commands do not count towards the command limit creation daily.
The publish command automatically reads your .env file in the working directory. If you do not have a .env file, you can pass in the --token and --appId flags.
Your .env file should look like this:
Usage
Features
Automatically syncs API with your command base
Generates a JSON file of output (.sern/command-data-remote.json)
Supports publishing direct ESM TypeScript files
Prerequire scripts are supported
Supports a configuration that is the same as the original publish plugin
Each command file can have an extra config that follows ValidPublishOptions
This can be a function or a PublishConfig object
Config
Prerequiring
Is there a service that is required at the top level of a command?
Create an ES6 script anywhere, such as:
This will create a container for publishing.
Example
This example will publish a ping command to a specific guild: 889026545715400705.