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

fix(MessageComponentInteraction): component getter is not null anymore #6835

Merged
merged 6 commits into from Oct 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/structures/MessageComponentInteraction.js
Expand Up @@ -72,15 +72,13 @@ class MessageComponentInteraction extends Interaction {

/**
* The component which was interacted with
* @type {?(MessageActionRowComponent|APIMessageActionRowComponent)}
* @type {MessageActionRowComponent|APIMessageActionRowComponent}
* @readonly
*/
get component() {
return (
this.message.components
.flatMap(row => row.components)
.find(component => (component.customId ?? component.custom_id) === this.customId) ?? null
);
return this.message.components
.flatMap(row => row.components)
.find(component => (component.customId ?? component.custom_id) === this.customId);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Expand Up @@ -1415,7 +1415,7 @@ export class MessageCollector extends Collector<Snowflake, Message> {
export class MessageComponentInteraction extends Interaction {
protected constructor(client: Client, data: RawMessageComponentInteractionData);
public readonly channel: TextBasedChannels | null;
public readonly component: MessageActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent> | null;
public readonly component: MessageActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent>;
public componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
public customId: string;
public channelId: Snowflake;
Expand Down