diff --git a/.env.example b/.env.example index fbefe84..bbd14ef 100644 --- a/.env.example +++ b/.env.example @@ -2,11 +2,7 @@ TOKEN="." # Your bot token PREFIX= "!" # Your prefix -OWNER_IDS= "859640640640640640, 859640640640640640" # Your id - -CLIENT_ID= "960072976412340254" # Your bot client id - -CLIENT_SECRET= "" # Your bot client secret +OWNER_IDS=["959276033683628122","859640640640640640"] # Your discord id, you can add multiple ids GUILD_ID= "859640640640640640" # Your server Id if you want to use the for single server @@ -20,18 +16,18 @@ MAX_QUEUE_SIZE= "100" # Max queue size BOT_STATUS= "online" # Your bot status -BOT_ACTIVITY= "Wavemusic" # Your bot activity - -DATABASE_URL="mongodb+srv://Blacky:xxxxxxxxxxxx" # Your mongodb url +BOT_ACTIVITY= "Lavamusic" # Your bot activity -LAVALINK_URL="lava.moebot.xyz:443" # Your lavalink url +LAVALINK_URL="lavalink:2333" # Your lavalink url LAVALINK_AUTH="youshallnotpass" # Your lavalink password LAVALINK_NAME="Blacky" # Your lavalink name -LAVALINK_SECURE= "true" # true for secure lavalink +LAVALINK_SECURE= "false" # true for secure lavalink -BOT_ACTIVITY_TYPE=0 # Activity type is a number from 0 to 5 see more here https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types +KEEP_ALIVE= "false" # true for keep alive in https://replit.com + +LOG_CHANNEL_ID="" -KEEP_ALIVE= "false" # true for keep alive for replit +BOT_ACTIVITY_TYPE=0 # Activity type is a number from 0 to 5 see more here https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types diff --git a/.gitignore b/.gitignore index 1ac12a5..26aaae5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,9 @@ node_modules .env .vscode .prettierrc.json -config.js \ No newline at end of file +config.js +package-lock.json +pnpm-lock.yaml +WaveMusic.db +WaveMusic.db-shm +WaveMusic.db-wal \ No newline at end of file diff --git a/README.md b/README.md index 0405b91..79f5f07 100644 --- a/README.md +++ b/README.md @@ -113,8 +113,8 @@ Before starting with the installation, you need to have the following: - ![Node.js](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white) [v18.17.1 or higher](https://nodejs.org/en/download/) -- ![MongoDB](https://img.shields.io/badge/MongoDB-4EA94B?style=for-the-badge&logo=mongodb&logoColor=white) [v4.4.0 or higher](https://www.mongodb.com/try/download/community) -- ![Lavalink](https://img.shields.io/badge/Lavalink-7289DA?style=for-the-badge&logo=discord&logoColor=white) [v3.7.8 or higher](https://github.com/freyacodes/Lavalink) + +- ![Lavalink](https://img.shields.io/badge/Lavalink-7289DA?style=for-the-badge&logo=discord&logoColor=white) [v4.0.0 or higher](https://github.com/freyacodes/Lavalink) ## 🚀 Installation from source @@ -152,7 +152,6 @@ MAX_PLAYLIST_SIZE= "100" # Max playlist size MAX_QUEUE_SIZE= "100" # Max queue size BOT_STATUS= "online" # Your bot status BOT_ACTIVITY= "Wavemusic" # Your bot activity -DATABASE_URL="mongodb+srv://xxyydd:ejejeje@cluster0.f93tcdq.mongodb.net/Bot" ## Your MongoDB URL (add database name at the end) example: mongodb+srv://xxyydd:ejejeje@cluster0.f93tcdq.mongodb.net/Bot LAVALINK_URL="localhost:2333" # Your lavalink url LAVALINK_AUTH="youshallnotpass" # Your lavalink password LAVALINK_NAME="Blacky" # Your lavalink name @@ -162,37 +161,31 @@ KEEP_ALIVE= "false" # true for keep alive for replit ``` -5. Generate the Prisma client: - -**If you using replit than read this:** -go to **[prisma/schema.prisma](https://github.com/brblacky/WaveMusic/blob/main/prisma/schema.prisma)** and add engine type like this or remove `//` behind the `engineType` - -```bash -generator client { - provider = "prisma-client-js" - engineType = "binary" -} -``` - -and then run this command - -```bash -npx prisma generate -``` - -6. Run the bot: +5. Run the bot: ```bash npm run start or npm start ``` -### Errors: - -![image](https://cdn.discordapp.com/attachments/1147388529085780078/1165972143146815518/image_1.png) - -- Fix this error to add database name in end of the `DATABASE_URL` like this `mongodb+srv://xxyydd:ejejeje@cluster0.f93tcdq.mongodb.net/Bot` - +## 📝 Configuration + +- **Prefix**: The prefix for the bot commands +- **Owner ID**: The ID of the bot owner +- **Client ID**: The ID of the bot client +- **Guild ID**: The ID of the server where the bot will be used +- **Production**: Set to `true` for production +- **Search Engine**: The search engine to use for searching songs +- **Max Playlist Size**: The maximum size of a playlist +- **Max Queue Size**: The maximum size of the queue +- **Bot Status**: The status of the bot +- **Bot Activity**: The activity of the bot +- **Lavalink URL**: The URL of the Lavalink server +- **Lavalink Auth**: The password for the Lavalink server +- **Lavalink Name**: The name of the Lavalink server +- **Lavalink Secure**: Set to `true` for secure Lavalink +- **Bot Activity Type**: The type of activity for the bot +- **Keep Alive**: Set to `true` for keep alive for replit ### diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 1bca27c..0000000 --- a/package-lock.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "name": "wavemusic", - "version": "2.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "wavemusic", - "version": "2.1.0", - "license": "ISC", - "dependencies": { - "@prisma/client": "^5.6.0", - "discord.js": "^14.14.1", - "dotenv": "^16.3.1", - "shoukaku": "^3.4.0", - "shoukaku-sources": "^1.0.2", - "signale": "^1.4.0", - "undici": "^5.26.5" - }, - "devDependencies": { - "@types/signale": "^1.4.6", - "prisma": "^5.6.0" - } - }, - "node_modules/@discordjs/builders": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.6.5.tgz", - "integrity": "sha512-SdweyCs/+mHj+PNhGLLle7RrRFX9ZAhzynHahMCLqp5Zeq7np7XC6/mgzHc79QoVlQ1zZtOkTTiJpOZu5V8Ufg==", - "dependencies": { - "@discordjs/formatters": "^0.3.2", - "@discordjs/util": "^1.0.1", - "@sapphire/shapeshift": "^3.9.2", - "discord-api-types": "0.37.50", - "fast-deep-equal": "^3.1.3", - "ts-mixer": "^6.0.3", - "tslib": "^2.6.1" - }, - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@discordjs/collection": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz", - "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@discordjs/formatters": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.3.2.tgz", - "integrity": "sha512-lE++JZK8LSSDRM5nLjhuvWhGuKiXqu+JZ/DsOR89DVVia3z9fdCJVcHF2W/1Zxgq0re7kCzmAJlCMMX3tetKpA==", - "dependencies": { - "discord-api-types": "0.37.50" - }, - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@discordjs/rest": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.0.1.tgz", - "integrity": "sha512-/eWAdDRvwX/rIE2tuQUmKaxmWeHmGealttIzGzlYfI4+a7y9b6ZoMp8BG/jaohs8D8iEnCNYaZiOFLVFLQb8Zg==", - "dependencies": { - "@discordjs/collection": "^1.5.3", - "@discordjs/util": "^1.0.1", - "@sapphire/async-queue": "^1.5.0", - "@sapphire/snowflake": "^3.5.1", - "@vladfrangu/async_event_emitter": "^2.2.2", - "discord-api-types": "0.37.50", - "magic-bytes.js": "^1.0.15", - "tslib": "^2.6.1", - "undici": "5.22.1" - }, - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@discordjs/rest/node_modules/undici": { - "version": "5.22.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.1.tgz", - "integrity": "sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==", - "dependencies": { - "busboy": "^1.6.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/@discordjs/util": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.0.1.tgz", - "integrity": "sha512-d0N2yCxB8r4bn00/hvFZwM7goDcUhtViC5un4hPj73Ba4yrChLSJD8fy7Ps5jpTLg1fE9n4K0xBLc1y9WGwSsA==", - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@discordjs/ws": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.0.1.tgz", - "integrity": "sha512-avvAolBqN3yrSvdBPcJ/0j2g42ABzrv3PEL76e3YTp2WYMGH7cuspkjfSyNWaqYl1J+669dlLp+YFMxSVQyS5g==", - "dependencies": { - "@discordjs/collection": "^1.5.3", - "@discordjs/rest": "^2.0.1", - "@discordjs/util": "^1.0.1", - "@sapphire/async-queue": "^1.5.0", - "@types/ws": "^8.5.5", - "@vladfrangu/async_event_emitter": "^2.2.2", - "discord-api-types": "0.37.50", - "tslib": "^2.6.1", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.11.0" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz", - "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==", - "engines": { - "node": ">=14" - } - }, - "node_modules/@prisma/client": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.6.0.tgz", - "integrity": "sha512-2xsPaz4EaMKj1WS9iW6MlPhmbqtBsXAOeVttSePp8vTFTtvzh2hZbDgswwBdSCgPzmmwF+tLB259QzggvCmJqA==", - "hasInstallScript": true, - "dependencies": { - "@prisma/engines-version": "5.4.1-2.ac9d7041ed77bcc8a8dbd2ab6616b39013829574" - }, - "engines": { - "node": ">=16.13" - }, - "peerDependencies": { - "prisma": "*" - }, - "peerDependenciesMeta": { - "prisma": { - "optional": true - } - } - }, - "node_modules/@prisma/engines": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.6.0.tgz", - "integrity": "sha512-fqeucJ3LH0e1eyFdT0zRx+oETLancu5+n4lhiYECyEz6H2RDskPJHJYHkVc0LhkU4Uv7fuEnppKU3nVKNzMh8g==", - "devOptional": true, - "hasInstallScript": true - }, - "node_modules/@prisma/engines-version": { - "version": "5.4.1-2.ac9d7041ed77bcc8a8dbd2ab6616b39013829574", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.4.1-2.ac9d7041ed77bcc8a8dbd2ab6616b39013829574.tgz", - "integrity": "sha512-wvupDL4AA1vf4TQNANg7kR7y98ITqPsk6aacfBxZKtrJKRIsWjURHkZCGcQliHdqCiW/hGreO6d6ZuSv9MhdAA==" - }, - "node_modules/@sapphire/async-queue": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", - "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/shapeshift": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.3.tgz", - "integrity": "sha512-WzKJSwDYloSkHoBbE8rkRW8UNKJiSRJ/P8NqJ5iVq7U2Yr/kriIBx2hW+wj2Z5e5EnXL1hgYomgaFsdK6b+zqQ==", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/snowflake": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.1.tgz", - "integrity": "sha512-BxcYGzgEsdlG0dKAyOm0ehLGm2CafIrfQTZGWgkfKYbj+pNNsorZ7EotuZukc2MT70E0UbppVbtpBrqpzVzjNA==", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@types/node": { - "version": "20.8.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz", - "integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==", - "dependencies": { - "undici-types": "~5.25.1" - } - }, - "node_modules/@types/signale": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/@types/signale/-/signale-1.4.6.tgz", - "integrity": "sha512-vd2s2P5D0/U+OvEsDhh2JRAKzzhr+Baa+SL2XRxacdJY8+6bh5iJS8r0TXglhO45duTZPxwpmH9lGHRGtCn8cw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/ws": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.8.tgz", - "integrity": "sha512-flUksGIQCnJd6sZ1l5dqCEG/ksaoAg/eUwiLAGTJQcfgvZJKF++Ta4bJA6A5aPSJmsr+xlseHn4KLgVlNnvPTg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@vladfrangu/async_event_emitter": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.2.tgz", - "integrity": "sha512-HIzRG7sy88UZjBJamssEczH5q7t5+axva19UbZLO6u0ySbYPrwzWiXBcC0WuHyhKKoeCyneH+FvYzKQq/zTtkQ==", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/discord-api-types": { - "version": "0.37.50", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.50.tgz", - "integrity": "sha512-X4CDiMnDbA3s3RaUXWXmgAIbY1uxab3fqe3qwzg5XutR3wjqi7M3IkgQbsIBzpqBN2YWr/Qdv7JrFRqSgb4TFg==" - }, - "node_modules/discord.js": { - "version": "14.14.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.14.1.tgz", - "integrity": "sha512-gGjhTkauIPgFXxpBl0UZgyehrKhDe90cIS8Hn1xFBYQ63EuUAkKoUqRNmc/pcla6DD16s4cUz5tAbdSpXivnxw==", - "dependencies": { - "@discordjs/builders": "^1.6.4", - "@discordjs/collection": "^1.5.2", - "@discordjs/formatters": "^0.3.1", - "@discordjs/rest": "^2.0.0", - "@discordjs/util": "^1.0.0", - "@discordjs/ws": "^1.0.0", - "@sapphire/snowflake": "^3.5.1", - "@types/ws": "^8.5.5", - "discord-api-types": "^0.37.50", - "fast-deep-equal": "^3.1.3", - "lodash.snakecase": "^4.1.1", - "tslib": "^2.6.1", - "undici": "^5.22.1", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" - } - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" - }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.snakecase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", - "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" - }, - "node_modules/magic-bytes.js": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.5.0.tgz", - "integrity": "sha512-wJkXvutRbNWcc37tt5j1HyOK1nosspdh3dj6LUYYAvF6JYNqs53IfRvK9oEpcwiDA1NdoIi64yAMfdivPeVAyw==" - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "engines": { - "node": ">=4" - } - }, - "node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", - "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", - "dependencies": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/prisma": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.4.2.tgz", - "integrity": "sha512-GDMZwZy7mysB2oXU+angQqJ90iaPFdD0rHaZNkn+dio5NRkGLmMqmXs31//tg/qXT3iB0cTQwnGGQNuirhSTZg==", - "devOptional": true, - "hasInstallScript": true, - "dependencies": { - "@prisma/engines": "5.4.2" - }, - "bin": { - "prisma": "build/index.js" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/shoukaku": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/shoukaku/-/shoukaku-3.4.0.tgz", - "integrity": "sha512-IxkicImqMy7fu2QDXsQaqajR66oI2xL4FFEKaxIKLSPZTs/51ZlmsevnvwcZdABm+mfVkWFNQJotP1WcBeZ+Dg==", - "dependencies": { - "node-fetch": "^2.6.9", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/shoukaku-sources": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/shoukaku-sources/-/shoukaku-sources-1.0.2.tgz", - "integrity": "sha512-YRpmdkJki27sArbWKxTTnvApgFdaBb9qGflvUgS04yjpuecGQM09XKBInsaObi/PyD+6TS0OFFx8igyvvh3AXQ==", - "dependencies": { - "undici": "^5.26.5" - }, - "engines": { - "node": ">=14.x.x" - } - }, - "node_modules/signale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", - "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", - "dependencies": { - "chalk": "^2.3.2", - "figures": "^2.0.0", - "pkg-conf": "^2.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/ts-mixer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.3.tgz", - "integrity": "sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==" - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" - }, - "node_modules/undici": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz", - "integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/undici-types": { - "version": "5.25.3", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", - "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==" - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/ws": { - "version": "8.14.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", - "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - } - } -} diff --git a/package.json b/package.json index d5c4681..c5d17c3 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,53 @@ { - "name": "wavemusic", - "version": "2.1.0", - "description": "WaveMusic is a discord music bot base in (Shoukaku)", - "main": "src/index.js", - "repository": "https://github.com/brblacky/WaveMusic.git", - "author": "Blacky", - "license": "ISC", - "scripts": { - "start": "node src/index.js", - "dev": "nodemon src/index.js", - "prisma:generate": "npx prisma generate" - }, - "keywords": [ - "lavalink", - "vulkava", - "music", - "bot", - "discord-music", - "discord", - "musicbot" - ], - "bugs": "https://github.com/brblacky/WaveMusic/issues", - "homepage": "https://github.com/brblacky/WaveMusic#readme", - "devDependencies": { - "@types/signale": "^1.4.6", - "prisma": "^5.6.0" - }, - "dependencies": { - "@prisma/client": "^5.6.0", - "discord.js": "^14.14.1", - "dotenv": "^16.3.1", - "shoukaku": "^3.4.0", - "shoukaku-sources": "^1.0.2", - "signale": "^1.4.0", - "undici": "^5.26.5" - }, - "signale": { - "displayScope": true, - "displayBadge": true, - "displayDate": true, - "displayFilename": true, - "displayLabel": true, - "displayTimestamp": true, - "underlineLabel": true - } -} + "name": "wavemusic", + "version": "3.0.0", + "description": "WaveMusic is a discord music bot base in (Shoukaku)", + "main": "src/index.js", + "author": "Blacky", + "license": "ISC", + "scripts": { + "start": "node src/index.js", + "dev": "nodemon src/index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/appujet/wavemusic.git" + }, + "keywords": [ + "discord", + "music", + "bot", + "lavalink", + "shoukaku", + "WaveMusic", + "wavemusic", + "musicbot", + "javascript" + ], + "bugs": { + "url": "https://github.com/appujet/wavemusic/issues" + }, + "homepage": "https://github.com/appujet/wavemusic#readme", + "devDependencies": { + "@types/better-sqlite3": "^7.6.9", + "@types/signale": "^1.4.7" + }, + "dependencies": { + "better-sqlite3": "^9.4.3", + "discord.js": "^14.14.1", + "dotenv": "^16.4.5", + "shoukaku": "^4.0.1", + "signale": "^1.4.0", + "tslib": "^2.6.2", + "undici": "^6.7.1" + }, + "signale": { + "displayScope": true, + "displayBadge": true, + "displayDate": true, + "displayFilename": true, + "displayLabel": true, + "displayTimestamp": true, + "underlineLabel": true + } +} \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma deleted file mode 100644 index 77cbec9..0000000 --- a/prisma/schema.prisma +++ /dev/null @@ -1,102 +0,0 @@ -// This is your Prisma schema file, -// learn more about it in the docs: https://pris.ly/d/prisma-schema - -generator client { - provider = "prisma-client-js" - //engineType = "binary" // if you using replit than use this to fix error -} - -datasource db { - provider = "mongodb" - url = env("DATABASE_URL") -} - -model Guild { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String @unique - prefix String? @default("!") - setup Setup? - stay stay? - dj Dj? - botchannel Botchannel? - premium Premium? -} - -model Setup { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String - guild Guild? @relation(fields: [guildId], references: [guildId]) - textId String? - messageId String? - - @@unique([guildId]) -} - -model stay { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String - guild Guild @relation(fields: [guildId], references: [guildId]) - textId String? - voiceId String? - - @@unique([guildId]) -} - -model Botchannel { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String - guild Guild @relation(fields: [guildId], references: [guildId]) - textId String? - - @@unique([guildId]) -} - -model Dj { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String? - guild Guild? @relation(fields: [guildId], references: [guildId]) - roles Roles[] - mode Boolean @default(false) - - @@unique([guildId]) -} - -model Roles { - id String @id @default(auto()) @map("_id") @db.ObjectId - guildId String - Dj Dj? @relation(fields: [guildId], references: [guildId]) - roleId String @unique - - @@unique([guildId]) -} - -model User { - id String @id @default(auto()) @map("_id") @db.ObjectId - userId String @unique - accessToken String? - refreshToken String? - avatar String? - username String? - discriminator String? - playlists Playlist[] - premium Premium? -} - -model Playlist { - id String @id @default(auto()) @map("_id") @db.ObjectId - userId String - user User? @relation(fields: [userId], references: [userId]) - name String - songs String[] - - @@unique([userId, name]) -} - -model Premium { - isPremium Boolean @default(false) - id String @id @default(auto()) @map("_id") @db.ObjectId - userId String @unique - guildId String @unique - user User? @relation(fields: [userId], references: [userId]) - guild Guild? @relation(fields: [guildId], references: [guildId]) -} diff --git a/src/commands/Filters/8d.js b/src/commands/Filters/8d.js index 01b3b09..5c49793 100644 --- a/src/commands/Filters/8d.js +++ b/src/commands/Filters/8d.js @@ -1,62 +1,58 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class _8d extends Command { - constructor(client) { - super(client, { - name: '8d', - description: { - content: 'on/off 8d filter', - examples: ['8d'], - usage: '8d', - }, - category: 'filters', - aliases: ['3d'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class _8d extends Command { + constructor(client) { + super(client, { + name: "8d", + description: { + content: "on/off 8d filter", + examples: ["8d"], + usage: "8d", + }, + category: "filters", + aliases: ["3d"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (!player) return; + if (player.filters.includes("8D")) { + player.player.setRotation(); + player.filters.splice(player.filters.indexOf("8D"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "8D filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setRotation({ rotationHz: 0.2 }); + player.filters.push("8D"); + ctx.sendMessage({ + embeds: [ + { + description: "8D filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (!player) - return; - if (player.filters.includes('8D')) { - player.player.setRotation(); - player.filters.splice(player.filters.indexOf('8D'), 1); - ctx.sendMessage({ - embeds: [ - { - description: '8D filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setRotation({ rotationHz: 0.2 }); - player.filters.push('8D'); - ctx.sendMessage({ - embeds: [ - { - description: '8D filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = _8d; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/Distorsion.js b/src/commands/Filters/Distorsion.js index e1f450e..ff9bd97 100644 --- a/src/commands/Filters/Distorsion.js +++ b/src/commands/Filters/Distorsion.js @@ -1,69 +1,66 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Distorsion extends Command { - constructor(client) { - super(client, { - name: 'distorsion', - description: { - content: 'on/off distorsion filter', - examples: ['distorsion'], - usage: 'distorsion', - }, - category: 'filters', - aliases: ['distorsion'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [], - }); +module.exports = class Distorsion extends Command { + constructor(client) { + super(client, { + name: "distorsion", + description: { + content: "on/off distorsion filter", + examples: ["distorsion"], + usage: "distorsion", + }, + category: "filters", + aliases: ["distorsion"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("distorsion")) { + player.player.setDistortion({}); + player.filters.splice(player.filters.indexOf("distorsion"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Distorsion filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setDistortion({ + sinOffset: 0, + sinScale: 1, + cosOffset: 0, + cosScale: 1, + tanOffset: 0, + tanScale: 1, + offset: 0, + scale: 1, + }); + player.filters.push("distorsion"); + ctx.sendMessage({ + embeds: [ + { + description: "Distorsion filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('distorsion')) { - player.player.setDistortion({}); - player.filters.splice(player.filters.indexOf('distorsion'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Distorsion filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setDistortion({ - sinOffset: 0, - sinScale: 1, - cosOffset: 0, - cosScale: 1, - tanOffset: 0, - tanScale: 1, - offset: 0, - scale: 1, - }); - player.filters.push('distorsion'); - ctx.sendMessage({ - embeds: [ - { - description: 'Distorsion filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = Distorsion; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/Pitch.js b/src/commands/Filters/Pitch.js index d0dd5db..1f02145 100644 --- a/src/commands/Filters/Pitch.js +++ b/src/commands/Filters/Pitch.js @@ -1,72 +1,71 @@ -const { ApplicationCommandOptionType } = require('discord.js'); -const { Command } = require('../../structures/index.js'); +const { ApplicationCommandOptionType } = require("discord.js"); -class Pitch extends Command { - constructor(client) { - super(client, { - name: 'pitch', - description: { - content: 'on/off the pitch filter', - examples: ['pitch 1'], - usage: 'pitch ', - }, - category: 'filters', - aliases: ['ph'], - cooldown: 3, - args: true, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [ - { - name: 'number', - description: 'The number you want to set the pitch to', - type: ApplicationCommandOptionType.Integer, - required: true, - }, - ], - }); - } - async run(client, ctx, args) { - const player = client.queue.get(ctx.guild.id); - const number = Number(args[0]); - if (isNaN(number)) - return await ctx.sendMessage({ - embeds: [ - { - description: 'Please provide a valid number', - color: client.color.red, - }, - ], - }); - if (number > 5 || number < 1) - return await ctx.sendMessage({ - embeds: [ - { - description: 'Please provide a number between 1 and 5', - color: client.color.red, - }, - ], - }); - player.player.setTimescale({ pitch: number, rate: 1, speed: 1 }); - return await ctx.sendMessage({ - embeds: [ - { - description: `Pitch has been set to ${number}`, - color: client.color.main, - }, - ], - }); - } -} +const Command = require("../../structures/Command.js"); -module.exports = Pitch; \ No newline at end of file +module.exports = class Pitch extends Command { + constructor(client) { + super(client, { + name: "pitch", + description: { + content: "on/off the pitch filter", + examples: ["pitch 1"], + usage: "pitch ", + }, + category: "filters", + aliases: ["ph"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [ + { + name: "number", + description: "The number you want to set the pitch to", + type: ApplicationCommandOptionType.Integer, + required: true, + }, + ], + }); + } + async run(client, ctx, args) { + const player = client.queue.get(ctx.guild.id); + const number = Number(args[0]); + if (isNaN(number)) + return await ctx.sendMessage({ + embeds: [ + { + description: "Please provide a valid number", + color: client.color.red, + }, + ], + }); + if (number > 5 || number < 1) + return await ctx.sendMessage({ + embeds: [ + { + description: "Please provide a number between 1 and 5", + color: client.color.red, + }, + ], + }); + player.player.setTimescale({ pitch: number, rate: 1, speed: 1 }); + return await ctx.sendMessage({ + embeds: [ + { + description: `Pitch has been set to ${number}`, + color: client.color.main, + }, + ], + }); + } +}; diff --git a/src/commands/Filters/Reset.js b/src/commands/Filters/Reset.js index 3738823..19b7f24 100644 --- a/src/commands/Filters/Reset.js +++ b/src/commands/Filters/Reset.js @@ -1,46 +1,44 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Reset extends Command { - constructor(client) { - super(client, { - name: 'reset', - description: { - content: 'Resets the active filters', - examples: ['reset'], - usage: 'reset', - }, - category: 'filters', - aliases: ['reset'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [], - }); - } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - player.player.clearFilters(); - player.filters = []; - return await ctx.sendMessage({ - embeds: [ - { - description: 'Filters have been reset', - color: client.color.main, - }, - ], - }); - } -} - -module.exports = Reset; \ No newline at end of file +module.exports = class Reset extends Command { + constructor(client) { + super(client, { + name: "reset", + description: { + content: "Resets the active filters", + examples: ["reset"], + usage: "reset", + }, + category: "filters", + aliases: ["reset"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: false, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + player.player.clearFilters(); + player.filters = []; + return await ctx.sendMessage({ + embeds: [ + { + description: "Filters have been reset", + color: client.color.main, + }, + ], + }); + } +}; diff --git a/src/commands/Filters/Rotation.js b/src/commands/Filters/Rotation.js index a50ce55..393f1ed 100644 --- a/src/commands/Filters/Rotation.js +++ b/src/commands/Filters/Rotation.js @@ -1,60 +1,57 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Rotation extends Command { - constructor(client) { - super(client, { - name: 'rotation', - description: { - content: 'on/off rotation filter', - examples: ['rotation'], - usage: 'rotation', - }, - category: 'filters', - aliases: ['rt'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [], - }); +module.exports = class Rotation extends Command { + constructor(client) { + super(client, { + name: "rotation", + description: { + content: "on/off rotation filter", + examples: ["rotation"], + usage: "rotation", + }, + category: "filters", + aliases: ["rt"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("rotation")) { + player.player.setRotation(); + player.filters.splice(player.filters.indexOf("rotation"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "rotation filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setRotation({ rotationHz: 0 }); + player.filters.push("rotation"); + ctx.sendMessage({ + embeds: [ + { + description: "rotation filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('rotation')) { - player.player.setRotation(); - player.filters.splice(player.filters.indexOf('rotation'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'rotation filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setRotation({ rotationHz: 0 }); - player.filters.push('rotation'); - ctx.sendMessage({ - embeds: [ - { - description: 'rotation filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = Rotation; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/Tremolo.js b/src/commands/Filters/Tremolo.js index 1a12f4f..22858a8 100644 --- a/src/commands/Filters/Tremolo.js +++ b/src/commands/Filters/Tremolo.js @@ -1,60 +1,57 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Tremolo extends Command { - constructor(client) { - super(client, { - name: 'tremolo', - description: { - content: 'on/off the tremolo filter', - examples: ['tremolo'], - usage: 'tremolo', - }, - category: 'filters', - aliases: ['tremolo'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [], - }); +module.exports = class Tremolo extends Command { + constructor(client) { + super(client, { + name: "tremolo", + description: { + content: "on/off the tremolo filter", + examples: ["tremolo"], + usage: "tremolo", + }, + category: "filters", + aliases: ["tremolo"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("tremolo")) { + player.player.setTremolo(); + player.filters.splice(player.filters.indexOf("tremolo"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "tremolo filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setTremolo({ depth: 0.75, frequency: 4 }); + player.filters.push("tremolo"); + ctx.sendMessage({ + embeds: [ + { + description: "tremolo filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('tremolo')) { - player.player.setTremolo(); - player.filters.splice(player.filters.indexOf('tremolo'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'tremolo filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setTremolo({ depth: 0.75, frequency: 4 }); - player.filters.push('tremolo'); - ctx.sendMessage({ - embeds: [ - { - description: 'tremolo filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = Tremolo; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/Vibrato.js b/src/commands/Filters/Vibrato.js index f29fbcc..6dd0f35 100644 --- a/src/commands/Filters/Vibrato.js +++ b/src/commands/Filters/Vibrato.js @@ -1,59 +1,56 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Vibrato extends Command { - constructor(client) { - super(client, { - name: 'vibrato', - description: { - content: 'on/off vibrato filter', - examples: ['vibrato'], - usage: 'vibrato', - }, - category: 'filters', - aliases: ['vb'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - }); +module.exports = class Vibrato extends Command { + constructor(client) { + super(client, { + name: "vibrato", + description: { + content: "on/off vibrato filter", + examples: ["vibrato"], + usage: "vibrato", + }, + category: "filters", + aliases: ["vb"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("vibrato")) { + player.player.setVibrato(); + player.filters.splice(player.filters.indexOf("vibrato"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Vibrato filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setVibrato({ depth: 0.75, frequency: 4 }); + player.filters.push("vibrato"); + ctx.sendMessage({ + embeds: [ + { + description: "Vibrato filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('vibrato')) { - player.player.setVibrato(); - player.filters.splice(player.filters.indexOf('vibrato'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Vibrato filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setVibrato({ depth: 0.75, frequency: 4 }); - player.filters.push('vibrato'); - ctx.sendMessage({ - embeds: [ - { - description: 'Vibrato filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = Vibrato; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/bassboost.js b/src/commands/Filters/bassboost.js index b01efe0..cc56a66 100644 --- a/src/commands/Filters/bassboost.js +++ b/src/commands/Filters/bassboost.js @@ -1,64 +1,61 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class BassBoost extends Command { - constructor(client) { - super(client, { - name: 'bassboost', - description: { - content: 'on/off bassboost filter', - examples: ['bassboost'], - usage: 'bassboost', - }, - category: 'filters', - aliases: ['bb'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - }); +module.exports = class BassBoost extends Command { + constructor(client) { + super(client, { + name: "bassboost", + description: { + content: "on/off bassboost filter", + examples: ["bassboost"], + usage: "bassboost", + }, + category: "filters", + aliases: ["bb"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("bassboost")) { + player.player.setEqualizer([]); + player.filters.splice(player.filters.indexOf("bassboost"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Bassboost filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setEqualizer([ + { band: 0, gain: 0.34 }, + { band: 1, gain: 0.34 }, + { band: 2, gain: 0.34 }, + { band: 3, gain: 0.34 }, + ]); + player.filters.push("bassboost"); + ctx.sendMessage({ + embeds: [ + { + description: "Bassboost filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('bassboost')) { - player.player.setEqualizer([]); - player.filters.splice(player.filters.indexOf('bassboost'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Bassboost filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setEqualizer([ - { band: 0, gain: 0.34 }, - { band: 1, gain: 0.34 }, - { band: 2, gain: 0.34 }, - { band: 3, gain: 0.34 }, - ]); - player.filters.push('bassboost'); - ctx.sendMessage({ - embeds: [ - { - description: 'Bassboost filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = BassBoost; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/karaoke.js b/src/commands/Filters/karaoke.js index 9c8df37..cdc66ea 100644 --- a/src/commands/Filters/karaoke.js +++ b/src/commands/Filters/karaoke.js @@ -1,65 +1,62 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Karaoke extends Command { - constructor(client) { - super(client, { - name: 'karaoke', - description: { - content: 'on/off the karaoke filter', - examples: ['karaoke'], - usage: 'karaoke', - }, - category: 'filters', - aliases: ['kk'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [], - }); +module.exports = class Karaoke extends Command { + constructor(client) { + super(client, { + name: "karaoke", + description: { + content: "on/off the karaoke filter", + examples: ["karaoke"], + usage: "karaoke", + }, + category: "filters", + aliases: ["kk"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("karaoke")) { + player.player.setKaraoke(); + player.filters.splice(player.filters.indexOf("karaoke"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Karaoke filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setKaraoke({ + level: 1, + monoLevel: 1, + filterBand: 220, + filterWidth: 100, + }); + player.filters.push("karaoke"); + ctx.sendMessage({ + embeds: [ + { + description: "Karaoke filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('karaoke')) { - player.player.setKaraoke(); - player.filters.splice(player.filters.indexOf('karaoke'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Karaoke filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setKaraoke({ - level: 1, - monoLevel: 1, - filterBand: 220, - filterWidth: 100, - }); - player.filters.push('karaoke'); - ctx.sendMessage({ - embeds: [ - { - description: 'Karaoke filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = Karaoke; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/lowPass.js b/src/commands/Filters/lowPass.js index c031301..cdc9665 100644 --- a/src/commands/Filters/lowPass.js +++ b/src/commands/Filters/lowPass.js @@ -1,59 +1,56 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class lowPass extends Command { - constructor(client) { - super(client, { - name: 'lowpass', - description: { - content: 'on/off lowpass filter', - examples: ['lowpass'], - usage: 'lowpass ', - }, - category: 'filters', - aliases: ['lp'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: false, - }); +module.exports = class lowPass extends Command { + constructor(client) { + super(client, { + name: "lowpass", + description: { + content: "on/off lowpass filter", + examples: ["lowpass"], + usage: "lowpass ", + }, + category: "filters", + aliases: ["lp"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: false, + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("lowpass")) { + player.player.setLowPass({}); + player.filters.splice(player.filters.indexOf("lowpass"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Lowpass filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setLowPass({ smoothing: 20 }); + player.filters.push("lowpass"); + ctx.sendMessage({ + embeds: [ + { + description: "Lowpass filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('lowpass')) { - player.player.setLowPass({}); - player.filters.splice(player.filters.indexOf('lowpass'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Lowpass filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setLowPass({ smoothing: 20 }); - player.filters.push('lowpass'); - ctx.sendMessage({ - embeds: [ - { - description: 'Lowpass filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = lowPass; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/nightcore.js b/src/commands/Filters/nightcore.js index db847b0..3325e64 100644 --- a/src/commands/Filters/nightcore.js +++ b/src/commands/Filters/nightcore.js @@ -1,60 +1,57 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class NightCore extends Command { - constructor(client) { - super(client, { - name: 'nightcore', - description: { - content: 'on/off nightcore filter', - examples: ['nightcore'], - usage: 'nightcore', - }, - category: 'filters', - aliases: ['nc'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class NightCore extends Command { + constructor(client) { + super(client, { + name: "nightcore", + description: { + content: "on/off nightcore filter", + examples: ["nightcore"], + usage: "nightcore", + }, + category: "filters", + aliases: ["nc"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.filters.includes("nightcore")) { + player.player.setTimescale(); + player.filters.splice(player.filters.indexOf("nightcore"), 1); + ctx.sendMessage({ + embeds: [ + { + description: "Nightcore filter has been disabled", + color: client.color.main, + }, + ], + }); + } else { + player.player.setTimescale({ speed: 1.165, pitch: 1.125, rate: 1.05 }); + player.filters.push("nightcore"); + ctx.sendMessage({ + embeds: [ + { + description: "Nightcore filter has been enabled", + color: client.color.main, + }, + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.filters.includes('nightcore')) { - player.player.setTimescale(); - player.filters.splice(player.filters.indexOf('nightcore'), 1); - ctx.sendMessage({ - embeds: [ - { - description: 'Nightcore filter has been disabled', - color: client.color.main, - }, - ], - }); - } - else { - player.player.setTimescale({ speed: 1.165, pitch: 1.125, rate: 1.05 }); - player.filters.push('nightcore'); - ctx.sendMessage({ - embeds: [ - { - description: 'Nightcore filter has been enabled', - color: client.color.main, - }, - ], - }); - } - } -} - -module.exports = NightCore; \ No newline at end of file + } +}; diff --git a/src/commands/Filters/speed.js b/src/commands/Filters/speed.js index ef29e94..f2daefb 100644 --- a/src/commands/Filters/speed.js +++ b/src/commands/Filters/speed.js @@ -1,72 +1,71 @@ -const { ApplicationCommandOptionType } = require('discord.js'); -const { Command } = require('../../structures/index.js'); +const { ApplicationCommandOptionType } = require("discord.js"); -class Speed extends Command { - constructor(client) { - super(client, { - name: 'speed', - description: { - content: 'Sets the speed of the song', - examples: ['speed 1.5'], - usage: 'speed ', - }, - category: 'filters', - aliases: ['speed'], - cooldown: 3, - args: true, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: ['ManageGuild'], - }, - slashCommand: true, - options: [ - { - name: 'speed', - description: 'The speed you want to set', - type: ApplicationCommandOptionType.Integer, - required: true, - }, - ], - }); - } - async run(client, ctx, args) { - const player = client.queue.get(ctx.guild.id); - const speed = Number(args[0]); - if (isNaN(speed)) - return await ctx.sendMessage({ - embeds: [ - { - description: 'Please provide a valid number', - color: client.color.red, - }, - ], - }); - if (speed < 0.5 || speed > 5) - return await ctx.sendMessage({ - embeds: [ - { - description: 'Please provide a number between 0.5 and 5', - color: client.color.red, - }, - ], - }); - player.player.setTimescale({ speed: speed }); - return await ctx.sendMessage({ - embeds: [ - { - description: `Speed has been set to ${speed}`, - color: client.color.main, - }, - ], - }); - } -} +const Command = require("../../structures/Command.js"); -module.exports = Speed; \ No newline at end of file +module.exports = class Speed extends Command { + constructor(client) { + super(client, { + name: "speed", + description: { + content: "Sets the speed of the song", + examples: ["speed 1.5"], + usage: "speed ", + }, + category: "filters", + aliases: ["speed"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: ["ManageGuild"], + }, + slashCommand: true, + options: [ + { + name: "speed", + description: "The speed you want to set", + type: ApplicationCommandOptionType.Integer, + required: true, + }, + ], + }); + } + async run(client, ctx, args) { + const player = client.queue.get(ctx.guild.id); + const speed = Number(args[0]); + if (isNaN(speed)) + return await ctx.sendMessage({ + embeds: [ + { + description: "Please provide a valid number", + color: client.color.red, + }, + ], + }); + if (speed < 0.5 || speed > 5) + return await ctx.sendMessage({ + embeds: [ + { + description: "Please provide a number between 0.5 and 5", + color: client.color.red, + }, + ], + }); + player.player.setTimescale({ speed: speed }); + return await ctx.sendMessage({ + embeds: [ + { + description: `Speed has been set to ${speed}`, + color: client.color.main, + }, + ], + }); + } +}; diff --git a/src/commands/Music/ClearQueue.js b/src/commands/Music/ClearQueue.js index 18c7176..08bd59e 100644 --- a/src/commands/Music/ClearQueue.js +++ b/src/commands/Music/ClearQueue.js @@ -1,49 +1,51 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class ClearQueue extends Command { - constructor(client) { - super(client, { - name: 'clearqueue', - description: { - content: 'Clears the queue', - examples: ['clearqueue'], - usage: 'clearqueue', - }, - category: 'music', - aliases: ['cq'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); - } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (!player.queue.length) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There are no songs in the queue.'), - ], - }); - player.queue = []; - return await ctx.sendMessage({ - embeds: [embed.setColor(this.client.color.main).setDescription(`Cleared the queue`)], - }); - } -} - -module.exports = ClearQueue; \ No newline at end of file +module.exports = class ClearQueue extends Command { + constructor(client) { + super(client, { + name: "clearqueue", + description: { + content: "Clears the queue", + examples: ["clearqueue"], + usage: "clearqueue", + }, + category: "music", + aliases: ["cq"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.queue.length) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There are no songs in the queue."), + ], + }); + player.queue = []; + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription(`Cleared the queue`), + ], + }); + } +}; diff --git a/src/commands/Music/Grab.js b/src/commands/Music/Grab.js index f7aee62..bc0ca11 100644 --- a/src/commands/Music/Grab.js +++ b/src/commands/Music/Grab.js @@ -1,60 +1,69 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Grab extends Command { - constructor(client) { - super(client, { - name: 'grab', - description: { - content: 'Grabs the current playing song', - examples: ['grab'], - usage: 'grab', - }, - category: 'music', - aliases: [], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Grab extends Command { + constructor(client) { + super(client, { + name: "grab", + description: { + content: "Grabs the current playing song", + examples: ["grab"], + usage: "grab", + }, + category: "music", + aliases: [], + cooldown: 3, + args: false, + player: { + voice: false, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const embed = client.embed().setColor(client.color.main); + let player = client.queue.get(ctx.guild.id); + let song = player.current; + try { + const dm = client + .embed() + .setTitle(`**${song.info.title}**`) + .setURL(song.info.uri) + .setThumbnail(song.info.artworkUrl) + .setDescription( + `**Duration:** ${ + song.info.isStream + ? "LIVE" + : client.utils.formatTime(song.info.length) + }\n**Requested by:** ${song.info.requester}\n**Link:** [Click here](${ + song.info.uri + })` + ) + .setColor(client.color.main); + await ctx.author.send({ embeds: [dm] }); + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**I sent you a DM.**`) + .setColor(client.color.green), + ], + }); + } catch (e) { + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**I couldn't send you a DM.**`) + .setColor(client.color.red), + ], + }); } - async run(client, ctx) { - const embed = client.embed().setColor(client.color.main); - let player = client.queue.get(ctx.guild.id); - let song = player.current; - try { - const dm = client - .embed() - .setTitle(`**${song.info.title}**`) - .setURL(song.info.uri) - .setThumbnail(song.info.thumbnail) - .setDescription(`**Duration:** ${song.info.isStream ? 'LIVE' : client.utils.formatTime(song.info.length)}\n**Requested by:** ${song.info.requester}\n**Link:** [Click here](${song.info.uri})`) - .setColor(client.color.main); - await ctx.author.send({ embeds: [dm] }); - return await ctx.sendMessage({ - embeds: [embed.setDescription(`**I sent you a DM.**`).setColor(client.color.green)], - }); - } - catch (e) { - return await ctx.sendMessage({ - embeds: [ - embed - .setDescription(`**I couldn't send you a DM.**`) - .setColor(client.color.red), - ], - }); - } - } -} - -module.exports = Grab; \ No newline at end of file + } +}; diff --git a/src/commands/Music/autoplay.js b/src/commands/Music/autoplay.js index 5e60f74..a1cb6c9 100644 --- a/src/commands/Music/autoplay.js +++ b/src/commands/Music/autoplay.js @@ -1,47 +1,48 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Autoplay extends Command { - constructor(client) { - super(client, { - name: 'autoplay', - description: { - content: 'Toggles autoplay', - examples: ['autoplay'], - usage: 'autoplay', - }, - category: 'music', - aliases: ['ap'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Autoplay extends Command { + constructor(client) { + super(client, { + name: "autoplay", + description: { + content: "Toggles autoplay", + examples: ["autoplay"], + usage: "autoplay", + }, + category: "music", + aliases: ["ap"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + const autoplay = player.autoplay; + if (!autoplay) { + embed + .setDescription(`Autoplay has been enabled`) + .setColor(client.color.main); + player.setAutoplay(true); + } else { + embed + .setDescription(`Autoplay has been disabled`) + .setColor(client.color.main); + player.setAutoplay(false); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - const autoplay = player.autoplay; - if (!autoplay) { - embed.setDescription(`Autoplay has been enabled`).setColor(client.color.main); - player.setAutoplay(true); - } - else { - embed.setDescription(`Autoplay has been disabled`).setColor(client.color.main); - player.setAutoplay(false); - } - ctx.sendMessage({ embeds: [embed] }); - } -} - -module.exports = Autoplay; \ No newline at end of file + ctx.sendMessage({ embeds: [embed] }); + } +}; diff --git a/src/commands/Music/join.js b/src/commands/Music/join.js index fab178b..070a44a 100644 --- a/src/commands/Music/join.js +++ b/src/commands/Music/join.js @@ -1,57 +1,67 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Join extends Command { - constructor(client) { - super(client, { - name: 'join', - description: { - content: 'Joins the voice channel', - examples: ['join'], - usage: 'join', - }, - category: 'music', - aliases: ['j'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: false, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Join extends Command { + constructor(client) { + super(client, { + name: "join", + description: { + content: "Joins the voice channel", + examples: ["join"], + usage: "join", + }, + category: "music", + aliases: ["j"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: false, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + let player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player) { + const vc = ctx.member; + player = await client.queue.create( + ctx.guild, + vc.voice.channel, + ctx.channel, + client.shoukaku.options.nodeResolver(client.shoukaku.nodes) + ); + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Joined <#${ + player.node.manager.connections.get(ctx.guild.id).channelId + }>` + ), + ], + }); + } else { + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `I'm already connected to <#${ + player.node.manager.connections.get(ctx.guild.id).channelId + }>` + ), + ], + }); } - async run(client, ctx) { - let player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (!player) { - const vc = ctx.member; - player = await client.queue.create(ctx.guild, vc.voice.channel, ctx.channel, client.shoukaku.getNode()); - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Joined <#${player.player.connection.channelId}>`), - ], - }); - } - else { - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`I'm already connected to <#${player.player.connection.channelId}>`), - ], - }); - } - } -} - -module.exports = Join; \ No newline at end of file + } +}; diff --git a/src/commands/Music/leave.js b/src/commands/Music/leave.js index aecf42a..81ebf10 100644 --- a/src/commands/Music/leave.js +++ b/src/commands/Music/leave.js @@ -1,57 +1,57 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Leave extends Command { - constructor(client) { - super(client, { - name: 'leave', - description: { - content: 'Leaves the voice channel', - examples: ['leave'], - usage: 'leave', - }, - category: 'music', - aliases: ['dc'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: true, - active: false, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Leave extends Command { + constructor(client) { + super(client, { + name: "leave", + description: { + content: "Leaves the voice channel", + examples: ["leave"], + usage: "leave", + }, + category: "music", + aliases: ["dc"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: true, + active: false, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (player) { + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Left <#${ + player.node.manager.connections.get(ctx.guild.id).channelId + }>` + ), + ], + }); + player.destroy(); + } else { + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription(`I'm not in a voice channel`), + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (player) { - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Left <#${player.player.connection.channelId}>`), - ], - }); - player.destroy(); - } - else { - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`I'm not in a voice channel`), - ], - }); - } - } -} - - -module.exports = Leave; \ No newline at end of file + } +}; diff --git a/src/commands/Music/loop.js b/src/commands/Music/loop.js index 10ae025..595185d 100644 --- a/src/commands/Music/loop.js +++ b/src/commands/Music/loop.js @@ -1,61 +1,64 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Loop extends Command { - constructor(client) { - super(client, { - name: 'loop', - description: { - content: 'loop the current song or the queue', - examples: ['loop', 'loop queue', 'loop song'], - usage: 'loop', - }, - category: 'general', - aliases: ['loop'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], +module.exports = class Loop extends Command { + constructor(client) { + super(client, { + name: "loop", + description: { + content: "loop the current song or the queue", + examples: ["loop", "loop queue", "loop song"], + usage: "loop", + }, + category: "general", + aliases: ["loop"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const embed = client.embed().setColor(client.color.main); + const player = client.queue.get(ctx.guild.id); + switch (player.loop) { + case "off": + player.loop = "repeat"; + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**Looping the song**`) + .setColor(client.color.main), + ], + }); + case "repeat": + player.loop = "queue"; + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**Looping the queue**`) + .setColor(client.color.main), + ], + }); + case "queue": + player.loop = "off"; + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**Looping is now off**`) + .setColor(client.color.main), + ], }); } - async run(client, ctx) { - const embed = client.embed().setColor(client.color.main); - const player = client.queue.get(ctx.guild.id); - switch (player.loop) { - case 'off': - player.loop = 'repeat'; - return await ctx.sendMessage({ - embeds: [ - embed.setDescription(`**Looping the song**`).setColor(client.color.main), - ], - }); - case 'repeat': - player.loop = 'queue'; - return await ctx.sendMessage({ - embeds: [ - embed.setDescription(`**Looping the queue**`).setColor(client.color.main), - ], - }); - case 'queue': - player.loop = 'off'; - return await ctx.sendMessage({ - embeds: [ - embed.setDescription(`**Looping is now off**`).setColor(client.color.main), - ], - }); - } - } -} - - -module.exports = Loop; \ No newline at end of file + } +}; diff --git a/src/commands/Music/nowplaying.js b/src/commands/Music/nowplaying.js index bd35798..7f3268b 100644 --- a/src/commands/Music/nowplaying.js +++ b/src/commands/Music/nowplaying.js @@ -1,51 +1,53 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Nowplaying extends Command { - constructor(client) { - super(client, { - name: 'nowplaying', - description: { - content: 'Shows the currently playing song', - examples: ['nowplaying'], - usage: 'nowplaying', - }, - category: 'music', - aliases: ['np'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); - } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const track = player.current; - const position = player.player.position; - const duration = track.info.length; - const bar = client.utils.progressBar(position, duration, 20); - const embed1 = this.client - .embed() - .setColor(this.client.color.main) - .setAuthor({ name: 'Now Playing', iconURL: ctx.guild.iconURL({}) }) - .setThumbnail(track.info.thumbnail) - .setDescription(`[${track.info.title}](${track.info.uri}) - Request By: ${track.info.requester}\n\n\`${bar}\``) - .addFields({ - name: '\u200b', - value: `\`${client.utils.formatTime(position)} / ${client.utils.formatTime(duration)}\``, - }); - return await ctx.sendMessage({ embeds: [embed1] }); - } -} - -module.exports = Nowplaying; \ No newline at end of file +module.exports = class Nowplaying extends Command { + constructor(client) { + super(client, { + name: "nowplaying", + description: { + content: "Shows the currently playing song", + examples: ["nowplaying"], + usage: "nowplaying", + }, + category: "music", + aliases: ["np"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const track = player.current; + const position = player.player.position; + const duration = track.info.length; + const bar = client.utils.progressBar(position, duration, 20); + const embed1 = this.client + .embed() + .setColor(this.client.color.main) + .setAuthor({ name: "Now Playing", iconURL: ctx.guild.iconURL({}) }) + .setThumbnail(track.info.artworkUrl) + .setDescription( + `[${track.info.title}](${track.info.uri}) - Request By: ${track.info.requester}\n\n\`${bar}\`` + ) + .addFields({ + name: "\u200b", + value: `\`${client.utils.formatTime( + position + )} / ${client.utils.formatTime(duration)}\``, + }); + return await ctx.sendMessage({ embeds: [embed1] }); + } +}; diff --git a/src/commands/Music/pause.js b/src/commands/Music/pause.js index f6f6651..bde8c0c 100644 --- a/src/commands/Music/pause.js +++ b/src/commands/Music/pause.js @@ -1,52 +1,53 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Pause extends Command { - constructor(client) { - super(client, { - name: 'pause', - description: { - content: 'Pauses the current song', - examples: ['pause'], - usage: 'pause', - }, - category: 'music', - aliases: [], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Pause extends Command { + constructor(client) { + super(client, { + name: "pause", + description: { + content: "Pauses the current song", + examples: ["pause"], + usage: "pause", + }, + category: "music", + aliases: [], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.paused) { + player.pause(); + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription(`Paused the song`), + ], + }); + } else { + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription(`The song is already paused`), + ], + }); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (!player.paused) { - player.pause(); - return await ctx.sendMessage({ - embeds: [embed.setColor(this.client.color.main).setDescription(`Paused the song`)], - }); - } - else { - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`The song is already paused`), - ], - }); - } - } -} - -module.exports = Pause; \ No newline at end of file + } +}; diff --git a/src/commands/Music/play.js b/src/commands/Music/play.js index b734898..c457d17 100644 --- a/src/commands/Music/play.js +++ b/src/commands/Music/play.js @@ -1,145 +1,169 @@ -const { Command } = require('../../structures/index.js'); +const { LoadType } = require("shoukaku"); +const Command = require("../../structures/Command.js"); -class Play extends Command { - constructor(client) { - super(client, { - name: 'play', - description: { - content: 'Plays a song from YouTube or Spotify', - examples: [ - 'play https://www.youtube.com/watch?v=QH2-TGUlwu4', - 'play https://open.spotify.com/track/6WrI0LAC5M1Rw2MnX2ZvEg', - ], - usage: 'play ', - }, - category: 'music', - aliases: ['p'], - cooldown: 3, - args: true, - player: { - voice: true, - dj: false, - active: false, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks', 'Connect', 'Speak'], - user: [], - }, - slashCommand: true, - options: [ - { - name: 'song', - description: 'The song you want to play', - type: 3, - required: true, - autocomplete: true, - }, +module.exports = class Play extends Command { + constructor(client) { + super(client, { + name: "play", + description: { + content: "Plays a song from YouTube or Spotify", + examples: [ + "play https://www.youtube.com/watch?v=QH2-TGUlwu4", + "play https://open.spotify.com/track/6WrI0LAC5M1Rw2MnX2ZvEg", + ], + usage: "play ", + }, + category: "music", + aliases: ["p"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: false, + active: false, + djPerm: null, + }, + permissions: { + dev: false, + client: [ + "SendMessages", + "ViewChannel", + "EmbedLinks", + "Connect", + "Speak", + ], + user: [], + }, + slashCommand: true, + options: [ + { + name: "song", + description: "The song you want to play", + type: 3, + required: true, + autocomplete: true, + }, + ], + }); + } + async run(client, ctx, args) { + const query = args.join(" "); + let player = client.queue.get(ctx.guild.id); + const vc = ctx.member; + if (!player) + player = await client.queue.create( + ctx.guild, + vc.voice.channel, + ctx.channel + ); + const res = await this.client.queue.search(query); + const embed = this.client.embed(); + switch (res.loadType) { + case LoadType.ERROR: + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There was an error while searching."), + ], + }); + break; + case LoadType.EMPTY: + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There were no results found."), + ], + }); + break; + case LoadType.TRACK: { + const track = player.buildTrack(res.data, ctx.author); + if (player.queue.length > client.config.maxQueueSize) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription( + `The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.` + ), ], + }); + player.queue.push(track); + await player.isPlaying(); + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Added [${res.data.info.title}](${res.data.info.uri}) to the queue.` + ), + ], }); - } - async run(client, ctx, args) { - const query = args.join(' '); - let player = client.queue.get(ctx.guild.id); - const vc = ctx.member; - if (!player) - player = await client.queue.create(ctx.guild, vc.voice.channel, ctx.channel, client.shoukaku.getNode()); - const res = await this.client.queue.search(query); - const embed = this.client.embed(); - switch (res.loadType) { - case 'LOAD_FAILED': - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There was an error while searching.'), - ], - }); - break; - case 'NO_MATCHES': - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There were no results found.'), - ], - }); - break; - case 'TRACK_LOADED': { - const track = player.buildTrack(res.tracks[0], ctx.author); - if (player.queue.length > client.config.maxQueueSize) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.`), - ], - }); - player.queue.push(track); - await player.isPlaying(); - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Added [${res.tracks[0].info.title}](${res.tracks[0].info.uri}) to the queue.`), - ], - }); - break; - } - case 'PLAYLIST_LOADED': - if (res.length > client.config.maxPlaylistSize) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`The playlist is too long. The maximum length is ${client.config.maxPlaylistSize} songs.`), - ], - }); - for (const track of res.tracks) { - const pl = player.buildTrack(track, ctx.author); - if (player.queue.length > client.config.maxQueueSize) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.`), - ], - }); - player.queue.push(pl); - } - await player.isPlaying(); - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Added ${res.tracks.length} songs to the queue.`), - ], - }); - break; - case 'SEARCH_RESULT': { - const track1 = player.buildTrack(res.tracks[0], ctx.author); - if (player.queue.length > client.config.maxQueueSize) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription(`The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.`), - ], - }); - player.queue.push(track1); - await player.isPlaying(); - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Added [${res.tracks[0].info.title}](${res.tracks[0].info.uri}) to the queue.`), - ], - }); - break; - } + break; + } + case LoadType.PLAYLIST: { + if (res.data.tracks.length > client.config.maxPlaylistSize) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription( + `The playlist is too long. The maximum length is ${client.config.maxPlaylistSize} songs.` + ), + ], + }); + for (const track of res.data.tracks) { + const pl = player.buildTrack(track, ctx.author); + if (player.queue.length > client.config.maxQueueSize) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription( + `The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.` + ), + ], + }); + player.queue.push(pl); } + await player.isPlaying(); + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Added ${res.data.tracks.length} songs to the queue.` + ), + ], + }); + break; + } + case LoadType.SEARCH: { + const track1 = player.buildTrack(res.data[0], ctx.author); + if (player.queue.length > client.config.maxQueueSize) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription( + `The queue is too long. The maximum length is ${client.config.maxQueueSize} songs.` + ), + ], + }); + player.queue.push(track1); + await player.isPlaying(); + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Added [${res.data[0].info.title}](${res.data[0].info.uri}) to the queue.` + ), + ], + }); + break; + } } -} - -module.exports = Play; \ No newline at end of file + } +}; diff --git a/src/commands/Music/queue.js b/src/commands/Music/queue.js index 47c879c..b0fccbd 100644 --- a/src/commands/Music/queue.js +++ b/src/commands/Music/queue.js @@ -1,63 +1,74 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Queue extends Command { - constructor(client) { - super(client, { - name: 'queue', - description: { - content: 'Shows the current queue', - examples: ['queue'], - usage: 'queue', - }, - category: 'music', - aliases: ['q'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); +module.exports = class Queue extends Command { + constructor(client) { + super(client, { + name: "queue", + description: { + content: "Shows the current queue", + examples: ["queue"], + usage: "queue", + }, + category: "music", + aliases: ["q"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + if (player.queue.length === 0) + return await ctx.sendMessage({ + embeds: [ + this.client + .embed() + .setColor(this.client.color.main) + .setDescription( + `Now playing: [${player.current.info.title}](${ + player.current.info.uri + }) - Request By: ${player.current?.info.requester} - Duration: ${ + player.current.info.isStream + ? "LIVE" + : this.client.utils.formatTime(player.current.info.length) + }` + ), + ], + }); + const queue = player.queue.map( + (track, index) => + `${index + 1}. [${track.info.title}](${track.info.uri}) - Request By: ${ + track?.info.requester + } - Duration: ${ + track.info.isStream + ? "LIVE" + : this.client.utils.formatTime(track.info.length) + }` + ); + let chunks = client.utils.chunk(queue, 10); + if (chunks.length === 0) chunks = 1; + const pages = []; + for (let i = 0; i < chunks.length; i++) { + const embed = this.client + .embed() + .setColor(this.client.color.main) + .setAuthor({ name: "Queue", iconURL: ctx.guild.iconURL({}) }) + .setDescription(chunks[i].join("\n")) + .setFooter({ text: `Page ${i + 1} of ${chunks.length}` }); + pages.push(embed); } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - if (player.queue.length === 0) - return await ctx.sendMessage({ - embeds: [ - this.client - .embed() - .setColor(this.client.color.main) - .setDescription(`Now playing: [${player.current.info.title}](${player.current.info.uri}) - Request By: ${player.current?.info.requester} - Duration: ${player.current.info.isStream - ? 'LIVE' - : this.client.utils.formatTime(player.current.info.length)}`), - ], - }); - const queue = player.queue.map((track, index) => `${index + 1}. [${track.info.title}](${track.info.uri}) - Request By: ${track?.info - .requester} - Duration: ${track.info.isStream ? 'LIVE' : this.client.utils.formatTime(track.info.length)}`); - let chunks = client.utils.chunk(queue, 10); - if (chunks.length === 0) - chunks = 1; - const pages = []; - for (let i = 0; i < chunks.length; i++) { - const embed = this.client - .embed() - .setColor(this.client.color.main) - .setAuthor({ name: 'Queue', iconURL: ctx.guild.iconURL({}) }) - .setDescription(chunks[i].join('\n')) - .setFooter({ text: `Page ${i + 1} of ${chunks.length}` }); - pages.push(embed); - } - return await client.utils.paginate(ctx, pages); - } -} - -module.exports = Queue; \ No newline at end of file + return await client.utils.paginate(ctx, pages); + } +}; diff --git a/src/commands/Music/remove.js b/src/commands/Music/remove.js index 6440bd7..bd205d9 100644 --- a/src/commands/Music/remove.js +++ b/src/commands/Music/remove.js @@ -1,85 +1,84 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Remove extends Command { - constructor(client) { - super(client, { - name: 'remove', - description: { - content: 'Removes a song from the queue', - examples: ['remove 1'], - usage: 'remove ', - }, - category: 'music', - aliases: ['rm'], - cooldown: 3, - args: true, - player: { - voice: true, - dj: true, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [ - { - name: 'song', - description: 'The song number', - type: 4, - required: true, - }, - ], - }); - } - async run(client, ctx, args) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (!player.queue.length) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There are no songs in the queue.'), - ], - }); - if (isNaN(Number(args[0]))) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('That is not a valid number.'), - ], - }); - if (Number(args[0]) > player.queue.length) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('That is not a valid number.'), - ], - }); - if (Number(args[0]) < 1) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('That is not a valid number.'), - ], - }); - player.remove(Number(args[0]) - 1); - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.main) - .setDescription(`Removed song number ${Number(args[0])} from the queue`), - ], - }); - } -} - - -module.exports = Remove; \ No newline at end of file +module.exports = class Remove extends Command { + constructor(client) { + super(client, { + name: "remove", + description: { + content: "Removes a song from the queue", + examples: ["remove 1"], + usage: "remove ", + }, + category: "music", + aliases: ["rm"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: true, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [ + { + name: "song", + description: "The song number", + type: 4, + required: true, + }, + ], + }); + } + async run(client, ctx, args) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.queue.length) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There are no songs in the queue."), + ], + }); + if (isNaN(Number(args[0]))) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("That is not a valid number."), + ], + }); + if (Number(args[0]) > player.queue.length) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("That is not a valid number."), + ], + }); + if (Number(args[0]) < 1) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("That is not a valid number."), + ], + }); + player.remove(Number(args[0]) - 1); + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription( + `Removed song number ${Number(args[0])} from the queue` + ), + ], + }); + } +}; diff --git a/src/commands/Music/resume.js b/src/commands/Music/resume.js index 73f1083..2d490a7 100644 --- a/src/commands/Music/resume.js +++ b/src/commands/Music/resume.js @@ -1,50 +1,51 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); -class Resume extends Command { - constructor(client) { - super(client, { - name: 'resume', - description: { - content: 'Resumes the current song', - examples: ['resume'], - usage: 'resume', - }, - category: 'music', - aliases: ['r'], - cooldown: 3, - args: false, - player: { - voice: true, - dj: false, - active: true, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [], - }); - } - async run(client, ctx) { - const player = client.queue.get(ctx.guild.id); - const embed = this.client.embed(); - if (!player.paused) - return await ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('The player is not paused.'), - ], - }); - player.pause(); - return await ctx.sendMessage({ - embeds: [embed.setColor(this.client.color.main).setDescription(`Resumed the player`)], - }); - } -} - - -module.exports = Resume; \ No newline at end of file +module.exports = class Resume extends Command { + constructor(client) { + super(client, { + name: "resume", + description: { + content: "Resumes the current song", + examples: ["resume"], + usage: "resume", + }, + category: "music", + aliases: ["r"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [], + }); + } + async run(client, ctx) { + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.paused) + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("The player is not paused."), + ], + }); + player.pause(); + return await ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.main) + .setDescription(`Resumed the player`), + ], + }); + } +}; diff --git a/src/commands/Music/search.js b/src/commands/Music/search.js index 24c2d64..5ef56c3 100644 --- a/src/commands/Music/search.js +++ b/src/commands/Music/search.js @@ -1,112 +1,148 @@ -const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); -const { Command } = require('../../structures/index.js'); +const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -class Search extends Command { - constructor(client) { - super(client, { - name: 'search', - description: { - content: 'Searches for a song', - examples: ['search', 'search '], - usage: 'search', - }, - category: 'music', - aliases: ['search'], - cooldown: 3, - args: true, - player: { - voice: true, - dj: false, - active: false, - djPerm: null, - }, - permissions: { - dev: false, - client: ['SendMessages', 'ViewChannel', 'EmbedLinks'], - user: [], - }, - slashCommand: true, - options: [ - { - name: 'song', - description: 'The song you want to search', - type: 3, - required: true, - }, - ], - }); +const { LoadType } = require("shoukaku"); + +const Command = require("../../structures/Command.js"); + +module.exports = class Search extends Command { + constructor(client) { + super(client, { + name: "search", + description: { + content: "Searches for a song", + examples: ["search", "search "], + usage: "search", + }, + category: "music", + aliases: ["search"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: false, + active: false, + djPerm: null, + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [], + }, + slashCommand: true, + options: [ + { + name: "song", + description: "The song you want to search", + type: 3, + required: true, + }, + ], + }); + } + async run(client, ctx, args) { + const embed = client.embed().setColor(client.color.main); + let player = client.queue.get(ctx.guild.id); + const query = args.join(" "); + if (!player) { + const vc = ctx.member; + player = await client.queue.create( + ctx.guild, + vc.voice.channel, + ctx.channel, + client.shoukaku.options.nodeResolver(client.shoukaku.nodes) + ); } - async run(client, ctx, args) { - const embed = client.embed().setColor(client.color.main); - let player = client.queue.get(ctx.guild.id); - const query = args.join(' '); - if (!player) { - const vc = ctx.member; - player = await client.queue.create(ctx.guild, vc.voice.channel, ctx.channel, client.shoukaku.getNode()); - } - const res = await this.client.queue.search(query); - if (!res) - return await ctx.sendMessage({ - embeds: [embed.setDescription(`**No results found**`).setColor(client.color.red)], - }); - const row = new ActionRowBuilder().addComponents(new ButtonBuilder().setCustomId('1').setLabel('1').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('2').setLabel('2').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('3').setLabel('3').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('4').setLabel('4').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('5').setLabel('5').setStyle(ButtonStyle.Primary)); - switch (res.loadType) { - case 'LOAD_FAILED': - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There was an error while searching.'), - ], - }); - break; - case 'NO_MATCHES': - ctx.sendMessage({ - embeds: [ - embed - .setColor(this.client.color.red) - .setDescription('There were no results found.'), - ], - }); - break; - case 'SEARCH_RESULT': { - const tracks = res.tracks.slice(0, 5); - const embeds = tracks.map((track, index) => `${index + 1}. [${track.info.title}](${track.info.uri}) - \`${track.info.author}\``); - await ctx.sendMessage({ - embeds: [embed.setDescription(embeds.join('\n'))], - components: [row], - }); - break; - } - } - const collector = ctx.channel.createMessageComponentCollector({ - filter: (f) => (f.user.id === ctx.author.id ? true : false && f.deferUpdate()), - max: 1, - time: 60000, - idle: 60000 / 2, + const res = await this.client.queue.search(query); + if (!res) + return await ctx.sendMessage({ + embeds: [ + embed + .setDescription(`**No results found**`) + .setColor(client.color.red), + ], + }); + const row = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("1") + .setLabel("1") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("2") + .setLabel("2") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("3") + .setLabel("3") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("4") + .setLabel("4") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("5") + .setLabel("5") + .setStyle(ButtonStyle.Primary) + ); + switch (res.loadType) { + case LoadType.ERROR: + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There was an error while searching."), + ], }); - collector.on('collect', async (int) => { - for (let i = 0; i < res.tracks.length; i++) { - if (int.customId === `${i + 1}`) { - let track = res.tracks[i]; - track = player.buildTrack(track, ctx.author); - player.queue.push(track); - player.isPlaying(); - await ctx.editMessage({ - embeds: [ - embed.setDescription(`Added [${track.info.title}](${track.info.uri}) to the queue`), - ], - components: [], - }); - } - } - return int.deferUpdate(); + break; + case LoadType.EMPTY: + ctx.sendMessage({ + embeds: [ + embed + .setColor(this.client.color.red) + .setDescription("There were no results found."), + ], }); - collector.on('end', async () => { - await ctx.editMessage({ components: [] }); + break; + case LoadType.SEARCH: { + const tracks = res.data.slice(0, 5); + const embeds = tracks.map( + (track, index) => + `${index + 1}. [${track.info.title}](${track.info.uri}) - \`${ + track.info.author + }\`` + ); + await ctx.sendMessage({ + embeds: [embed.setDescription(embeds.join("\n"))], + components: [row], }); + break; + } } -} - - -module.exports = Search; \ No newline at end of file + const collector = ctx.channel.createMessageComponentCollector({ + filter: (f) => + f.user.id === ctx.author.id ? true : false && f.deferUpdate(), + max: 1, + time: 60000, + idle: 60000 / 2, + }); + collector.on("collect", async (int) => { + const track = res.data[parseInt(int.customId) - 1]; + await int.deferUpdate(); + if (!track) return; + const song = player.buildTrack(track, ctx.author); + player.queue.push(song); + player.isPlaying(); + await ctx.editMessage({ + embeds: [ + embed.setDescription( + `Added [${song.info.title}](${song.info.uri}) to the queue` + ), + ], + components: [], + }); + return collector.stop(); + }); + collector.on("end", async () => { + await ctx.editMessage({ components: [] }); + }); + } +}; diff --git a/src/commands/Music/seek.js b/src/commands/Music/seek.js index 54b0a69..56b0643 100644 --- a/src/commands/Music/seek.js +++ b/src/commands/Music/seek.js @@ -1,57 +1,59 @@ -const { Command } = require('../../structures/index.js'); +const Command = require("../../structures/Command.js"); - -class Seek extends Command { - constructor(client) { - super(client, { - name: 'seek', - description: { - content: 'Seeks to a certain time in the song', - examples: ['seek 1m, seek 1h 30m'], - usage: 'seek