2024-09-14 19:52:56 +05:00
|
|
|
const { SlashCommandBuilder, PermissionsBitField, ButtonBuilder, ButtonStyle, ActionRowBuilder, InteractionContextType } = require("discord.js");
|
2023-07-07 21:13:11 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class CreateTicketEmbed extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2023-07-07 21:13:11 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("createticketembed")
|
|
|
|
.setDescription(client.translate("tickets/createticketembed:DESCRIPTION"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("tickets/createticketembed:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("tickets/createticketembed:DESCRIPTION", null, "ru-RU"),
|
|
|
|
})
|
2024-09-14 19:52:56 +05:00
|
|
|
.setContexts([InteractionContextType.Guild])
|
2023-07-07 21:13:11 +05:00
|
|
|
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild),
|
|
|
|
dirname: __dirname,
|
|
|
|
ownerOnly: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2023-07-07 21:13:11 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
*/
|
2024-02-09 23:26:57 +05:00
|
|
|
async execute(client, interaction) {
|
|
|
|
const guildData = interaction.data.guild;
|
|
|
|
|
|
|
|
if (!guildData.plugins.tickets.ticketsCategory) return interaction.error("tickets/createticketembed:NO_CATEGORY");
|
2023-07-07 21:13:11 +05:00
|
|
|
|
|
|
|
await interaction.deferReply({ ephemeral: true });
|
|
|
|
|
2024-02-06 21:45:53 +05:00
|
|
|
const embed = client.embed({
|
|
|
|
title: interaction.translate("tickets/createticketembed:TICKET_TITLE"),
|
|
|
|
description: interaction.translate("tickets/createticketembed:TICKET_DESC"),
|
|
|
|
});
|
2023-07-07 21:13:11 +05:00
|
|
|
|
|
|
|
const supportButton = new ButtonBuilder().setCustomId("support_ticket").setLabel(interaction.translate("tickets/createticketembed:TICKET_SUPPORT")).setStyle(ButtonStyle.Primary);
|
|
|
|
const row = new ActionRowBuilder().addComponents(supportButton);
|
|
|
|
|
|
|
|
await interaction.channel.send({ embeds: [embed], components: [row] });
|
|
|
|
|
|
|
|
interaction.success("tickets/createticketembed:SUCCESS", null, { edit: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = CreateTicketEmbed;
|