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 docs2y 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
Morning2y ago
if i do the check it will show
Morning
Morning2y 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
Jaworek2y ago
u can't mix channel and id
Morning
Morning2y ago
removed that later its same .isDMBased() isn't showing up as option for channel btw.
Morning
Morning2y ago
Morning
Morning2y 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
Morning2y ago
it would show this then
Morning
Morning2y ago
how fix it up tho..
Morning
Morning2y ago
then i need to do that for all of them ??
Morning
Morning2y ago
donutCat
Want results from more Discord servers?
Add your server
More Posts