mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
Fixed catchup implementation
This commit is contained in:
@@ -2169,8 +2169,10 @@ var Client = (function (_EventEmitter) {
|
||||
if (self.options.catchup) {
|
||||
// mention_count, last_message_id, id
|
||||
rstate.forEach(function (catchup, index) {
|
||||
if (self.options.catchupAll) {
|
||||
self.getChannelLogs(catchup.id, 100000, { after: catchup.last_message_id }).then(function (results) {
|
||||
if (self.options.catchup === "all") {
|
||||
self.getChannelLogs(catchup.id, 100000, {
|
||||
after: catchup.last_message_id
|
||||
}).then(function (results) {
|
||||
|
||||
for (var _iterator19 = results, _isArray19 = Array.isArray(_iterator19), _i19 = 0, _iterator19 = _isArray19 ? _iterator19 : _iterator19[Symbol.iterator]();;) {
|
||||
var _ref19;
|
||||
@@ -2186,12 +2188,12 @@ var Client = (function (_EventEmitter) {
|
||||
|
||||
var m = _ref19;
|
||||
|
||||
if (self.options.catchupIsolate) self.emit("catchupMessage", m);else self.emit("message", m);
|
||||
self.emit("message", m, true);
|
||||
}
|
||||
|
||||
self.ack(results[0]);
|
||||
});
|
||||
} else {
|
||||
} else if (self.options.catchup) {
|
||||
self.getChannelLogs(catchup.id, 2500).then(function (results) {
|
||||
|
||||
for (var _iterator20 = results, _isArray20 = Array.isArray(_iterator20), _i20 = 0, _iterator20 = _isArray20 ? _iterator20 : _iterator20[Symbol.iterator]();;) {
|
||||
@@ -2209,7 +2211,7 @@ var Client = (function (_EventEmitter) {
|
||||
var m = _ref20;
|
||||
|
||||
if (m.id == catchup.last_message_id) break;
|
||||
if (self.options.catchupIsolate) self.emit("catchupMessage", m);else self.emit("message", m);
|
||||
self.emit("message", m, true);
|
||||
}
|
||||
|
||||
self.ack(results[0]);
|
||||
|
||||
Reference in New Issue
Block a user