Skip to content

Commit

Permalink
types(MessageEmbed): allow APIEmbed type (#6629)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Sep 14, 2021
1 parent 3c3522a commit 256fb90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/structures/MessageEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ const Util = require('../util/Util');
* Represents an embed in a message (image/video preview, rich embed, etc.)
*/
class MessageEmbed {
/**
* @name MessageEmbed
* @kind constructor
* @memberof MessageEmbed
* @param {MessageEmbed|MessageEmbedOptions} [data={}] MessageEmbed to clone or raw embed data
*/

/**
* A `Partial` object is a representation of any existing object.
* This object contains between 0 and all of the original objects parameters.
Expand All @@ -37,6 +30,10 @@ class MessageEmbed {
* @property {Partial<MessageEmbedFooter>} [footer] The footer of this embed
*/

// eslint-disable-next-line valid-jsdoc
/**
* @param {MessageEmbed|MessageEmbedOptions|APIEmbed} [data={}] MessageEmbed to clone or raw embed data
*/
constructor(data = {}, skipValidation = false) {
this.setup(data, skipValidation);
}
Expand Down
8 changes: 6 additions & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
APIApplicationCommandOption,
APIApplicationCommandPermission,
APIAuditLogChange,
APIEmbed,
APIEmoji,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
Expand Down Expand Up @@ -1342,7 +1343,7 @@ export class MessageComponentInteraction extends Interaction {
}

export class MessageEmbed {
public constructor(data?: MessageEmbed | MessageEmbedOptions);
public constructor(data?: MessageEmbed | MessageEmbedOptions | APIEmbed);
public author: MessageEmbedAuthor | null;
public color: number | null;
public readonly createdAt: Date | null;
Expand Down Expand Up @@ -3283,7 +3284,10 @@ export interface ClientEvents {
message: [message: Message];
messageCreate: [message: Message];
messageDelete: [message: Message | PartialMessage];
messageReactionRemoveAll: [message: Message | PartialMessage, reactions: Collection<string | Snowflake, MessageReaction>];
messageReactionRemoveAll: [
message: Message | PartialMessage,
reactions: Collection<string | Snowflake, MessageReaction>,
];
messageReactionRemoveEmoji: [reaction: MessageReaction | PartialMessageReaction];
messageDeleteBulk: [messages: Collection<Snowflake, Message | PartialMessage>];
messageReactionAdd: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser];
Expand Down

0 comments on commit 256fb90

Please sign in to comment.