Jakub „Jaczup”
Jakub „Jaczup”
DIAdiscord.js - Imagine an app
Created by Jakub „Jaczup” on 12/21/2024 in #djs-questions
TypeError: ticket.send is not a function
Can someone help me?
export async function transcriptTicket(language, interaction, reason = null) {
const ticket = interaction.guild.channels.fetch(process.env.TICKET_TRANSCRIPTS_CHANNEL_ID);
const category = ticketEmbed.embeds[0].title.split('|')[1]?.trim();

const embed = new EmbedBuilder()
.setTitle(msg[language]['embedTitle'])
.setColor(process.env.COLOR_SUMMARY)
.addFields(
{ name: msg[language]['category'], value: `${(category === null) ? msg[language]['undefined'] : category}`, inline: true },
{ name: msg[language]['created'], value: `<t:${Math.floor(new Date(interaction.channel.createdAt).getTime() / 1000)}:R>`, inline: true },
{ name: msg[language]['opened_by'], value: `<@${interaction.channel.topic}>`, inline: true },
{ name: msg[language]['closed_by'], value: `<@${interaction.user.id}>`, inline: true },
{ name: msg[language]['reason'], value: `${(reason === null) ? msg[language]['undefined'] : reason}`, inline: true}
)
.setFooter({ text: interaction.guild.name, iconURL: interaction.guild.iconURL() })
.setTimestamp();

await ticket.send({ embeds: [embed] });

const ticket_user = await interaction.guild.members.fetch(interaction.channel.topic);
await ticket_user.send({ embeds: [embed] }).catch(err => {});
};
export async function transcriptTicket(language, interaction, reason = null) {
const ticket = interaction.guild.channels.fetch(process.env.TICKET_TRANSCRIPTS_CHANNEL_ID);
const category = ticketEmbed.embeds[0].title.split('|')[1]?.trim();

const embed = new EmbedBuilder()
.setTitle(msg[language]['embedTitle'])
.setColor(process.env.COLOR_SUMMARY)
.addFields(
{ name: msg[language]['category'], value: `${(category === null) ? msg[language]['undefined'] : category}`, inline: true },
{ name: msg[language]['created'], value: `<t:${Math.floor(new Date(interaction.channel.createdAt).getTime() / 1000)}:R>`, inline: true },
{ name: msg[language]['opened_by'], value: `<@${interaction.channel.topic}>`, inline: true },
{ name: msg[language]['closed_by'], value: `<@${interaction.user.id}>`, inline: true },
{ name: msg[language]['reason'], value: `${(reason === null) ? msg[language]['undefined'] : reason}`, inline: true}
)
.setFooter({ text: interaction.guild.name, iconURL: interaction.guild.iconURL() })
.setTimestamp();

await ticket.send({ embeds: [embed] });

const ticket_user = await interaction.guild.members.fetch(interaction.channel.topic);
await ticket_user.send({ embeds: [embed] }).catch(err => {});
};
2 replies
DIAdiscord.js - Imagine an app
Created by Jakub „Jaczup” on 8/3/2024 in #djs-questions
Problem with fetching members with roles
const TEAM = ['1268886403756982312','1268886902879027220','1268886992150728774','1268887041559494721','1268887056961241129','1268887071372738592'];

const fetchedMembers = await interaction.guild.members.fetch();
const adminMembers = fetchedMembers.filter(member => {member.roles.cache.some(role => TEAM.includes(role.id))});
const TEAM = ['1268886403756982312','1268886902879027220','1268886992150728774','1268887041559494721','1268887056961241129','1268887071372738592'];

const fetchedMembers = await interaction.guild.members.fetch();
const adminMembers = fetchedMembers.filter(member => {member.roles.cache.some(role => TEAM.includes(role.id))});
Can someone help with this? It returns me empty collection every time even when member have a role.
7 replies