From 7c5b939a59c4ae434b30bc694ab718370cf1cbfb Mon Sep 17 00:00:00 2001 From: William Harrison Date: Sat, 14 Oct 2023 12:07:17 +0800 Subject: [PATCH] feat: remove nearly all of the ticket system --- bot/discord/commands/ticket/add.js | 20 -------- bot/discord/commands/ticket/downgrade.js | 12 ----- bot/discord/commands/ticket/help.js | 14 ----- bot/discord/commands/ticket/new.js | 65 +----------------------- bot/discord/commands/ticket/remove.js | 15 ------ bot/discord/commands/ticket/upgrade.js | 14 ----- 6 files changed, 1 insertion(+), 139 deletions(-) delete mode 100644 bot/discord/commands/ticket/add.js delete mode 100644 bot/discord/commands/ticket/downgrade.js delete mode 100644 bot/discord/commands/ticket/help.js delete mode 100644 bot/discord/commands/ticket/remove.js delete mode 100644 bot/discord/commands/ticket/upgrade.js diff --git a/bot/discord/commands/ticket/add.js b/bot/discord/commands/ticket/add.js deleted file mode 100644 index aec9746c..00000000 --- a/bot/discord/commands/ticket/add.js +++ /dev/null @@ -1,20 +0,0 @@ -exports.run = async (client, message, args) => { - if (!message.channel.name.includes("-ticket")) - return message.reply(`💡 | You can only use this command in a ticket channel.`); - - if (!args[1]) { - return message.reply(`💡 | You need to specify the user's ID whom you want to add to this ticket.`); - } - - if (!message.guild.members.cache.get(args[1])) { - return message.reply(`💡 | Enter a valid user ID.`); - } - - await message.channel.updateOverwrite(args[1], { - VIEW_CHANNEL: true, - SEND_MESSAGES: true, - READ_MESSAGE_HISTORY: true, - }); - - await message.reply(`💡 | Succesfully added **${message.guild.members.cache.get(args[1])}** to this ticket.`); -}; diff --git a/bot/discord/commands/ticket/downgrade.js b/bot/discord/commands/ticket/downgrade.js deleted file mode 100644 index f9f69261..00000000 --- a/bot/discord/commands/ticket/downgrade.js +++ /dev/null @@ -1,12 +0,0 @@ -exports.run = async (client, message, args) => { - if (message.channel.name.includes("-ticket")) { - message.reply("Now all staff can see your ticket."); - await message.channel.updateOverwrite("898041751099539497", { - VIEW_CHANNEL: true, - SEND_MESSAGES: true, - READ_MESSAGE_HISTORY: true, - }); - } else { - message.reply("This command is only to be used inside of ticket channels."); - } -}; diff --git a/bot/discord/commands/ticket/help.js b/bot/discord/commands/ticket/help.js deleted file mode 100644 index 6ac35c7d..00000000 --- a/bot/discord/commands/ticket/help.js +++ /dev/null @@ -1,14 +0,0 @@ -const Discord = require("discord.js"); - -exports.run = async (client, message, args) => { - let embed = new Discord.MessageEmbed() - .setAuthor(`${client.user.username} | Tickets Help`, client.user.avatarURL()) - .addField( - `🎫 | Ticket Commands`, - `> \`${config.DiscordBot.Prefix}ticket new\`\n> \`${config.DiscordBot.Prefix}ticket close\`\n> \`${config.DiscordBot.Prefix}ticket add\`\n> \`${config.DiscordBot.Prefix}ticket remove\`\n> \`${config.DiscordBot.Prefix}ticket upgrade\`\n> \`${config.DiscordBot.Prefix}ticket downgrade\`` - ) - .setThumbnail("https://cdn.discordapp.com/emojis/860696559573663815.png?v=1") - .setColor(message.guild.me.displayHexColor) - .setTimestamp(); - await message.reply(embed); -}; diff --git a/bot/discord/commands/ticket/new.js b/bot/discord/commands/ticket/new.js index b7ceff9c..c45a8b9e 100644 --- a/bot/discord/commands/ticket/new.js +++ b/bot/discord/commands/ticket/new.js @@ -1,68 +1,5 @@ const Discord = require("discord.js"); exports.run = async (client, message, args) => { - let category = message.guild.channels.cache.find((c) => c.id === "924757852504096768" && c.type === "category"); - if (!category) return; - - if ( - message.guild.channels.cache.find((ch) => - ch.name.includes(message.author.username.toLowerCase().replace(" ", "-")) - ) - ) - return message.reply(`You already have an open ticket.`); - - let channel = await message.guild.channels - .create("🎫╏" + message.author.username + "-ticket", "text") - - .catch((err) => { - console.log(err); - }); - - await channel.setParent(category.id).catch(console.error); - - setTimeout(() => { - channel.updateOverwrite(message.guild.roles.everyone, { - SEND_MESSAGES: false, - VIEW_CHANNEL: false, - }); - - channel.updateOverwrite(message.author.id, { - SEND_MESSAGES: true, - VIEW_CHANNEL: true, - READ_MESSAGE_HISTORY: true, - }); - - channel.updateOverwrite("898041751099539497", { - SEND_MESSAGES: true, - VIEW_CHANNEL: true, - READ_MESSAGE_HISTORY: true, - }); - }, 1000); - - message.reply(`A ticket has been opened for you, check it out here: ${channel}`); - - if (userData.get(message.author.id) == null) { - const embed = new Discord.MessageEmbed() - .setAuthor(`${client.user.username} | Tickets`, client.user.avatarURL()) - .setDescription("Please do not ping staff, it will not solve your problem faster.") - .addField(`📡 | Account Info`, `> This account is not linked with a console account.`) - .setColor(message.guild.me.displayHexColor) - .setTimestamp(); - channel.send(`${message.author} <@&983825037050142782>`, embed); - } else { - const embed = new Discord.MessageEmbed() - .setAuthor(`${client.user.username} | Tickets`, client.user.avatarURL()) - .setDescription(`Please do not ping staff, it will not solve your problem faster.`) - .addField( - `📡 | Account Info`, - `> **Username:** ${userData.fetch(message.author.id + ".username")}\n> **Email:** ||${userData.fetch( - message.author.id + ".email" - )}||\n> **Link Date:** ${userData.fetch( - message.author.id + ".linkDate" - )}\n> **Link Time:** ${userData.fetch(message.author.id + ".linkTime")}` - ) - .setColor(message.guild.me.displayHexColor) - .setTimestamp(); - channel.send(`${message.author} <@&983825037050142782>`, embed); - } + message.reply("Creating tickets using this bot has been deprecated. Please use the `/open` command on <@748317979971682385>."); }; diff --git a/bot/discord/commands/ticket/remove.js b/bot/discord/commands/ticket/remove.js deleted file mode 100644 index d90a032f..00000000 --- a/bot/discord/commands/ticket/remove.js +++ /dev/null @@ -1,15 +0,0 @@ -exports.run = async (client, message, args) => { - if (!message.channel.name.includes("-ticket")) - return message.reply(`💡 | You can only use this command in a ticket channel.`); - - let user = message.mentions.users.first() || message.guild.members.cache.get(args[1]); - if (!user) return message.reply(`💡 | Please mention or specify the user's ID you want to add to this ticket.`); - - await message.channel.updateOverwrite(user, { - VIEW_CHANNEL: false, - SEND_MESSAGES: false, - READ_MESSAGE_HISTORY: false, - }); - - message.reply(`💡 | Succesfully removed ${user} from this ticket.`); -}; diff --git a/bot/discord/commands/ticket/upgrade.js b/bot/discord/commands/ticket/upgrade.js deleted file mode 100644 index 3d051769..00000000 --- a/bot/discord/commands/ticket/upgrade.js +++ /dev/null @@ -1,14 +0,0 @@ -exports.run = async (client, message, args) => { - let staffRole = message.guild.roles.cache.get("898041751099539497"); - - if (message.channel.name.includes("-ticket")) { - message.reply("Only admins can see this ticket now."); - await message.channel.updateOverwrite("898041751099539497", { - VIEW_CHANNEL: false, - SEND_MESSAGES: false, - READ_MESSAGE_HISTORY: false, - }); - } else { - message.reply("This command is only to be used inside of ticket channels."); - } -};