poru 3.7.0 → 3.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poru",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "A stable and powerfull lavalink client around node.js",
5
5
  "main": "index.js",
6
6
  "typings": "./typings/index.d.ts",
package/src/Player.js CHANGED
@@ -121,7 +121,7 @@ class Player extends EventEmitter {
121
121
 
122
122
  volume = Math.min(5, Math.max(0, volume));
123
123
  this.filters.volume = volume;
124
- this.updateFilters();
124
+ this.filters.updateFilters();
125
125
 
126
126
  return this; }
127
127
 
package/src/Poru.js CHANGED
@@ -32,20 +32,49 @@ class Poru extends EventEmitter {
32
32
  }
33
33
 
34
34
  init(client) {
35
- if (this.isReady) return this;
36
-
35
+ if (this.isActive) return this;
37
36
  this.user = client.user.id;
38
37
  this.apple.requestToken();
38
+ if(!this.options.libraries) this.options.libraries = "discord.js";
39
+
40
+ if(config.libraries.discordjs.includes(this.options.library)){
39
41
  this.sendData = (data) => {
40
42
  const guild = client.guilds.cache.get(data.d.guild_id);
41
- if (guild) guild.shard.send(data);
43
+ if (guild) guild.shard?.send(data);
42
44
  };
43
45
 
44
- client.on("raw", async (packet) => {
46
+ client.on("rawWS", async (packet) => {
45
47
  await this.packetUpdate(packet);
46
48
  });
47
49
 
48
- this._nodes.forEach((node) => this.addNode(node));
50
+ }else if(config.libraries.eris.includes(this.options.library)){
51
+
52
+ this.sendData = (data) => {
53
+ const guild = client.guilds.get(data.d.guild_id);
54
+ if (guild) guild.shard.send(data);
55
+ };
56
+
57
+ client.on("raw", async (packet) => {
58
+ await this.packetUpdate(packet);
59
+ });
60
+
61
+ }else if(config.libraries.oceanic.includes(this.options.library)){
62
+
63
+ this.sendData = (data) => {
64
+ const guild = client.guilds.get(data.d.guild_id);
65
+ if (guild) guild.shard.send(data);
66
+ };
67
+
68
+ client.on("packet", async (packet) => {
69
+ await this.packetUpdate(packet);
70
+ });
71
+
72
+
73
+ }
74
+
75
+
76
+
77
+ this._nodes.forEach((node) => this.addNode(node));
49
78
  this.isActive = true;
50
79
  }
51
80
 
@@ -146,10 +175,9 @@ class Poru extends EventEmitter {
146
175
  let node;
147
176
  if (options.region) {
148
177
 
149
- const region = this.getNodeByRegion(options.region)[0];
150
- node = this.nodes.get(region.name || this.leastUsedNodes[0].name || this.leastUsedNodes[0].host
151
- )
152
- } else {
178
+ const region = this.getNodeByRegion(options.region)[0];
179
+ node = this.nodes.get(region.name || this.leastUsedNodes[0].name || this.leastUsedNodes[0].host)
180
+ } else {
153
181
  node = this.nodes.get(
154
182
  this.leastUsedNodes[0].name || this.leastUsedNodes[0].host
155
183
  );
package/src/config.js CHANGED
@@ -16,10 +16,15 @@ module.exports = {
16
16
  VOICE_UPDATE: "voiceUpdate",
17
17
  VOLUME: "volume",
18
18
  },
19
-
20
- Error:{
21
- sessionEndpoint:"[Poru Connection] Session endpoint missing. \n Kindly double check your client intents",
22
- noSessionID : "[Poru Connection] Session ID missing."
19
+ libraries: {
20
+ eris: ["eris", "ERIS", "eris.js", "ERIS.JS"],
21
+ discordjs: ["discord.js", "DISCORD.JS", "djs", "discordjs", "DISCORDJS"],
22
+ oceanic:['Oceanic',"oceanic","oceanic.js","Oceanic,js","OCEANIC","OCEANIC.JS"]
23
+ },
24
+
25
+ Error: {
26
+ sessionEndpoint: "[Poru Connection] Session endpoint missing. \n Kindly double check your client intents",
27
+ noSessionID: "[Poru Connection] Session ID missing."
23
28
 
24
29
 
25
30
  }
@@ -6,18 +6,18 @@ export interface PlaylistInfo {
6
6
  }
7
7
 
8
8
  export interface IvoiceServer {
9
- token : string;
9
+ token: string;
10
10
  guild_id: string;
11
- endpoint : string | null;
11
+ endpoint: string | null;
12
12
  }
13
13
 
14
14
  export interface ResolveResponse {
15
15
  loadType:
16
- | "TRACK_LOADED"
17
- | "PLAYLIST_LOADED"
18
- | "SEARCH_RESULT"
19
- | "NO_MATCHES"
20
- | "LOAD_FAILED";
16
+ | "TRACK_LOADED"
17
+ | "PLAYLIST_LOADED"
18
+ | "SEARCH_RESULT"
19
+ | "NO_MATCHES"
20
+ | "LOAD_FAILED";
21
21
  tracks: Track[];
22
22
  playlistInfo: PlaylistInfo;
23
23
  }
@@ -67,40 +67,6 @@ export interface FiltersOptions {
67
67
  lowPass?: boolean;
68
68
  }
69
69
 
70
- export class Filters {
71
- constructor(player: Player, options: FiltersOptions): this;
72
- _8d: boolean | null;
73
- bassboost: number | null;
74
- player: Player;
75
- node: Node;
76
- equalizer: { bands: number; gain: number }[] | null;
77
- karaoke: boolean | null;
78
- timescale: boolean | null;
79
- tremolo: boolean | null;
80
- vibrato: boolean | null;
81
- rotation: boolean | null;
82
- distortion: boolean | null;
83
- channelMix: boolean | null;
84
- lowPass: boolean | null;
85
-
86
- setEqualizer: (bands: number, gain: number) => void;
87
- setKaraoke: (value: boolean) => Filters;
88
- setTimescale: (value: boolean) => Filters;
89
- setTremolo: (value: boolean) => Filters;
90
- setVibrato: (value: boolean) => Filters;
91
- setRotation: (value: boolean) => Filters;
92
- setDistortion: (value: boolean) => Filters;
93
- setChannelMix: (value: boolean) => Filters;
94
- setLowPass: (value: boolean) => Filters;
95
- setFilters: (options: any) => Filters;
96
- clearFilters: () => Filters;
97
- setNightcore: (value: boolean) => boolean;
98
- setSlowmode: (value: boolean) => void;
99
- setVaporwave: (value: boolean) => void;
100
- set8D: (value: boolean) => void;
101
- setBassboost: (value: number) => void;
102
- updateFilters: () => void;
103
- }
104
70
 
105
71
  export interface NodeStats {
106
72
  players: number;
@@ -128,11 +94,12 @@ export interface NodeOptions {
128
94
  }
129
95
 
130
96
  export interface PoruOptions {
97
+ defaultPlatform?: string;
98
+ library?: string,
131
99
  reconnectTimeout?: number;
132
100
  reconnectTries?: number;
133
101
  resumeKey?: string;
134
102
  resumeTimeout?: number;
135
- defaultPlatform?: string;
136
103
  playlistLimit?: number;
137
104
  albumLimit?: number;
138
105
  artistLimit?: number;
@@ -142,14 +109,14 @@ export interface PoruOptions {
142
109
 
143
110
  export class voiceConnection {
144
111
 
145
- constructor (player:Player):this;
112
+ constructor(player: Player): this;
146
113
 
147
- player:Player;
148
- sessionId: string | null;;
149
- region = string | null;
150
- muted = boolean | false;
151
- deafened = boolean | false;
152
- voiceServer = IvoiceServer | null;
114
+ player: Player;
115
+ sessionId: string | null;;
116
+ region = string | null;
117
+ muted = boolean | false;
118
+ deafened = boolean | false;
119
+ voiceServer = IvoiceServer | null;
153
120
 
154
121
  }
155
122
 
@@ -286,10 +253,10 @@ export type LavalinkEvents =
286
253
  export interface PlayerOptions {
287
254
  guildId: string;
288
255
  voiceChannel:
289
- | {
290
- id: string;
291
- }
292
- | string;
256
+ | {
257
+ id: string;
258
+ }
259
+ | string;
293
260
  textChannel?: string;
294
261
  mute?: boolean;
295
262
  deaf?: boolean;
@@ -311,7 +278,6 @@ export class Player extends EventEmitter {
311
278
  loop: PlayerLoopModes;
312
279
  position: number;
313
280
  ping: number;
314
- volume: number;
315
281
  currentTrack: Track | null;
316
282
  previousTracks: Track;
317
283
  connection: voiceConnection
@@ -338,3 +304,40 @@ export class Player extends EventEmitter {
338
304
  send: (payload: any) => void;
339
305
  lavalinkEvent: (data: LavalinkEvents) => void;
340
306
  }
307
+
308
+
309
+ export class Filters {
310
+ constructor(player: Player, options: FiltersOptions): this;
311
+ _8d: boolean | null;
312
+ volume: number;
313
+ bassboost: number | null;
314
+ player: Player;
315
+ node: Node;
316
+ equalizer: { bands: number; gain: number }[] | null;
317
+ karaoke: boolean | null;
318
+ timescale: boolean | null;
319
+ tremolo: boolean | null;
320
+ vibrato: boolean | null;
321
+ rotation: boolean | null;
322
+ distortion: boolean | null;
323
+ channelMix: boolean | null;
324
+ lowPass: boolean | null;
325
+
326
+ setEqualizer: (bands: number, gain: number) => void;
327
+ setKaraoke: (value: boolean) => Filters;
328
+ setTimescale: (value: boolean) => Filters;
329
+ setTremolo: (value: boolean) => Filters;
330
+ setVibrato: (value: boolean) => Filters;
331
+ setRotation: (value: boolean) => Filters;
332
+ setDistortion: (value: boolean) => Filters;
333
+ setChannelMix: (value: boolean) => Filters;
334
+ setLowPass: (value: boolean) => Filters;
335
+ setFilters: (options: any) => Filters;
336
+ clearFilters: () => Filters;
337
+ setNightcore: (value: boolean) => boolean;
338
+ setSlowmode: (value: boolean) => void;
339
+ setVaporwave: (value: boolean) => void;
340
+ set8D: (value: boolean) => void;
341
+ setBassboost: (value: number) => void;
342
+ updateFilters: () => void;
343
+ }