diff --git a/bun.lockb b/bun.lockb index 784d3c2..b547594 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index f6c472d..0000000 --- a/package-lock.json +++ /dev/null @@ -1,1532 +0,0 @@ -{ - "name": "discord-voice-recorder", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "discord-voice-recorder", - "version": "1.0.0", - "dependencies": { - "@discordjs/opus": "^0.10.0", - "@discordjs/voice": "^0.19.1", - "@ffmpeg-installer/ffmpeg": "^1.1.0", - "@snazzah/davey": "^0.1.10", - "crc-32": "^1.2.2", - "discord.js-selfbot-v13": "^3.7.1", - "fluent-ffmpeg": "^2.1.3", - "libsodium-wrappers": "^0.8.2", - "node-crc": "^4.0.0", - "opusscript": "^0.1.1", - "prism-media": "2.0.0-alpha.0", - "sodium-native": "^4.3.2" - }, - "devDependencies": { - "@types/bun": "latest", - "@types/fluent-ffmpeg": "^2.1.28" - } - }, - "node_modules/@discordjs/builders": { - "version": "1.13.1", - "license": "Apache-2.0", - "dependencies": { - "@discordjs/formatters": "^0.6.2", - "@discordjs/util": "^1.2.0", - "@sapphire/shapeshift": "^4.0.0", - "discord-api-types": "^0.38.33", - "fast-deep-equal": "^3.1.3", - "ts-mixer": "^6.0.4", - "tslib": "^2.6.3" - }, - "engines": { - "node": ">=16.11.0" - }, - "funding": { - "url": "https://github.com/discordjs/discord.js?sponsor" - } - }, - "node_modules/@discordjs/builders/node_modules/discord-api-types": { - "version": "0.38.41", - "license": "MIT", - "workspaces": [ - "scripts/actions/documentation" - ] - }, - "node_modules/@discordjs/collection": { - "version": "2.1.1", - "license": "Apache-2.0", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/discordjs/discord.js?sponsor" - } - }, - "node_modules/@discordjs/formatters": { - "version": "0.6.2", - "license": "Apache-2.0", - "dependencies": { - "discord-api-types": "^0.38.33" - }, - "engines": { - "node": ">=16.11.0" - }, - "funding": { - "url": "https://github.com/discordjs/discord.js?sponsor" - } - }, - "node_modules/@discordjs/formatters/node_modules/discord-api-types": { - "version": "0.38.41", - "license": "MIT", - "workspaces": [ - "scripts/actions/documentation" - ] - }, - "node_modules/@discordjs/node-pre-gyp": { - "version": "0.4.5", - "license": "BSD-3-Clause", - "dependencies": { - "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "make-dir": "^3.1.0", - "node-fetch": "^2.6.7", - "nopt": "^5.0.0", - "npmlog": "^5.0.1", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.11" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - } - }, - "node_modules/@discordjs/opus": { - "version": "0.10.0", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "@discordjs/node-pre-gyp": "^0.4.5", - "node-addon-api": "^8.1.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@discordjs/util": { - "version": "1.2.0", - "license": "Apache-2.0", - "dependencies": { - "discord-api-types": "^0.38.33" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/discordjs/discord.js?sponsor" - } - }, - "node_modules/@discordjs/util/node_modules/discord-api-types": { - "version": "0.38.41", - "license": "MIT", - "workspaces": [ - "scripts/actions/documentation" - ] - }, - "node_modules/@discordjs/voice": { - "version": "0.19.1", - "license": "Apache-2.0", - "dependencies": { - "@snazzah/davey": "^0.1.9", - "@types/ws": "^8.18.1", - "discord-api-types": "^0.38.41", - "prism-media": "^1.3.5", - "tslib": "^2.8.1", - "ws": "^8.19.0" - }, - "engines": { - "node": ">=22.12.0" - }, - "funding": { - "url": "https://github.com/discordjs/discord.js?sponsor" - } - }, - "node_modules/@discordjs/voice/node_modules/opusscript": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.8.tgz", - "integrity": "sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==", - "license": "MIT", - "optional": true, - "peer": true - }, - "node_modules/@discordjs/voice/node_modules/prism-media": { - "version": "1.3.5", - "license": "Apache-2.0", - "peerDependencies": { - "@discordjs/opus": ">=0.8.0 <1.0.0", - "ffmpeg-static": "^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0", - "node-opus": "^0.3.3", - "opusscript": "^0.0.8" - }, - "peerDependenciesMeta": { - "@discordjs/opus": { - "optional": true - }, - "ffmpeg-static": { - "optional": true - }, - "node-opus": { - "optional": true - }, - "opusscript": { - "optional": true - } - } - }, - "node_modules/@ffmpeg-installer/ffmpeg": { - "version": "1.1.0", - "license": "LGPL-2.1", - "optionalDependencies": { - "@ffmpeg-installer/darwin-arm64": "4.1.5", - "@ffmpeg-installer/darwin-x64": "4.1.0", - "@ffmpeg-installer/linux-arm": "4.1.3", - "@ffmpeg-installer/linux-arm64": "4.1.4", - "@ffmpeg-installer/linux-ia32": "4.1.0", - "@ffmpeg-installer/linux-x64": "4.1.0", - "@ffmpeg-installer/win32-ia32": "4.1.0", - "@ffmpeg-installer/win32-x64": "4.1.0" - } - }, - "node_modules/@ffmpeg-installer/linux-x64": { - "version": "4.1.0", - "cpu": [ - "x64" - ], - "hasInstallScript": true, - "license": "GPLv3", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@minhducsun2002/leb128": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/@napi-rs/cli": { - "version": "2.18.4", - "license": "MIT", - "bin": { - "napi": "scripts/index.js" - }, - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" - } - }, - "node_modules/@otplib/core": { - "version": "12.0.1", - "license": "MIT" - }, - "node_modules/@otplib/plugin-crypto": { - "version": "12.0.1", - "license": "MIT", - "dependencies": { - "@otplib/core": "^12.0.1" - } - }, - "node_modules/@otplib/plugin-thirty-two": { - "version": "12.0.1", - "license": "MIT", - "dependencies": { - "@otplib/core": "^12.0.1", - "thirty-two": "^1.0.2" - } - }, - "node_modules/@otplib/preset-default": { - "version": "12.0.1", - "license": "MIT", - "dependencies": { - "@otplib/core": "^12.0.1", - "@otplib/plugin-crypto": "^12.0.1", - "@otplib/plugin-thirty-two": "^12.0.1" - } - }, - "node_modules/@otplib/preset-v11": { - "version": "12.0.1", - "license": "MIT", - "dependencies": { - "@otplib/core": "^12.0.1", - "@otplib/plugin-crypto": "^12.0.1", - "@otplib/plugin-thirty-two": "^12.0.1" - } - }, - "node_modules/@sapphire/async-queue": { - "version": "1.5.5", - "license": "MIT", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@sapphire/shapeshift": { - "version": "4.0.0", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=v16" - } - }, - "node_modules/@shinyoshiaki/jspack": { - "version": "0.0.6" - }, - "node_modules/@snazzah/davey": { - "version": "0.1.10", - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "funding": { - "url": "https://github.com/sponsors/Snazzah" - }, - "optionalDependencies": { - "@snazzah/davey-android-arm-eabi": "0.1.10", - "@snazzah/davey-android-arm64": "0.1.10", - "@snazzah/davey-darwin-arm64": "0.1.10", - "@snazzah/davey-darwin-x64": "0.1.10", - "@snazzah/davey-freebsd-x64": "0.1.10", - "@snazzah/davey-linux-arm-gnueabihf": "0.1.10", - "@snazzah/davey-linux-arm64-gnu": "0.1.10", - "@snazzah/davey-linux-arm64-musl": "0.1.10", - "@snazzah/davey-linux-x64-gnu": "0.1.10", - "@snazzah/davey-linux-x64-musl": "0.1.10", - "@snazzah/davey-wasm32-wasi": "0.1.10", - "@snazzah/davey-win32-arm64-msvc": "0.1.10", - "@snazzah/davey-win32-ia32-msvc": "0.1.10", - "@snazzah/davey-win32-x64-msvc": "0.1.10" - } - }, - "node_modules/@snazzah/davey-linux-x64-gnu": { - "version": "0.1.10", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@snazzah/davey-linux-x64-musl": { - "version": "0.1.10", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@types/bun": { - "version": "1.3.10", - "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.10.tgz", - "integrity": "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "bun-types": "1.3.10" - } - }, - "node_modules/@types/fluent-ffmpeg": { - "version": "2.1.28", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "25.3.5", - "license": "MIT", - "dependencies": { - "undici-types": "~7.18.0" - } - }, - "node_modules/@types/ws": { - "version": "8.18.1", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "license": "ISC" - }, - "node_modules/aes-js": { - "version": "3.1.2", - "license": "MIT" - }, - "node_modules/agent-base": { - "version": "6.0.2", - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/aproba": { - "version": "2.1.0", - "license": "ISC" - }, - "node_modules/are-we-there-yet": { - "version": "2.0.0", - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/async": { - "version": "0.2.10" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/bare-addon-resolve": { - "version": "1.10.0", - "license": "Apache-2.0", - "dependencies": { - "bare-module-resolve": "^1.10.0", - "bare-semver": "^1.0.0" - }, - "peerDependencies": { - "bare-url": "*" - }, - "peerDependenciesMeta": { - "bare-url": { - "optional": true - } - } - }, - "node_modules/bare-module-resolve": { - "version": "1.12.1", - "license": "Apache-2.0", - "dependencies": { - "bare-semver": "^1.0.0" - }, - "peerDependencies": { - "bare-url": "*" - }, - "peerDependenciesMeta": { - "bare-url": { - "optional": true - } - } - }, - "node_modules/bare-semver": { - "version": "1.0.2", - "license": "Apache-2.0" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/bun-types": { - "version": "1.3.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chownr": { - "version": "2.0.0", - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/cliui": { - "version": "6.0.0", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/color-support": { - "version": "1.1.3", - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, - "node_modules/commander": { - "version": "12.1.0", - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "license": "ISC" - }, - "node_modules/crc-32": { - "version": "1.2.2", - "license": "Apache-2.0", - "bin": { - "crc32": "bin/crc32.njs" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, - "node_modules/dijkstrajs": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/discord-api-types": { - "version": "0.38.41", - "license": "MIT", - "workspaces": [ - "scripts/actions/documentation" - ] - }, - "node_modules/discord.js-selfbot-v13": { - "version": "3.7.1", - "license": "GNU General Public License v3.0", - "dependencies": { - "@discordjs/builders": "^1.6.3", - "@discordjs/collection": "^2.1.1", - "@sapphire/async-queue": "^1.5.5", - "@sapphire/shapeshift": "^4.0.0", - "discord-api-types": "^0.38.15", - "fetch-cookie": "^3.1.0", - "find-process": "^2.0.0", - "otplib": "^12.0.1", - "prism-media": "^1.3.5", - "qrcode": "^1.5.4", - "tough-cookie": "^5.1.2", - "tree-kill": "^1.2.2", - "undici": "^7.11.0", - "werift-rtp": "^0.8.4", - "ws": "^8.16.0" - }, - "engines": { - "node": ">=20.18" - } - }, - "node_modules/discord.js-selfbot-v13/node_modules/opusscript": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.8.tgz", - "integrity": "sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==", - "license": "MIT", - "optional": true, - "peer": true - }, - "node_modules/discord.js-selfbot-v13/node_modules/prism-media": { - "version": "1.3.5", - "license": "Apache-2.0", - "peerDependencies": { - "@discordjs/opus": ">=0.8.0 <1.0.0", - "ffmpeg-static": "^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0", - "node-opus": "^0.3.3", - "opusscript": "^0.0.8" - }, - "peerDependenciesMeta": { - "@discordjs/opus": { - "optional": true - }, - "ffmpeg-static": { - "optional": true - }, - "node-opus": { - "optional": true - }, - "opusscript": { - "optional": true - } - } - }, - "node_modules/duplex-child-process": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "license": "MIT" - }, - "node_modules/fetch-cookie": { - "version": "3.2.0", - "license": "Unlicense", - "dependencies": { - "set-cookie-parser": "^2.4.8", - "tough-cookie": "^6.0.0" - } - }, - "node_modules/fetch-cookie/node_modules/tough-cookie": { - "version": "6.0.1", - "license": "BSD-3-Clause", - "dependencies": { - "tldts": "^7.0.5" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/fetch-cookie/node_modules/tough-cookie/node_modules/tldts": { - "version": "7.0.25", - "license": "MIT", - "dependencies": { - "tldts-core": "^7.0.25" - }, - "bin": { - "tldts": "bin/cli.js" - } - }, - "node_modules/fetch-cookie/node_modules/tough-cookie/node_modules/tldts/node_modules/tldts-core": { - "version": "7.0.25", - "license": "MIT" - }, - "node_modules/find-process": { - "version": "2.1.0", - "license": "MIT", - "dependencies": { - "chalk": "~4.1.2", - "commander": "^12.1.0", - "loglevel": "^1.9.2" - }, - "bin": { - "find-process": "dist/cjs/bin/find-process.js" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fluent-ffmpeg": { - "version": "2.1.3", - "license": "MIT", - "dependencies": { - "async": "^0.2.9", - "which": "^1.1.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "license": "ISC" - }, - "node_modules/gauge": { - "version": "3.0.2", - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "license": "ISC" - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/inflight": { - "version": "1.0.6", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "license": "ISC" - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "license": "ISC" - }, - "node_modules/libsodium": { - "version": "0.8.2", - "license": "ISC" - }, - "node_modules/libsodium-wrappers": { - "version": "0.8.2", - "license": "ISC", - "dependencies": { - "libsodium": "^0.8.0" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.23", - "license": "MIT" - }, - "node_modules/loglevel": { - "version": "1.9.2", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - }, - "funding": { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/loglevel" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/minimatch": { - "version": "3.1.5", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minipass": { - "version": "5.0.0", - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib": { - "version": "2.1.2", - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mp4box": { - "version": "0.5.4", - "license": "BSD-3-Clause" - }, - "node_modules/ms": { - "version": "2.1.3", - "license": "MIT" - }, - "node_modules/node-addon-api": { - "version": "8.6.0", - "license": "MIT", - "engines": { - "node": "^18 || ^20 || >= 21" - } - }, - "node_modules/node-crc": { - "version": "4.0.0", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "@napi-rs/cli": "^2.18.4", - "@types/node": "^22.7.8" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/node-crc/node_modules/@types/node": { - "version": "22.19.15", - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/node-crc/node_modules/@types/node/node_modules/undici-types": { - "version": "6.21.0", - "license": "MIT" - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/nopt": { - "version": "5.0.0", - "license": "ISC", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/npmlog": { - "version": "5.0.1", - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/opusscript": { - "version": "0.1.1", - "license": "MIT" - }, - "node_modules/otplib": { - "version": "12.0.1", - "license": "MIT", - "dependencies": { - "@otplib/core": "^12.0.1", - "@otplib/preset-default": "^12.0.1", - "@otplib/preset-v11": "^12.0.1" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pngjs": { - "version": "5.0.0", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/prism-media": { - "version": "2.0.0-alpha.0", - "license": "Apache-2.0", - "dependencies": { - "duplex-child-process": "^1.0.1" - } - }, - "node_modules/qrcode": { - "version": "1.5.4", - "license": "MIT", - "dependencies": { - "dijkstrajs": "^1.0.1", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - }, - "bin": { - "qrcode": "bin/qrcode" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/require-addon": { - "version": "1.2.0", - "license": "Apache-2.0", - "dependencies": { - "bare-addon-resolve": "^1.3.0" - }, - "engines": { - "bare": ">=1.10.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "license": "ISC" - }, - "node_modules/rimraf": { - "version": "3.0.2", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/semver": { - "version": "7.7.4", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "license": "ISC" - }, - "node_modules/set-cookie-parser": { - "version": "2.7.2", - "license": "MIT" - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "license": "ISC" - }, - "node_modules/sodium-native": { - "version": "4.3.3", - "license": "MIT", - "dependencies": { - "require-addon": "^1.1.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tar": { - "version": "6.2.1", - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/thirty-two": { - "version": "1.0.2", - "engines": { - "node": ">=0.2.6" - } - }, - "node_modules/tldts": { - "version": "6.1.86", - "license": "MIT", - "dependencies": { - "tldts-core": "^6.1.86" - }, - "bin": { - "tldts": "bin/cli.js" - } - }, - "node_modules/tldts-core": { - "version": "6.1.86", - "license": "MIT" - }, - "node_modules/tough-cookie": { - "version": "5.1.2", - "license": "BSD-3-Clause", - "dependencies": { - "tldts": "^6.1.32" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "license": "MIT" - }, - "node_modules/tree-kill": { - "version": "1.2.2", - "license": "MIT", - "bin": { - "tree-kill": "cli.js" - } - }, - "node_modules/ts-mixer": { - "version": "6.0.4", - "license": "MIT" - }, - "node_modules/tslib": { - "version": "2.8.1", - "license": "0BSD" - }, - "node_modules/undici": { - "version": "7.24.2", - "license": "MIT", - "engines": { - "node": ">=20.18.1" - } - }, - "node_modules/undici-types": { - "version": "7.18.2", - "license": "MIT" - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "license": "BSD-2-Clause" - }, - "node_modules/werift-rtp": { - "version": "0.8.8", - "license": "MIT", - "dependencies": { - "@minhducsun2002/leb128": "^1.0.0", - "@shinyoshiaki/jspack": "^0.0.6", - "aes-js": "^3.1.2", - "buffer": "^6.0.3", - "mp4box": "^0.5.3" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "1.3.1", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/which-module": { - "version": "2.0.1", - "license": "ISC" - }, - "node_modules/wide-align": { - "version": "1.1.5", - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/wrap-ansi": { - "version": "6.2.0", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "license": "ISC" - }, - "node_modules/ws": { - "version": "8.19.0", - "license": "MIT", - "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/y18n": { - "version": "4.0.3", - "license": "ISC" - }, - "node_modules/yallist": { - "version": "4.0.0", - "license": "ISC" - }, - "node_modules/yargs": { - "version": "15.4.1", - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs-parser": { - "version": "18.1.3", - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - } - } -} diff --git a/package.json b/package.json index 01a59e0..56e65e4 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@types/express": "^5.0.6", "@types/fluent-ffmpeg": "^2.1.28", "@types/ws": "^8.18.1", + "pino-pretty": "^10.3.1", "vitest": "latest" } } diff --git a/src/index.ts b/src/index.ts index d5a0ec8..0e11340 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,10 +5,9 @@ import { getVoiceConnection } from "@discordjs/voice"; import { Client } from "discord.js-selfbot-v13"; import { config } from "./config"; import { discordPlayer } from "./player"; -import { startRecording } from "./recorder"; +import { startRecording, stopRecording } from "./recorder"; import { startWebserver } from "./webserver"; import { createChildLogger } from "./logger"; -import { retryWithBackoff } from "./retry"; const logger = createChildLogger("bot"); @@ -24,6 +23,58 @@ if (!guildId) throw new Error("Missing GUILD_ID in .env"); // Inisialisasi selfbot client const client = new Client(); +// Track shutdown state +let isShuttingDown = false; + +async function gracefulShutdown(signal: string) { + if (isShuttingDown) { + logger.warn(`Already shutting down, ignoring ${signal}`); + return; + } + + isShuttingDown = true; + logger.info({ signal }, "Graceful shutdown initiated"); + + try { + // Step 1: Stop recording + if (guildId) { + logger.info("Stopping recording..."); + stopRecording(guildId); + } + + // Step 2: Pause player + logger.info("Pausing player..."); + discordPlayer.pause(); + + // Step 3: Destroy voice connection + if (guildId) { + const connection = getVoiceConnection(guildId); + if (connection) { + logger.info("Destroying voice connection..."); + try { + connection.destroy(); + } catch (err) { + logger.warn({ error: err }, "Error destroying voice connection"); + } + } + } + + // Step 4: Destroy client + logger.info("Destroying Discord client..."); + try { + client.destroy(); + } catch (err) { + logger.warn({ error: err }, "Error destroying client"); + } + + logger.info("Graceful shutdown completed"); + process.exit(0); + } catch (err) { + logger.error({ error: err }, "Error during graceful shutdown"); + process.exit(1); + } +} + client.on("ready", async () => { if (config.verbose) { logger.info({ user: client.user?.tag }, "Bot logged in"); @@ -70,21 +121,25 @@ client.on("error", (err) => { logger.error({ error: err }, "Client error"); }); -// Graceful shutdown +// Graceful shutdown handlers process.on("SIGINT", () => { - if (config.verbose) { - logger.info("Shutting down gracefully..."); - } - client.destroy(); - process.exit(0); + gracefulShutdown("SIGINT"); }); process.on("SIGTERM", () => { - if (config.verbose) { - logger.info("Terminating..."); - } - client.destroy(); - process.exit(0); + gracefulShutdown("SIGTERM"); +}); + +// Handle uncaught exceptions +process.on("uncaughtException", (err) => { + logger.error({ error: err }, "Uncaught exception"); + gracefulShutdown("uncaughtException"); +}); + +// Handle unhandled promise rejections +process.on("unhandledRejection", (reason, promise) => { + logger.error({ reason, promise }, "Unhandled rejection"); + gracefulShutdown("unhandledRejection"); }); client.login(token);