Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typings(Attachment): make attachment private #8982

Merged
merged 9 commits into from Feb 17, 2023
Merged

typings(Attachment): make attachment private #8982

merged 9 commits into from Feb 17, 2023

Conversation

net-tech
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

Removes <Attachment>.attachment. This isn't documented anywhere in the docs and from my testing returns a URL like https://cdn.discordapp.com/ephemeral-attachments/XXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXX/message.txt. If this is here on purpose then the typing should be string, not BufferResolvable | Stream.

Status and versioning classification:

  • This PR only includes non-code changes, like changes to documentation, README, etc.
  • Code changes have been tested against the Discord API, or there are no code changes

@vercel
Copy link

vercel bot commented Dec 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 17, 2023 at 9:13PM (UTC)
discord-js-guide ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 17, 2023 at 9:13PM (UTC)

@net-tech net-tech changed the title typings(Attachment): remove attachment property typings(Attachment): remove attachment Dec 26, 2022
@Jiralite
Copy link
Member

Jiralite commented Dec 26, 2022

I cannot seem to find where this is referenced:

Perhaps it's a remnant of an old refactor - possibly from being split into a builder? That property can be removed too. Pretty sure.

@Jiralite Jiralite added this to the discord.js v14.8 milestone Dec 26, 2022
@Jiralite
Copy link
Member

Jiralite commented Dec 26, 2022

Okay, I just found out how and where this is being used.

Let's say a message is created and it has an attachment. They would be created as an Attachment. The property this.attachment = data.url; is being defined here.

We modify that via AttachmentBuilder.from(). For example: const attachment = AttachmentBuilder.from(message.attachments.first());

Without that property, it looks like the AttachmentBuilder will not be properly created. Definitely something funny is going on here (I'm a little confused by the JSDoc), but for now, I would keep that property as it is and remove only the typing or make it private.

@net-tech
Copy link
Contributor Author

@Jiralite Wait, revert structures change and keep the typing removed entirely or revert structures change and keep the typing but change it to string?

@Jiralite
Copy link
Member

Probably best to remove the typings altogether since there is no documentation for it.

@Syjalo
Copy link
Contributor

Syjalo commented Dec 27, 2022

Isn't it better to make that property private?

@net-tech
Copy link
Contributor Author

net-tech commented Jan 4, 2023

Isn't it better to make that property private?

Done.

@Idris1401
Copy link
Contributor

Maybe you should change the return type too, if it actually returns a string (or it doesn't matter?).

Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind also modifying the pull request title to reflect the changes too?

@kyranet kyranet changed the title typings(Attachment): remove attachment typings(Attachment): make attachment private Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

8 participants