ChannelCreate with my bot TS

DiscordJS: 14.5.0 Node: 16.16.0 (property) Guild.channels: GuildChannelManager | undefined No overload matches this call. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'CategoryChannelResolvable | null | undefined'. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'string | GuildMember | Role | User | Message<boolean> | ThreadMember'. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'string | GuildMember | Role | User | Message<boolean> | ThreadMember'.ts(2769) index.d.ts(4901, 3): The expected type comes from property 'parent' which is declared here on type 'GuildChannelCreateOptions' index.d.ts(2118, 10): The expected type comes from property 'id' which is declared here on type 'OverwriteResolvable' index.d.ts(2118, 10): The expected type comes from property 'id' which is declared here on type 'OverwriteResolvable' the IDs for Category, botrole and the everyone role are saved in a mongoDB
await guild?.channels
.create({
name: `${customId + '-' + ID}`,
type: ChannelType.GuildText,
parent: Data.Category,
permissionOverwrites: [
{
id: member?.id,
allow: ['SendMessages', 'ViewChannel', 'ReadMessageHistory', 'AttachFiles', 'EmbedLinks'],
},
{
id: Data.Everyone,
deny: ['ViewChannel'],
},
{
id: Data.BotRole,
allow: ['ViewChannel', 'SendMessages']
},
]
})
await guild?.channels
.create({
name: `${customId + '-' + ID}`,
type: ChannelType.GuildText,
parent: Data.Category,
permissionOverwrites: [
{
id: member?.id,
allow: ['SendMessages', 'ViewChannel', 'ReadMessageHistory', 'AttachFiles', 'EmbedLinks'],
},
{
id: Data.Everyone,
deny: ['ViewChannel'],
},
{
id: Data.BotRole,
allow: ['ViewChannel', 'SendMessages']
},
]
})
9 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.
monbrey
monbrey2y ago
why is Data.Category type String with a capital? Oh, its a mongoose type isnt it
CanadienDragon
yes
monbrey
monbrey2y ago
Yeah the mongoose String type is not the same as the native string
CanadienDragon
yea there all typed as String in the member?.id im also getting an error saying: Property 'id' does not exist on type 'GuildMember | APIInteractionGuildMember'. Property 'id' does not exist on type 'APIInteractionGuildMember'.
monbrey
monbrey2y ago
You havent typeguarded the interaction as being inCachedGuild()
CanadienDragon
its a button interaction, if (!interaction.isButton()) return; is at the top of it
monbrey
monbrey2y ago
Okay, that doesn't change my answer
d.js docs
d.js docs2y ago
method ButtonInteraction#inCachedGuild() Indicates whether or not this interaction is both cached and received from a guild.