Mike | Team BG
DIAdiscord.js - Imagine an app
•Created by Mike | Team BG on 12/9/2023 in #djs-questions
Not creating channel overwrites
const rolename = roleToClone.name;
const rolecolor = roleToClone.color;
const roleposition = roleToClone.position;
const rolepermissions = roleToClone.permissions;
const rolementionable = roleToClone.mentionable;
const rolehoist = roleToClone.hoist;
try {
// Clone role
const clonedRole = await interaction.guild.roles.create({
name: rolename,
color: rolecolor,
permissions: rolepermissions,
position: roleposition,
mentionable: rolementionable,
hoist: rolehoist
});
interaction.guild.channels.cache.forEach(async (channel) => {
const existingOverwrites = channel.permissionOverwrites.cache.get(roleToClone.id);
if (existingOverwrites) {
await channel.permissionOverwrites.edit(clonedRole, {
id: channel.id,
allow: existingOverwrites.allow,
deny: existingOverwrites.deny,
});
} else {s
return;
}
});
const rolename = roleToClone.name;
const rolecolor = roleToClone.color;
const roleposition = roleToClone.position;
const rolepermissions = roleToClone.permissions;
const rolementionable = roleToClone.mentionable;
const rolehoist = roleToClone.hoist;
try {
// Clone role
const clonedRole = await interaction.guild.roles.create({
name: rolename,
color: rolecolor,
permissions: rolepermissions,
position: roleposition,
mentionable: rolementionable,
hoist: rolehoist
});
interaction.guild.channels.cache.forEach(async (channel) => {
const existingOverwrites = channel.permissionOverwrites.cache.get(roleToClone.id);
if (existingOverwrites) {
await channel.permissionOverwrites.edit(clonedRole, {
id: channel.id,
allow: existingOverwrites.allow,
deny: existingOverwrites.deny,
});
} else {s
return;
}
});
17 replies