summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorsky <116099351+skyrina@users.noreply.github.com>2023-12-15 08:31:00 +0200
committerGitHub <noreply@github.com>2023-12-15 08:31:00 +0200
commit864bf75ef25e527ede50917bab5cf715ca11ff5d (patch)
tree828f246256ff59c438bc03bed8d9603ff02765c3 /src
parentadd new right for creating registration tokens (diff)
downloadserver-864bf75ef25e527ede50917bab5cf715ca11ff5d.tar.xz
what the hell erkin
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/guilds/#guild_id/bans.ts55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts
index 0776ab62..9aeb27f0 100644
--- a/src/api/routes/guilds/#guild_id/bans.ts
+++ b/src/api/routes/guilds/#guild_id/bans.ts
@@ -178,58 +178,6 @@ router.put(
 	},
 );
 
-router.put(
-	"/@me",
-	route({
-		requestBody: "BanCreateSchema",
-		responses: {
-			200: {
-				body: "Ban",
-			},
-			400: {
-				body: "APIErrorResponse",
-			},
-			403: {
-				body: "APIErrorResponse",
-			},
-		},
-	}),
-	async (req: Request, res: Response) => {
-		const { guild_id } = req.params;
-
-		const banned_user = await User.getPublicUser(req.params.user_id);
-
-		if (req.permission?.cache.guild?.owner_id === req.params.user_id)
-			throw new HTTPError(
-				"You are the guild owner, hence can't ban yourself",
-				403,
-			);
-
-		const ban = Ban.create({
-			user_id: req.params.user_id,
-			guild_id: guild_id,
-			ip: getIpAdress(req),
-			executor_id: req.params.user_id,
-			reason: req.body.reason, // || otherwise empty
-		});
-
-		await Promise.all([
-			Member.removeFromGuild(req.user_id, guild_id),
-			ban.save(),
-			emitEvent({
-				event: "GUILD_BAN_ADD",
-				data: {
-					guild_id: guild_id,
-					user: banned_user,
-				},
-				guild_id: guild_id,
-			} as GuildBanAddEvent),
-		]);
-
-		return res.json(ban);
-	},
-);
-
 router.delete(
 	"/:user_id",
 	route({
@@ -251,9 +199,6 @@ router.delete(
 			where: { guild_id: guild_id, user_id: user_id },
 		});
 
-		if (ban.user_id === ban.executor_id) throw DiscordApiErrors.UNKNOWN_BAN;
-		// make self-bans irreversible and hide them from view to avoid victim chasing
-
 		const banned_user = await User.getPublicUser(user_id);
 
 		await Promise.all([