Handle specific edge case in stop

This commit is contained in:
Essem 2022-01-05 18:55:42 -06:00
parent 3234688929
commit fb0c8ffae1
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ class StopCommand extends MusicCommand {
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.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!";
await manager.leave(this.message.channel.guild.id);
const connection = this.connection.player;