changes to tickets
diff --git a/src/automations/tickets/create.ts b/src/automations/tickets/create.ts
index 1fd743b..fd0ae57 100644
--- a/src/automations/tickets/create.ts
+++ b/src/automations/tickets/create.ts
@@ -118,6 +118,11 @@
allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
type: "member"
}] as Discord.OverwriteResolvable[];
+ overwrites.push({
+ id: interaction.guild.roles.everyone,
+ deny: ["VIEW_CHANNEL"],
+ type: "role"
+ })
if (config.tickets.supportRole != null) {
overwrites.push({
id: interaction.guild.roles.cache.get(config.tickets.supportRole),
diff --git a/src/automations/tickets/delete.ts b/src/automations/tickets/delete.ts
index 8feeb4b..32315bc 100644
--- a/src/automations/tickets/delete.ts
+++ b/src/automations/tickets/delete.ts
@@ -9,10 +9,10 @@
let config = await readConfig(interaction.guild.id);
let channel = (interaction.channel as Discord.TextChannel)
- if (config.tickets.category != channel.parent.id) {
+ if (!channel.parent || config.tickets.category != channel.parent.id) {
return interaction.reply({embeds: [new generateEmojiEmbed()
.setTitle("Close Ticket")
- .setDescription("This ticket is not in your tickets category, so cannot be deleted.")
+ .setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.") // TODO bridge to cross later!
.setStatus("Danger")
.setEmoji("CONTROL.BLOCKCROSS")
], ephemeral: true});
@@ -56,7 +56,26 @@
.setEmoji("GUILD.TICKET.ARCHIVED")
]});
setTimeout(async () =>{
- channel.permissionsFor(await interaction.guild.members.fetch(channel.topic.split(" ")[0])).remove("VIEW_CHANNEL");
+ let overwrites = [
+ {
+ id: channel.topic.split(" ")[0],
+ deny: ["VIEW_CHANNEL"],
+ type: "member"
+ },
+ {
+ id: interaction.guild.id,
+ deny: ["VIEW_CHANNEL"],
+ type: "role"
+ }
+ ] as Discord.OverwriteResolvable[];
+ if (config.tickets.supportRole != null) {
+ overwrites.push({
+ id: interaction.guild.roles.cache.get(config.tickets.supportRole),
+ allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
+ type: "role"
+ })
+ }
+ channel.edit({permissionOverwrites: overwrites})
channel.setTopic(`${channel.topic.split(" ")[0]} Archived`);
let data = {
meta:{
@@ -98,6 +117,7 @@
let config = await readConfig(guild.id);
if (!config.tickets.category) return;
let tickets = guild.channels.cache.get(config.tickets.category);
+ if (!tickets) return;
let ticketChannels = tickets.children;
let deleted = 0
ticketChannels.forEach(element => {