Channel not being created

Bot is not rate limited.
await Promise.all(
data.channels
.filter(
(channel) => "isThread" in channel && !channel?.isThread()
)
.map(async (channel) => {
if (channel.isThread()) return;
return await guild.channels
.create({
name: channel.name,
type: channel.type,
parent: channelsMap.get(channel.parentId!),
permissionOverwrites: Array.from(
channel.permissionOverwrites.cache.values()
).map((v) =>
v.type === OverwriteType.Role
? { ...v, id: rolesMap.get(v.id)! }
: v
),
......
})
.catch(console.error)
.then((ch) => {
console.log("w");
if (!ch) return;
console.log(ch.name);
channelsMap.set(channel.id, ch.id);
});
})
);
progress[6] = "Created all channels";
await Promise.all(
data.channels
.filter(
(channel) => "isThread" in channel && !channel?.isThread()
)
.map(async (channel) => {
if (channel.isThread()) return;
return await guild.channels
.create({
name: channel.name,
type: channel.type,
parent: channelsMap.get(channel.parentId!),
permissionOverwrites: Array.from(
channel.permissionOverwrites.cache.values()
).map((v) =>
v.type === OverwriteType.Role
? { ...v, id: rolesMap.get(v.id)! }
: v
),
......
})
.catch(console.error)
.then((ch) => {
console.log("w");
if (!ch) return;
console.log(ch.name);
channelsMap.set(channel.id, ch.id);
});
})
);
progress[6] = "Created all channels";
The progress[6] gets changed, but nothing is logged. I can also confirm that there are channels in data.channels
2 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
mallusrgreat
mallusrgreat4mo ago
I changed the filter:
.filter((channel) =>
channel.type !== ChannelType.GuildCategory
? !channel?.isThread()
: true
)
.filter((channel) =>
channel.type !== ChannelType.GuildCategory
? !channel?.isThread()
: true
)
but it says channel?.isThread() is not a function nvm i was trying to use that on a channel json