From 4f9f79ccadbc337bd40c1d02d09764f6537be238 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sun, 12 Jan 2020 12:25:25 +0100 Subject: [PATCH] Remove table of content and add examples --- README.md | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 68351dc..acaf9da 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,6 @@ Discord Player is a powerful [Node.js](https://nodejs.org) module that allows you to easily implement music commands. **Everything** is customizable, and everything is done to simplify your work **without limiting you**! -- [Installation](#installation) -- [Player](#player) - - [Play](#play) - - [Pause](#pause) - - [Resume](#resume) - - [Stop](#stop) - - [SetVolume](#setvolume) - - [AddToQueue](#addtoqueue) - - [ClearQueue](#clearqueue) - - [GetQueue](#getqueue) -- [Info Messages](#info-messages) -- [Handle errors](#handle-errors) - ## Installation ```sh @@ -61,6 +48,43 @@ You can pass a third parameter when instantiating the class Player: the **option **options.leaveOnEnd**: whether the bot should leave the voice channel when there is no more song in the queue. **options.leaveOnStop**: whether the bot should leave the voice channel when the `stop()` function is used. +### Features Overview + +You need to **init the guild queue using the play() function**, then you are able to manage the queue using the following functions: + +```js +// Play a song in the voice channel and init the guild queue +client.player.play(voiceChannel, songName); +// Add a song to the queue +client.player.addToQueue(guildID, songName); +// Clear the queue +client.player.clearQueue(guildID); +// Get the queue +client.player.getQueue(guildID); +// Pause +client.player.pause(guildID); +// Resume +client.player.resume(guildID); +// Stop +client.player.stop(guildID); +// Check if music is playing in a guild +client.player.isPlaying(guildID); +``` + +### Event messages + +```js +client.player.getQueue(guildID) +.on('end', () => { + message.channel.send('There is no more music in the queue!'); +}) +.on('songChanged', (oldSong, newSong) => { + message.channel.send(`Now playing ${newSong.name}...`); +}); +``` + +## Examples + ### Play To play a song, use the `client.player.play()` function.