Add Song.requestedBy usage and remove example (#18)

Co-Authored-By: Androz <androz2091@gmail.com>
This commit is contained in:
Thomas 2020-04-26 16:07:56 +01:00 committed by GitHub
parent 7bde7bfbe3
commit 33a92434c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,6 +65,8 @@ client.player.clearQueue(guildID);
client.player.getQueue(guildID);
// Skip the current song
client.player.skip(guildID);
// Remove a song from the queue using the index number
client.player.remove(guildID, song);
// Pause
@ -110,7 +112,7 @@ To play a song, use the `client.player.play()` function.
**Usage:**
```js
client.player.play(voiceChannel, songName);
client.player.play(voiceChannel, songName, requestedBy);
```
**Example**:
@ -124,8 +126,8 @@ client.on('message', async (message) => {
// will play "Despacito" in the member voice channel
if(command === 'play'){
let song = await client.player.play(message.member.voice.channel, args[0])
message.channel.send(`Currently playing ${song.name}!`);
let song = await client.player.play(message.member.voice.channel, args[0], message.member.user.tag);
message.channel.send(`Currently playing ${song.name}! - Requested by ${song.requestedBy}`);
}
```
@ -424,6 +426,32 @@ client.on('message', async (message) => {
});
```
### Remove
To remove a song from the queue, use the `client.player.remove()` function.
**Usage:**
```js
client.player.remove(guildID, song);
```
**Example:**
```js
client.on('message', async (message) => {
const args = message.content.slice(settings.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if(command === 'remove'){
// Removes a song from the queue
client.player.remove(message.guild.id, args[0]).then(() => {
message.channel.send('Removed song!');
});
}
});
```
## Info Messages
You can send a message when the queue ends or when the song changes:
@ -487,4 +515,3 @@ These bots are made by the community, they can help you build your own!
* [Discord-Music](https://github.com/hydraindia/discord-music) by [hydraindia](https://github.com/hydraindia)
* [Music-bot](https://github.com/ZerioDev/Music-bot) by [ZerioDev](https://github.com/ZerioDev)