Skip to content

Commit

Permalink
chore: make requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
suneettipirneni committed Nov 26, 2022
1 parent 37cfe43 commit 1c3672c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions packages/discord.js/src/structures/ApplicationCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class ApplicationCommand extends Base {
*/
this.type = data.type;

/**
* Whether this command is age-restricted (18+)
* @type {boolean}
*/
this.nsfw = data.nsfw ?? false;

this._patch(data);
}

Expand Down Expand Up @@ -152,16 +158,6 @@ class ApplicationCommand extends Base {
*/
this.version = data.version;
}

if ('nsfw' in data) {
/**
* Whether this command is NSFW
* @type {?boolean}
*/
this.nsfw = data.nsfw;
} else {
this.nsfw ??= null;
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
>;
public type: ApplicationCommandType;
public version: Snowflake;
public nsfw: boolean | null;
public nsfw: boolean;
public delete(): Promise<ApplicationCommand<PermissionsFetchType>>;
public edit(data: Partial<ApplicationCommandData>): Promise<ApplicationCommand<PermissionsFetchType>>;
public setName(name: string): Promise<ApplicationCommand<PermissionsFetchType>>;
Expand Down Expand Up @@ -4166,6 +4166,7 @@ export interface BaseApplicationCommandData {
nameLocalizations?: LocalizationMap;
dmPermission?: boolean;
defaultMemberPermissions?: PermissionResolvable | null;
nsfw?: boolean;
}

export interface AttachmentData {
Expand Down Expand Up @@ -4216,7 +4217,6 @@ export interface ChatInputApplicationCommandData extends BaseApplicationCommandD
descriptionLocalizations?: LocalizationMap;
type?: ApplicationCommandType.ChatInput;
options?: ApplicationCommandOptionData[];
nsfw?: boolean;
}

export type ApplicationCommandData =
Expand Down

0 comments on commit 1c3672c

Please sign in to comment.