Skip to content

Commit

Permalink
feat: claim button
Browse files Browse the repository at this point in the history
  • Loading branch information
DaStormer committed Mar 12, 2024
1 parent f4fd5dc commit 14833a7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions bot/interactions/components/buttons/claim.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 14833a7

Please sign in to comment.