From 3ed65c3c8679c17d41f419f8b478ba19ae18aa9f Mon Sep 17 00:00:00 2001 From: Essem Date: Sat, 26 Nov 2022 13:31:40 -0600 Subject: [PATCH] Update readme, attempt some things, update packages --- README.md | 17 ++++- commands/general/channel.js | 4 +- commands/general/info.js | 2 +- commands/music/host.js | 2 +- commands/music/nowplaying.js | 2 +- commands/tags/tags.js | 2 +- events/interactionCreate.js | 7 ++- package.json | 8 +-- pnpm-lock.yaml | 119 ++++++++++++++++++----------------- utils/soundplayer.js | 2 +- 10 files changed, 91 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index e16c7a7..595e32d 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,25 @@ [![esmBot Support](https://discordapp.com/api/guilds/592399417676529688/embed.png)](https://discord.gg/esmbot) ![GitHub license](https://img.shields.io/github/license/esmBot/esmBot.svg) -esmBot is an easily-extendable, multipurpose, and entertainment-focused Discord bot made using [Oceanic](https://oceanic.ws) with image, music, and utility commands, alongside many others. +esmBot is a free and open-source Discord bot designed to entertain your server. It's made using [Oceanic](https://oceanic.ws) and comes with image, music, and utility commands out of the box. [![Top.gg](https://top.gg/api/widget/429305856241172480.svg)](https://top.gg/bot/429305856241172480) +## Features +- Powerful, efficient, and performant image processing powered by [libvips](https://github.com/libvips/libvips) +- Lots of image manipulation and processing commands out of the box +- Handling of output images larger than 8MB via a local web server +- Optional WebSocket/HTTP-based external image API with load balancing +- Music and sound playback from many different configurable sources via [Lavalink](https://github.com/freyacodes/Lavalink) +- Server tags system for saving/retrieving content +- Low RAM and CPU usage when idle +- Support for slash/application commands and classic, prefix-based message commands +- Support for multiple database backends (PostgreSQL and SQLite backends included) +- [PM2](https://pm2.keymetrics.io)-based cluster/shard handling +- Flexible command handler allowing you to create new commands by adding script files + ## Usage -You can invite the bot to your server using this link: https://esmbot.net/invite +You can invite the main instance of esmBot to your server using this link: https://esmbot.net/invite A command list can be found [here](https://esmbot.net/help.html). diff --git a/commands/general/channel.js b/commands/general/channel.js index f0c5191..bdc54f0 100644 --- a/commands/general/channel.js +++ b/commands/general/channel.js @@ -17,7 +17,7 @@ class ChannelCommand extends Command { if (this.args[1]?.match(/^?$/) && this.args[1] >= 21154535154122752n) { const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", ""); if (guildDB.disabled.includes(id)) return "I'm already disabled in this channel!"; - channel = this.guild.channels.get(id); + channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id); } else { if (guildDB.disabled.includes(this.channel.id)) return "I'm already disabled in this channel!"; channel = this.channel; @@ -31,7 +31,7 @@ class ChannelCommand extends Command { if (this.args[1]?.match(/^?$/) && this.args[1] >= 21154535154122752n) { const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", ""); if (!guildDB.disabled.includes(id)) return "I'm not disabled in that channel!"; - channel = this.guild.channels.get(id); + channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id); } else { if (!guildDB.disabled.includes(this.channel.id)) return "I'm not disabled in this channel!"; channel = this.channel; diff --git a/commands/general/info.js b/commands/general/info.js index 0293f9f..d27b87c 100644 --- a/commands/general/info.js +++ b/commands/general/info.js @@ -6,7 +6,7 @@ import { getServers } from "../../utils/misc.js"; class InfoCommand extends Command { async run() { let owner = this.client.users.get(process.env.OWNER.split(",")[0]); - if (!owner) owner = await this.client.getRESTUser(process.env.OWNER.split(",")[0]); + if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]); const servers = await getServers(this.client); await this.acknowledge(); return { diff --git a/commands/music/host.js b/commands/music/host.js index 93d9f5a..584cf6c 100644 --- a/commands/music/host.js +++ b/commands/music/host.js @@ -18,7 +18,7 @@ class HostCommand extends MusicCommand { user = getUser; } else if (input.match(/^?$/) && input >= 21154535154122752n) { try { - user = await this.client.getRESTUser(input); + user = await this.client.rest.users.get(input); } catch { // no-op } diff --git a/commands/music/nowplaying.js b/commands/music/nowplaying.js index b72eaad..e93a768 100644 --- a/commands/music/nowplaying.js +++ b/commands/music/nowplaying.js @@ -30,7 +30,7 @@ class NowPlayingCommand extends MusicCommand { }, { name: "💬 Channel", - value: this.guild.channels.get(this.member.voiceState.channelID).name + value: (this.guild.channels.get(this.member.voiceState.channelID) ?? await this.client.rest.channels.get(this.member.voiceState.channelID)).name }, { name: "🌐 Node", diff --git a/commands/tags/tags.js b/commands/tags/tags.js index 02d224f..5d275d1 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -48,7 +48,7 @@ class TagsCommand extends Command { this.success = true; if (!user) { try { - const restUser = await this.client.getRESTUser(getResult.author); + const restUser = await this.client.rest.users.get(getResult.author); return `This tag is owned by **${restUser.username}#${restUser.discriminator}** (\`${getResult.author}\`).`; } catch { return `I couldn't find exactly who owns this tag, but I was able to get their ID: \`${getResult.author}\``; diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 4302007..b17b27d 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -51,6 +51,11 @@ export default async (client, interaction) => { flags: result.flags ?? (commandClass.success ? 0 : 64) }, result)); } + } else { + logger.warn(`Unknown return type for command ${command}: ${result} (${typeof result})`); + await interaction[replyMethod](Object.assign({ + flags: commandClass.success ? 0 : 64 + }, result)); } } catch (error) { const replyMethod = interaction.acknowledged ? "editOriginal" : "createMessage"; @@ -58,8 +63,6 @@ export default async (client, interaction) => { await interaction[replyMethod]({ content: "The resulting file was too large to upload. Try again with a smaller image if possible.", flags: 64 }); } else if (error.toString().includes("Job ended prematurely")) { await interaction[replyMethod]({ content: "Something happened to the image servers before I could receive the image. Try running your command again.", flags: 64 }); - } 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.optionsArray)}: ${error.stack || error}`); try { diff --git a/package.json b/package.json index f072518..09e128d 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,11 @@ "jsqr": "^1.4.0", "node-addon-api": "^5.0.0", "node-emoji": "^1.11.0", - "oceanic.js": "1.3.0", + "oceanic.js": "1.3.1", "qrcode": "^1.5.1", "sharp": "^0.31.2", "shoukaku": "^3.2.2", - "undici": "^5.12.0", + "undici": "^5.13.0", "winston": "^3.8.2", "winston-daily-rotate-file": "^4.7.1" }, @@ -49,7 +49,7 @@ "@babel/eslint-plugin": "^7.19.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "cmake-js": "^7.0.0", - "eslint": "^8.27.0", + "eslint": "^8.28.0", "eslint-plugin-unicorn": "^44.0.2" }, "optionalDependencies": { @@ -57,7 +57,7 @@ "bufferutil": "^4.0.7", "erlpack": "^0.1.4", "pm2": "^5.2.2", - "postgres": "^3.3.1", + "postgres": "^3.3.2", "uuid": "^9.0.0", "ws": "^8.11.0", "zlib-sync": "^0.1.7" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d2c0af..298ce97 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,20 +12,20 @@ specifiers: dotenv: ^16.0.3 emoji-regex: ^10.2.1 erlpack: ^0.1.4 - eslint: ^8.27.0 + eslint: ^8.28.0 eslint-plugin-unicorn: ^44.0.2 file-type: ^18.0.0 format-duration: ^2.0.0 jsqr: ^1.4.0 node-addon-api: ^5.0.0 node-emoji: ^1.11.0 - oceanic.js: 1.3.0 + oceanic.js: 1.3.1 pm2: ^5.2.2 - postgres: ^3.3.1 + postgres: ^3.3.2 qrcode: ^1.5.1 sharp: ^0.31.2 shoukaku: ^3.2.2 - undici: ^5.12.0 + undici: ^5.13.0 uuid: ^9.0.0 winston: ^3.8.2 winston-daily-rotate-file: ^4.7.1 @@ -41,11 +41,11 @@ dependencies: jsqr: 1.4.0 node-addon-api: 5.0.0 node-emoji: 1.11.0 - oceanic.js: 1.3.0_bufferutil@4.0.7 + oceanic.js: 1.3.1_bufferutil@4.0.7 qrcode: 1.5.1 sharp: 0.31.2 shoukaku: 3.2.2_bufferutil@4.0.7 - undici: 5.12.0 + undici: 5.13.0 winston: 3.8.2 winston-daily-rotate-file: 4.7.1_winston@3.8.2 @@ -54,19 +54,19 @@ optionalDependencies: bufferutil: 4.0.7 erlpack: 0.1.4 pm2: 5.2.2_bufferutil@4.0.7 - postgres: 3.3.1 + postgres: 3.3.2 uuid: 9.0.0 ws: 8.11.0_bufferutil@4.0.7 zlib-sync: 0.1.7 devDependencies: '@babel/core': 7.20.2 - '@babel/eslint-parser': 7.19.1_qn3xnppexigqgidmp7nt2fn2oy - '@babel/eslint-plugin': 7.19.1_hglg2ujm7s5e6njekelpyebi5y + '@babel/eslint-parser': 7.19.1_ustmoyzvfgos66cf2wvsplsloa + '@babel/eslint-plugin': 7.19.1_qo7nbvejrlukndoriyrzp32xfy '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.20.2 cmake-js: 7.0.0 - eslint: 8.27.0 - eslint-plugin-unicorn: 44.0.2_eslint@8.27.0 + eslint: 8.28.0 + eslint-plugin-unicorn: 44.0.2_eslint@8.28.0 packages: @@ -113,7 +113,7 @@ packages: - supports-color dev: true - /@babel/eslint-parser/7.19.1_qn3xnppexigqgidmp7nt2fn2oy: + /@babel/eslint-parser/7.19.1_ustmoyzvfgos66cf2wvsplsloa: resolution: {integrity: sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} peerDependencies: @@ -122,20 +122,20 @@ packages: dependencies: '@babel/core': 7.20.2 '@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1 - eslint: 8.27.0 + eslint: 8.28.0 eslint-visitor-keys: 2.1.0 semver: 6.3.0 dev: true - /@babel/eslint-plugin/7.19.1_hglg2ujm7s5e6njekelpyebi5y: + /@babel/eslint-plugin/7.19.1_qo7nbvejrlukndoriyrzp32xfy: resolution: {integrity: sha512-ElGPkQPapKMa3zVqXHkZYzuL7I5LbRw9UWBUArgWsdWDDb9XcACqOpBib5tRPA9XvbVZYrFUkoQPbiJ4BFvu4w==} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} peerDependencies: '@babel/eslint-parser': '>=7.11.0' eslint: '>=7.5.0' dependencies: - '@babel/eslint-parser': 7.19.1_qn3xnppexigqgidmp7nt2fn2oy - eslint: 8.27.0 + '@babel/eslint-parser': 7.19.1_ustmoyzvfgos66cf2wvsplsloa + eslint: 8.28.0 eslint-rule-composer: 0.3.0 dev: true @@ -386,7 +386,7 @@ packages: requiresBuild: true dependencies: '@types/ws': 8.5.3 - discord-api-types: 0.37.17 + discord-api-types: 0.37.20 prism-media: 1.3.4 tslib: 2.4.1 ws: 8.11.0_bufferutil@4.0.7 @@ -407,7 +407,7 @@ packages: ajv: 6.12.6 debug: 4.3.4 espree: 9.4.1 - globals: 13.17.0 + globals: 13.18.0 ignore: 5.2.0 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -710,8 +710,8 @@ packages: dependencies: color-convert: 2.0.1 - /anymatch/3.1.2: - resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} + /anymatch/3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} dependencies: normalize-path: 3.0.0 @@ -860,7 +860,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001431 + caniuse-lite: 1.0.30001434 electron-to-chromium: 1.4.284 node-releases: 2.0.6 update-browserslist-db: 1.0.10_browserslist@4.21.4 @@ -913,8 +913,8 @@ packages: engines: {node: '>=6'} dev: false - /caniuse-lite/1.0.30001431: - resolution: {integrity: sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==} + /caniuse-lite/1.0.30001434: + resolution: {integrity: sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==} dev: true /chalk/2.4.2: @@ -952,7 +952,7 @@ packages: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} dependencies: - anymatch: 3.1.2 + anymatch: 3.1.3 braces: 3.0.2 glob-parent: 5.1.2 is-binary-path: 2.1.0 @@ -973,8 +973,9 @@ packages: engines: {node: '>=10'} dev: true - /ci-info/3.5.0: - resolution: {integrity: sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw==} + /ci-info/3.7.0: + resolution: {integrity: sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog==} + engines: {node: '>=8'} dev: true /clean-regexp/1.0.0: @@ -1229,8 +1230,8 @@ packages: resolution: {integrity: sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==} dev: false - /discord-api-types/0.37.17: - resolution: {integrity: sha512-5ZIw1VtkmToBy8ziketjHkZnW1FoLevyXdK/TslNFLozijug2RnB3MyBNtSGzML1c72koU3neeGkvFZ8OiU0tQ==} + /discord-api-types/0.37.20: + resolution: {integrity: sha512-uAO+55E11rMkYR36/paE1vKN8c2bZa1mgrIaiQIBgIZRKZTDIGOZB+8I5eMRPFJcGxrg16riUu+0aTu2JQEPew==} dev: false optional: true @@ -1329,17 +1330,17 @@ packages: dev: false optional: true - /eslint-plugin-unicorn/44.0.2_eslint@8.27.0: + /eslint-plugin-unicorn/44.0.2_eslint@8.28.0: resolution: {integrity: sha512-GLIDX1wmeEqpGaKcnMcqRvMVsoabeF0Ton0EX4Th5u6Kmf7RM9WBl705AXFEsns56ESkEs0uyelLuUTvz9Tr0w==} engines: {node: '>=14.18'} peerDependencies: eslint: '>=8.23.1' dependencies: '@babel/helper-validator-identifier': 7.19.1 - ci-info: 3.5.0 + ci-info: 3.7.0 clean-regexp: 1.0.0 - eslint: 8.27.0 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint: 8.28.0 + eslint-utils: 3.0.0_eslint@8.28.0 esquery: 1.4.0 indent-string: 4.0.0 is-builtin-module: 3.2.0 @@ -1373,13 +1374,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.27.0: + /eslint-utils/3.0.0_eslint@8.28.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.27.0 + eslint: 8.28.0 eslint-visitor-keys: 2.1.0 dev: true @@ -1393,8 +1394,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.27.0: - resolution: {integrity: sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==} + /eslint/8.28.0: + resolution: {integrity: sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: @@ -1409,7 +1410,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint-utils: 3.0.0_eslint@8.28.0 eslint-visitor-keys: 3.3.0 espree: 9.4.1 esquery: 1.4.0 @@ -1418,14 +1419,14 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.17.0 + globals: 13.18.0 grapheme-splitter: 1.0.4 ignore: 5.2.0 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.1.5 + js-sdsl: 4.2.0 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -1658,7 +1659,7 @@ packages: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} dependencies: - minipass: 3.3.4 + minipass: 3.3.6 dev: true /fs.realpath/1.0.0: @@ -1773,8 +1774,8 @@ packages: engines: {node: '>=4'} dev: true - /globals/13.17.0: - resolution: {integrity: sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==} + /globals/13.18.0: + resolution: {integrity: sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -1977,8 +1978,8 @@ packages: dev: false optional: true - /js-sdsl/4.1.5: - resolution: {integrity: sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==} + /js-sdsl/4.2.0: + resolution: {integrity: sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==} dev: true /js-tokens/4.0.0: @@ -2160,8 +2161,8 @@ packages: /minimist/1.2.7: resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==} - /minipass/3.3.4: - resolution: {integrity: sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==} + /minipass/3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} engines: {node: '>=8'} dependencies: yallist: 4.0.0 @@ -2171,7 +2172,7 @@ packages: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} dependencies: - minipass: 3.3.4 + minipass: 3.3.6 yallist: 4.0.0 dev: true @@ -2318,11 +2319,11 @@ packages: engines: {node: '>= 6'} dev: false - /oceanic.js/1.3.0_bufferutil@4.0.7: - resolution: {integrity: sha512-DWGAyOtax0Oc4gWRDEiiw+Jo6m1pDmsBJxtEvq8BGoTXWHmT7PiiBKSAU4i7DW4F68t44AYBohvmMd9jrKVDDg==} + /oceanic.js/1.3.1_bufferutil@4.0.7: + resolution: {integrity: sha512-UhP9lLMaDQsUqerhMvJ4Rye3gLamXD6HWsn0h35CAj1eJ9sZacsCUoww6meU05y0YUPVIGiDNyKNZ77HA/8J5g==} engines: {node: '>=16.16.0'} dependencies: - undici: 5.12.0 + undici: 5.13.0 ws: 8.11.0_bufferutil@4.0.7 optionalDependencies: '@discordjs/voice': 0.13.0_bufferutil@4.0.7 @@ -2549,7 +2550,7 @@ packages: async: 3.2.4 debug: 4.3.4 pidusage: 2.0.21 - systeminformation: 5.12.14 + systeminformation: 5.14.4 tx2: 1.0.5 transitivePeerDependencies: - supports-color @@ -2605,8 +2606,8 @@ packages: engines: {node: '>=10.13.0'} dev: false - /postgres/3.3.1: - resolution: {integrity: sha512-ak/xXToZYwRvQlZIUtLgPUIggz62eIIbPTgxl/Yl4oTu0TgNOd1CrzTCifsvZ89jBwLvnX6+Ky5frp5HzIBoaw==} + /postgres/3.3.2: + resolution: {integrity: sha512-NaPqFpUC6C7aCQkJXLvuO/3RKNKL4en8opY53YrcXK3//xXra6CZ2qX6290lxuQ1dW1LbRGYCmsawRlCxSBonQ==} requiresBuild: true dev: false optional: true @@ -2949,7 +2950,7 @@ packages: resolution: {integrity: sha512-GhgjV4i3gbN9cnX+RtbvIcLk4/dVJqOQFId33Quu5H9Pkm7kYi1ISqjIel4G4gJo4x3hdxAncvTiKCctcgQeaQ==} engines: {node: '>=16.0.0', npm: '>=7.0.0'} dependencies: - undici: 5.12.0 + undici: 5.13.0 ws: 8.11.0_bufferutil@4.0.7 transitivePeerDependencies: - bufferutil @@ -3129,8 +3130,8 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - /systeminformation/5.12.14: - resolution: {integrity: sha512-POlTQg4Oalbsk4JQqHNQlIeX4qZlzatVjgxZqX3FSsWNSjaRqFI+Fy0Da6/kZF36bgMRyQwBc8niA9ll+eMQhA==} + /systeminformation/5.14.4: + resolution: {integrity: sha512-SpFIc6AkGL4RCtwmhCoECFdvnVVk/heA+pxdgjXvxW75oLQsJVXz0epNRNnnMucrk/+rvKFnMqC4LorDE5xzmQ==} engines: {node: '>=8.0.0'} os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android] hasBin: true @@ -3163,7 +3164,7 @@ packages: dependencies: chownr: 2.0.0 fs-minipass: 2.1.0 - minipass: 3.3.4 + minipass: 3.3.6 minizlib: 2.1.2 mkdirp: 1.0.4 yallist: 4.0.0 @@ -3270,8 +3271,8 @@ packages: engines: {node: '>=8'} dev: true - /undici/5.12.0: - resolution: {integrity: sha512-zMLamCG62PGjd9HHMpo05bSLvvwWOZgGeiWlN/vlqu3+lRo3elxktVGEyLMX+IO7c2eflLjcW74AlkhEZm15mg==} + /undici/5.13.0: + resolution: {integrity: sha512-UDZKtwb2k7KRsK4SdXWG7ErXiL7yTGgLWvk2AXO1JMjgjh404nFo6tWSCM2xMpJwMPx3J8i/vfqEh1zOqvj82Q==} engines: {node: '>=12.18'} dependencies: busboy: 1.6.0 diff --git a/utils/soundplayer.js b/utils/soundplayer.js index 564bf1a..9147c34 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -52,7 +52,7 @@ export async function play(client, sound, options, music = false) { if (!options.channel.guild) return { content: "This command only works in servers!", flags: 64 }; if (!options.member.voiceState) return { content: "You need to be in a voice channel first!", flags: 64 }; if (!options.channel.guild.permissionsOf(client.user.id.toString()).has("CONNECT")) return { content: "I can't join this voice channel!", flags: 64 }; - const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID); + const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID) ?? await client.rest.channels.get(options.member.voiceState.channelID); if (!voiceChannel.permissionsOf(client.user.id.toString()).has("CONNECT")) return { content: "I don't have permission to join this voice channel!", flags: 64 }; if (!music && manager.players.has(options.channel.guildID)) return { content: "I can't play a sound effect while other audio is playing!", flags: 64 }; const node = manager.getNode();