From 2e589aa9dea60839c654016fa4abd2ccc13ed040 Mon Sep 17 00:00:00 2001 From: k2helix <49949593+k2helix@users.noreply.github.com> Date: Fri, 9 Sep 2022 18:50:41 +0200 Subject: [PATCH] avoid crash if guild has Apps context menu --- modules/Patcher/General.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/Patcher/General.js b/modules/Patcher/General.js index e67b02b..fb0545d 100644 --- a/modules/Patcher/General.js +++ b/modules/Patcher/General.js @@ -80,6 +80,10 @@ module.exports = class General { if (menu?.type?.displayName) { patchMenu(menu.type.displayName); } else { + const { getGuild } = getModule([ 'getGuild' ], false); + if (getGuild(menu?.props?.guildId).applicationCommandCounts[2]) { + return menu; // avoid infinite loop if there are context menu commands in the guild + } menu.type = memorizeRender(menu.type, (res) => { res.props.children.type = memorizeRender(res.props.children.type, (res2) => { patchMenu(res2?.type?.displayName);