mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
✨ invites TTL
This commit is contained in:
parent
4715ef1eab
commit
f72156a40d
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user