From 8db8b219956dcdc0bee3a263b46c8a7aabc14fcb Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 23 Apr 2022 19:52:55 +0300 Subject: [PATCH] fix: fix crash in role_buttons if the role button message is removed and the guild reloaded --- backend/src/plugins/RoleButtons/functions/applyRoleButtons.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/plugins/RoleButtons/functions/applyRoleButtons.ts b/backend/src/plugins/RoleButtons/functions/applyRoleButtons.ts index b171bc2b..b48e13f2 100644 --- a/backend/src/plugins/RoleButtons/functions/applyRoleButtons.ts +++ b/backend/src/plugins/RoleButtons/functions/applyRoleButtons.ts @@ -20,7 +20,7 @@ export async function applyRoleButtons( if (existingSavedButtons?.channel_id) { const existingChannel = await pluginData.guild.channels.fetch(configItem.message.channel_id); const existingMessage = await (existingChannel?.isText() && - existingChannel.messages.fetch(existingSavedButtons.message_id)); + existingChannel.messages.fetch(existingSavedButtons.message_id).catch(() => null)); if (existingMessage && existingMessage.components.length) { await existingMessage.edit({ components: [],