summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-01-15 18:42:29 +1100
committerErkin Alp Güney <erkinalp9035@gmail.com>2022-01-23 23:29:14 +0300
commit14a4321c0ffe1e1adb7d95f5b3045b53cc7b8abd (patch)
treedcdb9a328ab340f470694cd140d211b4e7928f83
parentApply suggestions from code review (diff)
downloadserver-14a4321c0ffe1e1adb7d95f5b3045b53cc7b8abd.tar.xz
Add unhandled channel types to IsTextChannel method
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index c3d3d408..1ae9d676 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -37,7 +37,11 @@ export function isTextChannel(type: ChannelType): boolean {
 		case ChannelType.GUILD_PUBLIC_THREAD:
 		case ChannelType.GUILD_PRIVATE_THREAD:
 		case ChannelType.GUILD_TEXT:
+		case ChannelType.ENCRYPTED:
+		case ChannelType.ENCRYPTED_THREAD:
 			return true;
+		default:
+			throw new HTTPError("unimplemented", 400);
 	}
 }
 
@@ -87,7 +91,7 @@ router.get("/", async (req: Request, res: Response) => {
 	permissions.hasThrow("VIEW_CHANNEL");
 	if (!permissions.has("READ_MESSAGE_HISTORY")) return res.json([]);
 
-	var query: FindManyOptions<Message> & { where: { id?: any } } = {
+	var query: FindManyOptions<Message> & { where: { id?: any; }; } = {
 		order: { id: "DESC" },
 		take: limit,
 		where: { channel_id },
@@ -216,7 +220,7 @@ router.post(
 			channel.save()
 		]);
 
-		postHandleMessage(message).catch((e) => {}); // no await as it shouldnt block the message send function and silently catch error
+		postHandleMessage(message).catch((e) => { }); // no await as it shouldnt block the message send function and silently catch error
 
 		return res.json(message);
 	}