hullcss-discord-bot/SlashCommands/admin/unlock.js

25 lines
1021 B
JavaScript
Raw Normal View History

2022-07-25 20:33:58 +01:00
const { Client, CommandInteraction, Permissions } = require("discord.js");
2022-08-27 21:25:29 +01:00
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionFlagsBits } = require('discord-api-types/v10');
2022-07-25 20:33:58 +01:00
module.exports = {
2022-08-27 21:25:29 +01:00
...new SlashCommandBuilder()
.setName('unlock')
.setDescription('Unlock a channel')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
2022-07-25 20:33:58 +01:00
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => {
const permission = interaction.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS)
if (!permission)return interaction.reply({ contents: "You don't have permission to use this command", ephemeral: true });
interaction.channel.permissionOverwrites.edit(interaction.guild.roles.everyone.id, {SEND_MESSAGES: true});
interaction.reply("Channel has been unlocked.")
},
};