Skip to content

Commit

Permalink
fix(MessageComponentInteraction): component getter is not null anymore (
Browse files Browse the repository at this point in the history
  • Loading branch information
chrdek committed Oct 24, 2021
1 parent 672baa4 commit 7621e9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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 @@ -1448,7 +1448,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

0 comments on commit 7621e9d

Please sign in to comment.