Revert "Revert "Now commands is global""

This reverts commit c8659ac884.
This commit is contained in:
unknowableshade committed 2021-11-21 23:46:38 +03:00
1 parent c8659ac884
commit fc691899f2
23 files changed
+210 -254

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@
<TypeScriptCompile Include="src\events\voiceStateUpdate.ts">
<SubType>Code</SubType>
</TypeScriptCompile>
<TypeScriptCompile Include="src\types\Client.ts" />
<TypeScriptCompile Include="src\types\MyClient.ts" />
<TypeScriptCompile Include="src\types\Types.ts" />
<TypeScriptCompile Include="src\types\Misc.ts" />
<TypeScriptCompile Include="src\types\Music.ts" />
+76 -163
View File
@@ -8,9 +8,9 @@
"name": "5a0a-bot",
"version": "0.0.0",
"dependencies": {
"@discordjs/opus": "^0.6.0",
"@discordjs/voice": "0.6.0",
"@types/node": "^14.14.7",
"@discordjs/opus": "0.7.0",
"@discordjs/voice": "0.7.5",
"@types/node": "^16.11.9",
"discord-ytdl-core": "5.0.4",
"discord.js": "13.2.0",
"libsodium-wrappers": "^0.7.9",
@@ -19,39 +19,12 @@
"ytdl-core": "4.9.1"
},
"devDependencies": {
"@discordjs/builders": "0.8.2",
"@types/yt-search": "^2.3.2"
},
"engines": {
"node": "16.x.x"
}
},
"node_modules/@discordjs/builders": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.8.2.tgz",
"integrity": "sha512-/YRd11SrcluqXkKppq/FAVzLIPRVlIVmc6X8ZklspzMIHDtJ+A4W37D43SHvLdH//+NnK+SHW/WeOF4Ts54PeQ==",
"dev": true,
"dependencies": {
"@sindresorhus/is": "^4.2.0",
"discord-api-types": "^0.24.0",
"ow": "^0.27.0",
"ts-mixer": "^6.0.0",
"tslib": "^2.3.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"node_modules/@discordjs/collection": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz",
@@ -74,50 +47,52 @@
}
},
"node_modules/@discordjs/node-pre-gyp": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@discordjs/node-pre-gyp/-/node-pre-gyp-0.4.1.tgz",
"integrity": "sha512-PLYLPG3R+m9QlMROOjdy2htQq54g6f9vRb1xPfZ97CL53yj0uNTfpB/jtY/AXY6OKNtZtrre5SKjei8Hcc44HQ==",
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@discordjs/node-pre-gyp/-/node-pre-gyp-0.4.2.tgz",
"integrity": "sha512-V239Czn+DXFGLhhuccwEDBoTdgMGrRu30dOlzm1GzrSIjwFj01ZJerNX7x+CEX1NG1Q/1gGfOOkeZFNHjycrRA==",
"dependencies": {
"detect-libc": "^1.0.3",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.1",
"node-fetch": "^2.6.5",
"nopt": "^5.0.0",
"npmlog": "^5.0.0",
"npmlog": "^5.0.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.8"
"tar": "^6.1.11"
},
"bin": {
"node-pre-gyp": "bin/node-pre-gyp"
}
},
"node_modules/@discordjs/opus": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.6.0.tgz",
"integrity": "sha512-Xuw8OP9BJgObEBs/SgxixnKj+y+w9st45uOAJ+cGegUGwxAIR4J7sQt3Y1J3G9SGGe82+MTxvy7sg1/QUkigcg==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.7.0.tgz",
"integrity": "sha512-3Xxa3dh7taSDwBAR5fLALZ/KTxvbMmHCMxYLYve6NlPO7Ms1CLmKqp/R4ZoVzkRGQVUVWEhaB1s0v9jfa2tfDg==",
"hasInstallScript": true,
"dependencies": {
"@discordjs/node-pre-gyp": "^0.4.1",
"node-addon-api": "^4.0.0"
"@discordjs/node-pre-gyp": "^0.4.2",
"node-addon-api": "^4.2.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/@discordjs/voice": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz",
"integrity": "sha512-DF2fZAnB8gX3Qz5BEWPOUl565ptpda1uVmXJije4iK5aQrECfkqc6XcI+wzbGaNvzsH1Wb76NPzxngsEw8bblw==",
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.7.5.tgz",
"integrity": "sha512-lUk+CmIXNKslT6DkC9IF9rpsqhzlTiedauUCPBzepjd4XWxwBZiyVIzR6QpbAirxkAwCoAbbje+3Ho71PGLEAw==",
"dependencies": {
"@types/ws": "^7.4.4",
"discord-api-types": "^0.22.0",
"prism-media": "^1.3.1",
"tiny-typed-emitter": "^2.0.3",
"ws": "^7.4.4"
"@types/ws": "^8.2.0",
"discord-api-types": "^0.24.0",
"prism-media": "^1.3.2",
"tiny-typed-emitter": "^2.1.0",
"tslib": "^2.3.1",
"ws": "^8.2.3"
},
"engines": {
"node": ">=16.0.0"
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@sapphire/async-queue": {
@@ -141,14 +116,14 @@
}
},
"node_modules/@types/node": {
"version": "14.17.29",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.29.tgz",
"integrity": "sha512-sd4CHI9eTJXTH2vF3RGtGkqvWRwhsSSUFsXD4oG38GZzSZ0tNPbWikd2AbOAcKxCXhOg57fL8FPxjpfSzb2pIQ=="
"version": "16.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.9.tgz",
"integrity": "sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A=="
},
"node_modules/@types/ws": {
"version": "7.4.7",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz",
"integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==",
"dependencies": {
"@types/node": "*"
}
@@ -488,9 +463,9 @@
}
},
"node_modules/discord-api-types": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==",
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==",
"engines": {
"node": ">=12"
}
@@ -550,14 +525,6 @@
"node": ">=12"
}
},
"node_modules/discord.js/node_modules/@types/ws": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz",
"integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/discord.js/node_modules/discord-api-types": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.1.tgz",
@@ -566,26 +533,6 @@
"node": ">=12"
}
},
"node_modules/discord.js/node_modules/ws": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"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
}
}
},
"node_modules/dom-serializer": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
@@ -1269,9 +1216,9 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"node_modules/signal-exit": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ=="
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
"integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ=="
},
"node_modules/string_decoder": {
"version": "1.3.0",
@@ -1426,11 +1373,11 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"node_modules/ws": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz",
"integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==",
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"engines": {
"node": ">=8.3.0"
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
@@ -1485,27 +1432,6 @@
}
},
"dependencies": {
"@discordjs/builders": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.8.2.tgz",
"integrity": "sha512-/YRd11SrcluqXkKppq/FAVzLIPRVlIVmc6X8ZklspzMIHDtJ+A4W37D43SHvLdH//+NnK+SHW/WeOF4Ts54PeQ==",
"dev": true,
"requires": {
"@sindresorhus/is": "^4.2.0",
"discord-api-types": "^0.24.0",
"ow": "^0.27.0",
"ts-mixer": "^6.0.0",
"tslib": "^2.3.1"
},
"dependencies": {
"discord-api-types": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==",
"dev": true
}
}
},
"@discordjs/collection": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz",
@@ -1522,40 +1448,41 @@
}
},
"@discordjs/node-pre-gyp": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@discordjs/node-pre-gyp/-/node-pre-gyp-0.4.1.tgz",
"integrity": "sha512-PLYLPG3R+m9QlMROOjdy2htQq54g6f9vRb1xPfZ97CL53yj0uNTfpB/jtY/AXY6OKNtZtrre5SKjei8Hcc44HQ==",
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@discordjs/node-pre-gyp/-/node-pre-gyp-0.4.2.tgz",
"integrity": "sha512-V239Czn+DXFGLhhuccwEDBoTdgMGrRu30dOlzm1GzrSIjwFj01ZJerNX7x+CEX1NG1Q/1gGfOOkeZFNHjycrRA==",
"requires": {
"detect-libc": "^1.0.3",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.1",
"node-fetch": "^2.6.5",
"nopt": "^5.0.0",
"npmlog": "^5.0.0",
"npmlog": "^5.0.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.8"
"tar": "^6.1.11"
}
},
"@discordjs/opus": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.6.0.tgz",
"integrity": "sha512-Xuw8OP9BJgObEBs/SgxixnKj+y+w9st45uOAJ+cGegUGwxAIR4J7sQt3Y1J3G9SGGe82+MTxvy7sg1/QUkigcg==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.7.0.tgz",
"integrity": "sha512-3Xxa3dh7taSDwBAR5fLALZ/KTxvbMmHCMxYLYve6NlPO7Ms1CLmKqp/R4ZoVzkRGQVUVWEhaB1s0v9jfa2tfDg==",
"requires": {
"@discordjs/node-pre-gyp": "^0.4.1",
"node-addon-api": "^4.0.0"
"@discordjs/node-pre-gyp": "^0.4.2",
"node-addon-api": "^4.2.0"
}
},
"@discordjs/voice": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz",
"integrity": "sha512-DF2fZAnB8gX3Qz5BEWPOUl565ptpda1uVmXJije4iK5aQrECfkqc6XcI+wzbGaNvzsH1Wb76NPzxngsEw8bblw==",
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.7.5.tgz",
"integrity": "sha512-lUk+CmIXNKslT6DkC9IF9rpsqhzlTiedauUCPBzepjd4XWxwBZiyVIzR6QpbAirxkAwCoAbbje+3Ho71PGLEAw==",
"requires": {
"@types/ws": "^7.4.4",
"discord-api-types": "^0.22.0",
"prism-media": "^1.3.1",
"tiny-typed-emitter": "^2.0.3",
"ws": "^7.4.4"
"@types/ws": "^8.2.0",
"discord-api-types": "^0.24.0",
"prism-media": "^1.3.2",
"tiny-typed-emitter": "^2.1.0",
"tslib": "^2.3.1",
"ws": "^8.2.3"
}
},
"@sapphire/async-queue": {
@@ -1569,14 +1496,14 @@
"integrity": "sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw=="
},
"@types/node": {
"version": "14.17.29",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.29.tgz",
"integrity": "sha512-sd4CHI9eTJXTH2vF3RGtGkqvWRwhsSSUFsXD4oG38GZzSZ0tNPbWikd2AbOAcKxCXhOg57fL8FPxjpfSzb2pIQ=="
"version": "16.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.9.tgz",
"integrity": "sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A=="
},
"@types/ws": {
"version": "7.4.7",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz",
"integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==",
"requires": {
"@types/node": "*"
}
@@ -1859,9 +1786,9 @@
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
},
"discord-api-types": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg=="
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A=="
},
"discord-ytdl-core": {
"version": "5.0.4",
@@ -1905,24 +1832,10 @@
}
}
},
"@types/ws": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz",
"integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==",
"requires": {
"@types/node": "*"
}
},
"discord-api-types": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.1.tgz",
"integrity": "sha512-igWmn+45mzXRWNEPU25I/pr8MwxHb767wAr51oy3VRLRcTlp5ADBbrBR0lq3SA1Rfw3MtM4TQu1xo3kxscfVdQ=="
},
"ws": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"requires": {}
}
}
},
@@ -2443,9 +2356,9 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"signal-exit": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ=="
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
"integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ=="
},
"string_decoder": {
"version": "1.3.0",
@@ -2572,9 +2485,9 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"ws": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz",
"integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==",
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"requires": {}
},
"yallist": {
+3 -3
View File
@@ -15,9 +15,9 @@
"start": "node dist/app.js"
},
"dependencies": {
"@discordjs/opus": "^0.6.0",
"@discordjs/voice": "0.6.0",
"@types/node": "^14.14.7",
"@discordjs/opus": "0.7.0",
"@discordjs/voice": "0.7.5",
"@types/node": "^16.11.9",
"discord-ytdl-core": "5.0.4",
"discord.js": "13.2.0",
"libsodium-wrappers": "^0.7.9",
+2 -2
View File
@@ -1,9 +1,9 @@
"use strict";
import { MyClient } from "./types/Client";
import { MyClient } from "./types/MyClient";
const token = process.env.DISCORD_TOKEN;
const client = new MyClient("./commands", "./events");
const client = new MyClient("./commands", "./events", "214422162906415106");
client.login(token);
+2 -2
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { ColorResolvable, CommandInteraction, Message, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -4,7 +4,7 @@ import {
ColorResolvable, CommandInteraction, GuildMember,
MessageEmbed, TextChannel
} from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
import { loopOption } from "../../types/Types";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
import { run as connect } from "./connect";
+1 -1
View File
@@ -6,7 +6,7 @@ import {
MessageButton, MessageComponentInteraction, MessageEmbed
} from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
import { generateQueue } from "../../types/Misc";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,7 +1,7 @@
import { design } from "../../config";
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
import { MyClient } from "../../types/Client";
import { MyClient } from "../../types/MyClient";
+1 -1
View File
@@ -1,5 +1,5 @@
import { Interaction } from "discord.js";
import { MyClient } from "../types/Client";
import { MyClient } from "../types/MyClient";
export async function run(args: Interaction[], client: MyClient): Promise<void> {
const [interaction] = args;
+13 -5
View File
@@ -1,12 +1,20 @@
import { Message } from "discord.js";
import { MyClient } from "../types/Client";
import { ClientApplication, Message, User } from "discord.js";
import { MyClient } from "../types/MyClient";
export async function run(args: Message[], client: MyClient): Promise<void> {
const [message] = args;
if (message.guild)
await message.guild.commands.set(client.restCommands);
const application = client.application as ClientApplication;
if (application && message.author.id === client.owner) {
switch (message.content) {
case `!${client.user?.username}-dev-set-global-commands`: {
application.commands.set(client.restCommands);
await message.reply("Setting up command interactions. (It can take up to 1 hour)");
break;
}
}
}
}
export const name = "messageCreate";
+3 -2
View File
@@ -1,9 +1,10 @@
import { MyClient } from "../types/Client";
import { MyClient } from "../types/MyClient";
export async function run(args: unknown[], client: MyClient): Promise<void> {
if (!client.user)
return;
console.log(`Logged in as ${client.user.tag}!`);
console.log(`${client.user.username} logged in as ${client.user.tag}!`);
client.user.setActivity("on sound waves.", { type: "PLAYING" });
}
+9 -12
View File
@@ -1,6 +1,6 @@
import { ColorResolvable, MessageEmbed, VoiceState } from "discord.js";
import { design } from "../config";
import { MyClient } from "../types/Client";
import { MyClient } from "../types/MyClient";
import { sleep } from "../types/Misc";
export async function run(args: VoiceState[], client: MyClient): Promise<void> {
@@ -11,20 +11,17 @@ export async function run(args: VoiceState[], client: MyClient): Promise<void> {
if (!player)
return;
if (newState.id === client.user?.id && newState.deaf === false) {
newState.setDeaf(true);
if (oldState.channel?.members.size === 1 && oldState.channel.members.first()?.id === client.user?.id) {
await sleep(30000);
const channel = player.channel;
if (oldState.channel.members.size === 1)
player.destroy();
const embed = new MessageEmbed()
.setColor(design.color as ColorResolvable)
.setTitle("Please do not undeafen me.")
.setDescription("It's for your own privacy, trust me.")
await player.channel.send({ embeds: [embed] });
}
if (newState.channel?.members.size === 1 && newState.channel.members.first()) {
await sleep(30000);
if (newState.channel.members.first()?.id === client.user?.id)
player.destroy();
.setTitle("I've decided to leave to conserve my energy")
.setDescription("Since there was nobody in the voice channel.")
await channel.send({ embeds: [embed] });
}
}
+65 -44
View File
@@ -20,17 +20,35 @@ import yts from "yt-search";
export class Player {
public guild: Guild;
public music: Music;
public channel: TextChannel;
public connection: VoiceConnection | undefined;
public player: AudioPlayer | undefined;
private _connection: VoiceConnection | undefined;
get connection(): VoiceConnection | undefined {
return this._connection;
}
private _player: AudioPlayer | undefined;
get player(): AudioPlayer | undefined {
return this._player;
}
public queue: track[] = [];
public queuePosition: number = 0;
public nowPlaying: AudioResource | undefined;
public filters: filter = {};
public repeatMode: loopOption = "LOOP";
public channel: TextChannel;
private _queuePosition: number = 0;
get queuePosition(): number {
return this._queuePosition;
}
private _nowPlaying: AudioResource | undefined;
get nowPlaying(): AudioResource | undefined {
return this._nowPlaying;
}
public filters: filter = {};
public repeatMode: loopOption = "LOOP";
public message: Message | undefined;
public constructor(playerGuild: Guild, clientMusic: Music, ctxChannel: TextChannel) {
@@ -49,28 +67,31 @@ export class Player {
seek: seek
});
this.nowPlaying = createAudioResource(stream, {
this._nowPlaying = createAudioResource(stream, {
inlineVolume: true,
metadata: track
});
await player.play(this.nowPlaying);
await player.play(this._nowPlaying);
return player;
}
private _resourceEndResolvable(): boolean {
if (this._nowPlaying)
this._nowPlaying.encoder?.destroy();
switch (this.repeatMode) {
case "NONE": {
if (++this.queuePosition >= this.queue.length) {
this.queuePosition = 0;
this.nowPlaying = undefined;
if (++this._queuePosition >= this.queue.length) {
this._queuePosition = 0;
this._nowPlaying = undefined;
return false;
}
return true;
}
case "LOOP": {
this.queuePosition = (this.queuePosition + 1) % this.queue.length;
this._queuePosition = (this._queuePosition + 1) % this.queue.length;
return true;
}
case "SONG": return true;
@@ -107,15 +128,15 @@ export class Player {
}
public async play(seek: number = 0): Promise<void> {
if (!this.connection || this.queue.length === 0)
if (!this._connection || this.queue.length === 0)
return;
const track = this.queue[this.queuePosition];
const track = this.queue[this._queuePosition];
this.player = await this._playerCreator(track, seek);
this.connection.subscribe(this.player);
this._player = await this._playerCreator(track, seek);
this._connection.subscribe(this._player);
this.player.on(AudioPlayerStatus.Idle, async () => {
this._player.on(AudioPlayerStatus.Idle, async () => {
if (this._resourceEndResolvable())
await this.play();
});
@@ -124,18 +145,18 @@ export class Player {
}
public connect(channel: VoiceChannel | StageChannel): void {
this.connection = joinVoiceChannel({
this._connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guildId,
selfDeaf: true,
// selfDeaf: true,
adapterCreator: channel.guild.voiceAdapterCreator as unknown as DiscordGatewayAdapterCreator
});
this.connection.on(VoiceConnectionStatus.Disconnected, async (oldState, newState) => {
this._connection.on(VoiceConnectionStatus.Disconnected, async (oldState, newState) => {
try {
await Promise.race([
entersState(this.connection as VoiceConnection, VoiceConnectionStatus.Signalling, 5_000),
entersState(this.connection as VoiceConnection, VoiceConnectionStatus.Connecting, 5_000),
entersState(this._connection as VoiceConnection, VoiceConnectionStatus.Signalling, 5_000),
entersState(this._connection as VoiceConnection, VoiceConnectionStatus.Connecting, 5_000),
]);
}
catch (error) {
@@ -159,8 +180,8 @@ export class Player {
this.queue.push(metadata);
else {
this.queue.splice(Math.max(0, index), 0, metadata)
if (this.queuePosition >= index)
this.queuePosition++;
if (this._queuePosition >= index)
this._queuePosition++;
}
return metadata;
@@ -168,24 +189,24 @@ export class Player {
public clear() {
this.queue = [];
this.queuePosition = 0;
this.nowPlaying = undefined;
if (this.player)
this.player.stop();
this._queuePosition = 0;
this._nowPlaying = undefined;
if (this._player)
this._player.stop();
}
public destroy() {
if (this.connection)
this.connection.destroy();
if (this._connection)
this._connection.destroy();
this.music.delPlayer(this.guild.id);
}
public async jump(query: number | string): Promise<boolean> {
if (!this.player)
if (!this._player)
return false;
if (typeof query === "number" && query < this.queue.length && query >= 0) {
this.queuePosition = query;
this._queuePosition = query;
await this.play();
return true;
}
@@ -193,7 +214,7 @@ export class Player {
for (let i = 0; i < this.queue.length; i++) {
const track = this.queue[i];
if (track.title.toLowerCase().includes(String(query).toLowerCase())) {
this.queuePosition = i;
this._queuePosition = i;
await this.play();
return true;
}
@@ -205,7 +226,7 @@ export class Player {
public async remove(query: number | string): Promise<boolean> {
if (typeof query === "number" && query < this.queue.length && query >= 0) {
this.queue.splice(query, 1);
if (query === this.queuePosition)
if (query === this._queuePosition)
await this.play();
return true;
}
@@ -214,7 +235,7 @@ export class Player {
const track = this.queue[i];
if (track.title.toLowerCase().includes(String(query).toLowerCase())) {
this.queue.splice(i, 1);
if (i === this.queuePosition)
if (i === this._queuePosition)
await this.play();
return true;
}
@@ -228,15 +249,15 @@ export class Player {
}
public pause(): boolean {
if (!this.player)
if (!this._player)
return false;
if (this.player.state.status === AudioPlayerStatus.Paused) {
this.player.unpause();
if (this._player.state.status === AudioPlayerStatus.Paused) {
this._player.unpause();
return false;
}
else {
this.player.pause();
this._player.pause();
return true;
}
}
@@ -246,8 +267,8 @@ export class Player {
}
public volume(amount: number): boolean {
if (amount > 0 && amount < Infinity && this.nowPlaying && this.nowPlaying.volume) {
this.nowPlaying.volume.setVolumeLogarithmic(amount / 100);
if (amount > 0 && amount < Infinity && this._nowPlaying && this._nowPlaying.volume) {
this._nowPlaying.volume.setVolumeLogarithmic(amount / 100);
return true;
}
return false;
@@ -258,8 +279,8 @@ export class Player {
}
public skip(): void {
if (this.player)
this.player.stop();
if (this._player)
this._player.stop();
}
}
+22 -7
View File
@@ -1,15 +1,28 @@
import { ApplicationCommandData, Client as DiscordClient, Intents } from "discord.js";
import { ApplicationCommandData, Client as DiscordClient, Intents, User } from "discord.js";
import { readdirSync } from "fs";
import { Music } from "./Music";
export class MyClient extends DiscordClient {
commands = new Map<string, any>();
restCommands: ApplicationCommandData[] = [];
players = new Music();
private _commands = new Map<string, any>();
private _restCommands: ApplicationCommandData[] = [];
private _owner: string;
public players = new Music();
get commands(): Map<string, any> {
return this._commands;
}
get restCommands(): ApplicationCommandData[] {
return this._restCommands;
}
get owner(): string {
return this._owner;
}
constructor(commandsPath: string, eventsPath: string) {
public constructor(commandsPath: string, eventsPath: string, ownerId: string) {
super({
intents: [
Intents.FLAGS.GUILDS,
@@ -24,8 +37,8 @@ export class MyClient extends DiscordClient {
for (const file of cmdFiles) {
import(`.${commandsPath}/${dir}/${file}`).then((command) => {
const name = command.data.name;
this.restCommands.push(command.data);
this.commands.set(name, command);
this._restCommands.push(command.data);
this._commands.set(name, command);
});
}
});
@@ -39,5 +52,7 @@ export class MyClient extends DiscordClient {
});
});
}
this._owner = ownerId;
}
}
+2 -1
View File
@@ -7,7 +7,8 @@
"esModuleInterop": true,
"moduleResolution": "Node",
"lib": [ "ESNext", "DOM" ],
"sourceMap": true
"sourceMap": true,
"types": [ "node" ]
},
"include": [
"src/**/*"