summary refs log tree commit diff
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/channels/#channel_id/invites.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/routes/channels/#channel_id/invites.ts b/src/routes/channels/#channel_id/invites.ts
index 10d6ae3f..457e78ca 100644
--- a/src/routes/channels/#channel_id/invites.ts
+++ b/src/routes/channels/#channel_id/invites.ts
@@ -24,16 +24,19 @@ router.post("/", check(InviteCreateSchema), async (req: Request, res: Response)
 	const permission = await getPermission(user_id, guild_id);
 	permission.hasThrow("CREATE_INSTANT_INVITE");
 
+	const expires_at = new Date(req.body.max_age * 1000 + Date.now());
+
 	const invite = {
 		code: random(),
 		temporary: req.body.temporary,
 		uses: 0,
 		max_uses: req.body.max_uses,
 		max_age: req.body.max_age,
+		expires_at,
 		created_at: new Date(),
 		guild_id,
 		channel_id: channel_id,
-		inviter_id: user_id,
+		inviter_id: user_id
 	};
 
 	await new InviteModel(invite).save();