From cfb5cb506f3683a3f5b6cbb0aa1f07c6aec33a34 Mon Sep 17 00:00:00 2001 From: Essem Date: Sun, 2 Oct 2022 13:28:43 -0500 Subject: [PATCH] Properly log Lavalink connection errors, fix large file fallback message, actions changes --- .github/workflows/build.yml | 18 ++++-------------- events/interactionCreate.js | 2 +- events/messageCreate.js | 4 +++- utils/soundplayer.js | 4 ++-- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fe1c4b..c36757d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,6 @@ jobs: uses: actions/checkout@v1 - name: Setup Node.js environment uses: actions/setup-node@v2.1.2 - with: - cache: 'pnpm' - name: Setup pnpm uses: pnpm/action-setup@v2.2.2 with: @@ -33,23 +31,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 - - name: Setup MSYS2 - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - path-type: inherit - update: true - install: git mingw-w64-x86_64-cc mingw-w64-x86_64-libvips mingw-w64-x86_64-imagemagick + - name: Setup Scoop + uses: MinoruSekine/setup-scoop@v1 - name: Setup Node.js environment uses: actions/setup-node@v2.1.2 - with: - cache: 'pnpm' - name: Setup pnpm uses: pnpm/action-setup@v2.2.2 with: version: 7 + - name: Install Dependencies + run: scoop install libvips imagemagick - name: Build - shell: msys2 {0} run: $PNPM_HOME/pnpm install --config.strict-peer-dependencies=false && $PNPM_HOME/pnpm run build darwin: @@ -59,8 +51,6 @@ jobs: uses: actions/checkout@v1 - name: Setup Node.js environment uses: actions/setup-node@v2.1.2 - with: - cache: 'pnpm' - name: Setup pnpm uses: pnpm/action-setup@v2.2.2 with: diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 0a2ba80..1c18e8f 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -59,7 +59,7 @@ export default async (client, interaction) => { } else if (error.toString().includes("Timed out")) { await interaction[replyMethod]({ content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size.", flags: 64 }); } else { - logger.error(`Error occurred with application command ${command} with arguments ${JSON.stringify(interaction.data.options)}: ${error.stack || error}`); + logger.error(`Error occurred with application command ${command} with arguments ${JSON.stringify(interaction.data.optionsArray)}: ${error.stack || error}`); try { let err = error; if (error?.constructor?.name == "Promise") err = await error; diff --git a/events/messageCreate.js b/events/messageCreate.js index f922427..9938da7 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -140,7 +140,9 @@ export default async (client, message) => { if (process.env.TEMPDIR && process.env.TEMPDIR !== "") { await upload(client, result, message); } else { - await client.rest.channels.createMessage(message.channelID, "The resulting image was more than 8MB in size, so I can't upload it."); + await client.rest.channels.createMessage(message.channelID, { + content: "The resulting image was more than 8MB in size, so I can't upload it." + }); } } else { await client.rest.channels.createMessage(message.channelID, Object.assign({ diff --git a/utils/soundplayer.js b/utils/soundplayer.js index b84fed7..b0d6628 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -22,8 +22,8 @@ export async function checkStatus() { try { const response = await request(`http://${node.url}/version`, { headers: { authorization: node.auth } }).then(res => res.body.text()); if (response) newNodes.push(node); - } catch { - logger.error(`Failed to get status of Lavalink node ${node.url}.`); + } catch (e) { + logger.error(`Failed to get status of Lavalink node ${node.url}: ${e}`); } } nodes = newNodes;