@discordjs/voice 0.9.0-dev.1649937819-b01f414 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -22,7 +22,7 @@ var require_package = __commonJS({
22
22
  "package.json"(exports, module) {
23
23
  module.exports = {
24
24
  name: "@discordjs/voice",
25
- version: "0.9.0-dev",
25
+ version: "0.9.0",
26
26
  description: "Implementation of the Discord Voice API for node.js",
27
27
  scripts: {
28
28
  build: "tsup && node scripts/postbuild.mjs",
@@ -72,7 +72,7 @@ var require_package = __commonJS({
72
72
  },
73
73
  homepage: "https://discord.js.org",
74
74
  dependencies: {
75
- "@types/ws": "^8.2.2",
75
+ "@types/ws": "^8.5.3",
76
76
  "discord-api-types": "^0.29.0",
77
77
  "prism-media": "^1.3.2",
78
78
  "tiny-typed-emitter": "^2.1.0",
@@ -80,26 +80,26 @@ var require_package = __commonJS({
80
80
  ws: "^8.5.0"
81
81
  },
82
82
  devDependencies: {
83
- "@babel/core": "^7.17.2",
83
+ "@babel/core": "^7.17.9",
84
84
  "@babel/preset-env": "^7.16.11",
85
85
  "@babel/preset-typescript": "^7.16.7",
86
- "@discordjs/ts-docgen": "^0.3.4",
87
- "@types/jest": "^27.4.0",
88
- "@types/node": "^16.11.24",
89
- "@typescript-eslint/eslint-plugin": "^5.11.0",
90
- "@typescript-eslint/parser": "^5.11.0",
91
- eslint: "^8.9.0",
92
- "eslint-config-marine": "^9.3.2",
93
- "eslint-config-prettier": "^8.3.0",
94
- "eslint-plugin-prettier": "^4.0.0",
86
+ "@discordjs/ts-docgen": "^0.4.1",
87
+ "@types/jest": "^27.4.1",
88
+ "@types/node": "^16.11.27",
89
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
90
+ "@typescript-eslint/parser": "^5.19.0",
91
+ eslint: "^8.13.0",
92
+ "eslint-config-marine": "^9.4.1",
93
+ "eslint-config-prettier": "^8.5.0",
94
+ "eslint-plugin-import": "^2.26.0",
95
95
  jest: "^27.5.1",
96
96
  "jest-websocket-mock": "^2.3.0",
97
97
  "mock-socket": "^9.1.2",
98
- prettier: "^2.5.1",
99
- tsup: "^5.11.13",
98
+ prettier: "^2.6.2",
99
+ tsup: "^5.12.5",
100
100
  tweetnacl: "^1.0.3",
101
- typedoc: "^0.22.11",
102
- typescript: "^4.5.5"
101
+ typedoc: "^0.22.15",
102
+ typescript: "^4.6.3"
103
103
  },
104
104
  engines: {
105
105
  node: ">=16.9.0"
@@ -111,6 +111,9 @@ var require_package = __commonJS({
111
111
  }
112
112
  });
113
113
 
114
+ // src/VoiceConnection.ts
115
+ import { TypedEmitter as TypedEmitter7 } from "tiny-typed-emitter";
116
+
114
117
  // src/DataStore.ts
115
118
  import { GatewayOpcodes } from "discord-api-types/v10";
116
119
  function createJoinVoiceChannelPayload(config) {
@@ -211,6 +214,7 @@ __name(deleteAudioPlayer, "deleteAudioPlayer");
211
214
 
212
215
  // src/networking/Networking.ts
213
216
  import { VoiceOpcodes as VoiceOpcodes2 } from "discord-api-types/voice/v4";
217
+ import { TypedEmitter as TypedEmitter3 } from "tiny-typed-emitter";
214
218
 
215
219
  // src/networking/VoiceUDPSocket.ts
216
220
  import { createSocket } from "node:dgram";
@@ -315,8 +319,8 @@ __name(VoiceUDPSocket, "VoiceUDPSocket");
315
319
 
316
320
  // src/networking/VoiceWebSocket.ts
317
321
  import { VoiceOpcodes } from "discord-api-types/voice/v4";
318
- import WebSocket from "ws";
319
322
  import { TypedEmitter as TypedEmitter2 } from "tiny-typed-emitter";
323
+ import WebSocket from "ws";
320
324
  var VoiceWebSocket = class extends TypedEmitter2 {
321
325
  constructor(address, debug) {
322
326
  super();
@@ -469,7 +473,6 @@ var noop = /* @__PURE__ */ __name(() => {
469
473
  }, "noop");
470
474
 
471
475
  // src/networking/Networking.ts
472
- import { TypedEmitter as TypedEmitter3 } from "tiny-typed-emitter";
473
476
  var CHANNELS = 2;
474
477
  var TIMESTAMP_INC = 48e3 / 100 * CHANNELS;
475
478
  var MAX_NONCE_SIZE = 2 ** 32 - 1;
@@ -759,15 +762,15 @@ to ${stringifyState(newState)}`);
759
762
  };
760
763
  __name(Networking, "Networking");
761
764
 
762
- // src/VoiceConnection.ts
763
- import { TypedEmitter as TypedEmitter7 } from "tiny-typed-emitter";
764
-
765
765
  // src/receive/VoiceReceiver.ts
766
766
  import { VoiceOpcodes as VoiceOpcodes3 } from "discord-api-types/voice/v4";
767
767
 
768
768
  // src/receive/AudioReceiveStream.ts
769
769
  import { Readable } from "node:stream";
770
770
 
771
+ // src/audio/AudioPlayer.ts
772
+ import { TypedEmitter as TypedEmitter4 } from "tiny-typed-emitter";
773
+
771
774
  // src/audio/AudioPlayerError.ts
772
775
  var AudioPlayerError = class extends Error {
773
776
  constructor(error, resource) {
@@ -796,7 +799,6 @@ var PlayerSubscription = class {
796
799
  __name(PlayerSubscription, "PlayerSubscription");
797
800
 
798
801
  // src/audio/AudioPlayer.ts
799
- import { TypedEmitter as TypedEmitter4 } from "tiny-typed-emitter";
800
802
  var SILENCE_FRAME = Buffer.from([248, 255, 254]);
801
803
  var NoSubscriberBehavior = /* @__PURE__ */ ((NoSubscriberBehavior2) => {
802
804
  NoSubscriberBehavior2["Pause"] = "pause";
@@ -1112,41 +1114,9 @@ var AudioReceiveStream = class extends Readable {
1112
1114
  };
1113
1115
  __name(AudioReceiveStream, "AudioReceiveStream");
1114
1116
 
1115
- // src/receive/SpeakingMap.ts
1116
- import { TypedEmitter as TypedEmitter5 } from "tiny-typed-emitter";
1117
- var _SpeakingMap = class extends TypedEmitter5 {
1118
- constructor() {
1119
- super();
1120
- __publicField(this, "users");
1121
- __publicField(this, "speakingTimeouts");
1122
- this.users = /* @__PURE__ */ new Map();
1123
- this.speakingTimeouts = /* @__PURE__ */ new Map();
1124
- }
1125
- onPacket(userId) {
1126
- const timeout = this.speakingTimeouts.get(userId);
1127
- if (timeout) {
1128
- clearTimeout(timeout);
1129
- } else {
1130
- this.users.set(userId, Date.now());
1131
- this.emit("start", userId);
1132
- }
1133
- this.startTimeout(userId);
1134
- }
1135
- startTimeout(userId) {
1136
- this.speakingTimeouts.set(userId, setTimeout(() => {
1137
- this.emit("end", userId);
1138
- this.speakingTimeouts.delete(userId);
1139
- this.users.delete(userId);
1140
- }, _SpeakingMap.DELAY));
1141
- }
1142
- };
1143
- var SpeakingMap = _SpeakingMap;
1144
- __name(SpeakingMap, "SpeakingMap");
1145
- __publicField(SpeakingMap, "DELAY", 100);
1146
-
1147
1117
  // src/receive/SSRCMap.ts
1148
- import { TypedEmitter as TypedEmitter6 } from "tiny-typed-emitter";
1149
- var SSRCMap = class extends TypedEmitter6 {
1118
+ import { TypedEmitter as TypedEmitter5 } from "tiny-typed-emitter";
1119
+ var SSRCMap = class extends TypedEmitter5 {
1150
1120
  constructor() {
1151
1121
  super();
1152
1122
  __publicField(this, "map");
@@ -1195,6 +1165,38 @@ var SSRCMap = class extends TypedEmitter6 {
1195
1165
  };
1196
1166
  __name(SSRCMap, "SSRCMap");
1197
1167
 
1168
+ // src/receive/SpeakingMap.ts
1169
+ import { TypedEmitter as TypedEmitter6 } from "tiny-typed-emitter";
1170
+ var _SpeakingMap = class extends TypedEmitter6 {
1171
+ constructor() {
1172
+ super();
1173
+ __publicField(this, "users");
1174
+ __publicField(this, "speakingTimeouts");
1175
+ this.users = /* @__PURE__ */ new Map();
1176
+ this.speakingTimeouts = /* @__PURE__ */ new Map();
1177
+ }
1178
+ onPacket(userId) {
1179
+ const timeout = this.speakingTimeouts.get(userId);
1180
+ if (timeout) {
1181
+ clearTimeout(timeout);
1182
+ } else {
1183
+ this.users.set(userId, Date.now());
1184
+ this.emit("start", userId);
1185
+ }
1186
+ this.startTimeout(userId);
1187
+ }
1188
+ startTimeout(userId) {
1189
+ this.speakingTimeouts.set(userId, setTimeout(() => {
1190
+ this.emit("end", userId);
1191
+ this.speakingTimeouts.delete(userId);
1192
+ this.users.delete(userId);
1193
+ }, _SpeakingMap.DELAY));
1194
+ }
1195
+ };
1196
+ var SpeakingMap = _SpeakingMap;
1197
+ __name(SpeakingMap, "SpeakingMap");
1198
+ __publicField(SpeakingMap, "DELAY", 100);
1199
+
1198
1200
  // src/receive/VoiceReceiver.ts
1199
1201
  var VoiceReceiver = class {
1200
1202
  constructor(voiceConnection) {
@@ -1652,6 +1654,10 @@ function joinVoiceChannel(options) {
1652
1654
  }
1653
1655
  __name(joinVoiceChannel, "joinVoiceChannel");
1654
1656
 
1657
+ // src/audio/AudioResource.ts
1658
+ import { pipeline } from "node:stream";
1659
+ import prism2 from "prism-media";
1660
+
1655
1661
  // src/audio/TransformerGraph.ts
1656
1662
  import prism from "prism-media";
1657
1663
  var FFMPEG_PCM_ARGUMENTS = ["-analyzeduration", "0", "-loglevel", "0", "-f", "s16le", "-ar", "48000", "-ac", "2"];
@@ -1796,8 +1802,6 @@ function findPipeline(from, constraint) {
1796
1802
  __name(findPipeline, "findPipeline");
1797
1803
 
1798
1804
  // src/audio/AudioResource.ts
1799
- import { pipeline } from "node:stream";
1800
- import prism2 from "prism-media";
1801
1805
  var AudioResource = class {
1802
1806
  constructor(edges, streams, metadata, silencePaddingFrames) {
1803
1807
  __publicField(this, "playStream");
@@ -1947,6 +1951,9 @@ function generateDependencyReport() {
1947
1951
  }
1948
1952
  __name(generateDependencyReport, "generateDependencyReport");
1949
1953
 
1954
+ // src/util/entersState.ts
1955
+ import { once } from "node:events";
1956
+
1950
1957
  // src/util/abortAfter.ts
1951
1958
  function abortAfter(delay) {
1952
1959
  const ac = new AbortController();
@@ -1957,7 +1964,6 @@ function abortAfter(delay) {
1957
1964
  __name(abortAfter, "abortAfter");
1958
1965
 
1959
1966
  // src/util/entersState.ts
1960
- import { once } from "node:events";
1961
1967
  async function entersState(target, status, timeoutOrSignal) {
1962
1968
  if (target.state.status !== status) {
1963
1969
  const [ac, signal] = typeof timeoutOrSignal === "number" ? abortAfter(timeoutOrSignal) : [void 0, timeoutOrSignal];