1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-09 12:12:35 +01:00

Add missing route middleware to messages route

This commit is contained in:
Madeline 2023-04-12 11:45:51 +10:00
parent 3c981b496b
commit 2d50adf151
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -73,9 +73,11 @@ export function isTextChannel(type: ChannelType): boolean {
// https://discord.com/developers/docs/resources/channel#create-message
// get messages
router.get("/", async (req: Request, res: Response) => {
router.get("/", route({}), async (req: Request, res: Response) => {
const channel_id = req.params.channel_id;
const channel = await Channel.findOneOrFail({ where: { id: channel_id } });
const channel = await Channel.findOneOrFail({
where: { id: channel_id },
});
if (!channel) throw new HTTPError("Channel not found", 404);
isTextChannel(channel.type);