magmastream 2.8.6-dev.6 → 2.9.0-dev.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/README.md CHANGED
@@ -1,33 +1,91 @@
1
+ <div align="center">
2
+
3
+ <p align="center">
4
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=300&section=header&text=Magmastream&fontSize=90&fontAlignY=35&animation=twinkling&fontColor=gradient&desc=Next-Generation%20Lavalink%20Wrapper&descSize=25&descAlignY=60" />
5
+ </p>
6
+
7
+ [![NPM Version](https://img.shields.io/npm/v/magmastream?color=00DDB3&label=Magmastream&style=for-the-badge&logo=npm)](https://www.npmjs.com/package/magmastream)
8
+ [![GitHub Stars](https://img.shields.io/github/stars/Magmastream-NPM/magmastream?color=yellow&style=for-the-badge&logo=github)](https://github.com/Magmastream-NPM/magmastream/stargazers)
9
+ [![Downloads](https://img.shields.io/npm/dt/magmastream.svg?style=for-the-badge&color=FF6B6B)](https://www.npmjs.com/package/magmastream)
10
+
11
+ <br />
12
+
1
13
  <p align="center">
2
- <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=Magmastream&fontSize=80&fontAlignY=35&animation=twinkling&fontColor=gradient" />
14
+ <img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&duration=3000&pause=1000&color=00DDB3&center=true&vCenter=true&width=435&lines=Powerful+Audio+Streaming;Optimized+for+Lavalink+v4;Feature-Rich+API;Seamless+Integration" />
3
15
  </p>
4
16
 
5
- **Magmastream** is a powerful and feature-rich Lavalink wrapper for Node.js, designed to supercharge your audio applications. Currently optimized exclusively for Lavalink version 4, Magmastream delivers seamless audio streaming capabilities with elegant simplicity.
17
+ </div>
6
18
 
7
- ## Useful Links
19
+ <div align="center">
20
+ <h3>🎵 The Most Advanced Lavalink Wrapper for Node.js 🚀</h3>
21
+ <h4>Powering the next generation of Discord music bots</h4>
22
+ </div>
8
23
 
9
- - [Documentation](https://docs.magmastream.com)
10
- - [Example Bot](https://github.com/Magmastream-NPM/magmastream_basics_bot)
24
+ <br />
11
25
 
12
- ## Contributing
26
+ ## ✨ Features
27
+
28
+ <div align="center">
29
+ <table>
30
+ <tr>
31
+ <td align="center">🎯 Simple API</td>
32
+ <td align="center">⚡ High Performance</td>
33
+ <td align="center">🛠️ Rich Features</td>
34
+ </tr>
35
+ <tr>
36
+ <td align="center">🔌 Plugin Support</td>
37
+ <td align="center">📊 Advanced Analytics</td>
38
+ <td align="center">🎚️ Audio Filters</td>
39
+ </tr>
40
+ </table>
41
+ </div>
42
+
43
+ ## 📦 Resources
44
+
45
+ <div align="center">
46
+ <a href="https://docs.magmastream.com">
47
+ <img src="https://img.shields.io/badge/Documentation-00DDB3?style=for-the-badge&logo=bookstack&logoColor=white" />
48
+ </a>
49
+ <a href="https://github.com/Magmastream-NPM/magmastream_basics_bot">
50
+ <img src="https://img.shields.io/badge/Example_Bot-5865F2?style=for-the-badge&logo=discord&logoColor=white" />
51
+ </a>
52
+ <a href="https://discord.gg/HV59Z3zEjt">
53
+ <img src="https://img.shields.io/badge/Support_Server-FF6B6B?style=for-the-badge&logo=discord&logoColor=white" />
54
+ </a>
55
+ </div>
56
+
57
+ ## 🌟 Featured Projects
58
+
59
+ <div align="center">
60
+ <table>
61
+ <tr>
62
+ <td align="center" width="33%">
63
+ <img src="https://img.shields.io/badge/Lava_Jukebox-FF6B6B?style=for-the-badge&logo=discord&logoColor=white" /><br />
64
+ <sub>by Abel Purnwasy</sub>
65
+ </td>
66
+ <td align="center" width="33%">
67
+ <img src="https://img.shields.io/badge/Stal-00DDB3?style=for-the-badge&logo=discord&logoColor=white" /><br />
68
+ <sub>by memte</sub>
69
+ </td>
70
+ <td align="center" width="33%">
71
+ <img src="https://img.shields.io/badge/Lunio-5865F2?style=for-the-badge&logo=discord&logoColor=white" /><br />
72
+ <sub>by vexi</sub>
73
+ </td>
74
+ </tr>
75
+ </table>
13
76
 
14
- We warmly welcome contributions that help elevate Magmastream to new heights! Whether you've discovered bugs that need squashing or have brilliant ideas for improvements, we'd love to see your contributions. Here's how you can join our community of developers:
77
+ [View All Projects →](https://github.com/Magmastream-NPM/magmastream#used-by)
78
+ </div>
15
79
 
16
- 1. Fork the repository to your own GitHub account.
17
- 2. Create a fresh branch that reflects your intended changes.
18
- 3. Implement your awesome modifications and fixes.
19
- 4. Rigorously test your changes to ensure everything works flawlessly.
20
- 5. Submit a detailed pull request, clearly describing the enhancements you've made.
80
+ ## 📊 Project Statistics
21
81
 
22
- Together, we can make Magmastream an even more powerful and robust tool for everyone! Your expertise and creativity are invaluable to our project's growth. 🚀✨
82
+ <div align="center">
23
83
 
24
- ## Bug Fixes
84
+ ![Stats](https://repobeats.axiom.co/api/embed/e46896cea6c7ad6648effe4d7868ffa3fef0151b.svg "Repobeats analytics image")
25
85
 
26
- Have you discovered and squashed some pesky bugs? Fantastic! We'd love for you to [contribute](#contributing) by submitting a pull request. Your dedication to enhancing Magmastream's stability and reliability is invaluable to our community. Together, we can make this project even more robust! 🐛✨
86
+ <br />
27
87
 
28
- ## Support
29
- Need help or have questions? Feel free to create an issue, and our community will be happy to assist you!
30
- For real-time support and engaging discussions, join our vibrant [Discord Support Server](https://discord.com/invite/HV59Z3zEjt).
88
+ </div>
31
89
 
32
90
  ## Used By
33
91
 
@@ -41,36 +99,76 @@ For real-time support and engaging discussions, join our vibrant [Discord Suppor
41
99
  | [Soundy](https://dsc.gg/sndy) | iaMJ |
42
100
  | [HamBot](https://discord.com/oauth2/authorize?client_id=1049314312776335390) | yanishamburger|
43
101
  | [Miyu](https://discord.com/oauth2/authorize?client_id=1277180179273482280&permissions=572851999731703&response_type=code&redirect_uri=https%3A%2F%2Fdiscord.gg%2Ftn3nbFB8nX&integration_type=0&scope=identify+applications.commands+bot) | Kenver |
44
- | [Savage Bot](https://discord.com/oauth2/authorize?client_id=823703707522433054&permissions=8&scope=bot%20applications.commands) | Savage |
102
+ | [Savage Bot](https://discord.com/oauth2/authorize?client_id=823703707522433054&permissions=8&scope=bot%20applications.commands) | Savage
103
+ | [rive](https://discord.com/oauth2/authorize?client_id=1350601402325405806) | pomice
104
+
45
105
 
46
106
  Want to showcase your bot? Feel free to create a pull request and add it to our growing list of amazing bots powered by Magmastream!
47
107
 
48
- ## Contributors
108
+ ## 👥 Contributors
49
109
 
50
- A heartfelt thank you to all our amazing contributors who have poured their time and expertise into making Magmastream truly exceptional! Your dedication and passion continue to drive this project forward. 🚀✨
110
+ <div align="center">
51
111
 
52
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
53
- <!-- prettier-ignore-start -->
54
- <!-- markdownlint-disable -->
112
+ <!-- ALL-CONTRIBUTORS-LIST:START -->
55
113
  <table>
56
114
  <tbody>
57
115
  <tr>
58
- <td align="center" valign="top" width="14.28%"><a href="https://discord.gg/JCaTDJRz7P"><img src="https://avatars.githubusercontent.com/u/58607083?v=4?s=100" width="100px;" alt="Darek"/><br /><sub><b>Darek</b></sub></a><br /><a href="#doc-realdarek" title="Documentation">📖</a></td>
59
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/Vexify4103"><img src="https://avatars.githubusercontent.com/u/47192617?v=4?s=100" width="100px;" alt="Vexify4103"/><br /><sub><b>Vexify4103</b></sub></a><br /><a href="#code-Vexify4103" title="Code">💻</a> <a href="#doc-Vexify4103" title="Documentation">📖</a></td>
60
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/ItzRandom23"><img src="https://avatars.githubusercontent.com/u/100831398?v=4?s=100" width="100px;" alt="Itz Random"/><br /><sub><b>Itz Random</b></sub></a><br /><a href="#code-ItzRandom23" title="Code">💻</a></td>
116
+ <td align="center" valign="top" width="14.28%">
117
+ <a href="https://discord.gg/JCaTDJRz7P">
118
+ <img src="https://avatars.githubusercontent.com/u/58607083?v=4?s=100" width="100px;" alt="Darek"/>
119
+ <br />
120
+ <sub><b>Darek</b></sub>
121
+ </a>
122
+ <br />
123
+ <a href="#doc-realdarek" title="Documentation">📖</a>
124
+ </td>
125
+ <td align="center" valign="top" width="14.28%">
126
+ <a href="https://github.com/Vexify4103">
127
+ <img src="https://avatars.githubusercontent.com/u/47192617?v=4?s=100" width="100px;" alt="Vexify4103"/>
128
+ <br />
129
+ <sub><b>Vexify4103</b></sub>
130
+ </a>
131
+ <br />
132
+ <a href="#code-Vexify4103" title="Code">💻</a>
133
+ <a href="#doc-Vexify4103" title="Documentation">📖</a>
134
+ </td>
135
+ <td align="center" valign="top" width="14.28%">
136
+ <a href="https://github.com/ItzRandom23">
137
+ <img src="https://avatars.githubusercontent.com/u/100831398?v=4?s=100" width="100px;" alt="Itz Random"/>
138
+ <br />
139
+ <sub><b>Itz Random</b></sub>
140
+ </a>
141
+ <br />
142
+ <a href="#code-ItzRandom23" title="Code">💻</a>
143
+ </td>
61
144
  </tr>
62
145
  </tbody>
63
146
  </table>
64
147
 
65
- <!-- markdownlint-restore -->
66
- <!-- prettier-ignore-end -->
148
+ <br />
67
149
 
68
- <!-- ALL-CONTRIBUTORS-LIST:END -->
150
+ <img src="https://contributers.code-fy.tech/Magmastream-NPM?yousuck" alt="Contributors" />
69
151
 
152
+ </div>
70
153
 
71
- <img src="https://contributers.code-fy.tech/Magmastream-NPM?yousuck">
154
+ ## 🤝 Contributing
72
155
 
73
- ## Stats
156
+ <div align="center">
74
157
 
158
+ We welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.
75
159
 
76
- ![Stats](https://repobeats.axiom.co/api/embed/e46896cea6c7ad6648effe4d7868ffa3fef0151b.svg "Repobeats analytics image")
160
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](CONTRIBUTING.md)
161
+
162
+ </div>
163
+
164
+ <div align="center">
165
+
166
+ <br />
167
+
168
+ <p align="center">
169
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=100&section=footer" />
170
+ </p>
171
+
172
+ <sub>Built with ❤️ by the Magmastream Team</sub>
173
+
174
+ </div>
package/dist/index.d.ts CHANGED
@@ -308,28 +308,6 @@ declare class Node {
308
308
  * @private
309
309
  */
310
310
  private handleAutoplay;
311
- /**
312
- * Selects a platform from the given enabled sources.
313
- * @param {string[]} enabledSources - The enabled sources to select from.
314
- * @returns {SearchPlatform | null} - The selected platform or null if none was found.
315
- */
316
- selectPlatform(enabledSources: string[]): SearchPlatform | null;
317
- /**
318
- * Handles Last.fm-based autoplay.
319
- * @param {Player} player - The player instance.
320
- * @param {Track} previousTrack - The previous track.
321
- * @param {SearchPlatform} platform - The selected platform.
322
- * @param {string} apiKey - The Last.fm API key.
323
- * @returns {Promise<boolean>} - Whether the autoplay was successful.
324
- */
325
- private handlePlatformAutoplay;
326
- /**
327
- * Handles YouTube-based autoplay.
328
- * @param {Player} player - The player instance.
329
- * @param {Track} previousTrack - The previous track.
330
- * @returns {Promise<boolean>} - Whether the autoplay was successful.
331
- */
332
- private handleYouTubeAutoplay;
333
311
  /**
334
312
  * Handles the scenario when a track fails to play or load.
335
313
  * Shifts the queue to the next track and emits a track end event.
@@ -692,6 +670,20 @@ declare abstract class TrackUtils {
692
670
  */
693
671
  static build<T = User | ClientUser>(data: TrackData, requester?: T): Track;
694
672
  }
673
+ declare abstract class AutoPlayUtils {
674
+ private static manager;
675
+ /**
676
+ * Initializes the AutoPlayUtils class with the given manager.
677
+ * @param manager The manager instance to use.
678
+ * @hidden
679
+ */
680
+ static init(manager: Manager): void;
681
+ static getRecommendedTracks(player: Player, track: Track, attempt?: number): Promise<Track[]>;
682
+ static getRecommendedTracksFromLastFm(track: Track, apiKey: string): Promise<Track[]>;
683
+ static getRecommendedTracksFromSource(track: Track, mappedPlatform: string): Promise<Track[]>;
684
+ static getRecommendedTracksFromYouTube(track: Track): Promise<Track[]>;
685
+ static selectPlatform(enabledSources: string[]): SearchPlatform | null;
686
+ }
695
687
  /** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
696
688
  declare abstract class Structure {
697
689
  /**
@@ -1525,20 +1517,6 @@ declare class Player {
1525
1517
  * @returns {Promise<Track[]>} - Array of recommended tracks.
1526
1518
  */
1527
1519
  getRecommendedTracks(track: Track): Promise<Track[]>;
1528
- /**
1529
- * Handles YouTube-based recommendations.
1530
- * @param {Track} track - The track to find recommendations for.
1531
- * @returns {Promise<Track[]>} - Array of recommended tracks.
1532
- */
1533
- private handleYouTubeRecommendations;
1534
- /**
1535
- * Handles Last.fm-based autoplay (or other platforms).
1536
- * @param {Track} track - The track to find recommendations for.
1537
- * @param {SearchPlatform} source - The selected search platform.
1538
- * @param {string} apiKey - The Last.fm API key.
1539
- * @returns {Promise<Track[]>} - Array of recommended tracks.
1540
- */
1541
- private handlePlatformAutoplay;
1542
1520
  /**
1543
1521
  * Sets the volume of the player.
1544
1522
  * @param {number} volume - The new volume. Must be between 0 and 1000.
@@ -1704,7 +1682,7 @@ interface Track {
1704
1682
  /** The thumbnail of the track or null if it's a unsupported source. */
1705
1683
  readonly thumbnail: string | null;
1706
1684
  /** The user that requested the track. */
1707
- readonly requester?: User | ClientUser;
1685
+ requester?: User | ClientUser;
1708
1686
  /** Displays the track thumbnail with optional size or null if it's a unsupported source. */
1709
1687
  displayThumbnail(size?: Sizes): string;
1710
1688
  /** Additional track info provided by plugins. */
@@ -2158,4 +2136,5 @@ declare class Plugin {
2158
2136
  load(manager: Manager): void;
2159
2137
  }
2160
2138
 
2161
- export { AvailableFilters, type CPUStats, type EqualizerBand, type Exception, type Extendable, Filters, type FrameStats, type LavalinkInfo, type LavalinkResponse, type LoadType, LoadTypes, type Lyrics, type LyricsLine, Manager, ManagerEventTypes, type ManagerEvents, type ManagerOptions, type MemoryStats, Node, type NodeMessage, type NodeOptions, type NodeStats, type Payload, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerOptions, PlayerStateEventTypes, type PlayerUpdate, type PlaylistData, type PlaylistInfoData, type PlaylistRawData, Plugin, Queue, Rest, SearchPlatform, type SearchQuery, type SearchResult, type Severity, SeverityTypes, type Sizes, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, StateTypes, Structure, type Track, type TrackData, type TrackDataInfo, type TrackEndEvent, type TrackEndReason, TrackEndReasonTypes, type TrackExceptionEvent, TrackPartial, type TrackPluginInfo, type TrackSourceName, TrackSourceTypes, type TrackStartEvent, type TrackStuckEvent, TrackUtils, type UseNodeOption, UseNodeOptions, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent };
2139
+ export { AutoPlayUtils, AvailableFilters, Filters, LoadTypes, Manager, ManagerEventTypes, Node, Player, PlayerStateEventTypes, Plugin, Queue, Rest, SearchPlatform, SeverityTypes, SponsorBlockSegment, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
2140
+ export type { CPUStats, EqualizerBand, Exception, Extendable, FrameStats, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsLine, ManagerEvents, ManagerOptions, MemoryStats, NodeMessage, NodeOptions, NodeStats, Payload, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerUpdate, PlaylistData, PlaylistInfoData, PlaylistRawData, SearchQuery, SearchResult, Severity, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, State, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent };
@@ -42,6 +42,7 @@ class Manager extends events_1.EventEmitter {
42
42
  Utils_1.Structure.get("Player").init(this);
43
43
  Utils_1.Structure.get("Node").init(this);
44
44
  Utils_1.TrackUtils.init(this);
45
+ Utils_1.AutoPlayUtils.init(this);
45
46
  if (options.trackPartial) {
46
47
  Utils_1.TrackUtils.setTrackPartial(options.trackPartial);
47
48
  delete options.trackPartial;
@@ -60,7 +61,7 @@ class Manager extends events_1.EventEmitter {
60
61
  usePriority: false,
61
62
  clientName: "Magmastream",
62
63
  defaultSearchPlatform: SearchPlatform.YouTube,
63
- autoPlaySearchPlatform: SearchPlatform.YouTube,
64
+ // autoPlaySearchPlatform: SearchPlatform.YouTube,
64
65
  useNode: UseNodeOptions.LeastPlayers,
65
66
  maxPreviousTracks: options.maxPreviousTracks ?? 20,
66
67
  ...options,