summary refs log tree commit diff
path: root/api/src/routes/guilds/#guild_id/voice-states
diff options
context:
space:
mode:
authorAlTech98 <altech123159@gmail.com>2021-09-04 11:46:46 +0200
committerAlTech98 <altech123159@gmail.com>2021-09-04 11:46:46 +0200
commit58fb2d8a9187fb9f43a0df53fd5f36a75d02cc83 (patch)
tree57b16742488d54773da3d3519a5ada72e817f25e /api/src/routes/guilds/#guild_id/voice-states
parentAdded missing permissions and channel types (diff)
downloadserver-58fb2d8a9187fb9f43a0df53fd5f36a75d02cc83.tar.xz
Added /guilds/:id/voice-states apis
Diffstat (limited to 'api/src/routes/guilds/#guild_id/voice-states')
-rw-r--r--api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts15
-rw-r--r--api/src/routes/guilds/#guild_id/voice-states/@me/index.ts15
2 files changed, 30 insertions, 0 deletions
diff --git a/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts b/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts
new file mode 100644
index 00000000..02951f81
--- /dev/null
+++ b/api/src/routes/guilds/#guild_id/voice-states/#user_id/index.ts
@@ -0,0 +1,15 @@
+import { check } from "../../../../../util/instanceOf";
+import { VoiceStateUpdateSchema } from "../../../../../schema";
+import { Request, Response, Router } from "express";
+import { updateVoiceState } from "../../../../../util/VoiceState";
+
+const router = Router();
+
+router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
+	const body = req.body as VoiceStateUpdateSchema;
+	const { guild_id, user_id } = req.params;
+	await updateVoiceState(body, guild_id, req.user_id, user_id)
+	return res.sendStatus(204);
+});
+
+export default router;
\ No newline at end of file
diff --git a/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts b/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts
new file mode 100644
index 00000000..42ba543e
--- /dev/null
+++ b/api/src/routes/guilds/#guild_id/voice-states/@me/index.ts
@@ -0,0 +1,15 @@
+import { check } from "../../../../../util/instanceOf";
+import { VoiceStateUpdateSchema } from "../../../../../schema";
+import { Request, Response, Router } from "express";
+import { updateVoiceState } from "../../../../../util/VoiceState";
+
+const router = Router();
+
+router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
+	const body = req.body as VoiceStateUpdateSchema;
+	const { guild_id } = req.params;
+	await updateVoiceState(body, guild_id, req.user_id)
+	return res.sendStatus(204);
+});
+
+export default router;
\ No newline at end of file