Unclaim + Unlock
This commit is contained in:
1 parent
bbeea5db3e
commit
ec955d8dc9
2 files changed
+179
-10
No files matched your search
+13
-6
@@ -47,10 +47,10 @@ WarningColour: "#fca117"
|
||||
# -------------------------
|
||||
|
||||
AutoRole: true
|
||||
JoinRole: "Member"
|
||||
JoinRole: "SupportBot Member"
|
||||
|
||||
Staff: "Staff"
|
||||
Admin: "Admin"
|
||||
Staff: "SupportBot Staff"
|
||||
Admin: "SupportBot Admin"
|
||||
TicketBlackListRole: "Blacklisted"
|
||||
|
||||
# ----------------------------
|
||||
@@ -140,6 +140,8 @@ TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||
TicketRoleMention: "@here"
|
||||
TicketClaimMessage: "Your ticket will be handled by" #Automaticly tags user to the end
|
||||
TicketClaimTitle: "Ticket Claimed"
|
||||
TicketUnclaimMessage: "Your ticket is now unclaimed by" #Automaticly tags user to the end
|
||||
TicketUnclaimTitle: "Ticket Unclaimed"
|
||||
# To ping a role: <@ROLE_ID>
|
||||
|
||||
MaxAllowedTickets: 2
|
||||
@@ -191,19 +193,19 @@ AllowAllStaff: false
|
||||
|
||||
Departments:
|
||||
- title: "Support"
|
||||
role: "Staff"
|
||||
role: "SupportBot Staff"
|
||||
color: "SECONDARY"
|
||||
emoji: "1️⃣"
|
||||
category: "Tickets"
|
||||
|
||||
- title: "Billing Support"
|
||||
role: "Staff"
|
||||
role: "SupportBot Staff"
|
||||
color: "SECONDARY"
|
||||
emoji: "2️⃣"
|
||||
category: "Tickets"
|
||||
|
||||
- title: "Admin Team"
|
||||
role: "Admin"
|
||||
role: "SupportBot Admin"
|
||||
color: "SECONDARY"
|
||||
emoji: "3️⃣"
|
||||
category: "Tickets"
|
||||
@@ -224,16 +226,21 @@ Departments:
|
||||
# --- Start ---
|
||||
|
||||
LockTicketCategory: "Archive"
|
||||
UnlockTicketCategory: "Tickets" #This moves the ticket back to the main category.
|
||||
|
||||
TicketCloseEmoji: "❌"
|
||||
TicketDeleteEmoji: "⛔"
|
||||
TicketLockEmoji: "🔒"
|
||||
TicketClaimEmoji: "🧑💻"
|
||||
TicketUnlockEmoji: "🔓"
|
||||
TicketUnclaimEmoji: "🧑💻"
|
||||
|
||||
TicketCloseColour: "DANGER"
|
||||
TicketDeleteColour: "DANGER"
|
||||
TicketLockColour: "PRIMARY"
|
||||
TicketClaimColour: "SUCCESS"
|
||||
TicketUnclaimColour: "DANGER"
|
||||
TicketUnlockColour: "SUCCES"
|
||||
|
||||
# Discord Button Colour Selection
|
||||
# PRIMARY - Blue
|
||||
|
||||
+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