discord-player 6.6.8-dev.0 → 6.6.8-dev.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/dist/index.d.ts +167 -160
- package/dist/index.js +226 -213
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1946,6 +1946,169 @@ declare class IPRotator {
|
|
|
1946
1946
|
static getRandomIP(address: string, start?: number, end?: number): string;
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
|
+
type unsafe = any;
|
|
1950
|
+
/**
|
|
1951
|
+
* The receiver function that will be called when the context is provided
|
|
1952
|
+
*/
|
|
1953
|
+
type ContextReceiver<R> = () => R;
|
|
1954
|
+
/**
|
|
1955
|
+
* The props for the context provider
|
|
1956
|
+
*/
|
|
1957
|
+
interface ContextProviderProps<T, R> {
|
|
1958
|
+
/**
|
|
1959
|
+
* The value to provide
|
|
1960
|
+
*/
|
|
1961
|
+
value: T;
|
|
1962
|
+
/**
|
|
1963
|
+
* The receiver function that will be called when the context is provided
|
|
1964
|
+
*/
|
|
1965
|
+
receiver: ContextReceiver<R>;
|
|
1966
|
+
}
|
|
1967
|
+
declare class Context<T> {
|
|
1968
|
+
private defaultValue?;
|
|
1969
|
+
private storage;
|
|
1970
|
+
constructor(defaultValue?: T | undefined);
|
|
1971
|
+
/**
|
|
1972
|
+
* Exit out of this context
|
|
1973
|
+
*/
|
|
1974
|
+
exit(scope: ContextReceiver<void>): void;
|
|
1975
|
+
/**
|
|
1976
|
+
* Whether the context is lost
|
|
1977
|
+
*/
|
|
1978
|
+
get isLost(): boolean;
|
|
1979
|
+
/**
|
|
1980
|
+
* Get the current value of the context. If the context is lost and no default value is provided, undefined will be returned.
|
|
1981
|
+
*/
|
|
1982
|
+
consume(): T | undefined;
|
|
1983
|
+
/**
|
|
1984
|
+
* Run a function within the context of this provider
|
|
1985
|
+
*/
|
|
1986
|
+
provide<R = unsafe>({ receiver, value }: ContextProviderProps<T, R>): R;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Create a new context. The default value is optional.
|
|
1990
|
+
* @param defaultValue The default value of the context
|
|
1991
|
+
* @example const userContext = createContext();
|
|
1992
|
+
*
|
|
1993
|
+
* // the value to provide
|
|
1994
|
+
* const user = {
|
|
1995
|
+
* id: 1,
|
|
1996
|
+
* name: 'John Doe'
|
|
1997
|
+
* };
|
|
1998
|
+
*
|
|
1999
|
+
* // provide the context value to the receiver
|
|
2000
|
+
* context.provide({ value: user, receiver: handler });
|
|
2001
|
+
*
|
|
2002
|
+
* function handler() {
|
|
2003
|
+
* // get the context value
|
|
2004
|
+
* const { id, name } = useContext(context);
|
|
2005
|
+
*
|
|
2006
|
+
* console.log(id, name); // 1, John Doe
|
|
2007
|
+
* }
|
|
2008
|
+
*/
|
|
2009
|
+
declare function createContext<T = unsafe>(defaultValue?: T): Context<T>;
|
|
2010
|
+
/**
|
|
2011
|
+
* Get the current value of the context. If the context is lost and no default value is provided, undefined will be returned.
|
|
2012
|
+
* @param context The context to get the value from
|
|
2013
|
+
* @example const value = useContext(context);
|
|
2014
|
+
*/
|
|
2015
|
+
declare function useContext<T = unsafe>(context: Context<T>): T | undefined;
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Fetch guild queue history
|
|
2019
|
+
* @param node guild queue node resolvable
|
|
2020
|
+
*/
|
|
2021
|
+
declare function useHistory<Meta = unknown>(): GuildQueueHistory<Meta> | null;
|
|
2022
|
+
declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Fetch guild queue player node
|
|
2026
|
+
* @param node Guild queue node resolvable
|
|
2027
|
+
*/
|
|
2028
|
+
declare function usePlayer<Meta = unknown>(): GuildQueuePlayerNode<Meta> | null;
|
|
2029
|
+
declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlayerNode<Meta> | null;
|
|
2030
|
+
|
|
2031
|
+
/**
|
|
2032
|
+
* Fetch guild queue
|
|
2033
|
+
* @param node Guild queue node resolvable
|
|
2034
|
+
*/
|
|
2035
|
+
declare function useQueue<Meta = unknown>(): GuildQueue<Meta> | null;
|
|
2036
|
+
declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta> | null;
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* Fetch main player instance
|
|
2040
|
+
* @deprecated
|
|
2041
|
+
*/
|
|
2042
|
+
declare function useMasterPlayer(): Player;
|
|
2043
|
+
/**
|
|
2044
|
+
* Fetch main player instance
|
|
2045
|
+
*/
|
|
2046
|
+
declare function useMainPlayer(): Player;
|
|
2047
|
+
|
|
2048
|
+
type SetterFN$1<T, P> = (previous: P) => T;
|
|
2049
|
+
type MetadataDispatch<T> = readonly [() => T, (metadata: T | SetterFN$1<T, T>) => void];
|
|
2050
|
+
/**
|
|
2051
|
+
* Fetch or manipulate guild queue metadata
|
|
2052
|
+
* @param node Guild queue node resolvable
|
|
2053
|
+
*/
|
|
2054
|
+
declare function useMetadata<T = unknown>(): MetadataDispatch<T>;
|
|
2055
|
+
declare function useMetadata<T = unknown>(node: NodeResolvable): MetadataDispatch<T>;
|
|
2056
|
+
|
|
2057
|
+
interface TimelineDispatcherOptions {
|
|
2058
|
+
ignoreFilters: boolean;
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Fetch or manipulate current track
|
|
2062
|
+
* @param node Guild queue node resolvable
|
|
2063
|
+
* @param options Options for timeline dispatcher
|
|
2064
|
+
*/
|
|
2065
|
+
declare function useTimeline(node?: NodeResolvable, options?: Partial<TimelineDispatcherOptions>): {
|
|
2066
|
+
readonly timestamp: PlayerTimestamp;
|
|
2067
|
+
readonly volume: number;
|
|
2068
|
+
readonly paused: boolean;
|
|
2069
|
+
readonly track: Track<unknown> | null;
|
|
2070
|
+
pause(): boolean;
|
|
2071
|
+
resume(): boolean;
|
|
2072
|
+
setVolume(vol: number): boolean;
|
|
2073
|
+
setPosition(time: number): Promise<boolean>;
|
|
2074
|
+
} | null;
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* Global onAfterCreateStream handler
|
|
2078
|
+
* @param handler The handler callback
|
|
2079
|
+
*/
|
|
2080
|
+
declare function onAfterCreateStream(handler: OnAfterCreateStreamHandler): void;
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* Global onBeforeCreateStream handler
|
|
2084
|
+
* @param handler The handler callback
|
|
2085
|
+
*/
|
|
2086
|
+
declare function onBeforeCreateStream(handler: OnBeforeCreateStreamHandler): void;
|
|
2087
|
+
|
|
2088
|
+
type SetterFN = (previous: number) => number;
|
|
2089
|
+
type VolumeDispatch = readonly [() => number, (volume: number | SetterFN) => boolean | undefined];
|
|
2090
|
+
/**
|
|
2091
|
+
* Fetch or manipulate player volume
|
|
2092
|
+
* @param node Guild queue node resolvable
|
|
2093
|
+
*/
|
|
2094
|
+
declare function useVolume(): VolumeDispatch;
|
|
2095
|
+
declare function useVolume(node: NodeResolvable): VolumeDispatch;
|
|
2096
|
+
|
|
2097
|
+
declare const instances: Collection<string, Player>;
|
|
2098
|
+
|
|
2099
|
+
declare const getPlayer: () => Player | null;
|
|
2100
|
+
interface HooksCtx {
|
|
2101
|
+
guild: Guild;
|
|
2102
|
+
}
|
|
2103
|
+
declare const getQueue: <T = unknown>(node: NodeResolvable) => GuildQueue<T> | null;
|
|
2104
|
+
interface HookDeclarationContext {
|
|
2105
|
+
getQueue: typeof getQueue;
|
|
2106
|
+
getPlayer: typeof getPlayer;
|
|
2107
|
+
instances: typeof instances;
|
|
2108
|
+
}
|
|
2109
|
+
type HookDeclaration<T extends (...args: any[]) => any> = (context: HookDeclarationContext) => T;
|
|
2110
|
+
declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(hook: T): ReturnType<T>;
|
|
2111
|
+
|
|
1949
2112
|
interface PlayerNodeInitializationResult<T = unknown> {
|
|
1950
2113
|
track: Track;
|
|
1951
2114
|
extractor: BaseExtractor | null;
|
|
@@ -1979,6 +2142,10 @@ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
|
|
|
1979
2142
|
* @param {PlayerInitOptions} [options] The player init options
|
|
1980
2143
|
*/
|
|
1981
2144
|
constructor(client: Client, options?: PlayerInitOptions);
|
|
2145
|
+
/**
|
|
2146
|
+
* The hooks context for this player instance.
|
|
2147
|
+
*/
|
|
2148
|
+
get context(): Context<HooksCtx>;
|
|
1982
2149
|
/**
|
|
1983
2150
|
* Override default voice state update handler
|
|
1984
2151
|
* @param handler The handler callback
|
|
@@ -2849,166 +3016,6 @@ declare class QueryResolver {
|
|
|
2849
3016
|
static validateURL(q: string): boolean;
|
|
2850
3017
|
}
|
|
2851
3018
|
|
|
2852
|
-
type unsafe = any;
|
|
2853
|
-
/**
|
|
2854
|
-
* The receiver function that will be called when the context is provided
|
|
2855
|
-
*/
|
|
2856
|
-
type ContextReceiver<R> = () => R;
|
|
2857
|
-
/**
|
|
2858
|
-
* The props for the context provider
|
|
2859
|
-
*/
|
|
2860
|
-
interface ContextProviderProps<T, R> {
|
|
2861
|
-
/**
|
|
2862
|
-
* The value to provide
|
|
2863
|
-
*/
|
|
2864
|
-
value: T;
|
|
2865
|
-
/**
|
|
2866
|
-
* The receiver function that will be called when the context is provided
|
|
2867
|
-
*/
|
|
2868
|
-
receiver: ContextReceiver<R>;
|
|
2869
|
-
}
|
|
2870
|
-
declare class Context<T> {
|
|
2871
|
-
private defaultValue?;
|
|
2872
|
-
private storage;
|
|
2873
|
-
constructor(defaultValue?: T | undefined);
|
|
2874
|
-
/**
|
|
2875
|
-
* Exit out of this context
|
|
2876
|
-
*/
|
|
2877
|
-
exit(scope: ContextReceiver<void>): void;
|
|
2878
|
-
/**
|
|
2879
|
-
* Whether the context is lost
|
|
2880
|
-
*/
|
|
2881
|
-
get isLost(): boolean;
|
|
2882
|
-
/**
|
|
2883
|
-
* Get the current value of the context. If the context is lost and no default value is provided, undefined will be returned.
|
|
2884
|
-
*/
|
|
2885
|
-
getValue(): T | undefined;
|
|
2886
|
-
/**
|
|
2887
|
-
* Run a function within the context of this provider
|
|
2888
|
-
*/
|
|
2889
|
-
provide<R = unsafe>({ receiver, value }: ContextProviderProps<T, R>): R;
|
|
2890
|
-
}
|
|
2891
|
-
/**
|
|
2892
|
-
* Create a new context. The default value is optional.
|
|
2893
|
-
* @param defaultValue The default value of the context
|
|
2894
|
-
* @example const userContext = createContext();
|
|
2895
|
-
*
|
|
2896
|
-
* // the value to provide
|
|
2897
|
-
* const user = {
|
|
2898
|
-
* id: 1,
|
|
2899
|
-
* name: 'John Doe'
|
|
2900
|
-
* };
|
|
2901
|
-
*
|
|
2902
|
-
* // provide the context value to the receiver
|
|
2903
|
-
* context.provide({ value: user, receiver: handler });
|
|
2904
|
-
*
|
|
2905
|
-
* function handler() {
|
|
2906
|
-
* // get the context value
|
|
2907
|
-
* const { id, name } = useContext(context);
|
|
2908
|
-
*
|
|
2909
|
-
* console.log(id, name); // 1, John Doe
|
|
2910
|
-
* }
|
|
2911
|
-
*/
|
|
2912
|
-
declare function createContext<T = unsafe>(defaultValue?: T): Context<T>;
|
|
2913
|
-
/**
|
|
2914
|
-
* Get the current value of the context. If the context is lost and no default value is provided, undefined will be returned.
|
|
2915
|
-
* @param context The context to get the value from
|
|
2916
|
-
* @example const value = useContext(context);
|
|
2917
|
-
*/
|
|
2918
|
-
declare function useContext<T = unsafe>(context: Context<T>): T | undefined;
|
|
2919
|
-
|
|
2920
|
-
/**
|
|
2921
|
-
* Fetch guild queue history
|
|
2922
|
-
* @param node guild queue node resolvable
|
|
2923
|
-
*/
|
|
2924
|
-
declare function useHistory<Meta = unknown>(): GuildQueueHistory<Meta> | null;
|
|
2925
|
-
declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
|
|
2926
|
-
|
|
2927
|
-
/**
|
|
2928
|
-
* Fetch guild queue player node
|
|
2929
|
-
* @param node Guild queue node resolvable
|
|
2930
|
-
*/
|
|
2931
|
-
declare function usePlayer<Meta = unknown>(): GuildQueuePlayerNode<Meta> | null;
|
|
2932
|
-
declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlayerNode<Meta> | null;
|
|
2933
|
-
|
|
2934
|
-
/**
|
|
2935
|
-
* Fetch guild queue
|
|
2936
|
-
* @param node Guild queue node resolvable
|
|
2937
|
-
*/
|
|
2938
|
-
declare function useQueue<Meta = unknown>(): GuildQueue<Meta> | null;
|
|
2939
|
-
declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta> | null;
|
|
2940
|
-
|
|
2941
|
-
/**
|
|
2942
|
-
* Fetch main player instance
|
|
2943
|
-
* @deprecated
|
|
2944
|
-
*/
|
|
2945
|
-
declare function useMasterPlayer(): Player;
|
|
2946
|
-
/**
|
|
2947
|
-
* Fetch main player instance
|
|
2948
|
-
*/
|
|
2949
|
-
declare function useMainPlayer(): Player;
|
|
2950
|
-
|
|
2951
|
-
type SetterFN$1<T, P> = (previous: P) => T;
|
|
2952
|
-
type MetadataDispatch<T> = readonly [() => T, (metadata: T | SetterFN$1<T, T>) => void];
|
|
2953
|
-
/**
|
|
2954
|
-
* Fetch or manipulate guild queue metadata
|
|
2955
|
-
* @param node Guild queue node resolvable
|
|
2956
|
-
*/
|
|
2957
|
-
declare function useMetadata<T = unknown>(): MetadataDispatch<T>;
|
|
2958
|
-
declare function useMetadata<T = unknown>(node: NodeResolvable): MetadataDispatch<T>;
|
|
2959
|
-
|
|
2960
|
-
interface TimelineDispatcherOptions {
|
|
2961
|
-
ignoreFilters: boolean;
|
|
2962
|
-
}
|
|
2963
|
-
/**
|
|
2964
|
-
* Fetch or manipulate current track
|
|
2965
|
-
* @param node Guild queue node resolvable
|
|
2966
|
-
* @param options Options for timeline dispatcher
|
|
2967
|
-
*/
|
|
2968
|
-
declare function useTimeline(node?: NodeResolvable, options?: Partial<TimelineDispatcherOptions>): {
|
|
2969
|
-
readonly timestamp: PlayerTimestamp;
|
|
2970
|
-
readonly volume: number;
|
|
2971
|
-
readonly paused: boolean;
|
|
2972
|
-
readonly track: Track<unknown> | null;
|
|
2973
|
-
pause(): boolean;
|
|
2974
|
-
resume(): boolean;
|
|
2975
|
-
setVolume(vol: number): boolean;
|
|
2976
|
-
setPosition(time: number): Promise<boolean>;
|
|
2977
|
-
} | null;
|
|
2978
|
-
|
|
2979
|
-
/**
|
|
2980
|
-
* Global onAfterCreateStream handler
|
|
2981
|
-
* @param handler The handler callback
|
|
2982
|
-
*/
|
|
2983
|
-
declare function onAfterCreateStream(handler: OnAfterCreateStreamHandler): void;
|
|
2984
|
-
|
|
2985
|
-
/**
|
|
2986
|
-
* Global onBeforeCreateStream handler
|
|
2987
|
-
* @param handler The handler callback
|
|
2988
|
-
*/
|
|
2989
|
-
declare function onBeforeCreateStream(handler: OnBeforeCreateStreamHandler): void;
|
|
2990
|
-
|
|
2991
|
-
type SetterFN = (previous: number) => number;
|
|
2992
|
-
type VolumeDispatch = readonly [() => number, (volume: number | SetterFN) => boolean | undefined];
|
|
2993
|
-
/**
|
|
2994
|
-
* Fetch or manipulate player volume
|
|
2995
|
-
* @param node Guild queue node resolvable
|
|
2996
|
-
*/
|
|
2997
|
-
declare function useVolume(): VolumeDispatch;
|
|
2998
|
-
declare function useVolume(node: NodeResolvable): VolumeDispatch;
|
|
2999
|
-
|
|
3000
|
-
declare const instances: Collection<string, Player>;
|
|
3001
|
-
|
|
3002
|
-
declare const getPlayer: () => Player | null;
|
|
3003
|
-
declare const getQueue: <T = unknown>(node: NodeResolvable) => GuildQueue<T> | null;
|
|
3004
|
-
interface HookDeclarationContext {
|
|
3005
|
-
getQueue: typeof getQueue;
|
|
3006
|
-
getPlayer: typeof getPlayer;
|
|
3007
|
-
instances: typeof instances;
|
|
3008
|
-
}
|
|
3009
|
-
type HookDeclaration<T extends (...args: any[]) => any> = (context: HookDeclarationContext) => T;
|
|
3010
|
-
declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(hook: T): ReturnType<T>;
|
|
3011
|
-
|
|
3012
3019
|
declare const version: string;
|
|
3013
3020
|
|
|
3014
3021
|
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, Context, ContextProviderProps, 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, 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, ResolvedQuery, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, 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 };
|