discord-player 6.7.0 → 6.8.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 +17 -2
- package/dist/index.d.ts +27 -13
- package/dist/index.js +347 -60
- package/dist/index.mjs +8 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -25,6 +25,9 @@ Discord Player is a robust framework for developing Discord Music bots using Jav
|
|
|
25
25
|
- Out-of-the-box voice states handling
|
|
26
26
|
- IP Rotation support
|
|
27
27
|
- Easy serialization and deserialization
|
|
28
|
+
- Limited support for [Eris](https://npmjs.com/eris)
|
|
29
|
+
|
|
30
|
+
> Eris compat mode does not support `VoiceStateUpdate` handler. You need to handle it manually.
|
|
28
31
|
|
|
29
32
|
## Installation
|
|
30
33
|
|
|
@@ -85,6 +88,10 @@ $ npm install --save ffmpeg-binaries
|
|
|
85
88
|
|
|
86
89
|
#### Streaming Library
|
|
87
90
|
|
|
91
|
+
**The following method is deprecated and will be removed in the future. Please switch to [discord-player-youtubei](https://npmjs.com/discord-player-youtubei).**
|
|
92
|
+
|
|
93
|
+
**Not recommended**:
|
|
94
|
+
|
|
88
95
|
YouTube streaming is not supported without installing one of the following package. If you want to add support for YouTube playback, you need to install a streaming library. This step is not needed if you do not plan on using youtube source.
|
|
89
96
|
|
|
90
97
|
```bash
|
|
@@ -99,8 +106,6 @@ $ npm install --save yt-stream
|
|
|
99
106
|
$ npm install --save ytdl-core
|
|
100
107
|
```
|
|
101
108
|
|
|
102
|
-
We recommend using `youtube-ext` for better performance.
|
|
103
|
-
|
|
104
109
|
Once you have completed these installations, let's proceed with writing a simple music bot.
|
|
105
110
|
|
|
106
111
|
### Setup
|
|
@@ -132,6 +137,16 @@ player.events.on('playerStart', (queue, track) => {
|
|
|
132
137
|
});
|
|
133
138
|
```
|
|
134
139
|
|
|
140
|
+
## Eris Setup
|
|
141
|
+
|
|
142
|
+
Discord Player has limited support for Eris. You can use the following code to set up Discord Player with Eris:
|
|
143
|
+
|
|
144
|
+
```js index.js
|
|
145
|
+
const { Player, createErisCompat } = require('discord-player');
|
|
146
|
+
|
|
147
|
+
const player = new Player(createErisCompat(client));
|
|
148
|
+
```
|
|
149
|
+
|
|
135
150
|
Let's move on to the command part. You can define the command as per your requirements. We will only focus on the command part:
|
|
136
151
|
|
|
137
152
|
```js play.js
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { ListenerSignature, DefaultListener, EventEmitter, Queue, QueueStrategy, Collection } from '@discord-player/utils';
|
|
2
1
|
import * as discord_js from 'discord.js';
|
|
3
|
-
import { VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, VoiceBasedChannel, GuildVoiceChannelResolvable, User, Snowflake,
|
|
2
|
+
import { Client, VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, VoiceBasedChannel, GuildVoiceChannelResolvable, User, Snowflake, GuildResolvable } from 'discord.js';
|
|
3
|
+
import Eris from 'eris';
|
|
4
|
+
import { ListenerSignature, DefaultListener, EventEmitter, Queue, QueueStrategy, Collection } from '@discord-player/utils';
|
|
4
5
|
import * as _discord_player_equalizer from '@discord-player/equalizer';
|
|
5
6
|
import { EqualizerBand, BiquadFilters, PCMFilters, FiltersChain } from '@discord-player/equalizer';
|
|
6
7
|
export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as BiquadFilterType, BiquadFilters, FiltersChain, AudioFilters as PCMAudioFilters, PCMFilters, Q_BUTTERWORTH, VolumeTransformer } from '@discord-player/equalizer';
|
|
7
8
|
import { Readable as Readable$1 } from 'node:stream';
|
|
8
9
|
import { StreamType, AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, EndBehaviorType } from 'discord-voip';
|
|
9
|
-
export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer } from 'discord-voip';
|
|
10
|
+
export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer, getVoiceConnection, getVoiceConnections } from 'discord-voip';
|
|
10
11
|
import * as stream from 'stream';
|
|
11
12
|
import { Readable, Duplex } from 'stream';
|
|
12
13
|
import * as _discord_player_extractor from '@discord-player/extractor';
|
|
@@ -17,6 +18,14 @@ import { FFmpeg } from '@discord-player/ffmpeg';
|
|
|
17
18
|
export * from '@discord-player/ffmpeg';
|
|
18
19
|
import { downloadOptions } from 'ytdl-core';
|
|
19
20
|
|
|
21
|
+
declare function isErisProxy(client: any): client is Eris.Client;
|
|
22
|
+
/**
|
|
23
|
+
* Allows Eris clients to be used with discord-player. When this method is called, discord-player creates a proxy object that intercepts certain methods and properties to make it compatible with discord-player.
|
|
24
|
+
* @param client The Eris client to be used.
|
|
25
|
+
* @returns The Eris client with discord-player compatibility.
|
|
26
|
+
*/
|
|
27
|
+
declare function createErisCompat(client: Eris.Client): Client;
|
|
28
|
+
|
|
20
29
|
declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
|
|
21
30
|
#private;
|
|
22
31
|
requiredEvents: Array<keyof L>;
|
|
@@ -1590,12 +1599,13 @@ declare class Track<T = unknown> {
|
|
|
1590
1599
|
requestedBy: User | null;
|
|
1591
1600
|
playlist?: Playlist;
|
|
1592
1601
|
queryType: SearchQueryType | null | undefined;
|
|
1593
|
-
raw:
|
|
1602
|
+
raw: any;
|
|
1594
1603
|
extractor: BaseExtractor | null;
|
|
1595
1604
|
readonly id: string;
|
|
1596
1605
|
private __metadata;
|
|
1597
1606
|
private __reqMetadataFn;
|
|
1598
1607
|
cleanTitle: string;
|
|
1608
|
+
live: boolean;
|
|
1599
1609
|
/**
|
|
1600
1610
|
* Track constructor
|
|
1601
1611
|
* @param player The player that instantiated this Track
|
|
@@ -1633,7 +1643,7 @@ declare class Track<T = unknown> {
|
|
|
1633
1643
|
/**
|
|
1634
1644
|
* Returns source of this track
|
|
1635
1645
|
*/
|
|
1636
|
-
get source():
|
|
1646
|
+
get source(): any;
|
|
1637
1647
|
/**
|
|
1638
1648
|
* String representation of this track
|
|
1639
1649
|
*/
|
|
@@ -1654,7 +1664,7 @@ declare class Track<T = unknown> {
|
|
|
1654
1664
|
duration: string;
|
|
1655
1665
|
views: number;
|
|
1656
1666
|
requested_by: {} | null;
|
|
1657
|
-
source:
|
|
1667
|
+
source: any;
|
|
1658
1668
|
live: boolean;
|
|
1659
1669
|
query_type: SearchQueryType | null | undefined;
|
|
1660
1670
|
extractor: string | null;
|
|
@@ -1725,16 +1735,12 @@ declare class Playlist {
|
|
|
1725
1735
|
title: string;
|
|
1726
1736
|
description: string;
|
|
1727
1737
|
author: string;
|
|
1728
|
-
url: string;
|
|
1729
|
-
* Play this playlist to the given voice channel. If queue exists and another track is being played, this playlist will be added to the queue.
|
|
1730
|
-
* @param channel Voice channel on which this playlist shall be played
|
|
1731
|
-
* @param options Node initialization options
|
|
1732
|
-
*/
|
|
1738
|
+
url: string;
|
|
1733
1739
|
thumbnail: any;
|
|
1734
1740
|
duration: string;
|
|
1735
1741
|
views: number;
|
|
1736
1742
|
requested_by: {} | null;
|
|
1737
|
-
source:
|
|
1743
|
+
source: any;
|
|
1738
1744
|
live: boolean;
|
|
1739
1745
|
query_type: SearchQueryType | null | undefined;
|
|
1740
1746
|
extractor: string | null;
|
|
@@ -2495,6 +2501,10 @@ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
|
|
|
2495
2501
|
queryCacheEnabled: boolean;
|
|
2496
2502
|
queues: GuildQueueStatisticsMetadata[];
|
|
2497
2503
|
};
|
|
2504
|
+
/**
|
|
2505
|
+
* Whether the player is in compatibility mode. Compatibility mode is enabled when non-discord.js client is used.
|
|
2506
|
+
*/
|
|
2507
|
+
isCompatMode(): boolean;
|
|
2498
2508
|
/**
|
|
2499
2509
|
* Destroy every single queues managed by this master player instance
|
|
2500
2510
|
* @example ```typescript
|
|
@@ -3149,6 +3159,10 @@ interface PlayerInitOptions {
|
|
|
3149
3159
|
* The probe timeout in milliseconds. Defaults to 5000.
|
|
3150
3160
|
*/
|
|
3151
3161
|
probeTimeout?: number;
|
|
3162
|
+
/**
|
|
3163
|
+
* Configure ffmpeg path
|
|
3164
|
+
*/
|
|
3165
|
+
ffmpegPath?: string;
|
|
3152
3166
|
}
|
|
3153
3167
|
|
|
3154
3168
|
declare class AudioFilters {
|
|
@@ -3329,4 +3343,4 @@ declare class QueryResolver {
|
|
|
3329
3343
|
|
|
3330
3344
|
declare const version: string;
|
|
3331
3345
|
|
|
3332
|
-
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, Context, ContextReceiver, CreateStreamOps, DiscordPlayerQueryResultCache, Encodable, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorLoaderOptionDict, ExtractorResolvable, ExtractorSearchContext, ExtractorStreamable, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, GuildQueueStatistics, GuildQueueStatisticsMetadata, HookDeclaration, HookDeclarationContext, IPBlock, IPRotationConfig, IPRotator, LrcGetParams, LrcGetResult, LrcLib, LrcSearchParams, LrcSearchResult, MetadataDispatch, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheProvider, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, RequestEntity, ResolvedQuery, ResourcePlayOptions, Runtime, RuntimeType, SearchOptions, SearchQueryType, SearchResult, SearchResultData, SequentialBucket, SerializedPlaylist, SerializedTrack, SerializedType, SetterFN$1 as SetterFN, SkipOptions, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSkipReason, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createContext, createFFmpegStream, createHook, decode, deserialize, encode, onAfterCreateStream, onBeforeCreateStream, serialize, tryIntoThumbnailString, useContext, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
|
|
3346
|
+
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, Context, ContextReceiver, CreateStreamOps, DiscordPlayerQueryResultCache, Encodable, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorLoaderOptionDict, ExtractorResolvable, ExtractorSearchContext, ExtractorStreamable, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, GuildQueueStatistics, GuildQueueStatisticsMetadata, HookDeclaration, HookDeclarationContext, IPBlock, IPRotationConfig, IPRotator, LrcGetParams, LrcGetResult, LrcLib, LrcSearchParams, LrcSearchResult, MetadataDispatch, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheProvider, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, RequestEntity, ResolvedQuery, ResourcePlayOptions, Runtime, RuntimeType, SearchOptions, SearchQueryType, SearchResult, SearchResultData, SequentialBucket, SerializedPlaylist, SerializedTrack, SerializedType, SetterFN$1 as SetterFN, SkipOptions, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSkipReason, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createContext, createErisCompat, createFFmpegStream, createHook, decode, deserialize, encode, isErisProxy, onAfterCreateStream, onBeforeCreateStream, serialize, tryIntoThumbnailString, useContext, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
|