diff --git a/src/gateway/opcodes/LazyRequest.ts b/src/gateway/opcodes/LazyRequest.ts
index d8f4cb5a..c050fe98 100644
--- a/src/gateway/opcodes/LazyRequest.ts
+++ b/src/gateway/opcodes/LazyRequest.ts
@@ -18,11 +18,12 @@
import murmur from "murmurhash-js/murmurhash3_gc";
import { getDatabase, Member, Role, Session, User, Channel } from "@spacebar/database";
-import { arrayPartition } from "@spacebar/extensions";
+import { arrayPartition, Stopwatch } from "@spacebar/extensions";
import { WebSocket, Payload, handlePresenceUpdate, OPCODES, Send } from "@spacebar/gateway";
import { LazyRequestSchema } from "@spacebar/schemas";
import { getPermission, listenEvent, Presence, Permissions, getMostRelevantSession } from "@spacebar/util";
import { check } from "./instanceOf";
+import { And, Any, ArrayContains, In, Not } from "typeorm";
// TODO: only show roles/members that have access to this channel
// TODO: config: to list all members (even those who are offline) sorted by role, or just those who are online
@@ -258,3 +259,42 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
console.log(`[Gateway/${this.user_id}] LAZY_REQUEST ${guild_id} ${channel_id} took ${Date.now() - startTime}ms`);
}
+
+// async function getAllGroups(guild_id: string) {
+// const hoistedRoles = await Role.find({ where: { hoist: true, guild_id }, order: { position: "DESC" } });
+// return [...hoistedRoles.map((r) => ({ id: r.id, count: 0 })), { id: "online", count: 0 }, { id: "offline", count: 0 }];
+// }
+//
+// export async function buildFullMemberlistSequential(guild_id: string) {
+// const totalSw = Stopwatch.startNew();
+// const incSw = Stopwatch.startNew();
+// const logTrace = (...data: unknown[]) => {
+// if (process.env.LOG_VERBOSE_TRACES !== "true") return;
+// console.log("[LazyRequest/buildFullMemberlist]", ...data, `[${totalSw.elapsed().toString()} (+${incSw.getElapsedAndReset().totalMilliseconds}ms)]`);
+// };
+//
+// const groups = await getAllGroups(guild_id);
+// const handledGroups: string[] = [];
+// const handledUsers: string[] = [];
+// const offlineUsers: string[] = [];
+// logTrace("[LazyRequest] Got", groups.length, "groups...");
+//
+// for (const group of groups) {
+// console.log("[LazyRequest] Building member list for", group.id);
+// if (group.id == "offline") {
+// } else if (group.id == "online") {
+// } else {
+// const potentialMembers = await Member.find({
+// where: { roles: And<Role>(Any<Role>(And<Role>({ id: group.id }, Not(Any({ id: In(handledGroups) }))))) },
+// relations: { roles: true, user: true },
+// });
+// console.log(
+// "[LazyRequest] Found",
+// potentialMembers.length,
+// "potential members",
+// potentialMembers.map((pm) => ({ id: pm.id, name: pm.nick ?? pm.user.tag ?? pm.id })),
+// );
+// }
+// logTrace("Built member list for", group.id, "with", 0, "members!");
+// }
+// }
diff --git a/src/get-member-list.ts b/src/get-member-list.ts
new file mode 100644
index 00000000..58bd898b
--- /dev/null
+++ b/src/get-member-list.ts
@@ -0,0 +1,40 @@
+// /*
+// Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
+// Copyright (C) 2026 Spacebar and Spacebar Contributors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+// */
+//
+// process.on("uncaughtException", console.error);
+// process.on("unhandledRejection", console.error);
+//
+// import moduleAlias from "module-alias";
+// moduleAlias(__dirname + "../../package.json");
+// import { config } from "dotenv";
+// config({ quiet: true });
+//
+// // process.env.DB_LOGGING = "true";
+//
+// import { closeDatabase, initDatabase } from "@spacebar/database";
+// import { buildFullMemberlistSequential } from "@spacebar/gateway/opcodes/LazyRequest";
+//
+// async function main() {
+// await initDatabase();
+//
+// await buildFullMemberlistSequential("1006649183970562092");
+//
+// await closeDatabase();
+// }
+//
+// main().then(() => console.log("meow"));
|