summary refs log tree commit diff
path: root/libs/webhook.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/webhook.js')
-rw-r--r--libs/webhook.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/webhook.js b/libs/webhook.js
new file mode 100644
index 0000000..5c89f12
--- /dev/null
+++ b/libs/webhook.js
@@ -0,0 +1,11 @@
+const Discord = require("discord.js");
+
+module.exports = {
+	async getWebhook(guildId) {
+		const result = await database.query("SELECT * FROM amygdala_webhook WHERE guildId = $1;", [guildId]);
+		if (result.rows.length !== 1) return null;
+
+		return new Discord.WebhookClient({ url: result.rows[0].webhookurl });
+	}
+}
+