From cf99209887ad896ad3586cf1934fce5a2e9440cc Mon Sep 17 00:00:00 2001 From: ItzEmerald Date: Wed, 24 Jun 2020 09:50:14 +0100 Subject: [PATCH] Close Ticket --- commands/close.js | 22 +++++++++++++++++----- supportbot-config.yml | 8 ++++++++ test | 8 ++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 test diff --git a/commands/close.js b/commands/close.js index 006cc29..80413a0 100644 --- a/commands/close.js +++ b/commands/close.js @@ -13,13 +13,25 @@ module.exports = { execute(message, args) { console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[32m`, `${message.author.tag} has executed ${supportbot.Prefix}${supportbot.CloseTicket}!`); - - if (supportbot.Close === "staff") { - member.roles.cache.has(``) - } - if (supportbot.Close === "user") { + if (!message.channel.name.startsWith( `${TicketChannel}-` )) { + const Exists = new Discord.MessageEmbed() + .setTitle("Incorrect Channel") + .setDescription(`:warning: You cannot execute this command here. This command is used when closing a ticket.`) + .setColor(supportbot.WarningColour); + message.channel.send({ embed: Exists }); + + return; } + + if (supportbot.CloseConfirmation === "true") { + const CloseTicketRequest = new Discord.MessageEmbed() + .setDescription(`**${supportbot.ClosingTicket}**`) + .addField("Please confirm by repeating the following word..", `**${supportbot.ClosingConfirmation_Word}**`) + + } + + } }; \ No newline at end of file diff --git a/supportbot-config.yml b/supportbot-config.yml index 17ef23d..ee45c21 100644 --- a/supportbot-config.yml +++ b/supportbot-config.yml @@ -18,6 +18,9 @@ Bot_Name: "SupportBot DEV" BotActivity: "SB-6.0 dev-0.1" ActivityType: "PLAYING" +ShowErrorCodes: "true" +# This feature will show supportbot error codes such as "SB-01" + # Embed Configuration EmbedColour: "#04b545" @@ -53,6 +56,11 @@ TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid% TicketPanel: true ReactionForTicket: 🎫 +ClosingTicket: ":warning: You have requested to close your support ticket." +ClosingConfirmation_Word: "confirm" +CloseConfirmation: true +Transcripts: true + # Ticket Department Configuration TicketDepartments: true diff --git a/test b/test new file mode 100644 index 0000000..23e74ae --- /dev/null +++ b/test @@ -0,0 +1,8 @@ + const rolerequired = new Discord.MessageEmbed() + .setTitle("SupportBot Error!") + .setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n`) + .setColor(supportbot.ErrorColour); + + if (supportbot.ShowErrorCodes === "true") { + rolerequired.addField("Error Code", "SB-02") + } \ No newline at end of file