Log error

I`m trying to log new ticket creation by using this code
13 Replies
d.js toolkit
d.js toolkit2mo 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
Eselfins
EselfinsOP2mo 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] });
}
Eselfins
EselfinsOP2mo ago
No description
Eselfins
EselfinsOP2mo ago
And i`m getting this error
Eselfins
EselfinsOP2mo ago
No description
Mark
Mark2mo ago
where's your error handling so we can see what's going on there?
Eselfins
EselfinsOP2mo ago
No description
Eselfins
EselfinsOP2mo ago
What else do you need?
Mark
Mark2mo ago
your error handling
catch statement, etc
Eselfins
EselfinsOP2mo ago
at the end there is catch (error) { is it what you needed?
Mark
Mark2mo ago
what is the logAction function
Eselfins
EselfinsOP2mo 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
Want results from more Discord servers?
Add your server