Handle specific edge case in stop
This commit is contained in:
parent
3234688929
commit
fb0c8ffae1
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,10 @@ class StopCommand extends MusicCommand {
|
||||||
if (!this.message.channel.guild) return "This command only works in servers!";
|
if (!this.message.channel.guild) return "This command only works in servers!";
|
||||||
if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!";
|
if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!";
|
||||||
if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
|
if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
|
||||||
|
if (!this.connection) {
|
||||||
|
await manager.leave(this.message.channel.guild.id);
|
||||||
|
return "🔊 The current voice channel session has ended.";
|
||||||
|
}
|
||||||
if (this.connection.host !== this.message.author.id && !this.message.member.permissions.has("manageChannels")) return "Only the current voice session host can stop the music!";
|
if (this.connection.host !== this.message.author.id && !this.message.member.permissions.has("manageChannels")) return "Only the current voice session host can stop the music!";
|
||||||
await manager.leave(this.message.channel.guild.id);
|
await manager.leave(this.message.channel.guild.id);
|
||||||
const connection = this.connection.player;
|
const connection = this.connection.player;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue