Const messages
const { Client, message } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js')
const discordTranscripts = require('discord-html-transcripts');
const countdownTime = 4;
module.exports = {
data: new SlashCommandBuilder()
.setName('closeticket')
.setDescription('Closes your ticket'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092224079047704667')) {
interaction.reply('This ticket will close in 5 seconds!')
let countdown = countdownTime;
const channel = interaction.channel;
const countdownInterval = setInterval(() => {
if (countdown > 0) {
interaction.editReply(`${countdown} seconds left!`);
countdown--;
} else {
channel.permissionOverwrites.create(channel.guild.roles.everyone, { ViewChannel: false });
channel.setParent('1089611611314065519')
const attachment = discordTranscripts.generateFromMessages(messages, channel);
channel.setName(`close-${interaction.user.discriminator}`)
interaction.channel.send({ files: [attachment] });
clearInterval(countdownInterval);
}
}, 1000);
} else {
interaction.reply('You dont have permission to close this ticket!')
}
}
}const { Client, message } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js')
const discordTranscripts = require('discord-html-transcripts');
const countdownTime = 4;
module.exports = {
data: new SlashCommandBuilder()
.setName('closeticket')
.setDescription('Closes your ticket'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092224079047704667')) {
interaction.reply('This ticket will close in 5 seconds!')
let countdown = countdownTime;
const channel = interaction.channel;
const countdownInterval = setInterval(() => {
if (countdown > 0) {
interaction.editReply(`${countdown} seconds left!`);
countdown--;
} else {
channel.permissionOverwrites.create(channel.guild.roles.everyone, { ViewChannel: false });
channel.setParent('1089611611314065519')
const attachment = discordTranscripts.generateFromMessages(messages, channel);
channel.setName(`close-${interaction.user.discriminator}`)
interaction.channel.send({ files: [attachment] });
clearInterval(countdownInterval);
}
}, 1000);
} else {
interaction.reply('You dont have permission to close this ticket!')
}
}
}I am making a transcript system, but I need to define "messages" for the channel I am closing, but I got no clue how I would define "messages".
const messages = someWayToGetMessages(); // Must be Collection<string, Message> or Message[]
