How to create a channel ?
I wrote some codes but it always shows
But i defined it at first.like
Cannot read properties of undefined (reading 'guilds')
Cannot read properties of undefined (reading 'guilds')
const { SlashCommandBuilder,PermissionFlagsBits } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('create')
.setDescription('add'),
async execute(interaction,client) {
const { guildId } = require('../../config/main/config.json');
client.guilds.cache
.get(guildId)
.channels.create({
name: 'testticket',
reason: 'ticket',
permissionOverwrites: [
{
id: interaction.guild.roles.everyone,
deny: [PermissionFlagsBits.ViewChannel],
},
],
})
.fetch();
const newchannel = channel.id;
await interaction.reply(` ${interaction.user.username} created a ticket at<#${newchannel}>`);
},
};
const { SlashCommandBuilder,PermissionFlagsBits } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('create')
.setDescription('add'),
async execute(interaction,client) {
const { guildId } = require('../../config/main/config.json');
client.guilds.cache
.get(guildId)
.channels.create({
name: 'testticket',
reason: 'ticket',
permissionOverwrites: [
{
id: interaction.guild.roles.everyone,
deny: [PermissionFlagsBits.ViewChannel],
},
],
})
.fetch();
const newchannel = channel.id;
await interaction.reply(` ${interaction.user.username} created a ticket at<#${newchannel}>`);
},
};
2 Replies
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
thanks
ā¤ļø