From 32bd106de0859ebac50690126ddac6efcbc95a73 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 7 Nov 2022 14:06:36 +0000 Subject: [PATCH] fix 2 issues in `!config get` --- src/commands/ProtectionsCommands.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/ProtectionsCommands.ts b/src/commands/ProtectionsCommands.ts index 8df7ee9..5611922 100644 --- a/src/commands/ProtectionsCommands.ts +++ b/src/commands/ProtectionsCommands.ts @@ -139,9 +139,9 @@ export async function execConfigRemoveProtection(roomId: string, event: any, mjo * !mjolnir get [protection name] */ export async function execConfigGetProtection(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { - let pickProtections = Object.keys(mjolnir.protectionManager.protections); + let pickProtections = Array.from(mjolnir.protectionManager.protections.keys()); - if (parts.length < 3) { + if (parts.length === 0) { // no specific protectionName provided, show all of them. // sort output by protection name @@ -175,12 +175,12 @@ export async function execConfigGetProtection(roomId: string, event: any, mjolni for (const settingName of settingNames) { anySettings = true; - let value = protectionSettings[settingName].value + let value = protectionSettings[settingName].value.toString(); text += `* ${protectionName}.${settingName}: ${value}`; // `protectionName` and `settingName` are user-provided but // validated against the names of existing protections and their // settings, so XSS is avoided for these already - html += `
  • ${protectionName}.${settingName}: ${htmlEscape(value)}
  • ` + html += `
  • ${protectionName}.${settingName}: ${htmlEscape(value)}
  • `; } }