mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-15 05:36:54 +00:00
28 lines
873 B
JavaScript
28 lines
873 B
JavaScript
|
|
const { checkRole } = require('./verify.js');
|
||
|
|
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
name: 'unlock',
|
||
|
|
description: 'Unlock a channel',
|
||
|
|
execute(message, args, Discord, Client, bot) {
|
||
|
|
const guild = bot.guilds.cache.get(message.guild.id);
|
||
|
|
|
||
|
|
if (!checkRole(bot, guild, message.author.id)) { return message.reply('Insufficient Permissions!'); }
|
||
|
|
|
||
|
|
var channel;
|
||
|
|
if (args[0]) {
|
||
|
|
channel = guild.channels.cache.find(channel => channel.name.toLowerCase() === args[0]);
|
||
|
|
} else {
|
||
|
|
channel = message.channel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!channel) { return message.reply("This channel does not exist!"); }
|
||
|
|
|
||
|
|
channel.permissionOverwrites.edit(message.guild.roles.everyone.id, {
|
||
|
|
VIEW_CHANNEL: true,
|
||
|
|
SEND_MESSAGES: true,
|
||
|
|
READ_MESSAGE_HISTORY: true,
|
||
|
|
ATTACH_FILES: true
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|