RangeError [MessageNonceType]: Message nonce must be an integer or a string.

hi someone can help me?
require('dotenv').config();
const { EmbedBuilder, AttachmentBuilder, SnowflakeUtil } = require('discord.js');

module.exports = (member) => {
const attachment = new AttachmentBuilder('images/welcome.png', { name: 'welcome.png' });
const embed = new EmbedBuilder()
.setColor(0x169C9C)
.setDescription(`Welcome<@${member.user.id}>! (${member.user.username})\nSome text!\nSome text.\nSome text:\n<#${process.env.RULES_CHANNEL}>\n<#${process.env.TICKETS_CHANNEL}>`)
.setThumbnail(`https://cdn.discordapp.com/avatars/${member.user.id}/${member.user.avatar}.png`)
.setImage('attachment://welcome.png');

const nonce = SnowflakeUtil.generate();
const channel = member.guild.channels.cache.get(process.env.WELCOME_CHANNEL);
channel.send({ embeds: [embed], files: [attachment], enforceNonce: true, nonce: nonce });
};
require('dotenv').config();
const { EmbedBuilder, AttachmentBuilder, SnowflakeUtil } = require('discord.js');

module.exports = (member) => {
const attachment = new AttachmentBuilder('images/welcome.png', { name: 'welcome.png' });
const embed = new EmbedBuilder()
.setColor(0x169C9C)
.setDescription(`Welcome<@${member.user.id}>! (${member.user.username})\nSome text!\nSome text.\nSome text:\n<#${process.env.RULES_CHANNEL}>\n<#${process.env.TICKETS_CHANNEL}>`)
.setThumbnail(`https://cdn.discordapp.com/avatars/${member.user.id}/${member.user.avatar}.png`)
.setImage('attachment://welcome.png');

const nonce = SnowflakeUtil.generate();
const channel = member.guild.channels.cache.get(process.env.WELCOME_CHANNEL);
channel.send({ embeds: [embed], files: [attachment], enforceNonce: true, nonce: nonce });
};
and i've this problem
/home/bot2/node_modules/discord.js/src/structures/MessagePayload.js:132
throw new DiscordjsRangeError(ErrorCodes.MessageNonceType);
^

RangeError [MessageNonceType]: Message nonce must be an integer or a string.
}
/home/bot2/node_modules/discord.js/src/structures/MessagePayload.js:132
throw new DiscordjsRangeError(ErrorCodes.MessageNonceType);
^

RangeError [MessageNonceType]: Message nonce must be an integer or a string.
}
1 Reply
d.js toolkit
d.js toolkit6mo 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 staff
Want results from more Discord servers?
Add your server