summary refs log tree commit diff
path: root/api/src/routes
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 12:18:49 +0200
committerGitHub <noreply@github.com>2021-09-04 12:18:49 +0200
commitbfdd9c10d82760f0cadc2d59aa2b467cdf14b02a (patch)
tree5477dcf75a9abf3d5d5124b319e9251728744fd1 /api/src/routes
parent:bug: fix ReadyEventData (diff)
parent:pencil: added comments and updated type (diff)
downloadserver-bfdd9c10d82760f0cadc2d59aa2b467cdf14b02a.tar.xz
Merge pull request #320 from AlTech98/master
Added /guilds/:id/voice-states/ apis, VOICE_SERVER_UPDATE fix
Diffstat (limited to '')
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts4
-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
3 files changed, 34 insertions, 0 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts

index 1a3150cf..ad590d05 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -17,11 +17,15 @@ export function isTextChannel(type: ChannelType): boolean { switch (type) { case ChannelType.GUILD_STORE: case ChannelType.GUILD_VOICE: + case ChannelType.GUILD_STAGE_VOICE: case ChannelType.GUILD_CATEGORY: throw new HTTPError("not a text channel", 400); case ChannelType.DM: case ChannelType.GROUP_DM: case ChannelType.GUILD_NEWS: + case ChannelType.GUILD_NEWS_THREAD: + case ChannelType.GUILD_PUBLIC_THREAD: + case ChannelType.GUILD_PRIVATE_THREAD: case ChannelType.GUILD_TEXT: return true; } 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