const {
EmbedBuilder,
ChannelType,
TextInputBuilder,
ModalBuilder,
TextInputStyle,
} = require("[Link]");
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("[Link]");
const TicketCanal = require("../../models/ticketCreados");
const TicketPanel = require("../../models/ticketPanel");
const transcripts = require("discord-html-transcripts")
[Link] = {
name: "interactionCreate",
async execute(interaction, client) {
if ([Link]()) {
if ([Link] === "Crear") {
try {
const modal = new ModalBuilder()
.setCustomId("modal")
.setTitle("Crear tu Ticket'")
.addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("razon")
.setLabel("Problema")
.setStyle([Link])
.setRequired(true)
),
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("razon1")
.setLabel("Explica el problema")
.setStyle([Link])
.setRequired(true)
),
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("razon3")
.setLabel("Posibles soluciones")
.setStyle([Link])
.setRequired(true)
)
);
[Link](modal);
const modalInteraction = await [Link]({
filter: (i) => [Link] === [Link],
time: 1200000_000,
});
const razon2 = [Link]("razon");
const razon1 = [Link]("razon1");
const razon3 = [Link]("razon3");
const Data = await [Link]({
ServerID: [Link],
});
if (Data === null) return;
const RolId = [Link];
const CategoriaId = [Link];
let data_ticket = await [Link]({
ServerID: [Link],
AuthorID: [Link],
Cerrado: false,
});
for (const ticket of data_ticket) {
if ([Link]([Link]))
return [Link]({
embeds: [
new EmbedBuilder().setColor("#2f3136").setDescription(`
\`❌\` Error ya tienes uno abierto
Tu ya tienes un ticket abierto aqui esta
tu comprovacion de tu ticket <#${[Link]}>
`),
],
ephemeral: true,
});
}
await [Link]({
embeds: [
new EmbedBuilder()
.setColor("#2f3136")
.setDescription(` \`⏳\` Espera un momento.... `),
],
ephemeral: true,
});
const canal = await [Link]({
name: `ticket-${[Link]}`,
type: [Link],
parent: CategoriaId,
});
[Link]([Link], {
ViewChannel: true,
SendMessages: true,
});
[Link]([Link], {
ViewChannel: false,
SendMessages: false,
});
[Link](
[Link](`${RolId}`),
{
ViewChannel: true,
SendMessages: true,
}
);
const mensaje = new EmbedBuilder()
.setAuthor({
name: `${[Link]}`,
iconURL: `${[Link]({
dynamic: true,
})}`,
})
.setDescription(
`
\`🎫\` **Ticket Abierto**
**Creador del Ticket:** ${[Link]}
**👋 ¡Hola, bienvenid@ a tu ticket, <@$
{[Link]}>!
Por favor, espera un momento mientras uno de nuestros
moderadores revisa tu solicitud.**
# \`❓\` **Asunto**
**Problema:**
\`\`\`ansi
#[1;2m#[1;31m#[1;31m${razon2}#[0m#[1;31m#[0m#[0m \`\`\`
**Explica el problema:**
\`\`\`ansi
#[1;2m#[1;31m#[1;31m${razon1}#[0m#[1;31m#[0m#[0m \`\`\`
**Posibles soluciones:**
\`\`\`ansi
#[1;2m#[1;31m#[1;31m${razon3}#[0m#[1;31m#[0m#[0m \`\`\`
`
)
.setColor("#ff1900");
let data = new TicketCanal({
ServerID: [Link],
AuthorID: [Link],
Canal: [Link],
Cerrado: false,
});
[Link]();
await [Link]({
embeds: [
new EmbedBuilder().setColor("#2f3136")
.setDescription(`> *Tu ticket fue creado correctamente* *puedes ir
dando aqui click* ${canal}
`),
],
ephemeral: true,
});
const botones = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("cerrar")
.setEmoji("🔒")
.setLabel("Cerrar")
.setStyle([Link]),
new ButtonBuilder()
.setCustomId("borrar")
.setEmoji("🗑")
.setLabel("Borrar")
.setStyle([Link]),
new ButtonBuilder()
.setCustomId("claim")
.setEmoji("📌")
.setLabel("Reclamar")
.setStyle([Link]),
new ButtonBuilder()
.setCustomId("transcript")
.setEmoji("📋")
.setLabel("Transcripts")
.setStyle([Link])
);
[Link]({
embeds: [mensaje],
components: [botones],
content: `<@${[Link]}> <@&${RolId}>`,
});
} catch (error) {
[Link](error);
}
}
if ([Link] === "claim") {
try {
const Data = await [Link]({
ServerID: [Link],
});
if (Data === null) return;
const RolId = [Link];
if (Data === null) return;
const dueño = [Link];
const permiso = [Link](`${RolId}`);
if (!permiso)
return [Link]({
embeds: [
new EmbedBuilder()
.setDescription(
`
# \`❌\` **ERROR DE PERMISO**
**Solo los que tienen que rango** <@&${RolId}> **pueden usar este botón**
`
)
.setColor("#2f3136"),
],
ephemeral: true,
});
const embed = new EmbedBuilder()
.setDescription(
`
# \`📌\` **TICKET FUE RECLAMADO**
**Este ticket fue reclamados por** <@${[Link]}>
`
)
.setColor("Red");
[Link]({ embeds: [embed] });
} catch (error) {
[Link](error);
}
} else if ([Link] === "transcript") {
try{
const Data = await [Link]({ ServerID: [Link] })
if(Data === null) return; const RolId = [Link];
const permiso = [Link](`${RolId}`)
if(!permiso)
return [Link]({ content: "❌ No tienes permisos suficientes",
ephemeral: true })
const canal = [Link];
const trans_tickets = await [Link](canal)
[Link]({ files: [trans_tickets] })
} catch(err) {
}
} else if ([Link] === "borrar") {
try{
const Data = await [Link]({ ServerID:
[Link] })
if(Data === null) return; const RolId = [Link];
const permiso = [Link](`$
{RolId}`)
if(!permiso)
return [Link]({ content: "❌ No tienes
suficientes permiso", ephemeral: true })
const mensaje = new EmbedBuilder()
.setDescription("📌 ¿Estas seguro que quieres borrar el
ticket?")
.setColor("Red")
const botones = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("siboton")
.setEmoji("✅")
.setLabel("si")
.setStyle([Link]),
new ButtonBuilder()
.setCustomId("noboton")
.setEmoji("❌")
.setLabel("No")
.setStyle([Link])
)
} catch(err) {
}
} else if ([Link] === "cerrar") {
try{
const Data = await [Link]({ ServerID:
[Link] })
if(Data === null) return; const RolId = [Link];
const permiso = [Link](`$
{RolId}`)
if(!permiso)
return [Link]({ content: "❌ No tienes permisos
suficientes", ephemeral: true })
const mensaje = new EmbedBuilder()
.setDescription("✅ El ticket sera eliminado dentro de **5**
segundos")
.setColor("Green")
return [Link]({ embeds: [mensaje], ephemeral: true
})
&& setTimeout(() => {
[Link](`${[Link]}`)
}, 5000)
} catch(error){
[Link](error)
}
} if([Link] === "noboton"){
try{
const Data = await [Link]({ ServerID:
[Link] })
if(Data === null) return; const RolId = [Link];
const permiso = [Link](`$
{RolId}`)
if(!permiso)
return [Link]({ content: "❌ No tienes permisos
suficientes", ephemeral: true })
const mensaje = new EmbedBuilder()
.setDescription("❌ El ticket no fue eliminado")
.setColor("Red")
await [Link]({ embeds: [mensaje], ephemeral:
true })
} catch(error){
[Link](error)
}
}
}
}
}