I'm trying to write a command that messages a specified user. The user can type something like /warn @user insert warning here. Here is the code:
const user = await client.users
.fetch(interaction.options.getString("user"))
.catch(console.error);
const embed = new MessageEmbed()
.setColor("#FCE100")
.setTitle(`⚠️ Warning!`)
.setDescription(`${interaction.options.getString("warning")}`);
await user.send({ embeds: embed }).catch(() => {
interaction.channel.send("Error: user not found");
});
Here's the error I'm getting:
user_id: Value "<@!9872345978#####>" is not snowflake.
How do I get the correct "snowflake" value to actually be able to DM the user?
You have to use getUser instead of getString and also change your user option type to "USER" to make it work!