I get an error
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' }); }); }, };
guild.channels.create('new-channel', { type: 'GUILD_TEXT', parent: '1185290034962771998' }); }); }, };
12 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- 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!Codeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes
Inline Code:
`console.log('inline!');` becomes
console.log('inline!');
is it really v14? I was sure the method for
create
removed the positional string for name and put it inside options objectNot to mention channel types are numbers, not strings. Use the enum
I am confused?
Are you using discord.js v14?
let me check
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'
ah I try to understand ur advice thx
I found out what a "enum" is I learned a new word😍 ty