Discord refusing to add user to channel when channel is moved to another category

Im honestly not even sure what to do anymore iv tried a lot of different methods and none seem to work. In short i have a escelate command for my ticket system, It mvoes the ticket, sends the messages, however it removes the user from the channel whenever moved to another category. I tried to get around this by re adding the user and well, it does not work. Any help is greatly appreciated
const {
SlashCommandBuilder,
StringSelectMenuBuilder,
ActionRowBuilder,
StringSelectMenuOptionBuilder,
ButtonBuilder,
EmbedBuilder,
ButtonStyle
} = require("discord.js")
const { PermissionFlagsBits } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName("escelate")
.setDescription("Escelate this Ticket")
.addStringOption(option =>
option.setName("category")
.setDescription("You category you would like to escelate to.")
.setRequired(true)
.addChoices(
{ name: "Admin", value: "admin" },
{ name: "Management", value: "management"}
)
)
.addUserOption((option) =>
option
.setName(`escelate`)
.setRequired(true)
.setDescription(`The user you would like to escelate this ticket for`)
),
async execute(interaction, client) {

const category = interaction.options.getString("category");
const user = interaction.options.getUser("escelate");
const added = await interaction.guild.members.fetch(user.id);

if (category === `admin`) {
label = `Admin Required`;
}

let embed = new EmbedBuilder()
.setDescription(
`This ticket has now been escelated! Please Wait for a responce from an Admin`
)

.addFields([
{
name: `🪪 Escelated By`,
value: `${interaction.user.id} (${interaction.user.username})`
},
{
name: `🟠 Status`,
value: `${label}`,
},
]);

if(category === "admin") {
interaction.channel.setParent("1143313705682083920");

interaction.channel.send({
embeds: [embed],
content: `<@&977979177728876614>`, // <@&977986400521707520>
});

interaction.channel.permissionOverwrites.edit(added, {
ViewChannel: true,
SendMessages: true,
}).then(console.log(`Added ${user.id}`))


}

}
}
const {
SlashCommandBuilder,
StringSelectMenuBuilder,
ActionRowBuilder,
StringSelectMenuOptionBuilder,
ButtonBuilder,
EmbedBuilder,
ButtonStyle
} = require("discord.js")
const { PermissionFlagsBits } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName("escelate")
.setDescription("Escelate this Ticket")
.addStringOption(option =>
option.setName("category")
.setDescription("You category you would like to escelate to.")
.setRequired(true)
.addChoices(
{ name: "Admin", value: "admin" },
{ name: "Management", value: "management"}
)
)
.addUserOption((option) =>
option
.setName(`escelate`)
.setRequired(true)
.setDescription(`The user you would like to escelate this ticket for`)
),
async execute(interaction, client) {

const category = interaction.options.getString("category");
const user = interaction.options.getUser("escelate");
const added = await interaction.guild.members.fetch(user.id);

if (category === `admin`) {
label = `Admin Required`;
}

let embed = new EmbedBuilder()
.setDescription(
`This ticket has now been escelated! Please Wait for a responce from an Admin`
)

.addFields([
{
name: `🪪 Escelated By`,
value: `${interaction.user.id} (${interaction.user.username})`
},
{
name: `🟠 Status`,
value: `${label}`,
},
]);

if(category === "admin") {
interaction.channel.setParent("1143313705682083920");

interaction.channel.send({
embeds: [embed],
content: `<@&977979177728876614>`, // <@&977986400521707520>
});

interaction.channel.permissionOverwrites.edit(added, {
ViewChannel: true,
SendMessages: true,
}).then(console.log(`Added ${user.id}`))


}

}
}
7 Replies
d.js toolkit
d.js toolkit•10mo 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!
mg
mg•10mo ago
node -v = v18.16.1 14.13.0
treble/luna
treble/luna•10mo ago
your issue likely is because its syncing its perms with the category
d.js docs
d.js docs•10mo ago
method TextChannel#setParent() Sets the parent of this channel.
treble/luna
treble/luna•10mo ago
the second argument takes a SetParentOptions
mg
mg•10mo ago
I honestly didnt see this before, lack of sleep does that haha, thanks
treble/luna
treble/luna•10mo ago
no worries also you never resolve any promises in the above code so that would likely also be an issue