mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(ApplicationCommand): add setX methods for easier editing (#7063)
Co-authored-by: awned <65061212+ceilingfans@users.noreply.github.com>
This commit is contained in:
@@ -170,6 +170,42 @@ class ApplicationCommand extends Base {
|
||||
return this.manager.edit(this, data, this.guildId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the name of this ApplicationCommand
|
||||
* @param {string} name The new name of the command
|
||||
* @returns {Promise<ApplicationCommand>}
|
||||
*/
|
||||
setName(name) {
|
||||
return this.edit({ name });
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the description of this ApplicationCommand
|
||||
* @param {string} description The new description of the command
|
||||
* @returns {Promise<ApplicationCommand>}
|
||||
*/
|
||||
setDescription(description) {
|
||||
return this.edit({ description });
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the default permission of this ApplicationCommand
|
||||
* @param {boolean} [defaultPermission=true] The default permission for this command
|
||||
* @returns {Promise<ApplicationCommand>}
|
||||
*/
|
||||
setDefaultPermission(defaultPermission = true) {
|
||||
return this.edit({ defaultPermission });
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the options of this ApplicationCommand
|
||||
* @param {ApplicationCommandOptionData[]} options The options to set for this command
|
||||
* @returns {Promise<ApplicationCommand>}
|
||||
*/
|
||||
setOptions(options) {
|
||||
return this.edit({ options });
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes this command.
|
||||
* @returns {Promise<ApplicationCommand>}
|
||||
|
||||
4
typings/index.d.ts
vendored
4
typings/index.d.ts
vendored
@@ -226,6 +226,10 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
||||
public version: Snowflake;
|
||||
public delete(): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public edit(data: ApplicationCommandData): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public setName(name: string): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public setDescription(description: string): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public setDefaultPermission(defaultPermission?: boolean): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public setOptions(options: ApplicationCommandOptionData[]): Promise<ApplicationCommand<PermissionsFetchType>>;
|
||||
public equals(
|
||||
command: ApplicationCommand | ApplicationCommandData | RawApplicationCommandData,
|
||||
enforceOptionorder?: boolean,
|
||||
|
||||
Reference in New Issue
Block a user