From 0a2132eac440aea0568c3f2bf34a273964e2f93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A7=81Ash=C3=BB=EA=A7=82?= <30575805+Ashu11-A@users.noreply.github.com> Date: Fri, 14 Jun 2024 00:56:20 -0400 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20Refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Template/ButtonConfig.ts | 15 +++++++++++ .../{ButtonActions.ts => ButtonDelete.ts} | 26 ------------------- .../Template/{OpenTicket.ts => ButtonOpen.ts} | 0 .../discord/components/Template/ButtonSave.ts | 15 +++++++++++ .../{setSystem.ts => ButtonsSetSystem.ts} | 0 .../{EditActions.ts => EditTicket.ts} | 0 6 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 plugins/tickets/src/discord/components/Template/ButtonConfig.ts rename plugins/tickets/src/discord/components/Template/{ButtonActions.ts => ButtonDelete.ts} (68%) rename plugins/tickets/src/discord/components/Template/{OpenTicket.ts => ButtonOpen.ts} (100%) create mode 100644 plugins/tickets/src/discord/components/Template/ButtonSave.ts rename plugins/tickets/src/discord/components/Template/{setSystem.ts => ButtonsSetSystem.ts} (100%) rename plugins/tickets/src/discord/components/Template/{EditActions.ts => EditTicket.ts} (100%) diff --git a/plugins/tickets/src/discord/components/Template/ButtonConfig.ts b/plugins/tickets/src/discord/components/Template/ButtonConfig.ts new file mode 100644 index 00000000..974ef654 --- /dev/null +++ b/plugins/tickets/src/discord/components/Template/ButtonConfig.ts @@ -0,0 +1,15 @@ +import { TemplateBuilder } from "@/class/TemplateBuilder.js"; +import { Component } from "@/discord/base/index.js"; + +new Component({ + customId: 'Config', + type: "Button", + async run(interaction) { + await interaction.deferReply({ ephemeral: true }) + await new TemplateBuilder({ interaction }) + .setMode('debug') + .edit({ messageId: interaction.message.id }) + + if (interaction.deferred && !interaction.replied) await interaction.deleteReply() + } +}) \ No newline at end of file diff --git a/plugins/tickets/src/discord/components/Template/ButtonActions.ts b/plugins/tickets/src/discord/components/Template/ButtonDelete.ts similarity index 68% rename from plugins/tickets/src/discord/components/Template/ButtonActions.ts rename to plugins/tickets/src/discord/components/Template/ButtonDelete.ts index 54af6ee6..cc5fb7f1 100644 --- a/plugins/tickets/src/discord/components/Template/ButtonActions.ts +++ b/plugins/tickets/src/discord/components/Template/ButtonDelete.ts @@ -3,32 +3,6 @@ import { Component } from "@/discord/base/index.js"; import { ActionDrawer } from "@/functions/actionDrawer.js"; import { ButtonBuilder, ButtonStyle, ComponentType, EmbedBuilder } from "discord.js"; -new Component({ - customId: 'Save', - type: "Button", - async run(interaction) { - await interaction.deferReply({ ephemeral: true }) - await new TemplateBuilder({ interaction }) - .setMode('production') - .edit({ messageId: interaction.message.id }) - - if (!interaction.replied) await interaction.deleteReply() - } -}) - -new Component({ - customId: 'Config', - type: "Button", - async run(interaction) { - await interaction.deferReply({ ephemeral: true }) - await new TemplateBuilder({ interaction }) - .setMode('debug') - .edit({ messageId: interaction.message.id }) - - if (interaction.deferred && !interaction.replied) await interaction.deleteReply() - } -}) - new Component({ customId: 'DeleteTemplate', type: "Button", diff --git a/plugins/tickets/src/discord/components/Template/OpenTicket.ts b/plugins/tickets/src/discord/components/Template/ButtonOpen.ts similarity index 100% rename from plugins/tickets/src/discord/components/Template/OpenTicket.ts rename to plugins/tickets/src/discord/components/Template/ButtonOpen.ts diff --git a/plugins/tickets/src/discord/components/Template/ButtonSave.ts b/plugins/tickets/src/discord/components/Template/ButtonSave.ts new file mode 100644 index 00000000..de00681b --- /dev/null +++ b/plugins/tickets/src/discord/components/Template/ButtonSave.ts @@ -0,0 +1,15 @@ +import { TemplateBuilder } from "@/class/TemplateBuilder.js"; +import { Component } from "@/discord/base/index.js"; + +new Component({ + customId: 'Save', + type: "Button", + async run(interaction) { + await interaction.deferReply({ ephemeral: true }) + await new TemplateBuilder({ interaction }) + .setMode('production') + .edit({ messageId: interaction.message.id }) + + if (!interaction.replied) await interaction.deleteReply() + } +}) \ No newline at end of file diff --git a/plugins/tickets/src/discord/components/Template/setSystem.ts b/plugins/tickets/src/discord/components/Template/ButtonsSetSystem.ts similarity index 100% rename from plugins/tickets/src/discord/components/Template/setSystem.ts rename to plugins/tickets/src/discord/components/Template/ButtonsSetSystem.ts diff --git a/plugins/tickets/src/discord/components/Template/EditActions.ts b/plugins/tickets/src/discord/components/Template/EditTicket.ts similarity index 100% rename from plugins/tickets/src/discord/components/Template/EditActions.ts rename to plugins/tickets/src/discord/components/Template/EditTicket.ts