Repository: discordjs/discord.js
File: packages/builders/src/messages/Attachment.ts (TypeScript)

Code before:
export class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
	/**
	 * The API data associated with this attachment.
	 */
	private readonly data: Partial<RESTAPIAttachment>;

	/**
	 * This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
	 * that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
	 * To retrieve this data, use {@link getRawFile}.
	 *
	 * @remarks This cannot be set via the constructor, primarily because of the behavior described
	 * {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
	 * That is, when editing a message's attachments, you should only be providing file data for new attachments.
	 */
	private readonly fileData: Partial<Pick<RawFile, 'contentType' | 'data'>>;

	/**
	 * Creates a new attachment builder.
	 *
	 * @param data - The API data to create this attachment with
	 * @example
	 * ```ts
	 * const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')
	 * ```
	 * @remarks <warn>Please note that the `id` field is required, it's rather easy to miss!</warn>
	 */
	public constructor(data: Partial<RESTAPIAttachment> = {}) {
		this.data = structuredClone(data);
		this.fileData = {};
	}

	/**
	 * Sets the id of the attachment.
	 *
	 * @param id - The id of the attachment
	 */
	public setId(id: Snowflake | number): this {
		this.data.id = id;
		return this;
	}

	/**
	 * Sets the description of this attachment.
	 *
	 * @param description - The description of the attachment
	 */
	public setDescription(description: string): this {
		this.data.description = description;
		return this;
	}

Review comment (suggestion):
This only works for the legacy website, which this package does not have documentation for.

```suggestion
	 * @remarks Please note that the `id` field is required, it's rather easy to miss!
```

Code after:
export class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
	/**
	 * The API data associated with this attachment.
	 */
	private readonly data: Partial<RESTAPIAttachment>;

	/**
	 * This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
	 * that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
	 * To retrieve this data, use {@link getRawFile}.
	 *
	 * @remarks This cannot be set via the constructor, primarily because of the behavior described
	 * {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
	 * That is, when editing a message's attachments, you should only be providing file data for new attachments.
	 */
	private readonly fileData: Partial<Pick<RawFile, 'contentType' | 'data'>>;

	/**
	 * Creates a new attachment builder.
	 *
	 * @param data - The API data to create this attachment with
	 * @example
	 * ```ts
	 * const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')
	 * ```
	 * @remarks Please note that the `id` field is required, it's rather easy to miss!
	 */
	public constructor(data: Partial<RESTAPIAttachment> = {}) {
		this.data = structuredClone(data);
		this.fileData = {};
	}

	/**
	 * Sets the id of the attachment.
	 *
	 * @param id - The id of the attachment
	 */
	public setId(id: Snowflake | number): this {
		this.data.id = id;
		return this;
	}

	/**
	 * Sets the description of this attachment.
	 *
	 * @param description - The description of the attachment
	 */
	public setDescription(description: string): this {
		this.data.description = description;
		return this;
	}