remove subcommands - make it easy

This commit is contained in:
Nico Jensen 2022-01-24 15:23:32 +01:00
parent 83b370c1c4
commit 776280769c

View File

@ -4,36 +4,17 @@ const {MessageEmbed, Guild} = require('discord.js')
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('vc') .setName('vc')
.setDescription('create new voice channel') .setDescription('create new voice channel.'),
.addSubcommand(subCcommand => subCcommand.setName('Create').setDescription('Create new Voice Channel'))
.addSubcommand(subCcommand => subCcommand.setName('Rename').setDescription('Rename Voice Channel'))
.addSubcommand(subCcommand => subCcommand.setName('Delete').setDescription('Delete Voice Channel')),
async execute(interaction) { async execute(interaction) {
switch(interaction.options.getSubcommand()) { const newChannelName = `${interaction.member.displayName}'s Channel`
case 'Create': { interaction.guild.channels.create(`${newChannelName}`, {
const newChannelName = `${interaction.member.displayName}'s Channel` type: 'GUILD_VOICE',
interaction.guild.channels.create(`${newChannelName}`, { parent: '589107550520082591',
type: 'GUILD_VOICE', permissionOverwrites: [{
parent: '589107550520082591', id: interaction.member.user,
permissionOverwrites: [{ allow: ['MANAGE_CHANNELS']
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.")
})
await Tags.create({
name: interaction.guild.channels.getId(`${newChannelName}`),
description: 'channelID',
username: interaction.user.username,
})
break
}
case 'Rename': {
break
}
case 'Delete': {
break
}
}
} }
} }