summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/Server.ts2
-rw-r--r--src/routes/api/v8/guilds/index.ts8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/Server.ts b/src/Server.ts

index fa4111db..18bd1c7a 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -35,7 +35,7 @@ export class DiscordServer extends Server { await db.collection("messages").createIndex({ id: 1 }, { unique: true }); await db.collection("channels").createIndex({ id: 1 }, { unique: true }); await db.collection("guilds").createIndex({ id: 1 }, { unique: true }); - await db.collection("members").createIndex({ id: 1 }, { unique: true }); + await db.collection("members").createIndex({ id: 1, guild_id: 1 }, { unique: true }); await db.collection("roles").createIndex({ id: 1 }, { unique: true }); await db.collection("emojis").createIndex({ id: 1 }, { unique: true }); } diff --git a/src/routes/api/v8/guilds/index.ts b/src/routes/api/v8/guilds/index.ts
index f2c9d556..3aace64b 100644 --- a/src/routes/api/v8/guilds/index.ts +++ b/src/routes/api/v8/guilds/index.ts
@@ -86,7 +86,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = max_presences: 250000, max_video_channel_users: 25, presence_count: 0, - member_count: 0, + member_count: 1, // TODO: if a addMemberToGuild() function will be used in the future, set this to 0 and automatically increment this number mfa_level: 0, preferred_locale: "en-US", premium_subscription_count: 0, @@ -147,6 +147,12 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = }, }).save(); + // TODO: I don't know why the bigint needs to be converted to a string in order to save the model. + // But the weird thing is, that it gets saved as a Long/bigint in the database + // @ts-ignore + user.guilds.push(guildID.toString()); + await user.save(); + // // TODO: emit Event await emitEvent({ event: "GUILD_MEMBER_ADD",