refactor(MessageEmbed): remove files (#5813)

* refactor(MessageEmbed): remove files

* fix: test
This commit is contained in:
Jan
2021-06-11 22:36:31 +02:00
committed by GitHub
parent a7ebb2145c
commit e3e466d3e5
4 changed files with 2 additions and 42 deletions

View File

@@ -223,26 +223,7 @@ class APIMessage {
async resolveFiles() {
if (this.files) return this;
const embedLikes = [];
if (this.isInteraction || this.isWebhook) {
if (this.options.embeds) {
embedLikes.push(...this.options.embeds);
}
} else if (this.options.embed) {
embedLikes.push(this.options.embed);
}
const fileLikes = [];
if (this.options.files) {
fileLikes.push(...this.options.files);
}
for (const embed of embedLikes) {
if (embed.files) {
fileLikes.push(...embed.files);
}
}
this.files = await Promise.all(fileLikes.map(f => this.constructor.resolveFile(f)));
this.files = await Promise.all(this.options.files?.map(file => this.constructor.resolveFile(file)) ?? []);
return this;
}