mallusrgreat
mallusrgreat
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by mallusrgreat on 3/9/2024 in #djs-questions
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
4 replies
DIAdiscord.js - Imagine an app
Created by mallusrgreat on 3/8/2024 in #djs-questions
Creating emojis promise doesn't resolve
progress.push("Creating emojis...");
msg?.edit(progress.join("\n"));
try {
await Promise.all(
data.emojis.map(async (emoji, i) => {
return await guild.emojis
.create({
name: emoji.name!,
attachment: emoji.url,
roles: emoji.roles
? Array.from(emoji.roles.cache.values())
: undefined,
reason: "Backup",
})
.then((r) => {
console.log(r);
if (!r) return;
rolesMap.set(emoji.id, r.id);
progress[4] = `Created emojis ${i + 1}/${
data.emojis.length
}.`;
msg?.edit(progress.join("\n"));
})
.catch(console.error);
})
);
progress[4] = "Created all emojis.";
progress.push("Creating roles...");
msg?.edit(progress.join("\n"));
.....
progress.push("Creating emojis...");
msg?.edit(progress.join("\n"));
try {
await Promise.all(
data.emojis.map(async (emoji, i) => {
return await guild.emojis
.create({
name: emoji.name!,
attachment: emoji.url,
roles: emoji.roles
? Array.from(emoji.roles.cache.values())
: undefined,
reason: "Backup",
})
.then((r) => {
console.log(r);
if (!r) return;
rolesMap.set(emoji.id, r.id);
progress[4] = `Created emojis ${i + 1}/${
data.emojis.length
}.`;
msg?.edit(progress.join("\n"));
})
.catch(console.error);
})
);
progress[4] = "Created all emojis.";
progress.push("Creating roles...");
msg?.edit(progress.join("\n"));
.....
For some reason, its stuck at Creating emojis... and r doesn't get logged
6 replies