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

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;