Log error

I`m trying to log new ticket creation by using this code
13 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
1
1OP4mo ago
async function logNewTicketCreated(interaction, settings, issueKey, channel) {
const userAvatar = interaction.user.avatarURL();
const embed = new EmbedBuilder()
.setColor(0x1E90FF)
.setTitle('New ticket created')
.setDescription(`<@${interaction.user.id}> created a new ticket, \nIssue type: ${issueKey.replace('_', ' ')}, \nChannel link: <#${channel.id}>`)
.setThumbnail(userAvatar)
.setTimestamp(new Date());

const navigateButton = new ButtonBuilder()
.setLabel('Navigate to')
.setStyle(ButtonStyle.Link)
.setURL(`https://discord.com/channels/${channel.guild.id}/${channel.id}`);

const row = new ActionRowBuilder().addComponents(navigateButton);

await logAction(interaction.client, settings, interaction, { embeds: [embed], components: [row] });
}
async function logNewTicketCreated(interaction, settings, issueKey, channel) {
const userAvatar = interaction.user.avatarURL();
const embed = new EmbedBuilder()
.setColor(0x1E90FF)
.setTitle('New ticket created')
.setDescription(`<@${interaction.user.id}> created a new ticket, \nIssue type: ${issueKey.replace('_', ' ')}, \nChannel link: <#${channel.id}>`)
.setThumbnail(userAvatar)
.setTimestamp(new Date());

const navigateButton = new ButtonBuilder()
.setLabel('Navigate to')
.setStyle(ButtonStyle.Link)
.setURL(`https://discord.com/channels/${channel.guild.id}/${channel.id}`);

const row = new ActionRowBuilder().addComponents(navigateButton);

await logAction(interaction.client, settings, interaction, { embeds: [embed], components: [row] });
}
1
1OP4mo ago
No description
1
1OP4mo ago
And i`m getting this error
1
1OP4mo ago
No description
Mark
Mark4mo ago
where's your error handling so we can see what's going on there?
1
1OP4mo ago
No description
1
1OP4mo ago
What else do you need?
Mark
Mark4mo ago
your error handling
catch statement, etc
1
1OP4mo ago
1
1OP4mo ago
at the end there is catch (error) { is it what you needed?
Mark
Mark4mo ago
what is the logAction function
1
1OP4mo ago
I`m a dumbass, I fixed it. I forgot to add row = null in logAction Was like this:
async function logAction(client, settings, interaction, embed, attachment, row )
async function logAction(client, settings, interaction, embed, attachment, row )
Now:
async function logAction(client, settings, interaction, embed, attachment = null, row = null)
async function logAction(client, settings, interaction, embed, attachment = null, row = null)
and it works Ty tho

Did you find this page helpful?