mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix(MessageComponentInteraction): component getter is not null anymore (#6835)
This commit is contained in:
@@ -72,15 +72,13 @@ class MessageComponentInteraction extends Interaction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The component which was interacted with
|
* The component which was interacted with
|
||||||
* @type {?(MessageActionRowComponent|APIMessageActionRowComponent)}
|
* @type {MessageActionRowComponent|APIMessageActionRowComponent}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get component() {
|
get component() {
|
||||||
return (
|
return this.message.components
|
||||||
this.message.components
|
.flatMap(row => row.components)
|
||||||
.flatMap(row => row.components)
|
.find(component => (component.customId ?? component.custom_id) === this.customId);
|
||||||
.find(component => (component.customId ?? component.custom_id) === this.customId) ?? null
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -1448,7 +1448,7 @@ export class MessageCollector extends Collector<Snowflake, Message> {
|
|||||||
export class MessageComponentInteraction extends Interaction {
|
export class MessageComponentInteraction extends Interaction {
|
||||||
protected constructor(client: Client, data: RawMessageComponentInteractionData);
|
protected constructor(client: Client, data: RawMessageComponentInteractionData);
|
||||||
public readonly channel: TextBasedChannels | null;
|
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 componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
||||||
public customId: string;
|
public customId: string;
|
||||||
public channelId: Snowflake;
|
public channelId: Snowflake;
|
||||||
|
|||||||
Reference in New Issue
Block a user