diff options
Diffstat (limited to 'src/api/routes/users/@me/guilds.ts')
-rw-r--r-- | src/api/routes/users/@me/guilds.ts | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/api/routes/users/@me/guilds.ts b/src/api/routes/users/@me/guilds.ts index 0bce432b..1d2f79ce 100644 --- a/src/api/routes/users/@me/guilds.ts +++ b/src/api/routes/users/@me/guilds.ts @@ -17,15 +17,7 @@ */ import { route } from "@spacebar/api"; -import { - Config, - Guild, - GuildDeleteEvent, - GuildMemberRemoveEvent, - Member, - User, - emitEvent, -} from "@spacebar/util"; +import { Config, Guild, GuildDeleteEvent, GuildMemberRemoveEvent, Member, User, emitEvent } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; @@ -53,7 +45,7 @@ router.get( } res.json(guild); - }, + } ); // user send to leave a certain guild @@ -79,17 +71,9 @@ router.delete( }); if (!guild) throw new HTTPError("Guild doesn't exist", 404); - if (guild.owner_id === req.user_id) - throw new HTTPError("You can't leave your own guild", 400); - if ( - autoJoin.enabled && - autoJoin.guilds.includes(guild_id) && - !autoJoin.canLeave - ) { - throw new HTTPError( - "You can't leave instance auto join guilds", - 400, - ); + if (guild.owner_id === req.user_id) throw new HTTPError("You can't leave your own guild", 400); + if (autoJoin.enabled && autoJoin.guilds.includes(guild_id) && !autoJoin.canLeave) { + throw new HTTPError("You can't leave instance auto join guilds", 400); } await Promise.all([ @@ -115,7 +99,7 @@ router.delete( } as GuildMemberRemoveEvent); return res.sendStatus(204); - }, + } ); export default router; |