import { Client, Guild, GuildMember, ChatInputCommandInteraction, User } from "discord.js"; import { VoiceConnection, AudioPlayer, AudioResource } from "@discordjs/voice"; import { TinyEvents } from "../../interfaces/TinyEvents/Events"; import { TypedEmitter } from "tiny-typed-emitter"; import AoP from "../../interfaces/QueueTypes/AoPTypes.js"; import { RelatedTrack } from "../../interfaces/MusicTypes/RelatedTrack.js"; import MusicTypes from "../../interfaces/MusicTypes/MusicTypes"; export interface QueueOptions { youtubeURL?: string; spotifyURL?: string; youtubeTitle?: string; spotifyTitle?: string; spotifyDuration?: string; youtubeDuration?: string; spotifyThumbnail?: string; youtubeThumbnail?: string; author?: string; trackAddedOn?: string; user?: User | GuildMember; durationSeconds: number; /** * The output will be in the seconds form, not in the milliseconds. */ currentTime?: string; relatedTrack?: RelatedTrack; } /** * @since Sunday, 11 December 2022 * @description The player as of now only supports YouTube and Spotify as the main source to play the music. The player requires a client (Mandatory). You have to instantiate a client. */ export declare class Player extends TypedEmitter { player?: AudioPlayer; resource?: AudioResource; connection?: VoiceConnection; stream?: any; isPlaying?: boolean; isPaused?: boolean; loopEnabled?: boolean; isAutoPlayEnabled?: boolean; leaveOnStop?: boolean; /** * @param {Client} client * (Mandatory) */ constructor(client: Client); /** * @default * @module *frix* * @author *TrishCX* * @function *play* *@description The player as of now only supports YouTube and Spotify as the main playing source. * @since Sunday, 11 December 2022 * @param guild The "Guild" property from the discord.js. * @param query The query to play. This can be whether a uri/url or a simple search term. * @param voiceChannelId The voice channel id. * @param type The type, it can be whether a Message or ChatInputCommandInteraction. * @param member The GuildMember field from the discord.js itself. * @example - *__TypeScript__* ```typescript const query = interaction.options.getString("query"); await interaction.deferReply(); const member = await interaction.guild?.members.cache.get( interaction.user.id )!.voice; const m = await interaction.guild?.members.cache.get(interaction.user.id); const guild = interaction?.guild!; await player?.play!( interaction.guild!, `${query}`, `${member?.channel?.id}`, m!, interaction, ); ``` - *__JavaScript__* ```js const query = interaction.options.getString("query"); await interaction.deferReply(); const member = await interaction.guild?.members.cache.get(interaction.user.id).voice; const m = await interaction.guild?.members.cache.get(interaction.user.id); const guild = interaction?.guild; await player?.play(interaction.guild, `${query}`, `${member?.channel?.id}`, interaction, m); ``` * */ play?: ((guild: Guild, query: string, voiceChannelId: string, member: GuildMember, type?: ChatInputCommandInteraction | undefined) => Promise) | undefined; /** *@default @description *Toggles the loop mode.* * @param guild The guild property - (Mandatory) * */ toggleLoop?: ((guild: Guild) => Promise) | undefined; /** *@default @description *Turns the loop mode to on.* * @param guild The guild property - (Mandatory) @deprecated */ loopAdd?: ((guild: Guild) => boolean) | undefined; /** *@default @description *Turns the loop mode to off.* * @param guild The guild property - (Mandatory) @deprecated */ loopRemove?: ((guild: Guild) => boolean) | undefined; /** * @default * @description *Pauses the current playing track* * @throws *{Error}* * @param guild The guild property - (Mandatory) */ pause?: ((guild: Guild) => boolean | Error | undefined) | undefined; /** *@default @description *Seeks/Forwards the songs to xyz seconds.* * @param guild The guild property - (Mandatory) * @param secondsToSeek *Seconds to seek - (Mandatory)* */ seek?: ((guild: Guild, secondsToSeek?: number | undefined) => Promise) | undefined; /** * @default * @description *Resumes the paused track.* * @throws *{EvalError}* * @param guild The guild property - (Mandatory) */ resume?: ((guild: Guild) => Promise) | undefined; /** * @default * @param guild The guild property - (Mandatory) * @param volumePercentage *The volume percentage. - (Mandatory)* * @throws *{EvalError}* */ volume?: ((guild: Guild, volumePercentage?: number | undefined) => Promise) | undefined; /** *@default @description *Clears the queue. (Doesn't destroys the actual queue. Only clears all of the tracks from the track list.)* * @param guild The guild property - (Mandatory) */ clearQueue?: ((guild: Guild) => Promise) | undefined; /** * @default * @description *Leaves the current voice channel that the bot is connected to.* *@param guild The guild property - (Mandatory) */ leaveVoiceChannel: (guild: Guild) => Promise; /** * @default * @description *Connects to the voice channel. That you're connected to..* *@param guild The guild property - (Mandatory) @param voiceChannelId The id of the voice channel. - *(Mandatory)* */ connect?: ((guild: Guild, voiceChannelId?: string | undefined) => Promise) | undefined; /** * * @default *@param guild The guild property - (Mandatory) * @description *Adds a similar track to the current one that is playing.* * @param member The GuildMember property - *(Mandatory)* * */ addRelatedTrack?: ((guild: Guild, member?: User | GuildMember | undefined) => Promise) | undefined; /** * @default * @description *Get the current queue. * *@param guild The guild property - (Mandatory) */ getQueue?: ((guild: Guild) => Promise) | undefined; /** * * @default * @description *Skips the current playing track.* *@param guild The guild property - (Mandatory) * @param type ChatInputCommandInteraction * */ skip?: ((guild: Guild, type?: ChatInputCommandInteraction | undefined) => Promise) | undefined; /** * * @description *Plays the last/previous track again.* * @param guild The guild property - (Mandatory) * @param type Message | ChatInputCommandInteraction - *(Mandatory)* * */ playPrevious?: ((guild: Guild, type?: ChatInputCommandInteraction | undefined) => Promise) | undefined; /** * * @description *Stops the current playing track & will left the voice channel (Only if you specify the "leave value to true.")* * @param guild The guild property - (Mandatory) * @param leave *The boolean value of whether you want the bot to leave the voice channel or not.* * */ stop?: ((guild: Guild, leave?: boolean | undefined) => void) | undefined; /** * * @default * @description *Shuffles the current queue.* * @param guild The guild property - (Mandatory) * */ shuffle?: ((guild: Guild) => MusicTypes[]) | undefined; /** * * @default * @description *Shows the current track information.* @param guild The guild property - (Mandatory) * */ currentTrackInformation?: ((guild: Guild) => Promise) | undefined; /** * @default * @since Saturday, 10 December 2022 * @description The function as of now currently only supports the platform YouTube & Spotify as their main source of fetching data. So aside from YouTube & Spotify no platforms will be supported. * */ getPlaylist?: ((guild: Guild, uri: string, member?: User | GuildMember | undefined) => Promise) | undefined; /** *If you're wondering how you can use this function, and what is the exact use of this function is, then consider check the example below @example ```ts import { Client, ApplicationCommandOptionType } from "discord.js"; import { Player } from "frix"; //Initializing the player. const player = new Player(client) client.on("interactionCreate", async(interaction) => { if (!interaction.isChatInputCommand()) { return; } if(interaction.commandName === "playlist_song_add") { await interaction.deferReply(); const uri = await interaction.options.getString("playlist"); const response = await player.getPlaylist!(interaction.guild!, uri, interaction?.member!); await player.tracksAdd!(interaction?.guild!, response?.tracks!); interaction.followUp({ content: `Added ${response?.list.name} to the current queue.` }) } }) client.on("ready", () => { await client.guilds.cache.get("Your guild id here.")?.commands.set( [{ name: "playlist_song_add", description: "Adds some songs to the queue.", options: [{ name: "playlist", description : "Specify the playlist uri.", type: ApplicationCommandOptionType.String, required: true }] ) } ]) return console.log("The client is now up and ready to go.") }) client.login("Your Bot Token.") ``` @description In order to add tracks to the queue, you have to specify a proper tracks array. */ tracksAdd?: ((guild: Guild, type: ChatInputCommandInteraction, listOfTracks?: MusicTypes[] | undefined) => Promise) | undefined; /** * @default * @description *Jump/Skips to a particular track in the queue.* * @param guild The guild property - (Mandatory) * @param type The type Message/ChatInputCommandInteraction. * @param skipTo The track position to skip/jump on. * */ skipTo?: ((guild: Guild, type: ChatInputCommandInteraction, skipTo?: number | undefined) => Promise) | undefined; /** * @default * @description *Toggles the autoplay mode.* * @param guild The guild property - (Mandatory). * */ toggleAutoPlay?: ((guild: Guild) => Promise) | undefined; /** *@default * @description *Fully destroys the queue.* * @param guild The guild property - (Mandatory). * */ destroyQueue?: ((guild: Guild) => void) | undefined; } //# sourceMappingURL=Frix.d.ts.map