0% found this document useful (0 votes)
9 views1 page

Discord Bot Voice Channel Lock Script

The document is a Discord bot command that checks if the bot has permission to manage voice channels. If the user is not in a voice channel or lacks the necessary permissions, it returns an error message. If permissions are granted, it locks the voice channel by preventing the '@everyone' role from connecting to it and confirms the action to the user.

Uploaded by

Lovekesh Solanki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Discord Bot Voice Channel Lock Script

The document is a Discord bot command that checks if the bot has permission to manage voice channels. If the user is not in a voice channel or lacks the necessary permissions, it returns an error message. If permissions are granted, it locks the voice channel by preventing the '@everyone' role from connecting to it and confirms the action to the user.

Uploaded by

Lovekesh Solanki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

const Discord = require('discord.

js');

module.exports = async (client, interaction, args) => {


const perms = await client.checkBotPerms({
flags: [Discord.PermissionsBitField.Flags.ManageChannels],
perms: [Discord.PermissionsBitField.Flags.ManageChannels]
}, interaction)

if (perms == false) return;

const channel = interaction.member.voice.channel;


if (!channel) return client.errNormal({
error: `You're not in a voice channel!`,
type: 'editreply'
}, interaction);

var checkVoice = await client.checkVoice(interaction.guild, channel);


if (!checkVoice) {
return client.errNormal({
error: `You cannot edit this channel!`,
type: 'editreply'
}, interaction);
} else {
client.succNormal({
text: `The channel was succesfully locked!`,
fields: [
{
name: `📘┆Channel`,
value: `${channel} (${channel.name})`
}
],
type: 'editreply'
}, interaction);

channel.permissionOverwrites.edit(interaction.guild.roles.cache.find(x =>
x.name === '@everyone'), {
Connect: false
});
}
}

You might also like