Fix unlock and lock normal

imgbot
Kieran 2022-08-27 21:25:29 +01:00
parent 0c2f84e013
commit e3ec26e4a3
4 changed files with 44 additions and 48 deletions

View File

@ -1,15 +1,20 @@
const { Client, CommandInteraction, Permissions } = require("discord.js");
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionFlagsBits } = require('discord-api-types/v10');
module.exports = {
name: "lock",
description: "locks a channel",
type: 'CHAT_INPUT',
...new SlashCommandBuilder()
.setName('lock')
.setDescription('Lock a channel')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => {
const permission = interaction.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS)

View File

@ -1,9 +1,13 @@
const { Client, CommandInteraction, Permissions } = require("discord.js");
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionFlagsBits } = require('discord-api-types/v10');
module.exports = {
name: "unlock",
description: "unlocks a channel",
type: 'CHAT_INPUT',
...new SlashCommandBuilder()
.setName('unlock')
.setDescription('Unlock a channel')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
/**
*
* @param {Client} client

View File

@ -1,26 +1,20 @@
const { Client, CommandInteraction, Permissions } = require("discord.js");
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionFlagsBits } = require('discord-api-types/v10');
const { Client, Message, Permissions } = require('discord.js');
module.exports = {
...new SlashCommandBuilder()
.setName('lock')
.setDescription('Lock a channel')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
name: 'lock',
aliases: [''],
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {Message} message
* @param {String[]} args
*/
run: async(client, message, args) => {
run: async (client, interaction, args) => {
const permission = message.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS)
if (!permission)return message.reply({ contents: "You don't have permission to use this command" });
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: false});
interaction.reply("Channel has been locked.")
message.channel.permissionOverwrites.edit(message.guild.roles.everyone.id, {SEND_MESSAGES: false});
},
};
message.channel.send("Channel has been locked.")
}
}

View File

@ -1,25 +1,18 @@
const { Client, CommandInteraction, Permissions } = require("discord.js");
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionFlagsBits } = require('discord-api-types/v10');
const { Client, Message, Permissions } = require('discord.js');
module.exports = {
...new SlashCommandBuilder()
.setName('unlock')
.setDescription('Unlock a channel')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
name: 'unlock',
aliases: [''],
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {Message} message
* @param {String[]} args
*/
run: async (client, interaction, args) => {
run: async(client, message, 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.")
},
};
const permission = message.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS)
if (!permission)return message.reply({ contents: "You don't have permission to use this command" });
message.channel.permissionOverwrites.edit(message.guild.roles.everyone.id, {SEND_MESSAGES: true});
message.channel.send("Channel has been unlocked.")
}
}