diff --git a/src/commands/createVC.js b/src/commands/createVC.js index 19d905a..ce2d5c0 100644 --- a/src/commands/createVC.js +++ b/src/commands/createVC.js @@ -3,18 +3,30 @@ const {MessageEmbed, Guild} = require('discord.js') module.exports = { data: new SlashCommandBuilder() - .setName('vc') - .setDescription('create new voice channel.'), + .setName("vc") + .setDescription("create new voice channel.") + .addStringOption(option => + option.setName("vcname") + .setDescription("Enter your channel Name.") + .setRequired(false)), async execute(interaction) { - const newChannelName = `${interaction.member.displayName}'s Channel` + var selectedVCName = interaction.options.getString("vcname") + var newChannelName = `${interaction.member.displayName}'s Channel` + + if (selectedVCName) { + newChannelName = selectedVCName + } + interaction.guild.channels.create(`${newChannelName}`, { type: 'GUILD_VOICE', - parent: '589107550520082591', + parent: process.env.PARENT_CHANNEL_ID, permissionOverwrites: [{ id: interaction.member.user, allow: ['MANAGE_CHANNELS'] }] }) - interaction.reply("Your channel is created.\nYou have all the rights to modify the channel.\nThe channel is automatically deleted after the last user has left it.") + + var replyMsg = "Your channel is created.\nYou have all the rights to modify the channel.\nThe channel is automatically deleted after the last user has left it."; + await interaction.reply({ content: replyMsg, ephemeral: true }); } } \ No newline at end of file