types(MessageEmbed): allow APIEmbed type (#6629)

This commit is contained in:
Rodry
2021-09-14 23:19:49 +01:00
committed by GitHub
parent 3c3522ae8a
commit 256fb905fe
2 changed files with 10 additions and 9 deletions

View File

@@ -7,13 +7,6 @@ const Util = require('../util/Util');
* Represents an embed in a message (image/video preview, rich embed, etc.) * Represents an embed in a message (image/video preview, rich embed, etc.)
*/ */
class MessageEmbed { 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. * A `Partial` object is a representation of any existing object.
* This object contains between 0 and all of the original objects parameters. * This object contains between 0 and all of the original objects parameters.
@@ -37,6 +30,10 @@ class MessageEmbed {
* @property {Partial<MessageEmbedFooter>} [footer] The footer of this embed * @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) { constructor(data = {}, skipValidation = false) {
this.setup(data, skipValidation); this.setup(data, skipValidation);
} }

8
typings/index.d.ts vendored
View File

@@ -29,6 +29,7 @@ import {
APIApplicationCommandOption, APIApplicationCommandOption,
APIApplicationCommandPermission, APIApplicationCommandPermission,
APIAuditLogChange, APIAuditLogChange,
APIEmbed,
APIEmoji, APIEmoji,
APIInteractionDataResolvedChannel, APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember, APIInteractionDataResolvedGuildMember,
@@ -1342,7 +1343,7 @@ export class MessageComponentInteraction extends Interaction {
} }
export class MessageEmbed { export class MessageEmbed {
public constructor(data?: MessageEmbed | MessageEmbedOptions); public constructor(data?: MessageEmbed | MessageEmbedOptions | APIEmbed);
public author: MessageEmbedAuthor | null; public author: MessageEmbedAuthor | null;
public color: number | null; public color: number | null;
public readonly createdAt: Date | null; public readonly createdAt: Date | null;
@@ -3283,7 +3284,10 @@ export interface ClientEvents {
message: [message: Message]; message: [message: Message];
messageCreate: [message: Message]; messageCreate: [message: Message];
messageDelete: [message: Message | PartialMessage]; 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]; messageReactionRemoveEmoji: [reaction: MessageReaction | PartialMessageReaction];
messageDeleteBulk: [messages: Collection<Snowflake, Message | PartialMessage>]; messageDeleteBulk: [messages: Collection<Snowflake, Message | PartialMessage>];
messageReactionAdd: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser]; messageReactionAdd: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser];