parent
7416662b1b
commit
a2f2057d6a
2 changed files with 8 additions and 3 deletions
|
@ -56,6 +56,7 @@ const filters = {
|
||||||
/**
|
/**
|
||||||
* @typedef PlayerOptions
|
* @typedef PlayerOptions
|
||||||
* @property {boolean} [leaveOnEnd=true] Whether the bot should leave the current voice channel when the queue ends.
|
* @property {boolean} [leaveOnEnd=true] Whether the bot should leave the current voice channel when the queue ends.
|
||||||
|
* @property {number} [leaveOnEndCooldown=0] Used when leaveOnEnd is enabled, to let the time to users to add new tracks.
|
||||||
* @property {boolean} [leaveOnStop=true] Whether the bot should leave the current voice channel when the stop() function is used.
|
* @property {boolean} [leaveOnStop=true] Whether the bot should leave the current voice channel when the stop() function is used.
|
||||||
* @property {boolean} [leaveOnEmpty=true] Whether the bot should leave the voice channel if there is no more member in it.
|
* @property {boolean} [leaveOnEmpty=true] Whether the bot should leave the voice channel if there is no more member in it.
|
||||||
* @property {number} [leaveOnEmptyCooldown=0] Used when leaveOnEmpty is enabled, to let the time to users to come back in the voice channel.
|
* @property {number} [leaveOnEmptyCooldown=0] Used when leaveOnEmpty is enabled, to let the time to users to come back in the voice channel.
|
||||||
|
@ -717,9 +718,12 @@ class Player extends EventEmitter {
|
||||||
// If there isn't next music in the queue
|
// If there isn't next music in the queue
|
||||||
if (queue.tracks.length === 1 && !queue.repeatMode && !firstPlay) {
|
if (queue.tracks.length === 1 && !queue.repeatMode && !firstPlay) {
|
||||||
// Leave the voice channel
|
// Leave the voice channel
|
||||||
if (this.options.leaveOnEnd && !queue.stopped) queue.voiceConnection.channel.leave()
|
if (this.options.leaveOnEnd && !queue.stopped) {
|
||||||
// Remove the guild from the guilds list
|
setTimeout(() => {
|
||||||
this.queues.delete(queue.guildID)
|
queue.voiceConnection.channel.leave()
|
||||||
|
// Remove the guild from the guilds list
|
||||||
|
this.queues.delete(queue.guildID)
|
||||||
|
}, this.options.leaveOnEndCooldown || 0)
|
||||||
// Emit stop event
|
// Emit stop event
|
||||||
if (queue.stopped) {
|
if (queue.stopped) {
|
||||||
return this.emit('musicStop')
|
return this.emit('musicStop')
|
||||||
|
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
|
@ -47,6 +47,7 @@ declare module 'discord-player' {
|
||||||
}
|
}
|
||||||
interface PlayerOptions {
|
interface PlayerOptions {
|
||||||
leaveOnEnd: boolean;
|
leaveOnEnd: boolean;
|
||||||
|
leaveOnEndCooldown?: number;
|
||||||
leaveOnStop: boolean;
|
leaveOnStop: boolean;
|
||||||
leaveOnEmpty: boolean;
|
leaveOnEmpty: boolean;
|
||||||
leaveOnEmptyCooldown?: number;
|
leaveOnEmptyCooldown?: number;
|
||||||
|
|
Loading…
Reference in a new issue