discord-player 6.6.0 → 6.6.1
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 +1 -1
- package/dist/index.d.ts +34 -10
- package/dist/index.js +33 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ Let's move on to the command part. You can define the command as per your requir
|
|
|
121
121
|
|
|
122
122
|
```js
|
|
123
123
|
async function execute(interaction) {
|
|
124
|
-
const channel = interaction.
|
|
124
|
+
const channel = interaction.member.voice.channel;
|
|
125
125
|
if (!channel) return interaction.reply('You are not connected to a voice channel!'); // make sure we have a voice channel
|
|
126
126
|
const query = interaction.options.getString('query', true); // we need input/query to play
|
|
127
127
|
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { StreamType, AudioPlayerError, AudioResource, VoiceConnection, AudioPlay
|
|
|
9
9
|
export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer } from '@discordjs/voice';
|
|
10
10
|
import { RequestOptions } from 'http';
|
|
11
11
|
import { downloadOptions } from 'ytdl-core';
|
|
12
|
+
import { BridgeProvider } from '@discord-player/extractor';
|
|
12
13
|
export * from '@discord-player/ffmpeg';
|
|
13
14
|
|
|
14
15
|
declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
|
|
@@ -251,11 +252,13 @@ interface AsyncQueueAcquisitionOptions {
|
|
|
251
252
|
*/
|
|
252
253
|
signal?: AbortSignal;
|
|
253
254
|
}
|
|
255
|
+
type AsyncQueueExceptionHandler = (exception: Error) => void;
|
|
254
256
|
declare class AsyncQueue {
|
|
255
257
|
/**
|
|
256
258
|
* The queued entries
|
|
257
259
|
*/
|
|
258
260
|
entries: Array<AsyncQueueEntry>;
|
|
261
|
+
exceptionHandler?: AsyncQueueExceptionHandler;
|
|
259
262
|
/**
|
|
260
263
|
* Clear entries queue
|
|
261
264
|
* @param consume Whether or not to consume all entries before clearing
|
|
@@ -268,8 +271,7 @@ declare class AsyncQueue {
|
|
|
268
271
|
/**
|
|
269
272
|
* Acquire an entry.
|
|
270
273
|
*
|
|
271
|
-
*
|
|
272
|
-
* // lock the queue
|
|
274
|
+
* @example // lock the queue
|
|
273
275
|
* const entry = asyncQueue.acquire();
|
|
274
276
|
* // wait until previous task is completed
|
|
275
277
|
* await entry.getTask();
|
|
@@ -277,7 +279,7 @@ declare class AsyncQueue {
|
|
|
277
279
|
* await performSomethingExpensive();
|
|
278
280
|
* // make sure to release the lock once done
|
|
279
281
|
* asyncQueue.release();
|
|
280
|
-
*
|
|
282
|
+
*
|
|
281
283
|
*/
|
|
282
284
|
acquire(options?: AsyncQueueAcquisitionOptions): AsyncQueueEntry;
|
|
283
285
|
/**
|
|
@@ -1318,7 +1320,7 @@ declare class ExtractorExecutionContext extends PlayerEventsEmitter<ExtractorExe
|
|
|
1318
1320
|
* @param _extractor The extractor to register
|
|
1319
1321
|
* @param options Options supplied to the extractor
|
|
1320
1322
|
*/
|
|
1321
|
-
register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<
|
|
1323
|
+
register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<InstanceType<T> | null>;
|
|
1322
1324
|
/**
|
|
1323
1325
|
* Unregister single extractor
|
|
1324
1326
|
* @param _extractor The extractor to unregister
|
|
@@ -1484,6 +1486,10 @@ declare class Track<T = unknown> {
|
|
|
1484
1486
|
* The track duration in millisecond
|
|
1485
1487
|
*/
|
|
1486
1488
|
get durationMS(): number;
|
|
1489
|
+
/**
|
|
1490
|
+
* Discord hyperlink representation of this track
|
|
1491
|
+
*/
|
|
1492
|
+
toHyperlink(): string;
|
|
1487
1493
|
/**
|
|
1488
1494
|
* Returns source of this track
|
|
1489
1495
|
*/
|
|
@@ -1544,6 +1550,12 @@ declare class Playlist {
|
|
|
1544
1550
|
* @returns {PlaylistJSON}
|
|
1545
1551
|
*/
|
|
1546
1552
|
toJSON(withTracks?: boolean): PlaylistJSON;
|
|
1553
|
+
/**
|
|
1554
|
+
* 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.
|
|
1555
|
+
* @param channel Voice channel on which this playlist shall be played
|
|
1556
|
+
* @param options Node initialization options
|
|
1557
|
+
*/
|
|
1558
|
+
play<T = unknown>(channel: GuildVoiceChannelResolvable, options?: PlayerNodeInitializerOptions<T>): Promise<PlayerNodeInitializationResult<T>>;
|
|
1547
1559
|
}
|
|
1548
1560
|
|
|
1549
1561
|
interface SearchResultData {
|
|
@@ -1619,10 +1631,15 @@ declare class SearchResult {
|
|
|
1619
1631
|
|
|
1620
1632
|
declare class VoiceUtils {
|
|
1621
1633
|
player: Player;
|
|
1634
|
+
/**
|
|
1635
|
+
* Voice connection cache to store voice connections of the Player components.
|
|
1636
|
+
* This property is deprecated and will be removed in the future.
|
|
1637
|
+
* It only exists for compatibility reasons.
|
|
1638
|
+
* @deprecated
|
|
1639
|
+
*/
|
|
1622
1640
|
cache: Collection<Snowflake, StreamDispatcher>;
|
|
1623
1641
|
/**
|
|
1624
|
-
* The voice utils
|
|
1625
|
-
* @private
|
|
1642
|
+
* The voice utils constructor
|
|
1626
1643
|
*/
|
|
1627
1644
|
constructor(player: Player);
|
|
1628
1645
|
/**
|
|
@@ -1660,7 +1677,7 @@ declare class VoiceUtils {
|
|
|
1660
1677
|
* @param {Snowflake} guild The guild id
|
|
1661
1678
|
* @returns {StreamDispatcher}
|
|
1662
1679
|
*/
|
|
1663
|
-
getConnection(guild: Snowflake, group?: string):
|
|
1680
|
+
getConnection(guild: Snowflake, group?: string): VoiceConnection | undefined;
|
|
1664
1681
|
}
|
|
1665
1682
|
|
|
1666
1683
|
interface QueryCacheOptions {
|
|
@@ -1702,6 +1719,7 @@ interface PlayerNodeInitializerOptions<T> extends SearchOptions {
|
|
|
1702
1719
|
nodeOptions?: GuildNodeCreateOptions<T>;
|
|
1703
1720
|
connectionOptions?: VoiceConnectConfig;
|
|
1704
1721
|
audioPlayerOptions?: ResourcePlayOptions;
|
|
1722
|
+
signal?: AbortSignal;
|
|
1705
1723
|
afterSearch?: (result: SearchResult) => Promise<SearchResult>;
|
|
1706
1724
|
}
|
|
1707
1725
|
type VoiceStateHandler = (player: Player, queue: GuildQueue, oldVoiceState: VoiceState, newVoiceState: VoiceState) => Awaited<void>;
|
|
@@ -2038,13 +2056,17 @@ interface TimeData {
|
|
|
2038
2056
|
* @property {boolean} [timecodes] If it should render time codes
|
|
2039
2057
|
* @property {boolean} [queue] If it should create progress bar for the whole queue
|
|
2040
2058
|
* @property {number} [length] The bar length
|
|
2041
|
-
* @property {string} [
|
|
2059
|
+
* @property {string} [leftChar] The elapsed time track
|
|
2060
|
+
* @property {string} [rightChar] The remaining time track
|
|
2061
|
+
* @property {string} [separator] The separation between timestamp and line
|
|
2042
2062
|
* @property {string} [indicator] The indicator
|
|
2043
2063
|
*/
|
|
2044
2064
|
interface PlayerProgressbarOptions {
|
|
2045
2065
|
timecodes?: boolean;
|
|
2046
2066
|
length?: number;
|
|
2047
|
-
|
|
2067
|
+
leftChar?: string;
|
|
2068
|
+
rightChar?: string;
|
|
2069
|
+
separator?: string;
|
|
2048
2070
|
indicator?: string;
|
|
2049
2071
|
queue?: boolean;
|
|
2050
2072
|
}
|
|
@@ -2250,6 +2272,7 @@ interface PlaylistJSON {
|
|
|
2250
2272
|
* @property {QueryCache | null} [queryCache] Query cache provider
|
|
2251
2273
|
* @property {boolean} [ignoreInstance] Ignore player instance
|
|
2252
2274
|
* @property {boolean} [useLegacyFFmpeg] Use legacy version of ffmpeg
|
|
2275
|
+
* @property {BridgeProvider} [bridgeProvider] Set bridge provider
|
|
2253
2276
|
*/
|
|
2254
2277
|
interface PlayerInitOptions {
|
|
2255
2278
|
ytdlOptions?: downloadOptions;
|
|
@@ -2261,6 +2284,7 @@ interface PlayerInitOptions {
|
|
|
2261
2284
|
queryCache?: QueryCache | null;
|
|
2262
2285
|
ignoreInstance?: boolean;
|
|
2263
2286
|
useLegacyFFmpeg?: boolean;
|
|
2287
|
+
bridgeProvider?: BridgeProvider;
|
|
2264
2288
|
}
|
|
2265
2289
|
|
|
2266
2290
|
declare class AudioFilters {
|
|
@@ -2496,4 +2520,4 @@ declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(
|
|
|
2496
2520
|
|
|
2497
2521
|
declare const version: string;
|
|
2498
2522
|
|
|
2499
|
-
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, 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, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
|
|
2523
|
+
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, 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, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
|