Skip to content

Commit

Permalink
♻ Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashu11-A committed Jun 14, 2024
1 parent 72a5577 commit 0a2132e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
15 changes: 15 additions & 0 deletions plugins/tickets/src/discord/components/Template/ButtonConfig.ts
Original file line number Diff line number Diff line change
@@ -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()
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions plugins/tickets/src/discord/components/Template/ButtonSave.ts
Original file line number Diff line number Diff line change
@@ -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()
}
})

0 comments on commit 0a2132e

Please sign in to comment.