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

This commit is contained in:
chrdek
2021-10-25 01:34:53 +03:00
committed by GitHub
parent 672baa49e6
commit 7621e9da4c
2 changed files with 5 additions and 7 deletions

View File

@@ -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);
}
/**

2
typings/index.d.ts vendored
View File

@@ -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;