mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
feat(Message): allow editing files into messages (#5718)
This commit is contained in:
@@ -124,8 +124,10 @@ class MessageManager extends BaseManager {
|
|||||||
message = this.resolveID(message);
|
message = this.resolveID(message);
|
||||||
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
|
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
|
||||||
|
|
||||||
const { data } = (options instanceof APIMessage ? options : APIMessage.create(this, options)).resolveData();
|
const { data, files } = await (options instanceof APIMessage ? options : APIMessage.create(this, options))
|
||||||
const d = await this.client.api.channels[this.channel.id].messages[message].patch({ data });
|
.resolveData()
|
||||||
|
.resolveFiles();
|
||||||
|
const d = await this.client.api.channels[this.channel.id].messages[message].patch({ data, files });
|
||||||
|
|
||||||
if (this.cache.has(message)) {
|
if (this.cache.has(message)) {
|
||||||
const clone = this.cache.get(message)._clone();
|
const clone = this.cache.get(message)._clone();
|
||||||
|
|||||||
@@ -479,7 +479,9 @@ class Message extends Base {
|
|||||||
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
|
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
|
||||||
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
|
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
|
||||||
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be edited.
|
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be edited.
|
||||||
* @property {MessageAttachment[]} [attachments] The new attachments of the message (can only be removed, not added)
|
* @property {MessageAttachment[]} [attachments] An array of attachments to keep,
|
||||||
|
* all attachments will be kept if omitted
|
||||||
|
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to add to the message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
3
typings/index.d.ts
vendored
3
typings/index.d.ts
vendored
@@ -3204,12 +3204,13 @@ declare module 'discord.js' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface MessageEditOptions {
|
interface MessageEditOptions {
|
||||||
|
attachments?: MessageAttachment[];
|
||||||
content?: StringResolvable;
|
content?: StringResolvable;
|
||||||
embed?: MessageEmbed | MessageEmbedOptions | null;
|
embed?: MessageEmbed | MessageEmbedOptions | null;
|
||||||
code?: string | boolean;
|
code?: string | boolean;
|
||||||
|
files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[];
|
||||||
flags?: BitFieldResolvable<MessageFlagsString, number>;
|
flags?: BitFieldResolvable<MessageFlagsString, number>;
|
||||||
allowedMentions?: MessageMentionOptions;
|
allowedMentions?: MessageMentionOptions;
|
||||||
attachments?: MessageAttachment[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageEmbedAuthor {
|
interface MessageEmbedAuthor {
|
||||||
|
|||||||
Reference in New Issue
Block a user