From 1b373c11ec422208085f62c6ffb284166f1e415d Mon Sep 17 00:00:00 2001 From: Andrew Morgan <andrew@amorgan.xyz> Date: Sun, 17 Sep 2017 23:59:00 +0000 Subject: [PATCH] Auto-create _matrix webhook in channel. --- src/bot.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bot.ts b/src/bot.ts index 38c9b31..04b2b4c 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -194,6 +194,10 @@ export class DiscordBot { if (botUser) { const webhooks = await chan.fetchWebhooks(); hook = webhooks.filterArray((h) => h.name === "_matrix").pop(); + // Create a new webhook if none already exists + if (!hook) { + hook = await chan.createWebhook("_matrix", "", "Matrix Bridge: Allow rich user messages"); + } } try { if (!botUser) { -- GitLab