Skip to content

Conversation

Qjuh
Copy link
Member

@Qjuh Qjuh commented Jul 12, 2025

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

Status and versioning classification:

Copy link

vercel bot commented Jul 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
discord-js Ignored Ignored Preview Oct 12, 2025 6:38am
discord-js-guide Ignored Ignored Preview Oct 12, 2025 6:38am

Copy link

codecov bot commented Jul 12, 2025

Codecov Report

❌ Patch coverage is 65.81633% with 335 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.55%. Comparing base (a97ac82) to head (c3bae20).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ures/src/messages/components/TextInputComponent.ts 45.45% 18 Missing ⚠️
packages/structures/src/messages/Attachment.ts 67.30% 17 Missing ⚠️
packages/structures/src/stickers/Sticker.ts 44.82% 16 Missing ⚠️
...tures/src/messages/components/UnfurledMediaItem.ts 48.14% 14 Missing ⚠️
...res/src/messages/components/SelectMenuComponent.ts 47.82% 12 Missing ⚠️
packages/structures/src/messages/ChannelMention.ts 52.38% 10 Missing ⚠️
...ckages/structures/src/messages/MessageReference.ts 54.54% 10 Missing ⚠️
...es/structures/src/messages/RoleSubscriptionData.ts 50.00% 10 Missing ⚠️
.../src/messages/components/StringSelectMenuOption.ts 52.38% 10 Missing ⚠️
...ages/structures/src/messages/embeds/EmbedAuthor.ts 47.36% 10 Missing ⚠️
... and 42 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10982      +/-   ##
==========================================
+ Coverage   44.19%   45.55%   +1.36%     
==========================================
  Files         313      369      +56     
  Lines       18093    18974     +881     
  Branches     1796     1885      +89     
==========================================
+ Hits         7996     8644     +648     
- Misses      10085    10318     +233     
  Partials       12       12              
Flag Coverage Δ
structures 76.74% <65.81%> (-8.45%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@ckohen ckohen left a comment

Choose a reason for hiding this comment

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

Overall looking pretty good, some docstring errors and a couple things to discuss so far.

Also overall discussion, should we doc every param like types and kinda mainlib do rn. So many of them are very self-explanatory (especially the substructure ones) but I think we probably should do a lot of it anyways?

@github-project-automation github-project-automation bot moved this from Todo to Review in Progress in discord.js Aug 20, 2025
@Qjuh Qjuh force-pushed the feat/more-structures branch from 818d975 to a457ab0 Compare October 5, 2025 09:57
@Qjuh Qjuh marked this pull request as ready for review October 10, 2025 15:09
@Qjuh Qjuh requested a review from a team as a code owner October 10, 2025 15:09
@Qjuh Qjuh requested a review from ckohen October 12, 2025 06:40
Copy link
Member

@ckohen ckohen left a comment

Choose a reason for hiding this comment

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

Not quite through everything yet, but here's some stuff

Also I know it's brand new but we're missing the Label component

public get expiresAt() {
const expiresTimestamp = this.expiresTimestamp;
return expiresTimestamp ? new Date(expiresTimestamp) : null;
}
Copy link
Member

Choose a reason for hiding this comment

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

Need a toJSON on this one for expiry

* Represents an answer to a poll on a message on Discord.
*
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
* @remarks has a substructure `PollAnswerCount` which need to be instantiated and stored by an extending class using it
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this got flipped, should be PollMedia here and PollAnswerCount in PollResults

/**
* The timestamp of the embed content
*/
public get timestamp() {
Copy link
Member

Choose a reason for hiding this comment

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

Missing optimization

import { ButtonComponent } from './ButtonComponent.js';

/**
* Base class for all buttons that can havre a label on a message.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Base class for all buttons that can havre a label on a message.
* Base class for all buttons that can have a label on a message.

*/
public get placeholder() {
return this[kData].placeholder;
}
Copy link
Member

Choose a reason for hiding this comment

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

I assume none of the new modal component stuff is in, but this should have required now

*/
public constructor(data: Partialize<APIChannelSelectComponent, Omitted>) {
super(data);
}
Copy link
Member

Choose a reason for hiding this comment

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

This is missing channelTypes....and this does seem like a time when we just expose it directly. I can't envision anything we would want to do with those values other than expose them directly.

* Represents a section component on a message.
*
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
* @remarks has `TextDisplayComponent`s and `ThumbnailComponent` or `ButtonComponent` as substructures which need to be instantiated and stored by an extending class using it
Copy link
Member

Choose a reason for hiding this comment

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

This might change in the future, do we just want to update this string then or is there a better way to say this?

import { Component } from './Component.js';

/**
* Represents a container component on a message.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Represents a container component on a message.
* Represents a media gallery component on a message.

*/
public get spoiler() {
return this[kData].spoiler;
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this should have name and size properties?

// TODO: add `flags` as a BitField class and appropriate getter, once it gets properly documented

/**
* Represents an item in a media gallery on a message.
Copy link
Member

Choose a reason for hiding this comment

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

It's more than just media gallery, also thumbnail and file

Copy link
Member

@ckohen ckohen left a comment

Choose a reason for hiding this comment

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

Only a few more from the rest of the files

* The id of the referenced message
*/
public get messageId() {
return 'message_id' in this[kData] && typeof this[kData].message_id === 'string' ? this[kData].message_id : null;
Copy link
Member

Choose a reason for hiding this comment

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

Why are we nulling these?

*/
public get meBurst() {
return this[kData].me_burst;
}
Copy link
Member

Choose a reason for hiding this comment

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

burst_colors is another interesting one....not sure what to do with it (aside from optimizing it)

Copy link
Member

Choose a reason for hiding this comment

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

I think this belongs in an interactions folder. It's not present on messages, only interactions

@ckohen ckohen requested a review from a team October 14, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review in Progress

Development

Successfully merging this pull request may close these issues.

2 participants