1 files changed, 2 insertions, 8 deletions
diff --git a/src/routes/channels/#channel_id/invites.ts b/src/routes/channels/#channel_id/invites.ts
index 5ec5163a..10d6ae3f 100644
--- a/src/routes/channels/#channel_id/invites.ts
+++ b/src/routes/channels/#channel_id/invites.ts
@@ -22,10 +22,7 @@ router.post("/", check(InviteCreateSchema), async (req: Request, res: Response)
const { guild_id } = channel;
const permission = await getPermission(user_id, guild_id);
-
- if (!permission.has("CREATE_INSTANT_INVITE")) {
- throw new HTTPError("You aren't authorised to access this endpoint", 401);
- }
+ permission.hasThrow("CREATE_INSTANT_INVITE");
const invite = {
code: random(),
@@ -55,10 +52,7 @@ router.get("/", async (req: Request, res: Response) => {
}
const { guild_id } = channel;
const permission = await getPermission(user_id, guild_id);
-
- if (!permission.has("MANAGE_CHANNELS")) {
- throw new HTTPError("You aren't authorised to access this endpoint", 401);
- }
+ permission.hasThrow("MANAGE_CHANNELS");
const invites = await InviteModel.find({ guild_id }).exec();
|