-
-
Notifications
You must be signed in to change notification settings - Fork 4k
feat: message structures #10982
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
base: main
Are you sure you want to change the base?
feat: message structures #10982
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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?
packages/structures/src/messages/components/ActionRowComponent.ts
Outdated
Show resolved
Hide resolved
818d975
to
a457ab0
Compare
There was a problem hiding this 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; | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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; | ||
} |
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Represents a container component on a message. | |
* Represents a media gallery component on a message. |
*/ | ||
public get spoiler() { | ||
return this[kData].spoiler; | ||
} |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this 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; |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
Please describe the changes this PR makes and why it should be merged:
Status and versioning classification: