(interaction, config, client)
| 7 | import { InteractionHelper } from '../../../utils/interactionHelper.js'; |
| 8 | export default { |
| 9 | async execute(interaction, config, client) { |
| 10 | const category = interaction.options.getChannel('category'); |
| 11 | const nameTemplate = interaction.options.getString('channel_name') || "{username}'s Room"; |
| 12 | const userLimit = interaction.options.getInteger('user_limit') || 0; |
| 13 | const bitrate = interaction.options.getInteger('bitrate') || 64; |
| 14 | const guildId = interaction.guild.id; |
| 15 | |
| 16 | try { |
| 17 | const triggerChannel = await interaction.guild.channels.create({ |
| 18 | name: 'Join to Create', |
| 19 | type: ChannelType.GuildVoice, |
| 20 | parent: category?.id, |
| 21 | userLimit: userLimit, |
| 22 | bitrate: bitrate * 1000, |
| 23 | permissionOverwrites: [ |
| 24 | { |
| 25 | id: interaction.guild.id, |
| 26 | allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.Connect], |
| 27 | }, |
| 28 | ], |
| 29 | }); |
| 30 | |
| 31 | await addJoinToCreateTrigger(client, guildId, triggerChannel.id, { |
| 32 | nameTemplate: nameTemplate, |
| 33 | userLimit: userLimit, |
| 34 | bitrate: bitrate * 1000, |
| 35 | categoryId: category?.id |
| 36 | }); |
| 37 | |
| 38 | const embed = successEmbed( |
| 39 | `Created trigger channel: ${triggerChannel}\n\n` + |
| 40 | `**Settings:**\n` + |
| 41 | `• Temporary Channel Name Template: \`${nameTemplate}\`\n` + |
| 42 | `• User Limit: ${userLimit === 0 ? 'No limit' : userLimit + ' users'}\n` + |
| 43 | `• Bitrate: ${bitrate} kbps\n` + |
| 44 | `${category ?`• Category: ${category.name}`: '• Category: None (root level)'}\n\n` + |
| 45 | `When users join this channel, a temporary voice channel will be created for them.`, |
| 46 | '✅ Join to Create Setup Complete' |
| 47 | ); |
| 48 | |
| 49 | try { |
| 50 | if (interaction.deferred) { |
| 51 | await InteractionHelper.safeEditReply(interaction, { embeds: [embed] }); |
| 52 | } else { |
| 53 | await InteractionHelper.safeReply(interaction, { embeds: [embed], flags: MessageFlags.Ephemeral }); |
| 54 | } |
| 55 | } catch (responseError) { |
| 56 | logger.error('Error responding to interaction:', responseError); |
| 57 | |
| 58 | try { |
| 59 | if (!interaction.replied) { |
| 60 | await InteractionHelper.safeReply(interaction, { embeds: [embed], flags: MessageFlags.Ephemeral }); |
| 61 | } |
| 62 | } catch (e) { |
| 63 | logger.error('All response attempts failed:', e); |
| 64 | } |
| 65 | } |
| 66 | } catch (error) { |
nothing calls this directly
no test coverage detected