Unclaim + Unlock
This commit is contained in:
1 parent
bbeea5db3e
commit
ec955d8dc9
2 files changed
+179
-10
No files matched your search
+166
-4
@@ -118,8 +118,14 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||
.setStyle(supportbot.TicketDeleteColour)
|
||||
.setEmoji(supportbot.TicketDeleteEmoji);
|
||||
|
||||
const ticketUnlockButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketunlock")
|
||||
.setLabel("Unlock")
|
||||
.setStyle(supportbot.TicketUnlockColour)
|
||||
.setEmoji(supportbot.TicketUnlockEmoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
ticketDeleteButton
|
||||
ticketDeleteButton, ticketUnlockButton
|
||||
);
|
||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||
.setTitle("Archived")
|
||||
@@ -130,6 +136,81 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||
interaction.message.edit({ components: [row] });
|
||||
}
|
||||
}
|
||||
if (interaction.customId === "ticketunlock") {
|
||||
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||
interaction.message.fetch();
|
||||
let Admin =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
if (!interaction.member.roles.cache.has(Admin.id)) {
|
||||
return await interaction.reply({
|
||||
content: "You don't have permission to do that.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
let all = interaction.channel.permissionOverwrites.cache;
|
||||
|
||||
let parent =
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.name === supportbot.UnlockTicketCategory
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.id === supportbot.UnlockTicketCategory
|
||||
);
|
||||
if (parent) {
|
||||
await interaction.channel.setParent(parent.id);
|
||||
}
|
||||
|
||||
all.forEach((perm) => {
|
||||
interaction.channel.permissionOverwrites.create(perm.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
});
|
||||
await interaction.channel.permissionOverwrites.create(Admin.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
|
||||
await interaction.channel.permissionOverwrites.create(
|
||||
interaction.guild.id,
|
||||
{
|
||||
VIEW_CHANNEL: false,
|
||||
}
|
||||
);
|
||||
|
||||
const CloseButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji);
|
||||
|
||||
const LockButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketlock")
|
||||
.setLabel("Lock")
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji);
|
||||
|
||||
const TicketClaimButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclaim")
|
||||
.setLabel("Claim")
|
||||
.setStyle(supportbot.TicketClaimColour)
|
||||
.setEmoji(supportbot.TicketClaimEmoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
CloseButton, LockButton, TicketClaimButton
|
||||
);
|
||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||
.setTitle("Unarchived")
|
||||
.setDescription(`Unarchived ${interaction.channel.name}`)
|
||||
.setColor(supportbot.SuccessColour);
|
||||
|
||||
interaction.reply({ embeds: [ArchiveEmbed] });
|
||||
interaction.message.edit({ components: [row] });
|
||||
}
|
||||
}
|
||||
if (interaction.customId === "ticketclaim") {
|
||||
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||
const Staff = await interaction.client.getRole(supportbot.Staff, interaction.guild);
|
||||
@@ -149,13 +230,35 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||
});
|
||||
}
|
||||
let all = interaction.channel.permissionOverwrites.cache;
|
||||
|
||||
|
||||
const ticketUnclaimButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketunclaim")
|
||||
.setLabel("Unclaim")
|
||||
.setStyle(supportbot.TicketUnclaimColour)
|
||||
.setEmoji(supportbot.TicketUnclaimEmoji);
|
||||
|
||||
const CloseButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji);
|
||||
|
||||
const LockButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketlock")
|
||||
.setLabel("Lock")
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
CloseButton, LockButton, ticketUnclaimButton
|
||||
);
|
||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TicketClaimTitle)
|
||||
.setDescription(supportbot.TicketClaimMessage + " <@" + interaction.user.id + ">")
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
interaction.reply({ embeds: [ArchiveEmbed] });
|
||||
interaction.reply({ embeds: [ArchiveEmbed]});
|
||||
interaction.message.edit({ components: [row] });
|
||||
await interaction.channel.permissionOverwrites.edit(Staff.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
SEND_MESSAGES: false,
|
||||
@@ -167,4 +270,63 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (interaction.customId === "ticketunclaim") {
|
||||
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||
const Staff = await interaction.client.getRole(supportbot.Staff, interaction.guild);
|
||||
interaction.message.fetch();
|
||||
let User = interaction.guild.members.cache.get(interaction.user.id);
|
||||
let Admin =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
if (!interaction.member.roles.cache.has(Admin.id)) {
|
||||
return await interaction.reply({
|
||||
content: "You don't have permission to do that.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
let all = interaction.channel.permissionOverwrites.cache;
|
||||
|
||||
const CloseButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji);
|
||||
|
||||
const LockButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketlock")
|
||||
.setLabel("Lock")
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji);
|
||||
|
||||
const TicketClaimButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclaim")
|
||||
.setLabel("Claim")
|
||||
.setStyle(supportbot.TicketClaimColour)
|
||||
.setEmoji(supportbot.TicketClaimEmoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
CloseButton, LockButton, TicketClaimButton
|
||||
);
|
||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TicketUnclaimTitle)
|
||||
.setDescription(supportbot.TicketUnclaimMessage + " <@" + interaction.user.id + ">")
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
interaction.reply({ embeds: [ArchiveEmbed]});
|
||||
interaction.message.edit({ components: [row] });
|
||||
await interaction.channel.permissionOverwrites.edit(Staff.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
}
|
||||
await interaction.channel.permissionOverwrites.edit(interaction.user.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user