mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Fix split messages resolving with multiple of the same message
This commit is contained in:
@@ -68,8 +68,7 @@ class RESTMethods {
|
|||||||
if (channel instanceof User || channel instanceof GuildMember) {
|
if (channel instanceof User || channel instanceof GuildMember) {
|
||||||
this.createDM(channel).then(chan => {
|
this.createDM(channel).then(chan => {
|
||||||
this._sendMessageRequest(chan, content, file, tts, nonce, resolve, reject);
|
this._sendMessageRequest(chan, content, file, tts, nonce, resolve, reject);
|
||||||
})
|
}).catch(reject);
|
||||||
.catch(reject);
|
|
||||||
} else {
|
} else {
|
||||||
this._sendMessageRequest(channel, content, file, tts, nonce, resolve, reject);
|
this._sendMessageRequest(channel, content, file, tts, nonce, resolve, reject);
|
||||||
}
|
}
|
||||||
@@ -79,22 +78,24 @@ class RESTMethods {
|
|||||||
_sendMessageRequest(channel, content, file, tts, nonce, resolve, reject) {
|
_sendMessageRequest(channel, content, file, tts, nonce, resolve, reject) {
|
||||||
if (content instanceof Array) {
|
if (content instanceof Array) {
|
||||||
const datas = [];
|
const datas = [];
|
||||||
const promise = this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, {
|
let promise = this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, {
|
||||||
content: content[0], tts, nonce,
|
content: content[0], tts, nonce,
|
||||||
}, file).catch(reject);
|
}, file).catch(reject);
|
||||||
|
|
||||||
for (let i = 1; i <= content.length; i++) {
|
for (let i = 1; i <= content.length; i++) {
|
||||||
if (i < content.length) {
|
if (i < content.length) {
|
||||||
promise.then(data => {
|
const i2 = i;
|
||||||
|
promise = promise.then(data => {
|
||||||
datas.push(data);
|
datas.push(data);
|
||||||
return this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, {
|
return this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, {
|
||||||
content: content[i], tts, nonce,
|
content: content[i2], tts, nonce,
|
||||||
}, file);
|
}, file);
|
||||||
});
|
}).catch(reject);
|
||||||
} else {
|
} else {
|
||||||
promise.then(data => {
|
promise.then(data => {
|
||||||
datas.push(data);
|
datas.push(data);
|
||||||
resolve(this.rest.client.actions.MessageCreate.handle(datas).messages);
|
resolve(this.rest.client.actions.MessageCreate.handle(datas).messages);
|
||||||
});
|
}).catch(reject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user