From df79fa2bda2fb4dc0c300c88657da6715de15e0d Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 28 Nov 2024 10:12:25 +0500 Subject: [PATCH] fix /avatar returning non server url --- commands/General/avatar.c.js | 2 +- commands/General/avatar.js | 4 +- package.json | 8 +-- pnpm-lock.yaml | 131 +++++++++++++++++++---------------- 4 files changed, 80 insertions(+), 65 deletions(-) diff --git a/commands/General/avatar.c.js b/commands/General/avatar.c.js index 33c1231e..21b083d8 100644 --- a/commands/General/avatar.c.js +++ b/commands/General/avatar.c.js @@ -24,7 +24,7 @@ class AvatarContext extends BaseCommand { * @param {import("discord.js").UserContextMenuCommandInteraction} interaction */ async execute(client, interaction) { - const avatarURL = interaction.targetUser.displayAvatarURL({ size: 2048 }); + const avatarURL = interaction.guild ? interaction.targetMember.displayAvatarURL({ dynamic: true, extension: "png", size: 2048 }) : interaction.targetUser.avatarURL({ dynamic: true, extension: "png", size: 2048 }); const embed = client.embed({ image: avatarURL }); interaction.reply({ diff --git a/commands/General/avatar.js b/commands/General/avatar.js index b953ed98..485dc7d5 100644 --- a/commands/General/avatar.js +++ b/commands/General/avatar.js @@ -57,8 +57,8 @@ class Avatar extends BaseCommand { async execute(client, interaction) { await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false }); - const user = interaction.options.getUser("user") || interaction.user; - const avatarURL = interaction.options.getBoolean("server") ? user.displayAvatarURL({ size: 2048 }) : user.avatarURL({ size: 2048 }); + const user = interaction.guild ? interaction.options.getMember("user") || interaction.member : interaction.options.getUser("user") || interaction.user; + const avatarURL = interaction.options.getBoolean("server") && interaction.guild ? user.displayAvatarURL({ dynamic: true, extension: "png", size: 2048 }) : user.user.avatarURL({ dynamic: true, extension: "png", size: 2048 }); const embed = client.embed({ image: avatarURL }); interaction.editReply({ diff --git a/package.json b/package.json index 0fa046b9..26daf1bd 100644 --- a/package.json +++ b/package.json @@ -12,17 +12,17 @@ "@discordjs/opus": "^0.9.0", "@discordjs/rest": "^2.4.0", "@discordjs/voice": "^0.18.0", - "@napi-rs/canvas": "^0.1.62", + "@napi-rs/canvas": "^0.1.63", "chalk": "^4.1.2", "cron": "^3.2.1", - "discord-api-types": "^0.37.105", + "discord-api-types": "^0.37.107", "discord-giveaways": "^6.0.1", "discord-player": "^6.7.1", "discord-player-youtubei": "1.3.5", "discord.js": "^14.16.3", "gamedig": "^5.1.4", - "i18next": "^23.16.6", - "i18next-fs-backend": "^2.3.2", + "i18next": "^24.0.0", + "i18next-fs-backend": "^2.6.0", "md5": "^2.3.0", "moment": "^2.29.4", "mongoose": "^8.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5257e527..40604c47 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,8 +21,8 @@ importers: specifier: ^0.18.0 version: 0.18.0(@discordjs/opus@0.9.0) '@napi-rs/canvas': - specifier: ^0.1.62 - version: 0.1.62 + specifier: ^0.1.63 + version: 0.1.63 chalk: specifier: ^4.1.2 version: 4.1.2 @@ -30,8 +30,8 @@ importers: specifier: ^3.2.1 version: 3.2.1 discord-api-types: - specifier: ^0.37.105 - version: 0.37.105 + specifier: ^0.37.107 + version: 0.37.107 discord-giveaways: specifier: ^6.0.1 version: 6.0.1(discord.js@14.16.3) @@ -48,11 +48,11 @@ importers: specifier: ^5.1.4 version: 5.1.4 i18next: - specifier: ^23.16.6 - version: 23.16.6 + specifier: ^24.0.0 + version: 24.0.0 i18next-fs-backend: - specifier: ^2.3.2 - version: 2.3.2 + specifier: ^2.6.0 + version: 2.6.0 md5: specifier: ^2.3.0 version: 2.3.0 @@ -175,62 +175,68 @@ packages: '@mongodb-js/saslprep@1.1.9': resolution: {integrity: sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==} - '@napi-rs/canvas-android-arm64@0.1.62': - resolution: {integrity: sha512-gilURMgNfCqXQmw211Jo6BiaQpPS7RD5baKWgnQ17XbgpJPi8+DFtbdIzQsCiFWl6p2TfXpg3cqWfN0fm+blRw==} + '@napi-rs/canvas-android-arm64@0.1.63': + resolution: {integrity: sha512-+OqPr/ZGrPgHC5AHFWDo5PL+Az1UprgSoCnWJu8Uiv2TkW4zjVzTDDOLCnbUR/9dAeC+ztD5nabLxpC0e8RrSw==} engines: {node: '>= 10'} cpu: [arm64] os: [android] - '@napi-rs/canvas-darwin-arm64@0.1.62': - resolution: {integrity: sha512-TodBo7kdMEeGsGa80/BTJwyG9od+AMGDFe6UW7jkU8uEJmzOROVp6Y2Ka6LfLixpEGwNUCEFEUabr/gETD7bhg==} + '@napi-rs/canvas-darwin-arm64@0.1.63': + resolution: {integrity: sha512-yNO/6fESXlm8znomd0iXz+jhJJlykv4/iIPBnkyZnYLYu6sKuWklHUy6W4QvJsUuap23iiA74ZfJ1/5mCDwlsA==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@napi-rs/canvas-darwin-x64@0.1.62': - resolution: {integrity: sha512-1SqtF7HbLh1XwxUhpkIZg2huG25UHkOvjMKh+GksARs4RiKFC7/jPnPyj3KtmkejyA6zsuqFd49qeJ3StJr4hQ==} + '@napi-rs/canvas-darwin-x64@0.1.63': + resolution: {integrity: sha512-O/t+a6x+5KHDKDqY1GvEO7Y7y9rwueKHeFI+wqiY1d19DwB/+ogHO7wqSNdb2Wj1wEdzxuwedPHnqRkCACw+JA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@napi-rs/canvas-linux-arm-gnueabihf@0.1.62': - resolution: {integrity: sha512-L5Gp6sKyXV0KXw9V/Cy4DlouL/Wz+D5P14XsRQLlSnTXKVHSBEufZBopsbdjBu0XZTp5rAGWsdnACDzwMSsi+A==} + '@napi-rs/canvas-linux-arm-gnueabihf@0.1.63': + resolution: {integrity: sha512-pt3qXCmN0I6hGBcKPf9ufPyqxwHQEpUPFtQy3cXA++f2WNsfXgxGSAXh1j3MarMKo6Y+0hwK55esnwr6vqvNtQ==} engines: {node: '>= 10'} cpu: [arm] os: [linux] - '@napi-rs/canvas-linux-arm64-gnu@0.1.62': - resolution: {integrity: sha512-uiyeg4TFSf+SVOlM5pIh8a4oNEUAgL+KoCm6Qvpm8XhBmIpVrCpPShp0eje/zuaMCJtzFkenkbwOapW/blCCVQ==} + '@napi-rs/canvas-linux-arm64-gnu@0.1.63': + resolution: {integrity: sha512-BcdpLKFNm8HDZ1qmeRo7VXMbowVq6D7huGZBXDdScQll/rpm0V6+Zl55TmyuF/VwhEfqINtH4caSHXP2DnV+xQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@napi-rs/canvas-linux-arm64-musl@0.1.62': - resolution: {integrity: sha512-diZxX37Fs/Tn2m4UDhzVxAxu0rHtis8EImamcrL+KNDSjCiEe/h0r+Gfh7wNxRv9REh10UP+zlD8PTrcSKjL3g==} + '@napi-rs/canvas-linux-arm64-musl@0.1.63': + resolution: {integrity: sha512-t5R/k5X2Sly97Rz5KB91vW87C95n3DH2/ZiAdM+EoQzBxO/br04PYajYYeo09gmUblth3gfDbXk4rW79Oiaz2Q==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@napi-rs/canvas-linux-x64-gnu@0.1.62': - resolution: {integrity: sha512-nv0is/DH05kfREHD+62ienlb45Fi3kcvHKwmsHzSrvqNu0l6CFj8h8CuRvhB3tl1KStHZFDxUAqu14MecuK6eA==} + '@napi-rs/canvas-linux-riscv64-gnu@0.1.63': + resolution: {integrity: sha512-B3W00grMj/UCFW+qtO6mn8cRloYDlEE3azGi7oHsNwUvYFQpqgWSvBEiyCbqkyO3vvA7DpE0uckMM38twltehw==} + engines: {node: '>= 10'} + cpu: [riscv64] + os: [linux] + + '@napi-rs/canvas-linux-x64-gnu@0.1.63': + resolution: {integrity: sha512-SR6/cim4PRdMe3HYgSUiC06gtmE8zCldH9EKyu7+o4SVlhesRvgeDZq7E0WatdO9ymmX7PvA6gpBLaHdbl6WGw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@napi-rs/canvas-linux-x64-musl@0.1.62': - resolution: {integrity: sha512-r8tT3k67xN5KhPTEn2KPYZ4iEGTcE6b3+ahPpYBGhKRZfZkMdvzHnmuzcSLkjh8bBlkoiObSBK/G8oY7Q335RA==} + '@napi-rs/canvas-linux-x64-musl@0.1.63': + resolution: {integrity: sha512-bhI7qs2egJfvDaQZx80DQizyo121hHYBM/o3tAtSanET2e7XdKbH2OJju0ruSG3VLdDA7zolzBhW20N7RAfvmw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@napi-rs/canvas-win32-x64-msvc@0.1.62': - resolution: {integrity: sha512-uQdYrjHu6QfGFxD2K9qzomOzygC8Px5dy4v/PgwBSPCd0ShIjGrIGAY5YobjH2xwEtYEPL9KgJkGe3ts+k5Auw==} + '@napi-rs/canvas-win32-x64-msvc@0.1.63': + resolution: {integrity: sha512-2gP9bs8xqYQIU0M243Vf+u5pmJNBMwA2+unfwjWId8qUR6yASTtCD7GhZkCDVGPLBxHtAyTg2Gza4VkR2ev6zA==} engines: {node: '>= 10'} cpu: [x64] os: [win32] - '@napi-rs/canvas@0.1.62': - resolution: {integrity: sha512-+aqi0evK3ohAG3pFhMhM5C6y26foMUK0C1c3dfC1p/CRETwAuQlobuFGxadHkyIgc9mVyfGTpZUCnlrzt6xSwg==} + '@napi-rs/canvas@0.1.63': + resolution: {integrity: sha512-B1H0lBQJOivF3JW1uXMHydIbHRYcMLXUVgjyF5NZHvNCHCmQhbDerbiM9Q2Wwm9KtcQ2t1I2J+DJEFVE9Q33lQ==} engines: {node: '>= 10'} '@nodelib/fs.scandir@2.1.5': @@ -464,8 +470,8 @@ packages: discord-api-types@0.37.100: resolution: {integrity: sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==} - discord-api-types@0.37.105: - resolution: {integrity: sha512-TSNlLF5Q9vFLMeHjYskhmDj/zCQ4dFA+OLxQrHUypGW48gt8ttGaB+opCD9w3Zkq1otyoBoetrwaoDFZAFuGng==} + discord-api-types@0.37.107: + resolution: {integrity: sha512-XOxmxnhtYIRH55kLTrc/JS3nJV1l3wfBtTptFiRGdGDOe2qdCT4DltpxSgskasfDrKfw71Z5quG4tYqTxyPJ7g==} discord-api-types@0.37.83: resolution: {integrity: sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==} @@ -679,11 +685,16 @@ packages: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} - i18next-fs-backend@2.3.2: - resolution: {integrity: sha512-LIwUlkqDZnUI8lnUxBnEj8K/FrHQTT/Sc+1rvDm9E8YvvY5YxzoEAASNx+W5M9DfD5s77lI5vSAFWeTp26B/3Q==} + i18next-fs-backend@2.6.0: + resolution: {integrity: sha512-3ZlhNoF9yxnM8pa8bWp5120/Ob6t4lVl1l/tbLmkml/ei3ud8IWySCHt2lrY5xWRlSU5D9IV2sm5bEbGuTqwTw==} - i18next@23.16.6: - resolution: {integrity: sha512-wGdE5rUfkZtrL5k6MCptxbpjmgwku4rBRVU/YOJ7Xfd841fgaZjlxHpVJ5NIz8sfSvAJhEhJrvJ8qE7AWXE4Xg==} + i18next@24.0.0: + resolution: {integrity: sha512-ORGCwMrXxpmB/AljFbGEe0UK/9Pz6umb9aZgLZ9qJGE+kjKhlnLj423WX2mt+N0MlEJ78pQXFMBmeMzrkLxriQ==} + peerDependencies: + typescript: ^5 + peerDependenciesMeta: + typescript: + optional: true iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} @@ -1389,7 +1400,7 @@ snapshots: '@discordjs/voice@0.18.0(@discordjs/opus@0.9.0)': dependencies: '@types/ws': 8.5.12 - discord-api-types: 0.37.105 + discord-api-types: 0.37.107 prism-media: 1.3.5(@discordjs/opus@0.9.0) tslib: 2.7.0 ws: 8.18.0 @@ -1457,44 +1468,48 @@ snapshots: dependencies: sparse-bitfield: 3.0.3 - '@napi-rs/canvas-android-arm64@0.1.62': + '@napi-rs/canvas-android-arm64@0.1.63': optional: true - '@napi-rs/canvas-darwin-arm64@0.1.62': + '@napi-rs/canvas-darwin-arm64@0.1.63': optional: true - '@napi-rs/canvas-darwin-x64@0.1.62': + '@napi-rs/canvas-darwin-x64@0.1.63': optional: true - '@napi-rs/canvas-linux-arm-gnueabihf@0.1.62': + '@napi-rs/canvas-linux-arm-gnueabihf@0.1.63': optional: true - '@napi-rs/canvas-linux-arm64-gnu@0.1.62': + '@napi-rs/canvas-linux-arm64-gnu@0.1.63': optional: true - '@napi-rs/canvas-linux-arm64-musl@0.1.62': + '@napi-rs/canvas-linux-arm64-musl@0.1.63': optional: true - '@napi-rs/canvas-linux-x64-gnu@0.1.62': + '@napi-rs/canvas-linux-riscv64-gnu@0.1.63': optional: true - '@napi-rs/canvas-linux-x64-musl@0.1.62': + '@napi-rs/canvas-linux-x64-gnu@0.1.63': optional: true - '@napi-rs/canvas-win32-x64-msvc@0.1.62': + '@napi-rs/canvas-linux-x64-musl@0.1.63': optional: true - '@napi-rs/canvas@0.1.62': + '@napi-rs/canvas-win32-x64-msvc@0.1.63': + optional: true + + '@napi-rs/canvas@0.1.63': optionalDependencies: - '@napi-rs/canvas-android-arm64': 0.1.62 - '@napi-rs/canvas-darwin-arm64': 0.1.62 - '@napi-rs/canvas-darwin-x64': 0.1.62 - '@napi-rs/canvas-linux-arm-gnueabihf': 0.1.62 - '@napi-rs/canvas-linux-arm64-gnu': 0.1.62 - '@napi-rs/canvas-linux-arm64-musl': 0.1.62 - '@napi-rs/canvas-linux-x64-gnu': 0.1.62 - '@napi-rs/canvas-linux-x64-musl': 0.1.62 - '@napi-rs/canvas-win32-x64-msvc': 0.1.62 + '@napi-rs/canvas-android-arm64': 0.1.63 + '@napi-rs/canvas-darwin-arm64': 0.1.63 + '@napi-rs/canvas-darwin-x64': 0.1.63 + '@napi-rs/canvas-linux-arm-gnueabihf': 0.1.63 + '@napi-rs/canvas-linux-arm64-gnu': 0.1.63 + '@napi-rs/canvas-linux-arm64-musl': 0.1.63 + '@napi-rs/canvas-linux-riscv64-gnu': 0.1.63 + '@napi-rs/canvas-linux-x64-gnu': 0.1.63 + '@napi-rs/canvas-linux-x64-musl': 0.1.63 + '@napi-rs/canvas-win32-x64-msvc': 0.1.63 '@nodelib/fs.scandir@2.1.5': dependencies: @@ -1705,7 +1720,7 @@ snapshots: discord-api-types@0.37.100: {} - discord-api-types@0.37.105: {} + discord-api-types@0.37.107: {} discord-api-types@0.37.83: {} @@ -1745,7 +1760,7 @@ snapshots: '@discord-player/ffmpeg': 0.1.0 '@discord-player/opus': 0.1.2 '@types/ws': 8.5.12 - discord-api-types: 0.37.105 + discord-api-types: 0.37.107 prism-media: 1.3.5(@discordjs/opus@0.9.0) tslib: 2.7.0 ws: 8.18.0 @@ -2023,9 +2038,9 @@ snapshots: transitivePeerDependencies: - supports-color - i18next-fs-backend@2.3.2: {} + i18next-fs-backend@2.6.0: {} - i18next@23.16.6: + i18next@24.0.0: dependencies: '@babel/runtime': 7.25.6