poru 4.2.2 → 5.0.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.
Files changed (96) hide show
  1. package/.gitpod.yml +8 -8
  2. package/LICENSE +21 -21
  3. package/README.md +164 -157
  4. package/dist/src/Connection.d.ts +17 -17
  5. package/dist/src/Connection.js +50 -50
  6. package/dist/src/Error.d.ts +3 -3
  7. package/dist/src/Error.js +7 -7
  8. package/dist/src/Filters.d.ts +77 -77
  9. package/dist/src/Filters.js +94 -94
  10. package/dist/src/Node/Node.js +5 -5
  11. package/dist/src/Node/Node.js.map +1 -1
  12. package/dist/src/Node/Rest.d.ts +1 -1
  13. package/dist/src/Node/Rest.js +3 -3
  14. package/dist/src/Node/Rest.js.map +1 -1
  15. package/dist/src/Node.d.ts +59 -59
  16. package/dist/src/Node.js +179 -179
  17. package/dist/src/Player/Player.d.ts +3 -3
  18. package/dist/src/Player/Player.js +7 -8
  19. package/dist/src/Player/Player.js.map +1 -1
  20. package/dist/src/Player.d.ts +57 -57
  21. package/dist/src/Player.js +270 -270
  22. package/dist/src/Poru.d.ts +1 -1
  23. package/dist/src/Poru.js +6 -6
  24. package/dist/src/Rest.d.ts +40 -40
  25. package/dist/src/Rest.js +88 -88
  26. package/dist/src/config.d.ts +1 -1
  27. package/dist/src/config.js +1 -1
  28. package/dist/src/config.js.map +1 -1
  29. package/dist/src/guild/Response.d.ts +3 -2
  30. package/dist/src/guild/Response.js +12 -4
  31. package/dist/src/guild/Response.js.map +1 -1
  32. package/dist/src/guild/Track.d.ts +7 -1
  33. package/dist/src/guild/Track.js +7 -2
  34. package/dist/src/guild/Track.js.map +1 -1
  35. package/docs/404.html +16 -16
  36. package/docs/assets/js/main.5068e5c4.js +1 -1
  37. package/docs/assets/js/main.5068e5c4.js.LICENSE.txt +63 -63
  38. package/docs/blog/archive/index.html +16 -16
  39. package/docs/blog/atom.xml +69 -69
  40. package/docs/blog/first-blog-post/index.html +16 -16
  41. package/docs/blog/index.html +16 -16
  42. package/docs/blog/long-blog-post/index.html +16 -16
  43. package/docs/blog/mdx-blog-post/index.html +16 -16
  44. package/docs/blog/rss.xml +51 -51
  45. package/docs/blog/tags/docusaurus/index.html +16 -16
  46. package/docs/blog/tags/facebook/index.html +16 -16
  47. package/docs/blog/tags/hello/index.html +16 -16
  48. package/docs/blog/tags/hola/index.html +16 -16
  49. package/docs/blog/tags/index.html +16 -16
  50. package/docs/blog/welcome/index.html +16 -16
  51. package/docs/docs/classes/Connection/index.html +16 -16
  52. package/docs/docs/classes/Filters/index.html +16 -16
  53. package/docs/docs/classes/Node/index.html +16 -16
  54. package/docs/docs/classes/Player/index.html +16 -16
  55. package/docs/docs/classes/Plugin/index.html +16 -16
  56. package/docs/docs/classes/Poru/index.html +16 -16
  57. package/docs/docs/classes/Response/index.html +16 -16
  58. package/docs/docs/classes/Rest/index.html +16 -16
  59. package/docs/docs/classes/Track/index.html +16 -16
  60. package/docs/docs/classes/customFilter/index.html +16 -16
  61. package/docs/docs/enums/RequestMethod/index.html +16 -16
  62. package/docs/docs/interfaces/ConnectionOptions/index.html +16 -16
  63. package/docs/docs/interfaces/IVoiceServer/index.html +16 -16
  64. package/docs/docs/interfaces/LavalinkResponse/index.html +16 -16
  65. package/docs/docs/interfaces/NodeGroup/index.html +16 -16
  66. package/docs/docs/interfaces/NodeStats/index.html +16 -16
  67. package/docs/docs/interfaces/PoruEvents/index.html +16 -16
  68. package/docs/docs/interfaces/PoruOptions/index.html +16 -16
  69. package/docs/docs/interfaces/ResolveOptions/index.html +16 -16
  70. package/docs/docs/interfaces/channelMixOptions/index.html +16 -16
  71. package/docs/docs/interfaces/playOptions/index.html +16 -16
  72. package/docs/docs/interfaces/trackData/index.html +16 -16
  73. package/docs/docs/interfaces/trackInfo/index.html +16 -16
  74. package/docs/docs/introduction/index.html +22 -22
  75. package/docs/docs/modules/index.html +16 -16
  76. package/docs/img/undraw_docusaurus_mountain.svg +171 -171
  77. package/docs/img/undraw_docusaurus_react.svg +170 -170
  78. package/docs/img/undraw_docusaurus_tree.svg +40 -40
  79. package/docs/index.html +16 -16
  80. package/docs/markdown-page/index.html +16 -16
  81. package/guide.md +25 -25
  82. package/index.ts +9 -9
  83. package/package.json +57 -57
  84. package/src/Node/Node.ts +236 -236
  85. package/src/Node/Rest.ts +124 -123
  86. package/src/Player/Connection.ts +82 -82
  87. package/src/Player/CustomFilters.ts +100 -100
  88. package/src/Player/Filters.ts +339 -339
  89. package/src/Player/Player.ts +499 -500
  90. package/src/Plugin.ts +13 -13
  91. package/src/Poru.ts +523 -523
  92. package/src/config.ts +3 -3
  93. package/src/guild/Queue.ts +36 -36
  94. package/src/guild/Response.ts +44 -28
  95. package/src/guild/Track.ts +93 -83
  96. package/tsconfig.json +16 -16
