Fix voice channel check error

This commit is contained in:
Essem 2022-04-05 19:03:49 -05:00
parent a91c73b5bd
commit c37a8a5fcf
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 5 additions and 5 deletions

View file

@ -53,9 +53,9 @@ export async function connect(client) {
export async function play(client, sound, options, music = false) {
if (!manager) return "The sound commands are still starting up!";
if (!options.channel.guild) return "This command only works in servers!";
if (!options.author.voiceState.channelID) return "You need to be in a voice channel first!";
if (!options.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!options.channel.guild.permissionsOf(client.user.id).has("voiceConnect")) return "I can't join this voice channel!";
const voiceChannel = options.channel.guild.channels.get(options.author.voiceState.channelID);
const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID);
if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return "I don't have permission to join this voice channel!";
const player = players.get(options.channel.guild.id);
if (!music && manager.voiceStates.has(options.channel.guild.id) && (player && player.type === "music")) return "I can't play a sound effect while playing music!";