From 218aec4f0b030ded48d4f3c6ba05cecc095d11c7 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Wed, 27 Dec 2023 17:06:13 +0000 Subject: [PATCH] Fix command setting state twice --- src/Connections/SetupConnection.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Connections/SetupConnection.ts b/src/Connections/SetupConnection.ts index 74b531f58..8073b639f 100644 --- a/src/Connections/SetupConnection.ts +++ b/src/Connections/SetupConnection.ts @@ -272,11 +272,14 @@ export class SetupConnection extends CommandConnection { } throw err; }); - if (!event || Object.keys(event).length === 0) { + if (!event || event.disabled === true || Object.keys(event).length === 0) { throw new CommandError("Invalid webhook name", `No webhook by the name of "${name}" is configured.`); } - await this.client.sendStateEvent(this.roomId, GenericHookConnection.CanonicalEventType, name, {}); + await this.client.sendStateEvent(this.roomId, GenericHookConnection.CanonicalEventType, name, { + disabled: true + }); + return this.client.sendHtmlNotice(this.roomId, md.renderInline(`Removed webhook \`${name}\``)); }