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[]
14 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Syjalo
Syjalo2y ago
What message do you need? (In Discord)
Marcus
MarcusOP2y ago
channel every like all the messages in the channel
Syjalo
Syjalo2y ago
You can fetch only 100 messages per request. So you may be rate limited. It's better to save messages in db with message events.
Marcus
MarcusOP2y ago
how can I do that?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Marcus
MarcusOP2y ago
what is the simplest way? No. Uhmm which database do you recommend?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Marcus
MarcusOP2y ago
Alr thx 😄
const { SlashCommandBuilder } = require('@discordjs/builders');

const { EmbedBuilder, message } = require('discord.js')


module.exports = {
data: new SlashCommandBuilder()
.setName('hx')
.setDescription('Use this command to download hx software'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092774801875157052')) {
const user = interaction.member();
user.send("Hello").catch(console.error);

}
}
}
const { SlashCommandBuilder } = require('@discordjs/builders');

const { EmbedBuilder, message } = require('discord.js')


module.exports = {
data: new SlashCommandBuilder()
.setName('hx')
.setDescription('Use this command to download hx software'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092774801875157052')) {
const user = interaction.member();
user.send("Hello").catch(console.error);

}
}
}
Why isn't it sending any dms to me no errors
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
Documentation suggestion for @marqusdev:property BaseInteraction#member If this interaction was sent in a guild, the member which sent it
Marcus
MarcusOP2y ago
How can I do instead?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Marcus
MarcusOP2y ago
what? interaction.member.send or? Oh you mean just without the semi colon
Want results from more Discord servers?
Add your server