Update Webhook.js
This commit is contained in:
parent
225eac5ed2
commit
2558771083
@ -192,13 +192,29 @@ class Webhook {
|
|||||||
messagePayload = await MessagePayload.create(this, options).resolveData();
|
messagePayload = await MessagePayload.create(this, options).resolveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data, files } = await messagePayload.resolveFiles();
|
let { data, files } = await messagePayload.resolveFiles();
|
||||||
const d = await this.client.api.webhooks(this.id, this.token).post({
|
let webembed = data.webembed;
|
||||||
|
delete data.webembed; //remove webembed
|
||||||
|
|
||||||
|
let d = await this.client.api.webhooks(this.id, this.token).post({
|
||||||
data,
|
data,
|
||||||
files,
|
files,
|
||||||
query: { thread_id: messagePayload.options.threadId, wait: true },
|
query: { thread_id: messagePayload.options.threadId, wait: true },
|
||||||
auth: false,
|
auth: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (webembed) {
|
||||||
|
data.content = webembed;
|
||||||
|
|
||||||
|
const _d = await this.client.api.webhooks(this.id, this.token).post({
|
||||||
|
data,
|
||||||
|
files,
|
||||||
|
query: { thread_id: messagePayload.options.threadId, wait: true },
|
||||||
|
auth: false,
|
||||||
|
});
|
||||||
|
d.webembed = this.messages.cache.get(_d.id) ?? this.messages._add(_d);
|
||||||
|
}
|
||||||
|
|
||||||
return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d;
|
return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user