toowake

vc-unlock

Jun 21st, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
  2. const channel = require("../../Schemas.js/jointocreatechannels");
  3. const system = require("../../Schemas.js/jointocreate");
  4.  
  5. module.exports = {
  6. data: new SlashCommandBuilder()
  7. .setName("vc-unlock")
  8. .setDescription("Lock your voice channel"),
  9.  
  10. async execute (interaction, client) {
  11. const data = await channel.findOne({ Guild: interaction.guild.id, User: interaction.user.id});
  12. const sys = await system.findOne({ Guild: interaction.guild.id});
  13. if (!sys) {
  14. return await interaction.reply({ content: "This **[GUILD/SERVER]** doesnt have a join to create system!", ephemeral: true});
  15. } else if (!data) {
  16. return await interaction.reply({ content: "You dont have a valid voice channel in this **[GUILD/SERVER]**!", ephemeral: true});
  17. } else if (data) {
  18. const channelID = data.Channel;
  19. const channel = await interaction.guild.channels.cache.get(`${channelID}`);
  20.  
  21. await channel.edit({
  22. userLimit: 99,
  23. })
  24.  
  25. await interaction.reply({
  26. content: "Your voice channel has been unlocked!",
  27. ephemeral: true
  28. })
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment