-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Component = require("../../../../structures/base/BaseComponent"); | ||
|
||
class CloseButton extends Component { | ||
constructor(client) { | ||
super(client, { | ||
name: "close", | ||
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 }); | ||
|
||
await this.MentorQ.tickets.close(interaction.member, interaction.message.channel); | ||
|
||
interaction.reply({ embeds: [this.MentorQ.util.successEmbed(`Ticket ${interaction.message.channel.toString()} has been closed.`)] }); | ||
|
||
return; | ||
|
||
} | ||
} | ||
|
||
module.exports = CloseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const SlashCommand = require("../../../structures/base/BaseSlashCommand"); | ||
|
||
class CloseSlashCommand extends SlashCommand { | ||
constructor(client) { | ||
super(client, { | ||
name: "close", | ||
category: "mentor", | ||
cooldown: 5, | ||
guildRequired: true, | ||
commandData: { | ||
description: "Close the current ticket.", | ||
}, | ||
}); | ||
} | ||
|
||
/** | ||
* @param {import("discord.js").CommandInteraction} 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 = interaction.channel; | ||
if (!ticket.isThread() || ticket.ownerId !== this.MentorQ.user.id || ticket.parentId !== this.MentorQ.tickets.getRequestsChannel()?.id) | ||
return interaction.reply({ embeds: [this.MentorQ.util.errorEmbed("This is not a valid MentorQ ticket!")], ephemeral: true }); | ||
|
||
await this.MentorQ.tickets.close(interaction.member, ticket); | ||
|
||
interaction.reply({ embeds: [this.MentorQ.util.successEmbed(`Ticket ${ticket.toString()} has been closed.`)] }); | ||
|
||
return; | ||
|
||
} | ||
} | ||
|
||
module.exports = CloseSlashCommand; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters