magmastream 2.9.2-dev.1 → 2.9.2-dev.10

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.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { Collection } from '@discordjs/collection';
2
2
  import { GatewayVoiceStateUpdate } from 'discord-api-types/v10';
3
3
  import { EventEmitter } from 'events';
4
- import { Message, User, ClientUser, Client } from 'discord.js';
4
+ import { User, ClientUser, Message, Client } from 'discord.js';
5
+ import { User as User$1, Message as Message$1, Client as Client$2 } from 'oceanic.js';
6
+ import { User as User$2, Message as Message$2 } from 'detritus-client/lib/structures';
7
+ import { User as User$3, Message as Message$3, Client as Client$1 } from 'eris';
8
+ import { User as User$4, ClientUser as ClientUser$1, Message as Message$4, Client as Client$3, WorkerClient } from 'seyfert';
5
9
  import WebSocket$1, { WebSocket } from 'ws';
6
10
  import { Redis } from 'ioredis';
7
- import { Client as Client$1, User as User$1 } from 'eris';
8
11
  import { ClusterClient, ShardClient } from 'detritus-client';
9
- import { Client as Client$2, User as User$2 } from 'oceanic.js';
10
- import { Client as Client$3, WorkerClient, User as User$3 } from 'seyfert';
11
12
 
12
13
  /** Represents an equalizer band. */
13
14
  interface Band {
@@ -275,6 +276,53 @@ declare enum AvailableFilters {
275
276
  Vaporwave = "vaporwave",
276
277
  Vibrato = "vibrato"
277
278
  }
279
+ /**
280
+ * MagmaStream Error Codes Enum
281
+ */
282
+ declare enum MagmaStreamErrorCode {
283
+ GENERAL_UNKNOWN = "MS_GENERAL_UNKNOWN",
284
+ GENERAL_TIMEOUT = "MS_GENERAL_TIMEOUT",
285
+ GENERAL_INVALID_MANAGER = "MS_GENERAL_INVALID_MANAGER",
286
+ MANAGER_INIT_FAILED = "MS_MANAGER_INIT_FAILED",
287
+ MANAGER_INVALID_CONFIG = "MS_MANAGER_INVALID_CONFIG",
288
+ MANAGER_SHUTDOWN_FAILED = "MS_MANAGER_SHUTDOWN_FAILED",
289
+ MANAGER_NO_NODES = "MS_MANAGER_NO_NODES",
290
+ MANAGER_NODE_NOT_FOUND = "MS_MANAGER_NODE_NOT_FOUND",
291
+ MANAGER_SEARCH_FAILED = "MS_MANAGER_SEARCH_FAILED",
292
+ MANAGER_CLEANUP_INACTIVE_PLAYERS_FAILED = "MS_MANAGER_CLEANUP_INACTIVE_PLAYERS_FAILED",
293
+ NODE_INVALID_CONFIG = "MS_NODE_INVALID_CONFIG",
294
+ NODE_CONNECT_FAILED = "MS_NODE_CONNECT_FAILED",
295
+ NODE_RECONNECT_FAILED = "MS_NODE_RECONNECT_FAILED",
296
+ NODE_DISCONNECTED = "MS_NODE_DISCONNECTED",
297
+ NODE_PROTOCOL_ERROR = "MS_NODE_PROTOCOL_ERROR",
298
+ NODE_SESSION_IDS_LOAD_FAILED = "MS_NODE_SESSION_IDS_LOAD_FAILED",
299
+ NODE_SESSION_IDS_UPDATE_FAILED = "MS_NODE_SESSION_IDS_UPDATE_FAILED",
300
+ NODE_PLUGIN_ERROR = "MS_NODE_PLUGIN_ERROR",
301
+ PLAYER_INVALID_CONFIG = "MS_PLAYER_INVALID_CONFIG",
302
+ PLAYER_STATE_INVALID = "MS_PLAYER_STATE_INVALID",
303
+ PLAYER_QUEUE_EMPTY = "MS_PLAYER_QUEUE_EMPTY",
304
+ PLAYER_PREVIOUS_EMPTY = "MS_PLAYER_PREVIOUS_EMPTY",
305
+ PLAYER_INVALID_NOW_PLAYING_MESSAGE = "MS_PLAYER_INVALID_NOW_PLAYING_MESSAGE",
306
+ PLAYER_INVALID_AUTOPLAY = "MS_PLAYER_INVALID_AUTOPLAY",
307
+ PLAYER_INVALID_VOLUME = "MS_PLAYER_INVALID_VOLUME",
308
+ PLAYER_INVALID_REPEAT = "MS_PLAYER_INVALID_REPEAT",
309
+ PLAYER_INVALID_PAUSE = "MS_PLAYER_INVALID_PAUSE",
310
+ PLAYER_INVALID_SEEK = "MS_PLAYER_INVALID_SEEK",
311
+ PLAYER_MOVE_FAILED = "MS_PLAYER_MOVE_FAILED",
312
+ PLAYER_VOICE_RECEIVER_ERROR = "MS_PLAYER_VOICE_RECEIVER_ERROR",
313
+ QUEUE_REDIS_ERROR = "MS_QUEUE_REDIS_ERROR",
314
+ QUEUE_JSON_ERROR = "MS_QUEUE_JSON_ERROR",
315
+ QUEUE_MEMORY_ERROR = "MS_QUEUE_MEMORY_ERROR",
316
+ FILTER_APPLY_FAILED = "MS_FILTER_APPLY_FAILED",
317
+ REST_REQUEST_FAILED = "MS_REST_REQUEST_FAILED",
318
+ REST_UNAUTHORIZED = "MS_REST_UNAUTHORIZED",
319
+ UTILS_TRACK_PARTIAL_INVALID = "MS_UTILS_TRACK_PARTIAL_INVALID",
320
+ UTILS_TRACK_BUILD_FAILED = "MS_UTILS_TRACK_BUILD_FAILED",
321
+ UTILS_AUTOPLAY_BUILD_FAILED = "MS_UTILS_AUTOPLAY_BUILD_FAILED",
322
+ PLUGIN_LOAD_FAILED = "MS_PLUGIN_LOAD_FAILED",
323
+ PLUGIN_RUNTIME_ERROR = "MS_PLUGIN_RUNTIME_ERROR"
324
+ }
325
+ declare const MagmaStreamErrorNumbers: Record<MagmaStreamErrorCode, number>;
278
326
 
279
327
  /**
280
328
  * The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
@@ -914,6 +962,20 @@ interface PortableUser {
914
962
  id: string;
915
963
  username?: string;
916
964
  }
965
+ /**
966
+ * Any user
967
+ */
968
+ type AnyUser = PortableUser | User | ClientUser | User$1 | User$2 | User$3 | User$4 | ClientUser$1;
969
+ /**
970
+ * Portable Message
971
+ */
972
+ interface PortableMessage {
973
+ id: string;
974
+ }
975
+ /**
976
+ * Any message
977
+ */
978
+ type AnyMessage = PortableMessage | Message | Message$1 | Message$2 | Message$3 | Message$4;
917
979
  /**
918
980
  * Discord Packet
919
981
  */
@@ -1097,7 +1159,7 @@ interface Track {
1097
1159
  /** The base64 encoded track. */
1098
1160
  readonly track: string;
1099
1161
  /** The artwork url of the track. */
1100
- readonly artworkUrl: string;
1162
+ readonly artworkUrl: string | null;
1101
1163
  /** The track source name. */
1102
1164
  readonly sourceName: TrackSourceName;
1103
1165
  /** The title of the track. */
@@ -1119,9 +1181,9 @@ interface Track {
1119
1181
  /** The thumbnail of the track or null if it's a unsupported source. */
1120
1182
  readonly thumbnail: string | null;
1121
1183
  /** The user that requested the track. */
1122
- requester?: PortableUser;
1184
+ requester?: AnyUser;
1123
1185
  /** Displays the track thumbnail with optional size or null if it's a unsupported source. */
1124
- displayThumbnail(size?: Sizes): string;
1186
+ displayThumbnail(size?: Sizes): string | null;
1125
1187
  /** Additional track info provided by plugins. */
1126
1188
  pluginInfo: TrackPluginInfo;
1127
1189
  /** Add your own data to the track. */
@@ -1304,7 +1366,7 @@ interface PlaylistData {
1304
1366
  /** The playlist name. */
1305
1367
  name: string;
1306
1368
  /** Requester of playlist. */
1307
- requester: PortableUser;
1369
+ requester: AnyUser;
1308
1370
  /** More playlist information. */
1309
1371
  playlistInfo: PlaylistInfoData[];
1310
1372
  /** The length of the playlist. */
@@ -2000,7 +2062,7 @@ declare class Player {
2000
2062
  /** The text channel for the player. */
2001
2063
  textChannelId: string | null;
2002
2064
  /**The now playing message. */
2003
- nowPlayingMessage?: Message;
2065
+ nowPlayingMessage?: AnyMessage;
2004
2066
  /** The current state of the player. */
2005
2067
  state: StateTypes;
2006
2068
  /** The equalizer bands array. */
@@ -2099,7 +2161,7 @@ declare class Player {
2099
2161
  * @param message - The message of the now playing message.
2100
2162
  * @returns The now playing message.
2101
2163
  */
2102
- setNowPlayingMessage<T = Message>(message: T): Message;
2164
+ setNowPlayingMessage(message: AnyMessage): AnyMessage;
2103
2165
  /**
2104
2166
  * Plays the next track.
2105
2167
  *
@@ -2213,7 +2275,7 @@ declare class Player {
2213
2275
  * @throws {Error} If there are no previous tracks in the queue.
2214
2276
  * @emits {PlayerStateUpdate} - With {@link PlayerStateEventTypes.TrackChange} as the change type.
2215
2277
  */
2216
- previous(): Promise<this>;
2278
+ previous(addBackToQueue?: boolean): Promise<this>;
2217
2279
  /**
2218
2280
  * Seeks to a given position in the currently playing track.
2219
2281
  * @param position - The position in milliseconds to seek to.
@@ -2262,7 +2324,6 @@ declare class Player {
2262
2324
  * Retrieves the current lyrics for the playing track.
2263
2325
  * @param skipTrackSource - Indicates whether to skip the track source when fetching lyrics.
2264
2326
  * @returns {Promise<Lyrics>} - The lyrics of the current track.
2265
- * @throws {RangeError} - If the 'lavalyrics-plugin' is not available on the Lavalink node.
2266
2327
  */
2267
2328
  getCurrentLyrics(skipTrackSource?: boolean): Promise<Lyrics>;
2268
2329
  /**
@@ -2336,10 +2397,10 @@ declare class Rest {
2336
2397
  */
2337
2398
  setSessionId(sessionId: string): string;
2338
2399
  /**
2339
- * Retrieves all the players that are currently running on the node.
2400
+ * Retrieves one the player that is currently running on the node.
2340
2401
  * @returns {Promise<unknown>} Returns the result of the GET request.
2341
2402
  */
2342
- getAllPlayers(): Promise<unknown>;
2403
+ getPlayer(guildId: string): Promise<LavaPlayer>;
2343
2404
  /**
2344
2405
  * Sends a PATCH request to update player related data.
2345
2406
  * @param {RestPlayOptions} options The options to update the player with.
@@ -3030,7 +3091,7 @@ declare class Manager extends EventEmitter {
3030
3091
  * Resolves a PortableUser or ID to a real user object.
3031
3092
  * Can be overridden by wrapper managers to return wrapper-specific User classes.
3032
3093
  */
3033
- resolveUser(user: PortableUser | string): Promise<PortableUser>;
3094
+ resolveUser(user: AnyUser | string): Promise<AnyUser>;
3034
3095
  }
3035
3096
 
3036
3097
  declare class Filters {
@@ -3409,13 +3470,19 @@ declare abstract class TrackUtils {
3409
3470
  * @param requester The user who requested the track, if any.
3410
3471
  * @returns The built Track.
3411
3472
  */
3412
- static build<T = PortableUser | User | ClientUser>(data: TrackData, requester?: T): Track;
3473
+ static build<T = AnyUser>(data: TrackData, requester?: T): Track;
3413
3474
  /**
3414
3475
  * Validates a search result.
3415
3476
  * @param result The search result to validate.
3416
3477
  * @returns Whether the search result is valid.
3417
3478
  */
3418
3479
  static isErrorOrEmptySearchResult(result: SearchResult): result is ErrorOrEmptySearchResult;
3480
+ /**
3481
+ * Revives a track.
3482
+ * @param track The track to revive.
3483
+ * @returns The revived track.
3484
+ */
3485
+ static revive(track: Track): Track;
3419
3486
  }
3420
3487
  declare abstract class AutoPlayUtils {
3421
3488
  private static manager;
@@ -3525,6 +3592,19 @@ declare abstract class JSONUtils {
3525
3592
  static serializeTrack(track: Track): string;
3526
3593
  }
3527
3594
 
3595
+ interface MagmaStreamErrorOptions<T = unknown> {
3596
+ code: MagmaStreamErrorCode;
3597
+ message?: string;
3598
+ cause?: Error;
3599
+ context?: T;
3600
+ }
3601
+ declare class MagmaStreamError<T = unknown> extends Error {
3602
+ readonly code: MagmaStreamErrorCode;
3603
+ readonly number: number;
3604
+ readonly context?: T;
3605
+ constructor({ code, message, cause, context }: MagmaStreamErrorOptions<T>);
3606
+ }
3607
+
3528
3608
  /**
3529
3609
  * Discord.js wrapper for Magmastream.
3530
3610
  */
@@ -3532,7 +3612,7 @@ declare class DiscordJSManager extends Manager {
3532
3612
  readonly client: Client;
3533
3613
  constructor(client: Client, options?: ManagerOptions);
3534
3614
  protected send(packet: GatewayVoiceStateUpdate): void;
3535
- resolveUser(user: PortableUser | string): Promise<User | PortableUser>;
3615
+ resolveUser(user: AnyUser | string): Promise<User | AnyUser>;
3536
3616
  }
3537
3617
 
3538
3618
  /**
@@ -3542,7 +3622,7 @@ declare class ErisManager extends Manager {
3542
3622
  readonly client: Client$1;
3543
3623
  constructor(client: Client$1, options?: ManagerOptions);
3544
3624
  protected send(packet: GatewayVoiceStateUpdate): void;
3545
- resolveUser(user: PortableUser | string): Promise<User$1 | PortableUser>;
3625
+ resolveUser(user: AnyUser | string): Promise<User$3 | AnyUser>;
3546
3626
  }
3547
3627
 
3548
3628
  /**
@@ -3552,7 +3632,7 @@ declare class DetritusManager extends Manager {
3552
3632
  readonly client: ClusterClient | ShardClient;
3553
3633
  constructor(client: ClusterClient | ShardClient, options?: ManagerOptions);
3554
3634
  protected send(packet: GatewayVoiceStateUpdate): void;
3555
- resolveUser(user: PortableUser | string): Promise<PortableUser>;
3635
+ resolveUser(user: AnyUser | string): Promise<AnyUser>;
3556
3636
  }
3557
3637
 
3558
3638
  /**
@@ -3562,7 +3642,7 @@ declare class OceanicManager extends Manager {
3562
3642
  readonly client: Client$2;
3563
3643
  constructor(client: Client$2, options?: ManagerOptions);
3564
3644
  protected send(packet: GatewayVoiceStateUpdate): void;
3565
- resolveUser(user: PortableUser | string): Promise<User$2 | PortableUser>;
3645
+ resolveUser(user: AnyUser | string): Promise<User$1 | AnyUser>;
3566
3646
  }
3567
3647
 
3568
3648
  /**
@@ -3594,8 +3674,8 @@ declare class SeyfertManager extends Manager {
3594
3674
  readonly client: Client$3 | WorkerClient;
3595
3675
  constructor(client: Client$3 | WorkerClient, options?: ManagerOptions);
3596
3676
  protected send(packet: GatewayVoiceStateUpdate): void;
3597
- resolveUser(user: PortableUser | string): Promise<User$3 | PortableUser>;
3677
+ resolveUser(user: AnyUser | string): Promise<User$4 | AnyUser>;
3598
3678
  }
3599
3679
 
3600
- export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, JSONUtils, JsonQueue, LoadTypes, Manager, ManagerEventTypes, MemoryQueue, Node, OceanicManager, Player, PlayerStateEventTypes, PlayerUtils, Plugin, RedisQueue, Rest, SearchPlatform, SeverityTypes, SeyfertManager, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
3601
- export type { AlbumSearchResult, ArtistSearchResult, CPUStats, DiscordPacket, DistortionOptions, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, KaraokeOptions, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateUpdateEvent, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, PodcastSearchResult, PortableUser, RedisConfig, RestPlayOptions, ReverbOptions, RotationOptions, SearchQuery, SearchResult, SearchSearchResult, Severity, ShortSearchResult, ShowSearchResult, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, StationSearchResult, TimescaleOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VibratoOptions, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
3680
+ export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, JSONUtils, JsonQueue, LoadTypes, MagmaStreamError, MagmaStreamErrorCode, MagmaStreamErrorNumbers, Manager, ManagerEventTypes, MemoryQueue, Node, OceanicManager, Player, PlayerStateEventTypes, PlayerUtils, Plugin, RedisQueue, Rest, SearchPlatform, SeverityTypes, SeyfertManager, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
3681
+ export type { AlbumSearchResult, AnyMessage, AnyUser, ArtistSearchResult, CPUStats, DiscordPacket, DistortionOptions, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, KaraokeOptions, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateUpdateEvent, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, PodcastSearchResult, PortableMessage, PortableUser, RedisConfig, RestPlayOptions, ReverbOptions, RotationOptions, SearchQuery, SearchResult, SearchSearchResult, Severity, ShortSearchResult, ShowSearchResult, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, StationSearchResult, TimescaleOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VibratoOptions, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ tslib_1.__exportStar(require("./structures/Plugin"), exports);
9
9
  tslib_1.__exportStar(require("./statestorage/MemoryQueue"), exports);
10
10
  tslib_1.__exportStar(require("./structures/Rest"), exports);
11
11
  tslib_1.__exportStar(require("./structures/Utils"), exports);
12
+ tslib_1.__exportStar(require("./structures/MagmastreamError"), exports);
12
13
  // wrappers
13
14
  tslib_1.__exportStar(require("./wrappers/discord.js"), exports);
14
15
  tslib_1.__exportStar(require("./wrappers/eris"), exports);