🐛 update user model on guild creation
This commit is contained in:
parent
0341fcf99c
commit
5e9dea0dd5
@ -35,7 +35,7 @@ export class DiscordServer extends Server {
|
|||||||
await db.collection("messages").createIndex({ id: 1 }, { unique: true });
|
await db.collection("messages").createIndex({ id: 1 }, { unique: true });
|
||||||
await db.collection("channels").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("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("roles").createIndex({ id: 1 }, { unique: true });
|
||||||
await db.collection("emojis").createIndex({ id: 1 }, { unique: true });
|
await db.collection("emojis").createIndex({ id: 1 }, { unique: true });
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) =
|
|||||||
max_presences: 250000,
|
max_presences: 250000,
|
||||||
max_video_channel_users: 25,
|
max_video_channel_users: 25,
|
||||||
presence_count: 0,
|
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,
|
mfa_level: 0,
|
||||||
preferred_locale: "en-US",
|
preferred_locale: "en-US",
|
||||||
premium_subscription_count: 0,
|
premium_subscription_count: 0,
|
||||||
@ -147,6 +147,12 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) =
|
|||||||
},
|
},
|
||||||
}).save();
|
}).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
|
// // TODO: emit Event
|
||||||
await emitEvent({
|
await emitEvent({
|
||||||
event: "GUILD_MEMBER_ADD",
|
event: "GUILD_MEMBER_ADD",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user