From a438fe26df509c6fda6e0b2bc09af01cadb51715 Mon Sep 17 00:00:00 2001 From: Essem Date: Sat, 19 Mar 2022 23:22:35 -0500 Subject: [PATCH] Add fallback for message checking, add link to privacy policy in info --- classes/imageCommand.js | 2 +- commands/general/info.js | 4 ++++ utils/pagination/pagination.js | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/classes/imageCommand.js b/classes/imageCommand.js index e642ba8..a93d284 100644 --- a/classes/imageCommand.js +++ b/classes/imageCommand.js @@ -112,7 +112,7 @@ class ImageCommand extends Command { if (e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit."; throw e; } finally { - if (status && status.channel.messages.has(status.id)) await status.delete(); + if (status && (status.channel.messages ? status.channel.messages.has(status.id) : await this.client.getMessage(status.channel.id, status.id).catch(() => undefined))) await status.delete(); runningCommands.delete(this.message.author.id); } diff --git a/commands/general/info.js b/commands/general/info.js index dad8830..552d571 100644 --- a/commands/general/info.js +++ b/commands/general/info.js @@ -39,6 +39,10 @@ class InfoCommand extends Command { name: "💻 Source Code:", value: "[Click here!](https://github.com/esmBot/esmBot)" }, + { + name: "🛡️ Privacy Policy:", + value: "[Click here!](https://projectlounge.pw/esmBot/privacy.html)" + }, { name: "🐦 Twitter:", value: "[Click here!](https://twitter.com/esmBot_)" diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index a8a0934..af29b06 100644 --- a/utils/pagination/pagination.js +++ b/utils/pagination/pagination.js @@ -121,7 +121,7 @@ export default async (client, message, pages, timeout = 120000) => { dropdownCollector.on("interaction", async (response) => { if (response.data.custom_id !== "seekDropdown") return; try { - if (askMessage.channel.messages.has(askMessage.id)) await askMessage.delete(); + if (askMessage.channel.messages ? askMessage.channel.messages.has(askMessage.id) : await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); } catch { // no-op } @@ -133,7 +133,7 @@ export default async (client, message, pages, timeout = 120000) => { dropdownCollector.once("end", async () => { if (ended) return; try { - if (askMessage.channel.messages.has(askMessage.id)) await askMessage.delete(); + if (askMessage.channel.messages ? askMessage.channel.messages.has(askMessage.id) : await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); } catch { // no-op } @@ -146,7 +146,7 @@ export default async (client, message, pages, timeout = 120000) => { case "delete": await interaction.deferUpdate(); interactionCollector.emit("end"); - if (currentPage.channel.messages.has(currentPage.id)) await currentPage.delete(); + if (currentPage.channel.messages ? currentPage.channel.messages.has(currentPage.id) : await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) await currentPage.delete(); return; default: break; @@ -158,7 +158,7 @@ export default async (client, message, pages, timeout = 120000) => { for (const index of components.components[0].components.keys()) { components.components[0].components[index].disabled = true; } - if (currentPage.channel.messages.has(currentPage.id)) { + if (currentPage.channel.messages ? currentPage.channel.messages.has(currentPage.id) : await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) { await currentPage.edit(components); } });