@evolvejs/core
Version:
An advanced Discord API wrapper with TS and JS support
32 lines (31 loc) • 1.79 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../../..");
const objex_1 = require("@evolvejs/objex");
const GuildMembersChunkEvents_1 = require("../../Events/GuildMembersChunkEvents");
class default_1 {
constructor(client, payload, shard) {
(() => __awaiter(this, void 0, void 0, function* () {
const { members, chunk_index, chunk_count, not_found, presences, nonce, } = payload.d;
const memberObjex = new objex_1.Objex();
for (const member of members) {
memberObjex.set(member.user.id, new __1.GuildMember(member));
}
const presenceObjex = new objex_1.Objex();
for (const presence of presences) {
presenceObjex.set(presence.user.id, new __1.PresenceUpdate(presence, client));
}
client.emit(__1.EVENTS.GUILD_MEMBERS_CHUNK, new GuildMembersChunkEvents_1.GuildMembersChunkUpdate(client, memberObjex, presenceObjex, [chunk_index, chunk_count], not_found, nonce, shard));
}))();
}
}
exports.default = default_1;