diff --git a/app.js b/app.js index 4e9edae..35f0c7e 100644 --- a/app.js +++ b/app.js @@ -111,6 +111,7 @@ const Admiral = new Fleet({ requestTimeout: 30000 } }, + useCentralRequestHandler: true, services: [ { name: "prometheus", ServiceWorker: PrometheusWorker }, { name: "image", ServiceWorker: ImageWorker } diff --git a/classes/imageCommand.js b/classes/imageCommand.js index 7dc1b61..e642ba8 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 && await this.client.getMessage(status.channel.id, status.id).catch(() => undefined)) await status.delete(); + if (status && status.channel.messages.has(status.id)) await status.delete(); runningCommands.delete(this.message.author.id); } diff --git a/events/voiceChannelLeave.js b/events/voiceChannelLeave.js index a16b8dd..bce25bb 100644 --- a/events/voiceChannelLeave.js +++ b/events/voiceChannelLeave.js @@ -17,7 +17,7 @@ export default async (client, cluster, worker, ipc, member, oldChannel) => { waitMessage.edit(`🔊 ${member.mention} is the new voice channel host.`); } else { try { - if (waitMessage.channel.messages.get(waitMessage.id)) await waitMessage.delete(); + if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { // no-op } @@ -40,7 +40,7 @@ export default async (client, cluster, worker, ipc, member, oldChannel) => { awaitRejoin.on("end", async (rejoined) => { if (rejoined) { try { - if (waitMessage.channel.messages.get(waitMessage.id)) await waitMessage.delete(); + if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { // no-op } @@ -48,7 +48,7 @@ export default async (client, cluster, worker, ipc, member, oldChannel) => { const members = oldChannel.voiceMembers.filter((i) => i.id !== client.user.id && !i.bot); if (members.length === 0) { try { - if (waitMessage.channel.messages.get(waitMessage.id)) await waitMessage.delete(); + if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { // no-op } diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index 717d93b..a8a0934 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 (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); + if (askMessage.channel.messages.has(askMessage.id)) 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 (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); + if (askMessage.channel.messages.has(askMessage.id)) 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 (await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) await currentPage.delete(); + if (currentPage.channel.messages.has(currentPage.id)) 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 (await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) { + if (currentPage.channel.messages.has(currentPage.id)) { await currentPage.edit(components); } }); diff --git a/utils/soundplayer.js b/utils/soundplayer.js index 4aad4e2..23f3342 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -150,9 +150,9 @@ export async function nextSong(client, message, connection, track, info, music, players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: host, voiceChannel: voiceChannel, originalChannel: message.channel, loop: loop, shuffle: shuffle, playMessage: playingMessage }); connection.once("error", async (error) => { try { - if (playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); + if (playingMessage.channel.messages.has(playingMessage.id)) await playingMessage.delete(); const playMessage = players.get(voiceChannel.guild.id).playMessage; - if (playMessage.channel.messages.get(playMessage.id)) await playMessage.delete(); + if (playMessage.channel.messages.has(playMessage.id)) await playMessage.delete(); } catch { // no-op } @@ -196,8 +196,8 @@ export async function nextSong(client, message, connection, track, info, music, const newTrack = await Rest.decode(connection.node, newQueue[0]); nextSong(client, message, connection, newQueue[0], newTrack, music, voiceChannel, host, player.loop, player.shuffle, track); try { - if (newQueue[0] !== track && playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); - if (newQueue[0] !== track && player.playMessage.channel.messages.get(player.playMessage.id)) await player.playMessage.delete(); + if (newQueue[0] !== track && playingMessage.channel.messages.has(playingMessage.id)) await playingMessage.delete(); + if (newQueue[0] !== track && player.playMessage.channel.messages.has(player.playMessage.id)) await player.playMessage.delete(); } catch { // no-op } @@ -209,15 +209,15 @@ export async function nextSong(client, message, connection, track, info, music, skipVotes.delete(voiceChannel.guild.id); if (music) await client.createMessage(message.channel.id, "🔊 The current voice channel session has ended."); try { - if (playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); - if (player && player.playMessage.channel.messages.get(player.playMessage.id)) await player.playMessage.delete(); + if (playingMessage.channel.messages.has(playingMessage.id)) await playingMessage.delete(); + if (player && player.playMessage.channel.messages.has(player.playMessage.id)) await player.playMessage.delete(); } catch { // no-op } } else { try { - if (playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); - if (player && player.playMessage.channel.messages.get(player.playMessage.id)) await player.playMessage.delete(); + if (playingMessage.channel.messages.has(playingMessage.id)) await playingMessage.delete(); + if (player && player.playMessage.channel.messages.has(player.playMessage.id)) await player.playMessage.delete(); } catch { // no-op }