3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

fix: fix crash in role_buttons if the role button message is removed and the guild reloaded

This commit is contained in:
Dragory 2022-04-23 19:52:55 +03:00
parent 123b08c191
commit 8db8b21995
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -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: [],