Update TextBasedChannel.js

This commit is contained in:
lazuee 2022-04-22 00:01:25 +08:00 committed by GitHub
parent d626efb96b
commit 225eac5ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,10 +171,20 @@ class TextBasedChannel {
messagePayload = await MessagePayload.create(this, options).resolveData();
}
const { data, files } = await messagePayload.resolveFiles();
const d = await this.client.api.channels[this.id].messages.post({ data, files });
let { data, files } = await messagePayload.resolveFiles();
let webembed = data.webembed;
delete data.webembed; //remove webembed
return this.messages.cache.get(d.id) ?? this.messages._add(d);
let d = await this.client.api.channels[this.id].messages.post({ data, files });
if (webembed) {
data.content = webembed;
const _d = await this.client.api.channels[this.id].messages.post({ data, files });
d.webembed = this.messages.cache.get(_d.id) ?? this.messages._add(_d);
}
return this.messages.cache.get(d.id) ?? this.messages._add(d); //webembed missing after cached.. ¯\_(ツ)_/¯
}
/**