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' }); }); }, };
No description
12 Replies
d.js toolkit
d.js toolkit3mo ago
- 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!
d.js docs
d.js docs3mo ago
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
pat
pat3mo ago
is it really v14? I was sure the method for create removed the positional string for name and put it inside options object
d.js docs
d.js docs3mo ago
: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);
// Create a new text channel
guild.channels.create({ name: 'new-general', reason: 'Needed a cool new channel' })
.then(console.log)
.catch(console.error);
treble/luna
treble/luna3mo ago
Not to mention channel types are numbers, not strings. Use the enum
d.js docs
d.js docs3mo ago
:dtypes: v10: ChannelType read more
Nicolas Matheisen
I am confused?
pat
pat3mo ago
Are you using discord.js v14?
Nicolas Matheisen
let me check
pat
pat3mo ago
guild.channels.create('new-channel', {
type: 'GUILD_TEXT',
parent: '1185290034962771998'
});
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'
Nicolas Matheisen
ah I try to understand ur advice thx I found out what a "enum" is I learned a new word😍 ty
Want results from more Discord servers?
Add your server