package/.gitpod.yml CHANGED
@@ -1,8 +1,8 @@
1
- # This configuration file was automatically generated by Gitpod.
2
- # Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3
- # and commit this file to your remote git repository to share the goodness with others.
4
-
5
- tasks:
6
- - init: npm install
7
-
8
-
1
+ # This configuration file was automatically generated by Gitpod.
2
+ # Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3
+ # and commit this file to your remote git repository to share the goodness with others.
4
+
5
+ tasks:
6
+ - init: npm install
7
+
8
+
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 parasop
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 parasop
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,157 +1,164 @@
1
- <p align="center">
2
- <img src="https://cdn.discordapp.com/attachments/732987654165233744/987656504373026816/20220618_000923_0000.png" />
3
- </p>
4
- <p align="center">
5
-
6
- [![Discord](https://img.shields.io/discord/567705326774779944?style=flat-square)](https://discord.gg/Zmmc47Nrh8)
7
- [![npm](https://img.shields.io/npm/v/poru?style=flat-square)](https://www.npmjs.com/package/poru)
8
- ![Github Stars](https://img.shields.io/github/stars/parasop/poru?style=flat-square)
9
- ![GitHub issues](https://img.shields.io/github/issues-raw/parasop/poru?style=flat-square)
10
- ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/poru?style=flat-square)
11
- ![NPM](https://img.shields.io/npm/l/poru?style=flat-square)
12
-
13
- </p>
14
-
15
- <p align="center">
16
- <a href="https://nodei.co/npm/poru/"><img src="https://nodei.co/npm/poru.png?downloads=true&downloadRank=true&stars=true"></a>
17
- </p>
18
-
19
- ## Table of contents
20
-
21
- - [Documentation](https://poru.js.org)
22
- - [Installation](#installation)
23
- - [About](#about)
24
- - [Example](https://github.com/parasop/poru-example)
25
-
26
- # Installation
27
-
28
- ```
29
- // Using npm
30
- npm install poru
31
-
32
- // Using yarn
33
- yarn add poru
34
- ```
35
-
36
- # About
37
-
38
- To use you need a configured [Lavalink](https://github.com/freyacodes/Lavalink) instance.
39
-
40
- - Stable client
41
- - support typescript
42
- - 100% Compatible with Lavalink
43
- - Object-oriented
44
- - 100% Customizable
45
- - Easy to setup
46
- - Inbuilt Queue System
47
- - Inbuilt support for spotify,apple music and deezer
48
- ## Implementation
49
-
50
- [Poru Music](https://github.com/parasop/poru-example) **Example bot as guide for beginning.**
51
-
52
-
53
- ## Implementation Repo:
54
- Note : Send pr to add your repo here
55
-
56
- URL | Features | Additional Information
57
- -------|----------|-----------------
58
- [Poru Music](https://github.com/parasop/poru-example) | Basic example | works with latest djs version
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
- ## Example usage basic bot
70
-
71
- ```javascript
72
- const { Client, GatewayIntentBits } = require("discord.js");
73
- const { Poru } = require("poru");
74
- const nodes = [
75
- {
76
- name: "local-node",
77
- host: "localhost",
78
- port: 2333,
79
- password: "youshallnotpass",
80
- },
81
- ];
82
- const PoruOptions = {
83
- library:"discord.js",
84
- defaultPlatform: "scsearch",
85
- };
86
- const client = new Client({
87
- intents: [
88
- GatewayIntentBits.Guilds,
89
- GatewayIntentBits.GuildMessages,
90
- GatewayIntentBits.GuildVoiceStates,
91
- GatewayIntentBits.MessageContent,
92
- ],
93
- });
94
- client.poru = new Poru(client, nodes, PoruOptions);
95
-
96
- client.poru.on("trackStart", (player, track) => {
97
- const channel = client.channels.cache.get(player.textChannel);
98
- return channel.send(`Now playing \`${track.info.title}\``);
99
- });
100
-
101
- client.on("ready", () => {
102
- console.log("Ready!");
103
- client.poru.init(client);
104
- });
105
-
106
- client.on("interactionCreate", async (interaction) => {
107
- if (!interaction.isChatInputCommand()) return;
108
- if (!interaction.member.voice.channel)
109
- return interaction.reply({
110
- content: `Please connect with voice channel `,
111
- ephemeral: true,
112
- });
113
-
114
- const track = interaction.options.getString("track");
115
-
116
- const res = await client.poru.resolve({query:track,source:"scsearch",requester:interaction.member});
117
-
118
- if (res.loadType === "LOAD_FAILED") {
119
- return interaction.reply("Failed to load track.");
120
- } else if (res.loadType === "NO_MATCHES") {
121
- return interaction.reply("No source found!");
122
- }
123
-
124
- //create connection with discord voice channnel
125
- const player = client.poru.createConnection({
126
- guildId: interaction.guild.id,
127
- voiceChannel: interaction.member.voice.channelId,
128
- textChannel: interaction.channel.id,
129
- deaf: true,
130
- });
131
-
132
- if (res.loadType === "PLAYLIST_LOADED") {
133
- for (const track of res.tracks) {
134
- track.info.requester = interaction.user;
135
- player.queue.add(track);
136
- }
137
-
138
- interaction.reply(
139
- `${res.playlistInfo.name} has been loaded with ${res.tracks.length}`
140
- );
141
- } else {
142
- const track = res.tracks[0];
143
- track.info.requester = interaction.user;
144
- player.queue.add(track);
145
- interaction.reply(`Queued Track \n \`${track.info.title}\``)
146
- }
147
-
148
- if (!player.isPlaying && player.isConnected) player.play();
149
- });
150
-
151
- client.login("TOKEN");
152
- ```
153
-
154
- ## Need Help?
155
-
156
- Feel free to join our [discord server](https://discord.gg/Zmmc47Nrh8), Give us suggestions and advice about errors and new features.
157
- with ❤️ by [Paras](https://github.com/parasop) .
1
+ <p align="center">
2
+ <img src="https://cdn.discordapp.com/attachments/732987654165233744/987656504373026816/20220618_000923_0000.png" />
3
+ </p>
4
+ <p align="center">
5
+
6
+ [![Discord](https://img.shields.io/discord/567705326774779944?style=flat-square)](https://discord.gg/Zmmc47Nrh8)
7
+ [![npm](https://img.shields.io/npm/v/poru?style=flat-square)](https://www.npmjs.com/package/poru)
8
+ ![Github Stars](https://img.shields.io/github/stars/parasop/poru?style=flat-square)
9
+ ![GitHub issues](https://img.shields.io/github/issues-raw/parasop/poru?style=flat-square)
10
+ ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/poru?style=flat-square)
11
+ ![NPM](https://img.shields.io/npm/l/poru?style=flat-square)
12
+
13
+ </p>
14
+
15
+ <p align="center">
16
+ note: this version support only lavalink v4 or above
17
+ </p>
18
+
19
+
20
+
21
+ <p align="center">
22
+ <a href="https://nodei.co/npm/poru/"><img src="https://nodei.co/npm/poru.png?downloads=true&downloadRank=true&stars=true"></a>
23
+ </p>
24
+
25
+ ## Table of contents
26
+
27
+ - [Documentation](https://poru.js.org)
28
+ - [Installation](#installation)
29
+ - [About](#about)
30
+ - [Example](https://github.com/parasop/poru-example)
31
+
32
+ # Installation
33
+
34
+ ```
35
+ // Using npm
36
+ npm install poru
37
+
38
+ // Using yarn
39
+ yarn add poru
40
+ ```
41
+
42
+ # About
43
+
44
+ To use you need a configured [Lavalink](https://github.com/freyacodes/Lavalink) instance.
45
+
46
+ - Stable client
47
+ - support typescript
48
+ - 100% Compatible with Lavalink
49
+ - Object-oriented
50
+ - 100% Customizable
51
+ - Easy to setup
52
+ - Inbuilt Queue System
53
+ - Inbuilt support for spotify,apple music and deezer
54
+ ## Implementation
55
+
56
+ [Poru Music](https://github.com/parasop/poru-example) **Example bot as guide for beginning.**
57
+
58
+
59
+ ## Implementation Repo:
60
+ Note : Send pr to add your repo here
61
+
62
+ URL | Features | Additional Information
63
+ -------|----------|-----------------
64
+ [Poru Music](https://github.com/parasop/poru-example) | Basic example | works with latest djs version |
65
+ [The world machine](https://github.com/Reishimanfr/TWM-bot) | See github repo for full list | - |
66
+ [Lunox](https://github.com/adh319/Lunox) | Look over the repo for the full list of features. | Simply powerfull Discord Music Bot |
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ ## Example usage basic bot
77
+
78
+ ```javascript
79
+ const { Client, GatewayIntentBits } = require("discord.js");
80
+ const { Poru } = require("poru");
81
+ const nodes = [
82
+ {
83
+ name: "local-node",
84
+ host: "localhost",
85
+ port: 2333,
86
+ password: "youshallnotpass",
87
+ },
88
+ ];
89
+ const PoruOptions = {
90
+ library:"discord.js",
91
+ defaultPlatform: "scsearch",
92
+ };
93
+ const client = new Client({
94
+ intents: [
95
+ GatewayIntentBits.Guilds,
96
+ GatewayIntentBits.GuildMessages,
97
+ GatewayIntentBits.GuildVoiceStates,
98
+ GatewayIntentBits.MessageContent,
99
+ ],
100
+ });
101
+ client.poru = new Poru(client, nodes, PoruOptions);
102
+
103
+ client.poru.on("trackStart", (player, track) => {
104
+ const channel = client.channels.cache.get(player.textChannel);
105
+ return channel.send(`Now playing \`${track.info.title}\``);
106
+ });
107
+
108
+ client.on("ready", () => {
109
+ console.log("Ready!");
110
+ client.poru.init(client);
111
+ });
112
+
113
+ client.on("interactionCreate", async (interaction) => {
114
+ if (!interaction.isChatInputCommand()) return;
115
+ if (!interaction.member.voice.channel)
116
+ return interaction.reply({
117
+ content: `Please connect with voice channel `,
118
+ ephemeral: true,
119
+ });
120
+
121
+ const track = interaction.options.getString("track");
122
+
123
+ const res = await client.poru.resolve({query:track,source:"scsearch",requester:interaction.member});
124
+
125
+ if (res.loadType === "error") {
126
+ return interaction.reply("Failed to load track.");
127
+ } else if (res.loadType === "empty") {
128
+ return interaction.reply("No source found!");
129
+ }
130
+
131
+ //create connection with discord voice channnel
132
+ const player = client.poru.createConnection({
133
+ guildId: interaction.guild.id,
134
+ voiceChannel: interaction.member.voice.channelId,
135
+ textChannel: interaction.channel.id,
136
+ deaf: true,
137
+ });
138
+
139
+ if (res.loadType === "playlist") {
140
+ for (const track of res.tracks) {
141
+ track.info.requester = interaction.user;
142
+ player.queue.add(track);
143
+ }
144
+
145
+ interaction.reply(
146
+ `${res.playlistInfo.name} has been loaded with ${res.tracks.length}`
147
+ );
148
+ } else {
149
+ const track = res.tracks[0];
150
+ track.info.requester = interaction.user;
151
+ player.queue.add(track);
152
+ interaction.reply(`Queued Track \n \`${track.info.title}\``)
153
+ }
154
+
155
+ if (!player.isPlaying && player.isConnected) player.play();
156
+ });
157
+
158
+ client.login("TOKEN");
159
+ ```
160
+
161
+ ## Need Help?
162
+
163
+ Feel free to join our [discord server](https://discord.gg/Zmmc47Nrh8), Give us suggestions and advice about errors and new features.
164
+ with ❤️ by [Paras](https://github.com/parasop) .
@@ -1,17 +1,17 @@
1
- import { Player } from "./Player";
2
- export interface IVoiceServer {
3
- token: string;
4
- sessionId: string;
5
- endpoint: string;
6
- }
7
- export declare class Connection {
8
- player: Player;
9
- sessionId: string | null;
10
- region: string | null;
11
- voice: IVoiceServer | null;
12
- self_mute: boolean;
13
- self_deaf: boolean;
14
- constructor(player: Player);
15
- setServersUpdate(data: any): void;
16
- setStateUpdate(data: any): void;
17
- }
1
+ import { Player } from "./Player";
2
+ export interface IVoiceServer {
3
+ token: string;
4
+ sessionId: string;
5
+ endpoint: string;
6
+ }
7
+ export declare class Connection {
8
+ player: Player;
9
+ sessionId: string | null;
10
+ region: string | null;
11
+ voice: IVoiceServer | null;
12
+ self_mute: boolean;
13
+ self_deaf: boolean;
14
+ constructor(player: Player);
15
+ setServersUpdate(data: any): void;
16
+ setStateUpdate(data: any): void;
17
+ }
@@ -1,51 +1,51 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Connection = void 0;
4
- const Error_1 = require("./Error");
5
- class Connection {
6
- player;
7
- sessionId;
8
- region;
9
- voice;
10
- self_mute;
11
- self_deaf;
12
- constructor(player) {
13
- this.player = player;
14
- this.sessionId = null;
15
- this.region = null;
16
- this.voice = {
17
- sessionId: null,
18
- token: null,
19
- endpoint: null,
20
- };
21
- this.self_mute = false;
22
- this.self_deaf = false;
23
- }
24
- setServersUpdate(data) {
25
- if (!data.endpoint)
26
- throw new Error(Error_1.Errors.sessionNotFound);
27
- this.voice.endpoint = data.endpoint;
28
- this.voice.token = data.token;
29
- this.region =
30
- data.endpoint.split(".").shift()?.replace(/[0-9]/g, "") || null;
31
- this.player.node.rest.updatePlayer({
32
- guildId: this.player.guildId,
33
- data: { voice: this.voice },
34
- });
35
- this.player.poru.emit("debug", this.player.node.name, `[Voice] <- [Discord] : Voice Server Update | Server: ${this.region} Guild: ${this.player.guildId}`);
36
- }
37
- setStateUpdate(data) {
38
- const { session_id, channel_id, self_deaf, self_mute } = data;
39
- if (this.player.voiceChannel &&
40
- channel_id &&
41
- this.player.voiceChannel !== channel_id) {
42
- this.player.voiceChannel = channel_id;
43
- }
44
- this.self_deaf = self_deaf;
45
- this.self_mute = self_mute;
46
- this.voice.sessionId = session_id || null;
47
- // this.player.poru.emit('debug', this.player.node.name, `[Voice] <- [Discord] : State Update Received | Channel: ${this.player.voiceChannel} Session ID: ${session_id} Guild: ${this.player.guildId}`);
48
- }
49
- }
50
- exports.Connection = Connection;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Connection = void 0;
4
+ const Error_1 = require("./Error");
5
+ class Connection {
6
+ player;
7
+ sessionId;
8
+ region;
9
+ voice;
10
+ self_mute;
11
+ self_deaf;
12
+ constructor(player) {
13
+ this.player = player;
14
+ this.sessionId = null;
15
+ this.region = null;
16
+ this.voice = {
17
+ sessionId: null,
18
+ token: null,
19
+ endpoint: null,
20
+ };
21
+ this.self_mute = false;
22
+ this.self_deaf = false;
23
+ }
24
+ setServersUpdate(data) {
25
+ if (!data.endpoint)
26
+ throw new Error(Error_1.Errors.sessionNotFound);
27
+ this.voice.endpoint = data.endpoint;
28
+ this.voice.token = data.token;
29
+ this.region =
30
+ data.endpoint.split(".").shift()?.replace(/[0-9]/g, "") || null;
31
+ this.player.node.rest.updatePlayer({
32
+ guildId: this.player.guildId,
33
+ data: { voice: this.voice },
34
+ });
35
+ this.player.poru.emit("debug", this.player.node.name, `[Voice] <- [Discord] : Voice Server Update | Server: ${this.region} Guild: ${this.player.guildId}`);
36
+ }
37
+ setStateUpdate(data) {
38
+ const { session_id, channel_id, self_deaf, self_mute } = data;
39
+ if (this.player.voiceChannel &&
40
+ channel_id &&
41
+ this.player.voiceChannel !== channel_id) {
42
+ this.player.voiceChannel = channel_id;
43
+ }
44
+ this.self_deaf = self_deaf;
45
+ this.self_mute = self_mute;
46
+ this.voice.sessionId = session_id || null;
47
+ // this.player.poru.emit('debug', this.player.node.name, `[Voice] <- [Discord] : State Update Received | Channel: ${this.player.voiceChannel} Session ID: ${session_id} Guild: ${this.player.guildId}`);
48
+ }
49
+ }
50
+ exports.Connection = Connection;
51
51
  //# sourceMappingURL=Connection.js.map
@@ -1,3 +1,3 @@
1
- export declare enum Errors {
2
- sessionNotFound = ""
3
- }
1
+ export declare enum Errors {
2
+ sessionNotFound = ""
3
+ }
package/dist/src/Error.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Errors = void 0;
4
- var Errors;
5
- (function (Errors) {
6
- Errors["sessionNotFound"] = "";
7
- })(Errors = exports.Errors || (exports.Errors = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Errors = void 0;
4
+ var Errors;
5
+ (function (Errors) {
6
+ Errors["sessionNotFound"] = "";
7
+ })(Errors = exports.Errors || (exports.Errors = {}));
8
8
  //# sourceMappingURL=Error.js.map