kazagumo-bun 3.4.0-b → 3.4.0-c

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 (58) hide show
  1. package/README.md +270 -267
  2. package/package.json +21 -3
  3. package/.gitattributes +0 -2
  4. package/SECURITY.md +0 -21
  5. package/docs/.nojekyll +0 -1
  6. package/docs/assets/hierarchy.js +0 -1
  7. package/docs/assets/highlight.css +0 -99
  8. package/docs/assets/icons.js +0 -18
  9. package/docs/assets/icons.svg +0 -1
  10. package/docs/assets/main.js +0 -60
  11. package/docs/assets/navigation.js +0 -1
  12. package/docs/assets/search.js +0 -1
  13. package/docs/assets/style.css +0 -1633
  14. package/docs/classes/Kazagumo.Kazagumo.html +0 -307
  15. package/docs/classes/Managers_KazagumoPlayer.KazagumoPlayer.html +0 -81
  16. package/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html +0 -222
  17. package/docs/classes/Managers_Supports_KazagumoTrack.KazagumoTrack.html +0 -43
  18. package/docs/classes/Modules_Interfaces.KazagumoError.html +0 -33
  19. package/docs/classes/Modules_Interfaces.KazagumoPlugin.html +0 -4
  20. package/docs/classes/Modules_Utils.KazagumoUtils.html +0 -3
  21. package/docs/classes/Plugins_PlayerMoved.KazagumoPlugin.html +0 -13
  22. package/docs/enums/Modules_Interfaces.PlayerState.html +0 -7
  23. package/docs/functions/Modules_Interfaces.escapeRegExp.html +0 -1
  24. package/docs/hierarchy.html +0 -1
  25. package/docs/index.html +0 -208
  26. package/docs/interfaces/Kazagumo.KazagumoEvents.html +0 -40
  27. package/docs/interfaces/Modules_Interfaces.CreatePlayerOptions.html +0 -21
  28. package/docs/interfaces/Modules_Interfaces.KazagumoOptions.html +0 -17
  29. package/docs/interfaces/Modules_Interfaces.KazagumoPlayerOptions.html +0 -9
  30. package/docs/interfaces/Modules_Interfaces.KazagumoSearchOptions.html +0 -5
  31. package/docs/interfaces/Modules_Interfaces.KazagumoSearchResult.html +0 -4
  32. package/docs/interfaces/Modules_Interfaces.Payload.html +0 -4
  33. package/docs/interfaces/Modules_Interfaces.PlayOptions.html +0 -6
  34. package/docs/interfaces/Modules_Interfaces.PlayerMovedChannels.html +0 -3
  35. package/docs/interfaces/Modules_Interfaces.RawTrack.html +0 -4
  36. package/docs/interfaces/Modules_Interfaces.ResolveOptions.html +0 -4
  37. package/docs/modules/Index.html +0 -1
  38. package/docs/modules/Kazagumo.html +0 -1
  39. package/docs/modules/Managers_KazagumoPlayer.html +0 -1
  40. package/docs/modules/Managers_Supports_KazagumoQueue.html +0 -1
  41. package/docs/modules/Managers_Supports_KazagumoTrack.html +0 -1
  42. package/docs/modules/Modules_Interfaces.html +0 -1
  43. package/docs/modules/Modules_Plugins.html +0 -1
  44. package/docs/modules/Modules_Utils.html +0 -1
  45. package/docs/modules/Plugins_PlayerMoved.html +0 -1
  46. package/docs/modules.html +0 -1
  47. package/docs/types/Modules_Interfaces.PlayerMovedState.html +0 -1
  48. package/docs/types/Modules_Interfaces.SearchEngines.html +0 -1
  49. package/docs/types/Modules_Interfaces.SearchResultTypes.html +0 -1
  50. package/docs/types/Modules_Interfaces.YoutubeThumbnail.html +0 -1
  51. package/docs/types/Modules_Utils.Constructor.html +0 -1
  52. package/docs/variables/Index.version.html +0 -1
  53. package/docs/variables/Modules_Interfaces.Events.html +0 -1
  54. package/docs/variables/Modules_Interfaces.SourceIDs.html +0 -1
  55. package/docs/variables/Modules_Interfaces.SupportedSources.html +0 -1
  56. package/docs/variables/Modules_Plugins.default.html +0 -1
  57. package/eslint.config.mjs +0 -15
  58. package/tsconfig.json +0 -23
