#I get an error

15 messages · Page 1 of 1 (latest)

zealous flare
#

const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, EmbedBuilder, ChannelType, Permissions} = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('hallo')
.setDescription('Begrüßungsnachricht'),
async execute(interaction) {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('unique-id')
.setLabel('Click Me')
.setStyle(1)
);

    const embed = new EmbedBuilder()
        .setColor('#0099ff')
        .setTitle('Welcome!')
        .setDescription('This is a welcome message with an embedded button.');

    await interaction.reply({ content: 'Hello!', embeds: [embed], components: [row] });

    const filter = i => i.customId === 'unique-id' && i.user.id === interaction.user.id;
    const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });

    collector.on('collect', async () => {

const guild = interaction.guild;
const category = guild.channels.cache.find(c => c.type === 'GUILD_CATEGORY' && c.name === 'Bot-Developing');

    guild.channels.create('new-channel', {
        type: 'GUILD_TEXT',
        parent: '1185290034962771998'
    });
    });
},

};

green sequoiaBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
sand nebulaBOT
#

Codeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes

const Discord = require("discord.js"); 
// further code

Inline Code:
`console.log('inline!');` becomes console.log('inline!');

eternal quarry
sand nebulaBOT
#

method GuildChannelManager#create @14.15.3
Creates a new channel in the guild.

// Create a new text channel
guild.channels.create({ name: 'new-general', reason: 'Needed a cool new channel' })
  .then(console.log)
  .catch(console.error);

lime urchin
#

Not to mention channel types are numbers, not strings. Use the enum

sand nebulaBOT
zealous flare
#

I am confused?

eternal quarry
zealous flare
#

let me check

eternal quarry
#
guild.channels.create('new-channel', {
  type: 'GUILD_TEXT',
  parent: '1185290034962771998'
});

if yes, this is wrong, you should move 'new-channel' inside the object as the name property

#

The error says you are not providing a name for the channel

#

and like the other person said you need to use the ChannelType enum instead of 'GUILD_TEXT'

zealous flare
zealous flare