mg
mg
DIAdiscord.js - Imagine an app
Created by mg on 8/24/2023 in #djs-questions
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}`))


}

}
}
9 replies