mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 21:24:59 +05:00
97 lines
3.7 KiB
TypeScript
97 lines
3.7 KiB
TypeScript
|
import { Client, Collection, GuildResolvable } from "discord.js";
|
||
|
import { TypedEmitter as EventEmitter } from "tiny-typed-emitter";
|
||
|
import { Queue } from "./Structures/Queue";
|
||
|
import { VoiceUtils } from "./VoiceInterface/VoiceUtils";
|
||
|
import { PlayerEvents, PlayerOptions, SearchOptions, PlayerInitOptions, PlayerSearchResult, PlaylistInitData } from "./types/types";
|
||
|
import Track from "./Structures/Track";
|
||
|
import { Playlist } from "./Structures/Playlist";
|
||
|
import { ExtractorModel } from "./Structures/ExtractorModel";
|
||
|
declare class Player extends EventEmitter<PlayerEvents> {
|
||
|
readonly client: Client;
|
||
|
readonly options: PlayerInitOptions;
|
||
|
readonly queues: Collection<string, Queue<unknown>>;
|
||
|
readonly voiceUtils: VoiceUtils;
|
||
|
readonly extractors: Collection<string, ExtractorModel>;
|
||
|
requiredEvents: string[];
|
||
|
/**
|
||
|
* Creates new Discord Player
|
||
|
* @param {Client} client The Discord Client
|
||
|
* @param {PlayerInitOptions} [options] The player init options
|
||
|
*/
|
||
|
constructor(client: Client, options?: PlayerInitOptions);
|
||
|
/**
|
||
|
* Handles voice state update
|
||
|
* @param {VoiceState} oldState The old voice state
|
||
|
* @param {VoiceState} newState The new voice state
|
||
|
* @returns {void}
|
||
|
* @private
|
||
|
*/
|
||
|
private _handleVoiceState;
|
||
|
/**
|
||
|
* Creates a queue for a guild if not available, else returns existing queue
|
||
|
* @param {GuildResolvable} guild The guild
|
||
|
* @param {PlayerOptions} queueInitOptions Queue init options
|
||
|
* @returns {Queue}
|
||
|
*/
|
||
|
createQueue<T = unknown>(guild: GuildResolvable, queueInitOptions?: PlayerOptions & {
|
||
|
metadata?: T;
|
||
|
}): Queue<T>;
|
||
|
/**
|
||
|
* Returns the queue if available
|
||
|
* @param {GuildResolvable} guild The guild id
|
||
|
* @returns {Queue}
|
||
|
*/
|
||
|
getQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
|
||
|
/**
|
||
|
* Deletes a queue and returns deleted queue object
|
||
|
* @param {GuildResolvable} guild The guild id to remove
|
||
|
* @returns {Queue}
|
||
|
*/
|
||
|
deleteQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
|
||
|
/**
|
||
|
* @typedef {object} PlayerSearchResult
|
||
|
* @property {Playlist} [playlist] The playlist (if any)
|
||
|
* @property {Track[]} tracks The tracks
|
||
|
*/
|
||
|
/**
|
||
|
* Search tracks
|
||
|
* @param {string|Track} query The search query
|
||
|
* @param {SearchOptions} options The search options
|
||
|
* @returns {Promise<PlayerSearchResult>}
|
||
|
*/
|
||
|
search(query: string | Track, options: SearchOptions): Promise<PlayerSearchResult>;
|
||
|
/**
|
||
|
* Registers extractor
|
||
|
* @param {string} extractorName The extractor name
|
||
|
* @param {ExtractorModel|any} extractor The extractor object
|
||
|
* @param {boolean} [force=false] Overwrite existing extractor with this name (if available)
|
||
|
* @returns {ExtractorModel}
|
||
|
*/
|
||
|
use(extractorName: string, extractor: ExtractorModel | any, force?: boolean): ExtractorModel;
|
||
|
/**
|
||
|
* Removes registered extractor
|
||
|
* @param {string} extractorName The extractor name
|
||
|
* @returns {ExtractorModel}
|
||
|
*/
|
||
|
unuse(extractorName: string): ExtractorModel;
|
||
|
/**
|
||
|
* Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
scanDeps(): string;
|
||
|
emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
|
||
|
/**
|
||
|
* Resolves queue
|
||
|
* @param {GuildResolvable|Queue} queueLike Queue like object
|
||
|
* @returns {Queue}
|
||
|
*/
|
||
|
resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
|
||
|
[Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
|
||
|
/**
|
||
|
* Creates `Playlist` instance
|
||
|
* @param data The data to initialize a playlist
|
||
|
*/
|
||
|
createPlaylist(data: PlaylistInitData): Playlist;
|
||
|
}
|
||
|
export { Player };
|