CategoryChannel permission overwrites

export default {
data: new SlashCommandBuilder()
...
.addChannelOption(x => x.setName('channel').setDescription('The category or channel to hide')
.addChannelTypes(ChannelType.GuildCategory, ChannelType.GuildText)),
async execute(client: Client, interaction: ChatInputCommandInteraction) {
const channel = interaction.options.getChannel("channel") || interaction.channel?.id;

channel!.permissionOverwrites.edit(interaction.guild!.id, { ViewChannel: false })
export default {
data: new SlashCommandBuilder()
...
.addChannelOption(x => x.setName('channel').setDescription('The category or channel to hide')
.addChannelTypes(ChannelType.GuildCategory, ChannelType.GuildText)),
async execute(client: Client, interaction: ChatInputCommandInteraction) {
const channel = interaction.options.getChannel("channel") || interaction.channel?.id;

channel!.permissionOverwrites.edit(interaction.guild!.id, { ViewChannel: false })
and error is
11 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Morning
MorningOP3y ago
if i do the check it will show
Morning
MorningOP3y ago
and how it works is user can provide either a channel or category it should work for both. or if none it will be the interaction.channel do i typegaurd the channel or interaction ye had
Jaworek
Jaworek3y ago
u can't mix channel and id
Morning
MorningOP3y ago
removed that later its same .isDMBased() isn't showing up as option for channel btw.
Morning
MorningOP3y ago
Morning
MorningOP3y ago
wait what does adding channel types in option not infer the types ? OH hm that type gaurd doesn't work i wonder if i could assign 2 types to channel in someway
Morning
MorningOP3y ago
it would show this then
Morning
MorningOP3y ago
how fix it up tho..
Morning
MorningOP3y ago
then i need to do that for all of them ??
Morning
MorningOP3y ago
donutCat
Want results from more Discord servers?
Add your server