I'm trying to create a discord bot with discord.js.
Basically, I would like to create a category and get the id and then create another channel that takes the category as parent but I can't get the id
.
With console.log(tempo1.id)
I get undefined
.
If someone has an idea I am a taker, I have looked and tried all day but nothing conclusive.
Thanks in advance for your help =))
Code:
bot.on('message', message => {
if (message.content === ${prefix}vocal
) {
const tempo1 = guild.channels.create('Channel Tempo', {
type: 'category'
}).then(console.log)
//guild.channels.create('Text Channel Tempo', { type: 'text' })
console.log(`Hello from ${tempo1}!`)
console.log(tempo1.id)
} })
Console Output
Ready!
Hello from [object Promise]!
undefined
CategoryChannel {
type: 'category',
deleted: false,
id: '699377593845022741',
name: 'Channel Tempo',
rawPosition: 9,
parentID: null,
permissionOverwrites: Collection [Map] {},
guild: Guild {
members: GuildMemberManager {
cacheType: [Function: Collection],
cache: [Collection [Map]],
guild: [Circular]
},
channels: GuildChannelManager {
cacheType: [Function: Collection],
cache: [Collection [Map]],
guild: [Circular]
},
roles: RoleManager {
cacheType: [Function: Collection],
cache: [Collection [Map]],
guild: [Circular]
},
presences: PresenceManager {
cacheType: [Function: Collection],
cache: [Collection [Map]]
},
voiceStates: VoiceStateManager {
cacheType: [Function: Collection],
cache: [Collection [Map]],
guild: [Circular]
},
}
}
}