package/README.md CHANGED
@@ -1,267 +1,270 @@
1
- # Kazagumo
2
- #### A [Shoukaku](https://github.com/Deivu/Shoukaku) wrapper with built in queue system
3
-
4
- ![AppVeyor](https://img.shields.io/appveyor/build/Takiyo0/kazagumo) ![Downloads](https://img.shields.io/npm/dm/kazagumo) ![npm](https://img.shields.io/npm/v/kazagumo) ![GitHub contributors](https://img.shields.io/github/contributors/Takiyo0/Kazagumo) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Takiyo0/Kazagumo) ![GitHub last commit](https://img.shields.io/github/last-commit/Takiyo0/Kazagumo) ![NPM](https://img.shields.io/npm/l/kazagumo)
5
-
6
- ![Kazagumo](https://i.imgur.com/jfVSvHj.png)
7
- > Kazagumo © Azur Lane
8
-
9
- ## Features:
10
-
11
- ✓ Built-in queue system
12
- ✓ Easy to use
13
- Plugin system
14
- ✓ Uses shoukaku v4 + capable of Lavalink v4
15
- Stable _🙏_
16
-
17
- ## Note
18
- ⚠️Please check [Environment](#environment) that Kazagumo 3.2.0 is verified working on. It's recommended to use the latest version of lavalink. If you encounter any problem, try using previous [version](https://www.npmjs.com/package/kazagumo/v/3.1.2). If issue still persist, please [open an issue](https://github.com/Takiyo0/Kazagumo/issues) or ask me in [Discord](https://discord.gg/nPPW2Gzqg2) (I will answer if I have time) ⚠️
19
-
20
- ## Documentation
21
- Please read the docs first before asking methods
22
- > Kazagumo; https://takiyo0.github.io/Kazagumo
23
- > [Shoukaku](https://github.com/Deivu/Shoukaku) by [Deivu](https://github.com/Deivu); https://deivu.github.io/Shoukaku
24
-
25
- ## Installation
26
-
27
- > npm i kazagumo
28
-
29
- ## Metadata
30
-
31
- > version: 3.4.0
32
- > pre-release: false
33
- > Last build: 11-10-2025 21.20 PM
34
-
35
- ## Environment
36
- The new lavalink system that separate YouTube plugins made configuration a bit harder. I will list all working environment that's known working.
37
-
38
- | Environment | Case 1 | Case 2 | Case 3 |
39
- |----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
40
- | Lavalink Version | v4.0.7 | v4.0.7 | v4.0.7 |
41
- | Youtube Plugin Version | v1.7.2 | v1.7.2 | none |
42
- | [LavaSrc](https://google.com) Plugin Version | v4.1.1 | v4.1.1 | v4.1.1 |
43
- | Kazagumo Version | v3.2.0 | v3.2.0 | v3.2.0 |
44
- | Shoukaku Version | v4.1.0 (built-in v3.2.0) | v4.1.0 (built-in v3.2.0) | v4.1.0 (built-in v3.2.0) |
45
- | Youtube Plugin Config | youtube.oauth.enabled = true<br>youtube.oauth.accessToken = "filled"<br>youtube.oauth.clients = MUSIC,ANDROID_TESTSUITE,WEB | youtube.oauth.enabled = true<br>youtube.oauth.accessToken = "filled"<br>youtube.oauth.clients = MUSIC,ANDROID_TESTSUITE,WEB,TVHTML5EMBEDDED | none |
46
- | Lavalink Config | server.sources.youtube = false<br>server.sources.youtubeSearchEnabled = false | server.sources.youtube = false<br>server.sources.youtubeSearchEnabled = false | server.sources.youtube = true<br>server.sources.youtubeSearchEnabled = true |
47
- | LavaSrc Config | lavasrc.sources.youtube = true | lavasrc.sources.youtube = true | lavasrc.sources.youtube = true |
48
- | **Result** | | | |
49
- | YouTube Playlist Load* | | | |
50
- | YouTube Track Load ||||
51
- | YouTube Search | ✅ | | ✅ |
52
- | LavaSrc Spotify Playlist Load | ✅ | ✅ | |
53
- | LavaSrc Spotify Track Load | ✅ | ✅ | ✅ |
54
- | LavaSrc Spotify Search (spsearch:query)** | ✅ | ✅ | ✅ |
55
- | **Summary** | works just fine | ➖ cannot load youtube playlist | ❌ cannot play any track youtube related. including spotify |
56
-
57
- Note:
58
- - `*` = youtube playlist load with YouTube plugin requires oauth enabled and accessToken filled and `TVHTML5EMBEDDED` to be removed from oauth clients, since it's the default config
59
- - `**` = to do that, you need to add `source` option into `SearchOptions`. Example: `kazagumo.search(query, {source: "spsearch:"});` (⚠️you need to include `:` in the last of `spsearch` or anything to replace source)
60
-
61
- ## Plugins
62
- - Official [spotify plugin](https://npmjs.com/package/kazagumo-spotify)
63
- > npm i kazagumo-spotify
64
- - Additional [apple plugin](https://www.npmjs.com/package/kazagumo-apple)
65
- > npm i kazagumo-apple
66
- - Additional [filter plugin](https://www.npmjs.com/package/kazagumo-filter)
67
- > npm i kazagumo-filter
68
- - Additional [nicovideo.jp plugin](https://www.npmjs.com/package/kazagumo-nico)
69
- > npm i kazagumo-nico
70
- - Additional [deezer plugin](https://www.npmjs.com/package/kazagumo-deezer)
71
- > npm i kazagumo-deezer
72
- - Stone-Deezer [deezer plugin](https://www.npmjs.com/package/stone-deezer)
73
- > npm i stone-deezer
74
-
75
- ## Lavalink installation
76
- > Basically you can follow this [Official Step](https://lavalink.dev/getting-started/index.html)
77
-
78
-
79
- ## Changes v2 -> v3
80
- ```javascript
81
- // You can get ShoukakuPlayer from here
82
- + <KazagumoPlayer>.shoukaku
83
- + this.player.players.get("69696969696969").shoukaku
84
-
85
- // Search tracks
86
- - this.player.getNode().rest.resolve("ytsearch:pretender Official髭男dism") // Shoukaku
87
- + this.player.search("pretender Official髭男dism") // Kazagumo
88
-
89
- // Create a player
90
- - this.player.getNode().joinChannel(...) // Shoukaku
91
- + this.player.createPlayer(...) // Kazagumo
92
-
93
- // Add a track to the queue. MUST BE A kazagumoTrack, you can get from <KazagumoPlayer>.search()
94
- + this.player.players.get("69696969696969").queue.add(kazagumoTrack) // Kazagumo
95
-
96
- // Play a track
97
- - this.player.players.get("69696969696969").playTrack(shoukakuTrack) // Shoukaku
98
- + this.player.players.get("69696969696969").play() // Kazagumo, take the first song on queue
99
- + this.player.players.get("69696969696969").play(kazagumoTrack) // Kazagumo, will unshift current song and forceplay this song
100
-
101
- // Play previous song
102
- + this.player.players.get("69696969696969").play(this.player.players.get("69696969696969").getPrevious()) // Kazagumo, make sure it's not undefined first
103
-
104
- // Pauses or resumes the player. Control from kazagumoPlayer instead of shoukakuPlayer
105
- - this.player.players.get("69696969696969").setPaused(true) // Shoukaku
106
- + this.player.players.get("69696969696969").pause(true) // Kazagumo
107
-
108
- // Set filters. Access shoukakuPlayer from <KazagumoPlayer>.player
109
- - this.player.players.get("69696969696969").setFilters({lowPass: {smoothing: 2}}) // Shoukaku
110
- + this.player.players.get("69696969696969").shoukaku.setFilters({lowPass: {smoothing: 2}}) // Kazagumo
111
-
112
- // Set volume, use Kazagumo's for smoother volume
113
- - this.player.players.get("69696969696969").setVolume(1) // Shoukaku 100% volume
114
- + this.player.players.get("69696969696969").setVolume(100) // Kazagumo 100% volume
115
-
116
- // Skip the current song
117
- - this.player.players.get("69696969696969").stopTrack() // Stoptrack basically skip on shoukaku
118
- + this.player.players.get("69696969696969").skip() // skip on kazagumo. easier to find :v
119
- ```
120
-
121
- ## Support
122
- ⚠️ Please read the docs first before asking question ⚠️
123
- > Kazagumo support server: https://discord.gg/nPPW2Gzqg2 (anywhere lmao)
124
- > Shoukaku support server: https://discord.gg/FVqbtGu (#development)
125
- > Report if you found a bug here https://github.com/Takiyo0/Kazagumo/issues/new/choose
126
-
127
- ## Enable playerMoved event
128
- ```javascript
129
- import { Kazagumo, Payload, Plugins } from "kazagumo";
130
-
131
- const kazagumo = new Kazagumo({
132
- ...,
133
- plugins: [new Plugins.PlayerMoved(client)]
134
- }, Connector, Nodes, ShoukakuOptions)
135
- ```
136
-
137
- ## Example bot
138
- ```javascript
139
- const {Client, GatewayIntentBits} = require('discord.js');
140
- const {Guilds, GuildVoiceStates, GuildMessages, MessageContent} = GatewayIntentBits;
141
- const {Connectors} = require("shoukaku");
142
- const {Kazagumo, KazagumoTrack} = require("../dist");
143
-
144
- const Nodes = [{
145
- name: 'owo',
146
- url: 'localhost:2333',
147
- auth: 'youshallnotpass',
148
- secure: false
149
- }];
150
- const client = new Client({intents: [Guilds, GuildVoiceStates, GuildMessages, MessageContent]});
151
- const kazagumo = new Kazagumo({
152
- defaultSearchEngine: "youtube",
153
- // MAKE SURE YOU HAVE THIS
154
- send: (guildId, payload) => {
155
- const guild = client.guilds.cache.get(guildId);
156
- if (guild) guild.shard.send(payload);
157
- }
158
- }, new Connectors.DiscordJS(client), Nodes);
159
-
160
- client.on("ready", () => console.log(client.user.tag + " Ready!"));
161
-
162
- kazagumo.shoukaku.on('ready', (name) => console.log(`Lavalink ${name}: Ready!`));
163
- kazagumo.shoukaku.on('error', (name, error) => console.error(`Lavalink ${name}: Error Caught,`, error));
164
- kazagumo.shoukaku.on('close', (name, code, reason) => console.warn(`Lavalink ${name}: Closed, Code ${code}, Reason ${reason || 'No reason'}`));
165
- kazagumo.shoukaku.on('debug', (name, info) => console.debug(`Lavalink ${name}: Debug,`, info));
166
- kazagumo.shoukaku.on('disconnect', (name, count) => {
167
- const players = [...kazagumo.shoukaku.players.values()].filter(p => p.node.name === name);
168
- players.map(player => {
169
- kazagumo.destroyPlayer(player.guildId);
170
- player.destroy();
171
- });
172
- console.warn(`Lavalink ${name}: Disconnected`);
173
- });
174
-
175
- kazagumo.on("playerStart", (player, track) => {
176
- client.channels.cache.get(player.textId)?.send({content: `Now playing **${track.title}** by **${track.author}**`})
177
- .then(x => player.data.set("message", x));
178
- });
179
-
180
- kazagumo.on("playerEnd", (player) => {
181
- player.data.get("message")?.edit({content: `Finished playing`});
182
- });
183
-
184
- kazagumo.on("playerEmpty", player => {
185
- client.channels.cache.get(player.textId)?.send({content: `Destroyed player due to inactivity.`})
186
- .then(x => player.data.set("message", x));
187
- player.destroy();
188
- });
189
-
190
- client.on("messageCreate", async msg => {
191
- if (msg.author.bot) return;
192
-
193
- if (msg.content.startsWith("!play")) {
194
- const args = msg.content.split(" ");
195
- const query = args.slice(1).join(" ");
196
-
197
- const {channel} = msg.member.voice;
198
- if (!channel) return msg.reply("You need to be in a voice channel to use this command!");
199
-
200
- let player = await kazagumo.createPlayer({
201
- guildId: msg.guild.id,
202
- textId: msg.channel.id,
203
- voiceId: channel.id,
204
- volume: 40
205
- })
206
-
207
- let result = await kazagumo.search(query, {requester: msg.author});
208
- if (!result.tracks.length) return msg.reply("No results found!");
209
-
210
- if (result.type === "PLAYLIST") player.queue.add(result.tracks); // do this instead of using for loop if you want queueUpdate not spammy
211
- else player.queue.add(result.tracks[0]);
212
-
213
- if (!player.playing && !player.paused) player.play();
214
- return msg.reply({content: result.type === "PLAYLIST" ? `Queued ${result.tracks.length} from ${result.playlistName}` : `Queued ${result.tracks[0].title}`});
215
- }
216
-
217
- if (msg.content.startsWith("!skip")) {
218
- let player = kazagumo.players.get(msg.guild.id);
219
- if (!player) return msg.reply("No player found!");
220
- player.skip();
221
- log(msg.guild.id);
222
- return msg.reply({content: `Skipped to **${player.queue[0]?.title}** by **${player.queue[0]?.author}**`});
223
- }
224
-
225
- if (msg.content.startsWith("!forceplay")) {
226
- let player = kazagumo.players.get(msg.guild.id);
227
- if (!player) return msg.reply("No player found!");
228
- const args = msg.content.split(" ");
229
- const query = args.slice(1).join(" ");
230
- let result = await kazagumo.search(query, {requester: msg.author});
231
- if (!result.tracks.length) return msg.reply("No results found!");
232
- player.play(new KazagumoTrack(result.tracks[0].getRaw(), msg.author));
233
- return msg.reply({content: `Forced playing **${result.tracks[0].title}** by **${result.tracks[0].author}**`});
234
- }
235
-
236
- if (msg.content.startsWith("!previous")) {
237
- let player = kazagumo.players.get(msg.guild.id);
238
- if (!player) return msg.reply("No player found!");
239
- const previous = player.getPrevious(); // we get the previous track without removing it first
240
- if (!previous) return msg.reply("No previous track found!");
241
- await player.play(player.getPrevious(true)); // now we remove the previous track and play it
242
- return msg.reply("Previous!");
243
- }
244
- })
245
-
246
-
247
- client.login('');
248
- ```
249
-
250
- ## Known issue
251
- ###### This part should be in kazagumo-spotify but whatever
252
- - Force playing song from spotify module (player.play(result.tracks[0]); `result.tracks[0]` is from spotify) is currently not working. **ONLY WHEN YOU DO player.play(thing), NOT player.play() OR player.queue.add(new KazagumoTrack(...))** Please use this workaround
253
- ```js
254
- const { KazagumoTrack } = require("kazagumo"); // CommonJS
255
- import { KazagumoTrack } from "kazagumo"; // ES6; don't laugh if it's wrong
256
-
257
- let track = result.tracks[0] // the spotify track
258
- let convertedTrack = new KazagumoTrack(track.getRaw()._raw, track.author);
259
- player.play(convertedTrack);
260
- ```
261
-
262
- ## Contributors
263
- > - Deivu as the owner of Shoukaku
264
- > &nbsp;&nbsp;&nbsp;&nbsp; Github: https://github.com/Deivu
265
- > &nbsp;
266
- > - Takiyo as the owner of this project
267
- > &nbsp;&nbsp;&nbsp;&nbsp; Github: https://github.com/Takiyo0
1
+ # Kazagumo-Bun
2
+
3
+ [![Sponsor](https://img.shields.io/github/sponsors/LuigiColantuono?style=social)](https://github.com/sponsors/LuigiColantuono)
4
+ [![PayPal](https://img.shields.io/badge/💖-Support-ff69b4)](https://paypal.me/l0g4n7)
5
+ [![npm](https://img.shields.io/npm/v/Kazagumo-Bun?style=flat-square)](https://www.npmjs.com/package/shoukaku-bun)
6
+ ![Github Stars](https://img.shields.io/github/stars/LuigiColantuono/Kazagumo-Bun?style=flat-square)
7
+ ![GitHub issues](https://img.shields.io/github/issues-raw/LuigiColantuono/Kazagumo-Bun?style=flat-square)
8
+ ![NPM](https://img.shields.io/npm/l/Kazagumo-Bun?style=flat-square)
9
+
10
+ #### A [Shoukaku-Bun](https://github.com/LuigiColantuono/Shoukaku-Bun) wrapper with built in queue system
11
+
12
+ ![Kazagumo](https://i.imgur.com/jfVSvHj.png)
13
+ > Kazagumo © Azur Lane
14
+
15
+ ## Features:
16
+
17
+ Built-in queue system
18
+ Easy to use
19
+ ✓ Plugin system
20
+ Uses shoukaku v4 + capable of Lavalink v4
21
+ Stable _🙏_
22
+
23
+ ## Note
24
+ ⚠️Please check [Environment](#environment) that Kazagumo 3.2.0 is verified working on. It's recommended to use the latest version of lavalink. If you encounter any problem, try using previous [version](https://www.npmjs.com/package/kazagumo/v/3.1.2). If issue still persist, please [open an issue](https://github.com/Takiyo0/Kazagumo/issues) or ask me in [Discord](https://discord.gg/nPPW2Gzqg2) (I will answer if I have time) ⚠️
25
+
26
+ ## Documentation
27
+ Please read the docs first before asking methods
28
+ > Kazagumo; https://takiyo0.github.io/Kazagumo
29
+ > [Shoukaku](https://github.com/Deivu/Shoukaku) by [Deivu](https://github.com/Deivu); https://deivu.github.io/Shoukaku
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ bun add kazagumo-bun
35
+ ```
36
+
37
+ ## Environment
38
+ The new lavalink system that separate YouTube plugins made configuration a bit harder. I will list all working environment that's known working.
39
+
40
+ | Environment | Case 1 | Case 2 | Case 3 |
41
+ |----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
42
+ | Lavalink Version | v4.0.7 | v4.0.7 | v4.0.7 |
43
+ | Youtube Plugin Version | v1.7.2 | v1.7.2 | none |
44
+ | [LavaSrc](https://google.com) Plugin Version | v4.1.1 | v4.1.1 | v4.1.1 |
45
+ | Kazagumo Version | v3.2.0 | v3.2.0 | v3.2.0 |
46
+ | Shoukaku Version | v4.1.0 (built-in v3.2.0) | v4.1.0 (built-in v3.2.0) | v4.1.0 (built-in v3.2.0) |
47
+ | Youtube Plugin Config | youtube.oauth.enabled = true<br>youtube.oauth.accessToken = "filled"<br>youtube.oauth.clients = MUSIC,ANDROID_TESTSUITE,WEB | youtube.oauth.enabled = true<br>youtube.oauth.accessToken = "filled"<br>youtube.oauth.clients = MUSIC,ANDROID_TESTSUITE,WEB,TVHTML5EMBEDDED | none |
48
+ | Lavalink Config | server.sources.youtube = false<br>server.sources.youtubeSearchEnabled = false | server.sources.youtube = false<br>server.sources.youtubeSearchEnabled = false | server.sources.youtube = true<br>server.sources.youtubeSearchEnabled = true |
49
+ | LavaSrc Config | lavasrc.sources.youtube = true | lavasrc.sources.youtube = true | lavasrc.sources.youtube = true |
50
+ | **Result** | | | |
51
+ | YouTube Playlist Load* | ✅ | | ✅ |
52
+ | YouTube Track Load | ✅ | ✅ | |
53
+ | YouTube Search | ✅ | ✅ | ✅ |
54
+ | LavaSrc Spotify Playlist Load | ✅ | ✅ | ✅ |
55
+ | LavaSrc Spotify Track Load | | | |
56
+ | LavaSrc Spotify Search (spsearch:query)** | ✅ | ✅ | ✅ |
57
+ | **Summary** | ✅ works just fine | ➖ cannot load youtube playlist | ❌ cannot play any track youtube related. including spotify |
58
+
59
+ Note:
60
+ - `*` = youtube playlist load with YouTube plugin requires oauth enabled and accessToken filled and `TVHTML5EMBEDDED` to be removed from oauth clients, since it's the default config
61
+ - `**` = to do that, you need to add `source` option into `SearchOptions`. Example: `kazagumo.search(query, {source: "spsearch:"});` (⚠️you need to include `:` in the last of `spsearch` or anything to replace source)
62
+
63
+ ## Plugins
64
+ - Official [spotify plugin](https://npmjs.com/package/kazagumo-spotify)
65
+ > npm i kazagumo-spotify
66
+ - Additional [apple plugin](https://www.npmjs.com/package/kazagumo-apple)
67
+ > npm i kazagumo-apple
68
+ - Additional [filter plugin](https://www.npmjs.com/package/kazagumo-filter)
69
+ > npm i kazagumo-filter
70
+ - Additional [nicovideo.jp plugin](https://www.npmjs.com/package/kazagumo-nico)
71
+ > npm i kazagumo-nico
72
+ - Additional [deezer plugin](https://www.npmjs.com/package/kazagumo-deezer)
73
+ > npm i kazagumo-deezer
74
+ - Stone-Deezer [deezer plugin](https://www.npmjs.com/package/stone-deezer)
75
+ > npm i stone-deezer
76
+
77
+ ## Lavalink installation
78
+ > Basically you can follow this [Official Step](https://lavalink.dev/getting-started/index.html)
79
+
80
+
81
+ ## Changes v2 -> v3
82
+ ```javascript
83
+ // You can get ShoukakuPlayer from here
84
+ + <KazagumoPlayer>.shoukaku
85
+ + this.player.players.get("69696969696969").shoukaku
86
+
87
+ // Search tracks
88
+ - this.player.getNode().rest.resolve("ytsearch:pretender Official髭男dism") // Shoukaku
89
+ + this.player.search("pretender Official髭男dism") // Kazagumo
90
+
91
+ // Create a player
92
+ - this.player.getNode().joinChannel(...) // Shoukaku
93
+ + this.player.createPlayer(...) // Kazagumo
94
+
95
+ // Add a track to the queue. MUST BE A kazagumoTrack, you can get from <KazagumoPlayer>.search()
96
+ + this.player.players.get("69696969696969").queue.add(kazagumoTrack) // Kazagumo
97
+
98
+ // Play a track
99
+ - this.player.players.get("69696969696969").playTrack(shoukakuTrack) // Shoukaku
100
+ + this.player.players.get("69696969696969").play() // Kazagumo, take the first song on queue
101
+ + this.player.players.get("69696969696969").play(kazagumoTrack) // Kazagumo, will unshift current song and forceplay this song
102
+
103
+ // Play previous song
104
+ + this.player.players.get("69696969696969").play(this.player.players.get("69696969696969").getPrevious()) // Kazagumo, make sure it's not undefined first
105
+
106
+ // Pauses or resumes the player. Control from kazagumoPlayer instead of shoukakuPlayer
107
+ - this.player.players.get("69696969696969").setPaused(true) // Shoukaku
108
+ + this.player.players.get("69696969696969").pause(true) // Kazagumo
109
+
110
+ // Set filters. Access shoukakuPlayer from <KazagumoPlayer>.player
111
+ - this.player.players.get("69696969696969").setFilters({lowPass: {smoothing: 2}}) // Shoukaku
112
+ + this.player.players.get("69696969696969").shoukaku.setFilters({lowPass: {smoothing: 2}}) // Kazagumo
113
+
114
+ // Set volume, use Kazagumo's for smoother volume
115
+ - this.player.players.get("69696969696969").setVolume(1) // Shoukaku 100% volume
116
+ + this.player.players.get("69696969696969").setVolume(100) // Kazagumo 100% volume
117
+
118
+ // Skip the current song
119
+ - this.player.players.get("69696969696969").stopTrack() // Stoptrack basically skip on shoukaku
120
+ + this.player.players.get("69696969696969").skip() // skip on kazagumo. easier to find :v
121
+ ```
122
+
123
+ ## Support
124
+ ⚠️ Please read the docs first before asking question ⚠️
125
+ > Kazagumo support server: https://discord.gg/nPPW2Gzqg2 (anywhere lmao)
126
+ > Shoukaku support server: https://discord.gg/FVqbtGu (#development)
127
+ > Brucius support server: https://discord.gg/XqJw52d35R
128
+ > Report if you found a bug here https://github.com/Takiyo0/Kazagumo/issues/new/choose
129
+
130
+ ## Enable playerMoved event
131
+ ```javascript
132
+ import { Kazagumo, Payload, Plugins } from "kazagumo";
133
+
134
+ const kazagumo = new Kazagumo({
135
+ ...,
136
+ plugins: [new Plugins.PlayerMoved(client)]
137
+ }, Connector, Nodes, ShoukakuOptions)
138
+ ```
139
+
140
+ ## Example bot
141
+ ```javascript
142
+ const {Client, GatewayIntentBits} = require('discord.js');
143
+ const {Guilds, GuildVoiceStates, GuildMessages, MessageContent} = GatewayIntentBits;
144
+ const {Connectors} = require("shoukaku");
145
+ const {Kazagumo, KazagumoTrack} = require("../dist");
146
+
147
+ const Nodes = [{
148
+ name: 'owo',
149
+ url: 'localhost:2333',
150
+ auth: 'youshallnotpass',
151
+ secure: false
152
+ }];
153
+ const client = new Client({intents: [Guilds, GuildVoiceStates, GuildMessages, MessageContent]});
154
+ const kazagumo = new Kazagumo({
155
+ defaultSearchEngine: "youtube",
156
+ // MAKE SURE YOU HAVE THIS
157
+ send: (guildId, payload) => {
158
+ const guild = client.guilds.cache.get(guildId);
159
+ if (guild) guild.shard.send(payload);
160
+ }
161
+ }, new Connectors.DiscordJS(client), Nodes);
162
+
163
+ client.on("ready", () => console.log(client.user.tag + " Ready!"));
164
+
165
+ kazagumo.shoukaku.on('ready', (name) => console.log(`Lavalink ${name}: Ready!`));
166
+ kazagumo.shoukaku.on('error', (name, error) => console.error(`Lavalink ${name}: Error Caught,`, error));
167
+ kazagumo.shoukaku.on('close', (name, code, reason) => console.warn(`Lavalink ${name}: Closed, Code ${code}, Reason ${reason || 'No reason'}`));
168
+ kazagumo.shoukaku.on('debug', (name, info) => console.debug(`Lavalink ${name}: Debug,`, info));
169
+ kazagumo.shoukaku.on('disconnect', (name, count) => {
170
+ const players = [...kazagumo.shoukaku.players.values()].filter(p => p.node.name === name);
171
+ players.map(player => {
172
+ kazagumo.destroyPlayer(player.guildId);
173
+ player.destroy();
174
+ });
175
+ console.warn(`Lavalink ${name}: Disconnected`);
176
+ });
177
+
178
+ kazagumo.on("playerStart", (player, track) => {
179
+ client.channels.cache.get(player.textId)?.send({content: `Now playing **${track.title}** by **${track.author}**`})
180
+ .then(x => player.data.set("message", x));
181
+ });
182
+
183
+ kazagumo.on("playerEnd", (player) => {
184
+ player.data.get("message")?.edit({content: `Finished playing`});
185
+ });
186
+
187
+ kazagumo.on("playerEmpty", player => {
188
+ client.channels.cache.get(player.textId)?.send({content: `Destroyed player due to inactivity.`})
189
+ .then(x => player.data.set("message", x));
190
+ player.destroy();
191
+ });
192
+
193
+ client.on("messageCreate", async msg => {
194
+ if (msg.author.bot) return;
195
+
196
+ if (msg.content.startsWith("!play")) {
197
+ const args = msg.content.split(" ");
198
+ const query = args.slice(1).join(" ");
199
+
200
+ const {channel} = msg.member.voice;
201
+ if (!channel) return msg.reply("You need to be in a voice channel to use this command!");
202
+
203
+ let player = await kazagumo.createPlayer({
204
+ guildId: msg.guild.id,
205
+ textId: msg.channel.id,
206
+ voiceId: channel.id,
207
+ volume: 40
208
+ })
209
+
210
+ let result = await kazagumo.search(query, {requester: msg.author});
211
+ if (!result.tracks.length) return msg.reply("No results found!");
212
+
213
+ if (result.type === "PLAYLIST") player.queue.add(result.tracks); // do this instead of using for loop if you want queueUpdate not spammy
214
+ else player.queue.add(result.tracks[0]);
215
+
216
+ if (!player.playing && !player.paused) player.play();
217
+ return msg.reply({content: result.type === "PLAYLIST" ? `Queued ${result.tracks.length} from ${result.playlistName}` : `Queued ${result.tracks[0].title}`});
218
+ }
219
+
220
+ if (msg.content.startsWith("!skip")) {
221
+ let player = kazagumo.players.get(msg.guild.id);
222
+ if (!player) return msg.reply("No player found!");
223
+ player.skip();
224
+ log(msg.guild.id);
225
+ return msg.reply({content: `Skipped to **${player.queue[0]?.title}** by **${player.queue[0]?.author}**`});
226
+ }
227
+
228
+ if (msg.content.startsWith("!forceplay")) {
229
+ let player = kazagumo.players.get(msg.guild.id);
230
+ if (!player) return msg.reply("No player found!");
231
+ const args = msg.content.split(" ");
232
+ const query = args.slice(1).join(" ");
233
+ let result = await kazagumo.search(query, {requester: msg.author});
234
+ if (!result.tracks.length) return msg.reply("No results found!");
235
+ player.play(new KazagumoTrack(result.tracks[0].getRaw(), msg.author));
236
+ return msg.reply({content: `Forced playing **${result.tracks[0].title}** by **${result.tracks[0].author}**`});
237
+ }
238
+
239
+ if (msg.content.startsWith("!previous")) {
240
+ let player = kazagumo.players.get(msg.guild.id);
241
+ if (!player) return msg.reply("No player found!");
242
+ const previous = player.getPrevious(); // we get the previous track without removing it first
243
+ if (!previous) return msg.reply("No previous track found!");
244
+ await player.play(player.getPrevious(true)); // now we remove the previous track and play it
245
+ return msg.reply("Previous!");
246
+ }
247
+ })
248
+
249
+
250
+ client.login('');
251
+ ```
252
+
253
+ ## Known issue
254
+ ###### This part should be in kazagumo-spotify but whatever
255
+ - Force playing song from spotify module (player.play(result.tracks[0]); `result.tracks[0]` is from spotify) is currently not working. **ONLY WHEN YOU DO player.play(thing), NOT player.play() OR player.queue.add(new KazagumoTrack(...))** Please use this workaround
256
+ ```js
257
+ const { KazagumoTrack } = require("kazagumo"); // CommonJS
258
+ import { KazagumoTrack } from "kazagumo"; // ES6; don't laugh if it's wrong
259
+
260
+ let track = result.tracks[0] // the spotify track
261
+ let convertedTrack = new KazagumoTrack(track.getRaw()._raw, track.author);
262
+ player.play(convertedTrack);
263
+ ```
264
+
265
+ ## Contributors
266
+ > - Deivu as the owner of Shoukaku
267
+ > &nbsp;&nbsp;&nbsp;&nbsp; Github: https://github.com/Deivu
268
+ > &nbsp;
269
+ > - Takiyo as the owner of this project
270
+ > &nbsp;&nbsp;&nbsp;&nbsp; Github: https://github.com/Takiyo0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kazagumo-bun",
3
- "version": "3.4.0-b",
3
+ "version": "3.4.0-c",
4
4
  "description": "Bun-native high-performance Kazagumo fork. Node legacy purged.",
5
5
  "main": "src/Index.ts",
6
6
  "types": "src/Index.ts",
@@ -12,10 +12,28 @@
12
12
  "test": "bun test",
13
13
  "lint": "eslint ."
14
14
  },
15
- "author": "Takiyo & Luigi Colantuono",
15
+ "author": "Takiyo",
16
+ "contributors": [
17
+ {
18
+ "name": "Luigi Colantuono",
19
+ "url": "https://github.com/LuigiColantuono"
20
+ }
21
+ ],
16
22
  "license": "ISC",
23
+ "homepage": "https://github.com/LuigiColantuono/Kazagumo-Bun#readme",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/LuigiColantuono/Kazagumo-Bun.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/LuigiColantuono/Kazagumo-Bun/issues"
30
+ },
31
+ "funding": {
32
+ "type": "individual",
33
+ "url": "https://paypal.me/l0g4n7"
34
+ },
17
35
  "dependencies": {
18
- "shoukaku": "github:LuigiColantuono/shoukaku-bun"
36
+ "shoukaku": "^4.2.0-b"
19
37
  },
20
38
  "devDependencies": {
21
39
  "@types/bun": "latest",
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto