From 14833a7f2ebf5bf12b152f7cbb7200e9b969e2da Mon Sep 17 00:00:00 2001 From: DaStormer Date: Tue, 12 Mar 2024 17:50:18 -0400 Subject: [PATCH] feat: claim button --- bot/interactions/components/buttons/claim.js | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bot/interactions/components/buttons/claim.js b/bot/interactions/components/buttons/claim.js index e69de29..18f8077 100644 --- a/bot/interactions/components/buttons/claim.js +++ b/bot/interactions/components/buttons/claim.js @@ -0,0 +1,30 @@ +const Component = require("../../../../structures/base/BaseComponent"); + +class ClaimButton extends Component { + constructor(client) { + super(client, { + name: "claim", + category: "mentor", + cooldown: 5, + }); + } + + /** + * @param {import("discord.js").ButtonInteraction} interaction + */ + async run(interaction) { + + if (!this.MentorQ.tickets.isActive(interaction.guild)) + return interaction.reply({ embeds: [this.MentorQ.util.errorEmbed("The MentorQ system is not active. Contact a server admin to complete setup process.")], ephemeral: true }); + + const ticket = await this.MentorQ.tickets.claim(interaction.member, interaction.message); + if (!ticket) return interaction.reply({ embeds: [this.MentorQ.util.errorEmbed("A ticket could not be created because the member was not found.")], ephemeral: true }); + + interaction.reply({ embeds: [this.MentorQ.util.successEmbed(`Ticket ${ticket} has been created.`)], ephemeral: true }); + + return; + + } +} + +module.exports = ClaimButton; \ No newline at end of file