From 853f44b4d74ab4d259e8193713c2dc4f39f7bfe3 Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:11:50 +0545 Subject: [PATCH] fix: discord-voip issues --- package.json | 2 +- packages/discord-player/package.json | 5 +- packages/discord-player/src/Player.ts | 5 +- packages/discord-player/src/index.ts | 1 + .../discord-player/src/utils/FFmpegStream.ts | 6 +- packages/discord-voip/package.json | 2 +- packages/discord-voip/src/index.ts | 5 +- packages/equalizer/package.json | 2 +- packages/extractor/package.json | 2 +- packages/ffmpeg/package.json | 2 +- packages/opus/package.json | 2 +- packages/tsconfig/package.json | 2 +- packages/utils/package.json | 2 +- yarn.lock | 63 +------------------ 14 files changed, 26 insertions(+), 75 deletions(-) diff --git a/package.json b/package.json index 56f35dbd0..05235e617 100644 --- a/package.json +++ b/package.json @@ -57,4 +57,4 @@ "typescript": "^5.2.2", "vitest": "^0.34.6" } -} \ No newline at end of file +} diff --git a/packages/discord-player/package.json b/packages/discord-player/package.json index 5c7a65264..18e36ce0f 100644 --- a/packages/discord-player/package.json +++ b/packages/discord-player/package.json @@ -1,6 +1,6 @@ { "name": "discord-player", - "version": "7.0.0-dev.0", + "version": "7.0.0-dev.1", "description": "Complete framework to facilitate music commands using discord.js", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -57,7 +57,7 @@ "@discord-player/ffmpeg": "workspace:^", "@discord-player/utils": "workspace:^", "@web-scrobbler/metadata-filter": "^3.1.0", - "discord-voip": "^0.1.3", + "discord-voip": "workspace:^", "libsodium-wrappers": "^0.7.13" }, "peerDependencies": { @@ -72,6 +72,7 @@ "discord.js": "^14.15.3", "eris": "^0.17.2", "opusscript": "^0.0.8", + "prism-media": "^1.3.5", "tsup": "^7.2.0", "typescript": "^5.2.2", "vitest": "^0.34.6" diff --git a/packages/discord-player/src/Player.ts b/packages/discord-player/src/Player.ts index 46afa5e3f..3d8084271 100644 --- a/packages/discord-player/src/Player.ts +++ b/packages/discord-player/src/Player.ts @@ -6,7 +6,7 @@ import { VoiceUtils } from './VoiceInterface/VoiceUtils'; import { PlayerEvents, QueryType, SearchOptions, PlayerInitOptions, PlaylistInitData, SearchQueryType, PlayerEvent } from './types/types'; import { QueryResolver, ResolvedQuery } from './utils/QueryResolver'; import { Util } from './utils/Util'; -import { generateDependencyReport, version as dVoiceVersion } from 'discord-voip'; +import { version as dVoiceVersion } from 'discord-voip'; import { ExtractorExecutionContext } from './extractors/ExtractorExecutionContext'; import { BaseExtractor } from './extractors/BaseExtractor'; import * as _internals from './utils/__internal__'; @@ -19,6 +19,7 @@ import { Context, createContext } from './hooks'; import { HooksCtx } from './hooks/common'; import { LrcLib } from './lrclib/LrcLib'; import { getCompatName, isClientProxy } from './compat/createErisCompat'; +import { DependencyReportGenerator } from './utils/DependencyReportGenerator'; const kSingleton = Symbol('InstanceDiscordPlayerSingleton'); @@ -685,7 +686,7 @@ export class Player extends PlayerEventsEmitter { }) .join('\n') || 'N/A', '\n\ndiscord-voip', - generateDependencyReport() + DependencyReportGenerator.generateString() ]; return depsReport.join('\n'); diff --git a/packages/discord-player/src/index.ts b/packages/discord-player/src/index.ts index 919ce8679..0fc8d8a92 100644 --- a/packages/discord-player/src/index.ts +++ b/packages/discord-player/src/index.ts @@ -21,6 +21,7 @@ export * from './Player'; export * from './hooks'; export * from './utils/IPRotator'; export * from './utils/serde'; +export * from './utils/DependencyReportGenerator'; export { AudioFilters as PCMAudioFilters, type BiquadFilters, diff --git a/packages/discord-player/src/utils/FFmpegStream.ts b/packages/discord-player/src/utils/FFmpegStream.ts index 5083b0891..df9c05ab6 100644 --- a/packages/discord-player/src/utils/FFmpegStream.ts +++ b/packages/discord-player/src/utils/FFmpegStream.ts @@ -1,7 +1,9 @@ import type { Duplex, Readable } from 'stream'; -import * as prism from 'prism-media'; import { FFmpeg } from '@discord-player/ffmpeg'; +// @ts-ignore +import * as prism from 'prism-media'; + export interface FFmpegStreamOptions { fmt?: string; encoderArgs?: string[]; @@ -67,7 +69,7 @@ export function createFFmpegStream(stream: Readable | Duplex | string, options?: const FFMPEG = getFFmpegProvider(!!options.useLegacyFFmpeg); - const transcoder = new FFMPEG({ shell: false, args }); + const transcoder: Duplex = new FFMPEG({ shell: false, args }); transcoder.on('close', () => transcoder.destroy()); diff --git a/packages/discord-voip/package.json b/packages/discord-voip/package.json index 4eb809a40..25c474067 100644 --- a/packages/discord-voip/package.json +++ b/packages/discord-voip/package.json @@ -1,6 +1,6 @@ { "name": "discord-voip", - "version": "7.0.0-dev.0", + "version": "7.0.0-dev.1", "description": "Discord VoIP library used by discord-player", "keywords": [ "discord-player", diff --git a/packages/discord-voip/src/index.ts b/packages/discord-voip/src/index.ts index ac2eb44dd..b3dfe6d25 100644 --- a/packages/discord-voip/src/index.ts +++ b/packages/discord-voip/src/index.ts @@ -17,7 +17,10 @@ export { type VoiceConnectionDisconnectedWebSocketState, VoiceConnectionDisconnectReason, type VoiceConnectionReadyState, - type VoiceConnectionSignallingState, + type VoiceConnectionSignallingState } from './VoiceConnection'; export { type JoinConfig, getVoiceConnection, getVoiceConnections, getGroups } from './DataStore'; + +// eslint-disable-next-line @typescript-eslint/no-inferrable-types +export const version: string = '[VI]{{inject}}[/VI]'; diff --git a/packages/equalizer/package.json b/packages/equalizer/package.json index 9c0dd879a..998dc2725 100644 --- a/packages/equalizer/package.json +++ b/packages/equalizer/package.json @@ -54,4 +54,4 @@ "readmeFile": "./README.md", "tsconfig": "./tsconfig.json" } -} \ No newline at end of file +} diff --git a/packages/extractor/package.json b/packages/extractor/package.json index 8c17f96e8..2a26360c2 100644 --- a/packages/extractor/package.json +++ b/packages/extractor/package.json @@ -65,4 +65,4 @@ "readmeFile": "./README.md", "tsconfig": "./tsconfig.json" } -} \ No newline at end of file +} diff --git a/packages/ffmpeg/package.json b/packages/ffmpeg/package.json index 237082776..2d61f42b3 100644 --- a/packages/ffmpeg/package.json +++ b/packages/ffmpeg/package.json @@ -43,4 +43,4 @@ "typescript": "^5.2.2", "vitest": "^0.34.6" } -} \ No newline at end of file +} diff --git a/packages/opus/package.json b/packages/opus/package.json index 0bf6f3af1..ac3f76fd5 100644 --- a/packages/opus/package.json +++ b/packages/opus/package.json @@ -45,4 +45,4 @@ "typescript": "^5.2.2", "vitest": "^0.34.6" } -} \ No newline at end of file +} diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index 12e3cac59..ca485c74a 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -23,4 +23,4 @@ "devDependencies": { "typescript": "^5.2.2" } -} \ No newline at end of file +} diff --git a/packages/utils/package.json b/packages/utils/package.json index 6dadcd0bc..c98066284 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -47,4 +47,4 @@ "readmeFile": "./README.md", "tsconfig": "./tsconfig.json" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 7fda0aa85..3c19f6c9f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -140,13 +140,6 @@ __metadata: languageName: unknown linkType: soft -"@discord-player/ffmpeg@npm:^0.1.0": - version: 0.1.0 - resolution: "@discord-player/ffmpeg@npm:0.1.0" - checksum: 10/a4cb89a64d8e19b116175998be46d0870995c365a8ec602c211f34073f34616f959f61e925c1be56a168abba28b521bc1c3ede038915d5d8c7b206a9b21ab0f7 - languageName: node - linkType: hard - "@discord-player/ffmpeg@workspace:^, @discord-player/ffmpeg@workspace:packages/ffmpeg": version: 0.0.0-use.local resolution: "@discord-player/ffmpeg@workspace:packages/ffmpeg" @@ -159,13 +152,6 @@ __metadata: languageName: unknown linkType: soft -"@discord-player/opus@npm:^0.1.2": - version: 0.1.2 - resolution: "@discord-player/opus@npm:0.1.2" - checksum: 10/91ad76c6fb15d3f11968ac03340659e19bbc0145031079b7739e17abc344a33b6c03da7314eb844186dbe1c419cd690a99a9ad8e7be20c8f1a1d05fd0fc3722f - languageName: node - linkType: hard - "@discord-player/opus@workspace:^, @discord-player/opus@workspace:packages/opus": version: 0.0.0-use.local resolution: "@discord-player/opus@workspace:packages/opus" @@ -6505,13 +6491,6 @@ __metadata: languageName: node linkType: hard -"discord-api-types@npm:^0.37.50": - version: 0.37.52 - resolution: "discord-api-types@npm:0.37.52" - checksum: 10/c9212437192cbd782441bc1da7c8caf4114ada6241fd9673eda70df6f8b3003acf3fbe9c59d5be22cf9bb941ac5c3f234895be79f1476f9a1ce0096e2d52367e - languageName: node - linkType: hard - "discord-player@workspace:^, discord-player@workspace:packages/discord-player": version: 0.0.0-use.local resolution: "discord-player@workspace:packages/discord-player" @@ -6525,11 +6504,12 @@ __metadata: "@types/ws": "npm:^8.5.3" "@web-scrobbler/metadata-filter": "npm:^3.1.0" discord-api-types: "npm:^0.37.0" - discord-voip: "npm:^0.1.3" + discord-voip: "workspace:^" discord.js: "npm:^14.15.3" eris: "npm:^0.17.2" libsodium-wrappers: "npm:^0.7.13" opusscript: "npm:^0.0.8" + prism-media: "npm:^1.3.5" tsup: "npm:^7.2.0" typescript: "npm:^5.2.2" vitest: "npm:^0.34.6" @@ -6538,22 +6518,7 @@ __metadata: languageName: unknown linkType: soft -"discord-voip@npm:^0.1.3": - version: 0.1.3 - resolution: "discord-voip@npm:0.1.3" - dependencies: - "@discord-player/ffmpeg": "npm:^0.1.0" - "@discord-player/opus": "npm:^0.1.2" - "@types/ws": "npm:^8.5.5" - discord-api-types: "npm:^0.37.50" - prism-media: "npm:^1.3.5" - tslib: "npm:^2.6.1" - ws: "npm:^8.13.0" - checksum: 10/640db80b7ceb5be392b30d3f801fa9eaa2207204eaaa04fd265404f26d17fad4d7976de9c3d14a6c525b8bf23a3b69ac307300230e01bdd5f4689e3740961426 - languageName: node - linkType: hard - -"discord-voip@workspace:packages/discord-voip": +"discord-voip@workspace:^, discord-voip@workspace:packages/discord-voip": version: 0.0.0-use.local resolution: "discord-voip@workspace:packages/discord-voip" dependencies: @@ -15134,13 +15099,6 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.6.1": - version: 2.6.1 - resolution: "tslib@npm:2.6.1" - checksum: 10/5cf1aa7ea4ca7ee9b8aa3d80eb7ee86634b307fbefcb948a831c2b13728e21e156ef7fb9edcbe21f05c08f65e4cf4480587086f31133491ba1a49c9e0b28fc75 - languageName: node - linkType: hard - "tslib@npm:^2.6.2": version: 2.6.3 resolution: "tslib@npm:2.6.3" @@ -16382,21 +16340,6 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.13.0": - version: 8.13.0 - resolution: "ws@npm:8.13.0" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ">=5.0.2" - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 10/1769532b6fdab9ff659f0b17810e7501831d34ecca23fd179ee64091dd93a51f42c59f6c7bb4c7a384b6c229aca8076fb312aa35626257c18081511ef62a161d - languageName: node - linkType: hard - "ws@npm:^8.16.0, ws@npm:^8.2.3": version: 8.18.0 resolution: "ws@npm:8.18.0"