don't allow editing @everyone role

This commit is contained in:
Madeline 2023-04-11 13:51:55 +10:00
parent 80c7eaa70f
commit 3c981b496b
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -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"],