From 22c569c701c0bd56bbf065a0e6b6b4c6b1e88071 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 12 Mar 2025 10:25:23 +1300 Subject: [PATCH] Ignore not having access to read pins --- src/d2m/actions/update-pins.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d2m/actions/update-pins.js b/src/d2m/actions/update-pins.js index 692081a..6ef477f 100644 --- a/src/d2m/actions/update-pins.js +++ b/src/d2m/actions/update-pins.js @@ -25,7 +25,14 @@ function convertTimestamp(timestamp) { * @param {number?} convertedTimestamp */ async function updatePins(channelID, roomID, convertedTimestamp) { - const discordPins = await discord.snow.channel.getChannelPinnedMessages(channelID) + try { + var discordPins = await discord.snow.channel.getChannelPinnedMessages(channelID) + } catch (e) { + if (e.message === `{"message": "Missing Access", "code": 50001}`) { + return // Discord sends channel pins update events even for channels that the bot can't view/get pins in, just ignore it + } + throw e + } const pinned = pinsToList.pinsToList(discordPins) const kstate = await ks.roomToKState(roomID)