fix(arabot): add checkers if user is in vc when server muting

This commit is contained in:
smyalygames 2023-02-11 01:54:10 +00:00
parent c735509f57
commit d7aea2c6c1

View File

@ -85,7 +85,9 @@ export class VCMuteCommand extends Command {
// Check if removing VC Mute // Check if removing VC Mute
if (await checkActive(member.id)) { if (await checkActive(member.id)) {
await removeMute(member.id); await removeMute(member.id);
if (member.voice.channel !== null) {
await member.voice.setMute(false, reason === null ? undefined : reason); await member.voice.setMute(false, reason === null ? undefined : reason);
}
await interaction.reply({ await interaction.reply({
content: `Removed server mute from ${user}`, content: `Removed server mute from ${user}`,
@ -101,7 +103,9 @@ export class VCMuteCommand extends Command {
} }
// Add VC Mute // Add VC Mute
if (member.voice.channel !== null) {
await member.voice.setMute(true, reason === null ? undefined : reason); await member.voice.setMute(true, reason === null ? undefined : reason);
}
await addMute(member.id, mod.id, reason); await addMute(member.id, mod.id, reason);
await interaction.reply({ await interaction.reply({
content: `Server muted ${user}`, content: `Server muted ${user}`,
@ -133,7 +137,9 @@ export class VCMuteCommand extends Command {
// Check if removing VC Mute // Check if removing VC Mute
if (await checkActive(member.id)) { if (await checkActive(member.id)) {
await removeMute(member.id); await removeMute(member.id);
if (member.voice.channel !== null) {
await member.voice.setMute(false, reason === null ? undefined : reason); await member.voice.setMute(false, reason === null ? undefined : reason);
}
await message.reply(`Removed server mute from ${member}`); await message.reply(`Removed server mute from ${member}`);
await message.react('✅'); await message.react('✅');
@ -146,7 +152,9 @@ export class VCMuteCommand extends Command {
} }
// Add VC Mute // Add VC Mute
if (member.voice.channel !== null) {
await member.voice.setMute(true, reason === null ? undefined : reason); await member.voice.setMute(true, reason === null ? undefined : reason);
}
await addMute(member.id, mod.id, reason); await addMute(member.id, mod.id, reason);
await message.reply(`Server muted ${member}`); await message.reply(`Server muted ${member}`);