summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-14 21:16:15 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-14 21:16:15 +0200
commit8f862f0e5dba3985b4f38406fc19b5c5350324b9 (patch)
treecf27f5d6990995fa67ef78991b6837d2e58c70b1
parentfix #128 (diff)
downloadserver-8f862f0e5dba3985b4f38406fc19b5c5350324b9.tar.xz
fix #129
-rw-r--r--api/src/routes/guilds/#guild_id/webhooks.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/src/routes/guilds/#guild_id/webhooks.ts b/api/src/routes/guilds/#guild_id/webhooks.ts
new file mode 100644
index 00000000..a9dd164a
--- /dev/null
+++ b/api/src/routes/guilds/#guild_id/webhooks.ts
@@ -0,0 +1,17 @@
+import { Router, Response, Request } from "express";
+import { route } from "@fosscord/api";
+import { Webhook } from "@fosscord/util";
+
+const router: Router = Router();
+
+router.get("/", route({ permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => {
+	const webhooks = await Webhook.find({
+		where: { guild_id: req.params.guild_id },
+		select: ["application", "avatar", "channel_id", "guild_id", "id", "token", "type", "user", "source_guild", "name"],
+		relations: ["user", "application", "source_guild"]
+	});
+
+	return res.json(webhooks);
+});
+
+export default router;