Unclaim + Unlock
This commit is contained in:
1 parent
bbeea5db3e
commit
ec955d8dc9
2 files changed
+178
-9
No files matched your search
+13
-6
@@ -47,10 +47,10 @@ WarningColour: "#fca117"
|
|||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
AutoRole: true
|
AutoRole: true
|
||||||
JoinRole: "Member"
|
JoinRole: "SupportBot Member"
|
||||||
|
|
||||||
Staff: "Staff"
|
Staff: "SupportBot Staff"
|
||||||
Admin: "Admin"
|
Admin: "SupportBot Admin"
|
||||||
TicketBlackListRole: "Blacklisted"
|
TicketBlackListRole: "Blacklisted"
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
@@ -140,6 +140,8 @@ TicketBlackListMessage: "You are not allowed to open a ticket"
|
|||||||
TicketRoleMention: "@here"
|
TicketRoleMention: "@here"
|
||||||
TicketClaimMessage: "Your ticket will be handled by" #Automaticly tags user to the end
|
TicketClaimMessage: "Your ticket will be handled by" #Automaticly tags user to the end
|
||||||
TicketClaimTitle: "Ticket Claimed"
|
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>
|
# To ping a role: <@ROLE_ID>
|
||||||
|
|
||||||
MaxAllowedTickets: 2
|
MaxAllowedTickets: 2
|
||||||
@@ -191,19 +193,19 @@ AllowAllStaff: false
|
|||||||
|
|
||||||
Departments:
|
Departments:
|
||||||
- title: "Support"
|
- title: "Support"
|
||||||
role: "Staff"
|
role: "SupportBot Staff"
|
||||||
color: "SECONDARY"
|
color: "SECONDARY"
|
||||||
emoji: "1️⃣"
|
emoji: "1️⃣"
|
||||||
category: "Tickets"
|
category: "Tickets"
|
||||||
|
|
||||||
- title: "Billing Support"
|
- title: "Billing Support"
|
||||||
role: "Staff"
|
role: "SupportBot Staff"
|
||||||
color: "SECONDARY"
|
color: "SECONDARY"
|
||||||
emoji: "2️⃣"
|
emoji: "2️⃣"
|
||||||
category: "Tickets"
|
category: "Tickets"
|
||||||
|
|
||||||
- title: "Admin Team"
|
- title: "Admin Team"
|
||||||
role: "Admin"
|
role: "SupportBot Admin"
|
||||||
color: "SECONDARY"
|
color: "SECONDARY"
|
||||||
emoji: "3️⃣"
|
emoji: "3️⃣"
|
||||||
category: "Tickets"
|
category: "Tickets"
|
||||||
@@ -224,16 +226,21 @@ Departments:
|
|||||||
# --- Start ---
|
# --- Start ---
|
||||||
|
|
||||||
LockTicketCategory: "Archive"
|
LockTicketCategory: "Archive"
|
||||||
|
UnlockTicketCategory: "Tickets" #This moves the ticket back to the main category.
|
||||||
|
|
||||||
TicketCloseEmoji: "❌"
|
TicketCloseEmoji: "❌"
|
||||||
TicketDeleteEmoji: "⛔"
|
TicketDeleteEmoji: "⛔"
|
||||||
TicketLockEmoji: "🔒"
|
TicketLockEmoji: "🔒"
|
||||||
TicketClaimEmoji: "🧑💻"
|
TicketClaimEmoji: "🧑💻"
|
||||||
|
TicketUnlockEmoji: "🔓"
|
||||||
|
TicketUnclaimEmoji: "🧑💻"
|
||||||
|
|
||||||
TicketCloseColour: "DANGER"
|
TicketCloseColour: "DANGER"
|
||||||
TicketDeleteColour: "DANGER"
|
TicketDeleteColour: "DANGER"
|
||||||
TicketLockColour: "PRIMARY"
|
TicketLockColour: "PRIMARY"
|
||||||
TicketClaimColour: "SUCCESS"
|
TicketClaimColour: "SUCCESS"
|
||||||
|
TicketUnclaimColour: "DANGER"
|
||||||
|
TicketUnlockColour: "SUCCES"
|
||||||
|
|
||||||
# Discord Button Colour Selection
|
# Discord Button Colour Selection
|
||||||
# PRIMARY - Blue
|
# PRIMARY - Blue
|
||||||
|
|||||||
+165
-3
@@ -118,8 +118,14 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
|||||||
.setStyle(supportbot.TicketDeleteColour)
|
.setStyle(supportbot.TicketDeleteColour)
|
||||||
.setEmoji(supportbot.TicketDeleteEmoji);
|
.setEmoji(supportbot.TicketDeleteEmoji);
|
||||||
|
|
||||||
|
const ticketUnlockButton = new Discord.MessageButton()
|
||||||
|
.setCustomId("ticketunlock")
|
||||||
|
.setLabel("Unlock")
|
||||||
|
.setStyle(supportbot.TicketUnlockColour)
|
||||||
|
.setEmoji(supportbot.TicketUnlockEmoji);
|
||||||
|
|
||||||
const row = new Discord.MessageActionRow().addComponents(
|
const row = new Discord.MessageActionRow().addComponents(
|
||||||
ticketDeleteButton
|
ticketDeleteButton, ticketUnlockButton
|
||||||
);
|
);
|
||||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||||
.setTitle("Archived")
|
.setTitle("Archived")
|
||||||
@@ -130,6 +136,81 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
|||||||
interaction.message.edit({ components: [row] });
|
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.customId === "ticketclaim") {
|
||||||
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||||
const Staff = await interaction.client.getRole(supportbot.Staff, interaction.guild);
|
const Staff = await interaction.client.getRole(supportbot.Staff, interaction.guild);
|
||||||
@@ -150,12 +231,34 @@ module.exports = new Event("interactionCreate", async (client, interaction) => {
|
|||||||
}
|
}
|
||||||
let all = interaction.channel.permissionOverwrites.cache;
|
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()
|
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||||
.setTitle(supportbot.TicketClaimTitle)
|
.setTitle(supportbot.TicketClaimTitle)
|
||||||
.setDescription(supportbot.TicketClaimMessage + " <@" + interaction.user.id + ">")
|
.setDescription(supportbot.TicketClaimMessage + " <@" + interaction.user.id + ">")
|
||||||
.setColor(supportbot.EmbedColour);
|
.setColor(supportbot.EmbedColour);
|
||||||
|
|
||||||
interaction.reply({ embeds: [ArchiveEmbed] });
|
interaction.reply({ embeds: [ArchiveEmbed]});
|
||||||
|
interaction.message.edit({ components: [row] });
|
||||||
await interaction.channel.permissionOverwrites.edit(Staff.id, {
|
await interaction.channel.permissionOverwrites.edit(Staff.id, {
|
||||||
VIEW_CHANNEL: true,
|
VIEW_CHANNEL: true,
|
||||||
SEND_MESSAGES: false,
|
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