mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix(messagepayload): resolveFile property names (#7458)
This commit is contained in:
@@ -228,7 +228,7 @@ class MessagePayload {
|
|||||||
*/
|
*/
|
||||||
static async resolveFile(fileLike) {
|
static async resolveFile(fileLike) {
|
||||||
let attachment;
|
let attachment;
|
||||||
let fileName;
|
let name;
|
||||||
|
|
||||||
const findName = thing => {
|
const findName = thing => {
|
||||||
if (typeof thing === 'string') {
|
if (typeof thing === 'string') {
|
||||||
@@ -246,14 +246,14 @@ class MessagePayload {
|
|||||||
typeof fileLike === 'string' || fileLike instanceof Buffer || typeof fileLike.pipe === 'function';
|
typeof fileLike === 'string' || fileLike instanceof Buffer || typeof fileLike.pipe === 'function';
|
||||||
if (ownAttachment) {
|
if (ownAttachment) {
|
||||||
attachment = fileLike;
|
attachment = fileLike;
|
||||||
fileName = findName(attachment);
|
name = findName(attachment);
|
||||||
} else {
|
} else {
|
||||||
attachment = fileLike.attachment;
|
attachment = fileLike.attachment;
|
||||||
fileName = fileLike.name ?? findName(attachment);
|
name = fileLike.name ?? findName(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileData = await DataResolver.resolveFile(attachment);
|
const data = await DataResolver.resolveFile(attachment);
|
||||||
return { fileData, fileName };
|
return { data, name };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user