summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-11 13:51:55 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-11 13:51:55 +1000
commit3c981b496b23b49885452ac6ea41dd51d3d20e04 (patch)
tree6eb604fcfb65977001b2f63484513833c5976f42
parentMerge pull request #1023 from Rainb0wCodes/master (diff)
downloadserver-3c981b496b23b49885452ac6ea41dd51d3d20e04.tar.xz
don't allow editing @everyone role
-rw-r--r--src/api/routes/guilds/#guild_id/roles/#role_id/members.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/api/routes/guilds/#guild_id/roles/#role_id/members.ts b/src/api/routes/guilds/#guild_id/roles/#role_id/members.ts
index 705848aa..539cd5d8 100644
--- a/src/api/routes/guilds/#guild_id/roles/#role_id/members.ts
+++ b/src/api/routes/guilds/#guild_id/roles/#role_id/members.ts
@@ -17,7 +17,7 @@
 */
 
 import { Router, Request, Response } from "express";
-import { Member, partition } from "@spacebar/util";
+import { DiscordApiErrors, Member, partition } from "@spacebar/util";
 import { route } from "@spacebar/api";
 
 const router = Router();
@@ -30,6 +30,9 @@ router.patch(
 		const { guild_id, role_id } = req.params;
 		const { member_ids } = req.body;
 
+		// don't mess with @everyone
+		if (role_id == guild_id) throw DiscordApiErrors.INVALID_ROLE;
+
 		const members = await Member.find({
 			where: { guild_id },
 			relations: ["roles"],