From 11aa362edae695048e56b077c96b05264bdc889b Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 1 Dec 2021 17:23:26 +0000 Subject: [PATCH] Fix setBotPower to not use `.content` (#7179) * Fix setBotPower to not use `.content` * Simplify currentPl --- src/ScalarMessaging.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 8db6a17422..b110aef031 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -473,10 +473,7 @@ async function setBotPower( // If the PL is equal to or greater than the requested PL, ignore. if (ignoreIfGreater === true) { // As per https://matrix.org/docs/spec/client_server/r0.6.0#m-room-power-levels - const currentPl = ( - powerLevels.content.users && powerLevels.content.users[userId] - ) || powerLevels.content.users_default || 0; - + const currentPl = powerLevels.users?.[userId] ?? powerLevels.users_default ?? 0; if (currentPl >= level) { return sendResponse(event, { success: true,