fix(Split/Webhook): readd message chunk sending and fix webhook avatar/username (#2085)

This commit is contained in:
SpaceEEC
2017-11-06 02:42:24 +01:00
committed by Crawl
parent 21d09f338e
commit 05a41b5ca4
3 changed files with 28 additions and 7 deletions

View File

@@ -105,6 +105,19 @@ class Webhook {
const { data, files } = await createMessage(this, options);
if (data.content instanceof Array) {
const messages = [];
for (let i = 0; i < data.content.length; i++) {
const opt = i === data.content.length - 1 ? { embeds: data.embeds, files } : {};
Object.assign(opt, { avatarURL: data.avatar_url, content: data.content[i], username: data.username });
// eslint-disable-next-line no-await-in-loop
const message = await this.send(data.content[i], opt);
messages.push(message);
}
return messages;
}
return this.client.api.webhooks(this.id, this.token).post({
data, files,
query: { wait: true },